Update start and better volume names

This commit is contained in:
2025-06-25 14:53:32 +02:00
parent 56d94a06ce
commit 0a2cddf122
6 changed files with 826 additions and 223 deletions

View File

@@ -226,6 +226,9 @@
<button class="btn btn-sm btn-outline-info" onclick="window.location.href='/instances/{{ instance.id }}/detail'">
<i class="fas fa-info-circle"></i>
</button>
<button class="btn btn-sm btn-outline-warning" onclick="showUpdateInstanceModal({{ instance.id }}, '{{ instance.portainer_stack_name }}', '{{ instance.main_url }}')" title="Update Instance">
<i class="fas fa-arrow-up"></i>
</button>
<button class="btn btn-sm btn-outline-danger" type="button" onclick="showDeleteInstanceModal({{ instance.id }})">
<i class="fas fa-trash"></i>
</button>
@@ -719,6 +722,76 @@
</div>
</div>
<!-- Update Instance Modal -->
<div class="modal fade" id="updateInstanceModal" tabindex="-1">
<div class="modal-dialog modal-dialog-centered modal-lg">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Update Instance</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
</div>
<div class="modal-body">
<form id="updateInstanceForm">
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
<input type="hidden" id="update_instance_id">
<input type="hidden" id="update_stack_name">
<input type="hidden" id="update_instance_url">
<div class="text-center mb-4">
<i class="fas fa-arrow-up fa-3x mb-3" style="color: var(--primary-color);"></i>
<h4>Update Instance</h4>
<p class="text-muted">Update your instance with the latest version from the repository.</p>
</div>
<div class="row">
<div class="col-md-6 mb-3">
<label class="form-label">Repository</label>
<select class="form-select" id="updateRepoSelect">
<option value="">Loading repositories...</option>
</select>
<div class="form-text">Select the repository containing your application code</div>
</div>
<div class="col-md-6 mb-3">
<label class="form-label">Branch</label>
<select class="form-select" id="updateBranchSelect" disabled>
<option value="">Select a repository first</option>
</select>
<div class="form-text">Select the branch to deploy</div>
</div>
</div>
<div class="alert alert-info">
<h6><i class="fas fa-info-circle me-2"></i>Update Process:</h6>
<ul class="mb-0">
<li>Download the latest code from the selected repository and branch</li>
<li>Build a new Docker image with the updated code</li>
<li>Deploy the updated stack to replace the current instance</li>
<li>Preserve all existing data and configuration</li>
<li>Maintain the same port and domain configuration</li>
</ul>
</div>
<div class="alert alert-warning">
<h6><i class="fas fa-exclamation-triangle me-2"></i>Important Notes:</h6>
<ul class="mb-0">
<li>The instance will be temporarily unavailable during the update process</li>
<li>All existing data, rooms, and conversations will be preserved</li>
<li>The update process may take several minutes to complete</li>
<li>You will be redirected to a progress page to monitor the update</li>
</ul>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-warning" onclick="startInstanceUpdate()">
<i class="fas fa-arrow-up me-1"></i>Start Update
</button>
</div>
</div>
</div>
</div>
{% endblock %}
{% block extra_js %}

View File

@@ -9,9 +9,9 @@
{% block content %}
{{ header(
title="Launching Instance",
description="Setting up your new DocuPulse instance",
icon="fa-rocket"
title=is_update and "Updating Instance" or "Launching Instance",
description=is_update and "Updating your DocuPulse instance with the latest version" or "Setting up your new DocuPulse instance",
icon="fa-arrow-up" if is_update else "fa-rocket"
) }}
<div class="container-fluid">
@@ -78,6 +78,12 @@
// Pass CSRF token to JavaScript
window.csrfToken = '{{ csrf_token }}';
// Pass update parameters if this is an update operation
window.isUpdate = {{ 'true' if is_update else 'false' }};
window.updateInstanceId = '{{ instance_id or "" }}';
window.updateRepoId = '{{ repo_id or "" }}';
window.updateBranch = '{{ branch or "" }}';
</script>
<script src="{{ url_for('static', filename='js/launch_progress.js') }}"></script>
{% endblock %}