mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2026-01-21 15:02:08 +01:00
706 lines
21 KiB
HTML
706 lines
21 KiB
HTML
{% extends "baseTemplate/index.html" %}
|
|
{% load i18n %}
|
|
{% block title %}{% trans "Containers List - CyberPanel" %}{% endblock %}
|
|
{% block content %}
|
|
|
|
{% load static %}
|
|
{% get_current_language as LANGUAGE_CODE %}
|
|
<!-- Current language: {{ LANGUAGE_CODE }} -->
|
|
|
|
<style>
|
|
.modern-container {
|
|
max-width: 1400px;
|
|
margin: 0 auto;
|
|
padding: 2rem;
|
|
}
|
|
|
|
.page-header {
|
|
text-align: center;
|
|
margin-bottom: 3rem;
|
|
padding: 3rem 0;
|
|
background: linear-gradient(135deg, #f8f9ff 0%, #f0f1ff 100%);
|
|
border-radius: 20px;
|
|
animation: fadeInDown 0.5s ease-out;
|
|
position: relative;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.page-header::before {
|
|
content: '';
|
|
position: absolute;
|
|
top: -50%;
|
|
right: -50%;
|
|
width: 200%;
|
|
height: 200%;
|
|
background: radial-gradient(circle at 70% 30%, rgba(91, 95, 207, 0.15) 0%, transparent 50%);
|
|
animation: rotate 30s linear infinite;
|
|
}
|
|
|
|
.page-title {
|
|
font-size: 3rem;
|
|
font-weight: 700;
|
|
color: #1e293b;
|
|
margin-bottom: 1rem;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
gap: 1rem;
|
|
position: relative;
|
|
z-index: 1;
|
|
}
|
|
|
|
.docker-icon {
|
|
width: 60px;
|
|
height: 60px;
|
|
background: white;
|
|
border-radius: 12px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
box-shadow: 0 4px 12px rgba(0,0,0,0.1);
|
|
}
|
|
|
|
.page-subtitle {
|
|
font-size: 1.25rem;
|
|
color: #64748b;
|
|
margin-bottom: 1.5rem;
|
|
position: relative;
|
|
z-index: 1;
|
|
}
|
|
|
|
.header-actions {
|
|
display: flex;
|
|
gap: 1rem;
|
|
justify-content: center;
|
|
flex-wrap: wrap;
|
|
position: relative;
|
|
z-index: 1;
|
|
}
|
|
|
|
.btn-primary {
|
|
background: #5b5fcf;
|
|
color: white;
|
|
border: none;
|
|
padding: 0.75rem 2rem;
|
|
border-radius: 10px;
|
|
font-weight: 500;
|
|
cursor: pointer;
|
|
transition: all 0.3s ease;
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
text-decoration: none;
|
|
font-size: 0.875rem;
|
|
}
|
|
|
|
.btn-primary:hover {
|
|
background: #4547a9;
|
|
transform: translateY(-2px);
|
|
box-shadow: 0 8px 20px rgba(91, 95, 207, 0.4);
|
|
color: white;
|
|
}
|
|
|
|
.btn-danger {
|
|
background: #ef4444;
|
|
color: white;
|
|
border: none;
|
|
padding: 0.5rem 1rem;
|
|
border-radius: 8px;
|
|
font-weight: 500;
|
|
cursor: pointer;
|
|
transition: all 0.3s ease;
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
font-size: 0.825rem;
|
|
margin-right: 0.5rem;
|
|
}
|
|
|
|
.btn-danger:hover {
|
|
background: #dc2626;
|
|
transform: translateY(-2px);
|
|
box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
|
|
}
|
|
|
|
.btn-info {
|
|
background: #3b82f6;
|
|
color: white;
|
|
border: none;
|
|
padding: 0.5rem 1rem;
|
|
border-radius: 8px;
|
|
font-weight: 500;
|
|
cursor: pointer;
|
|
transition: all 0.3s ease;
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
font-size: 0.825rem;
|
|
margin-right: 0.5rem;
|
|
}
|
|
|
|
.btn-info:hover {
|
|
background: #2563eb;
|
|
transform: translateY(-2px);
|
|
box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
|
|
}
|
|
|
|
.btn-success {
|
|
background: #10b981;
|
|
color: white;
|
|
border: none;
|
|
padding: 0.5rem 1rem;
|
|
border-radius: 8px;
|
|
font-weight: 500;
|
|
cursor: pointer;
|
|
transition: all 0.3s ease;
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
font-size: 0.825rem;
|
|
margin-right: 0.5rem;
|
|
}
|
|
|
|
.btn-success:hover {
|
|
background: #059669;
|
|
transform: translateY(-2px);
|
|
box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
|
|
}
|
|
|
|
.main-card {
|
|
background: white;
|
|
border-radius: 16px;
|
|
box-shadow: 0 1px 3px rgba(0,0,0,0.05), 0 10px 40px rgba(0,0,0,0.08);
|
|
border: 1px solid #e8e9ff;
|
|
overflow: hidden;
|
|
margin-bottom: 2rem;
|
|
animation: fadeInUp 0.5s ease-out;
|
|
}
|
|
|
|
.card-header {
|
|
background: linear-gradient(135deg, #f8f9ff 0%, #f0f1ff 100%);
|
|
padding: 1.5rem 2rem;
|
|
border-bottom: 1px solid #e8e9ff;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
}
|
|
|
|
.card-title {
|
|
font-size: 1.25rem;
|
|
font-weight: 600;
|
|
color: #1e293b;
|
|
margin: 0;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.75rem;
|
|
}
|
|
|
|
.card-body {
|
|
padding: 2rem;
|
|
}
|
|
|
|
.containers-table {
|
|
width: 100%;
|
|
background: white;
|
|
border-radius: 12px;
|
|
overflow: hidden;
|
|
border: 1px solid #e8e9ff;
|
|
margin-bottom: 2rem;
|
|
}
|
|
|
|
.containers-table thead {
|
|
background: linear-gradient(135deg, #f8f9ff 0%, #f0f1ff 100%);
|
|
}
|
|
|
|
.containers-table th {
|
|
padding: 1rem;
|
|
text-align: left;
|
|
font-weight: 600;
|
|
color: #1e293b;
|
|
font-size: 0.875rem;
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.05em;
|
|
border-bottom: 2px solid #e8e9ff;
|
|
}
|
|
|
|
.containers-table td {
|
|
padding: 1rem;
|
|
color: #64748b;
|
|
font-size: 0.875rem;
|
|
border-bottom: 1px solid #f3f4f6;
|
|
vertical-align: middle;
|
|
}
|
|
|
|
.containers-table tbody tr {
|
|
transition: all 0.2s ease;
|
|
}
|
|
|
|
.containers-table tbody tr:hover {
|
|
background: #f8f9ff;
|
|
}
|
|
|
|
.containers-table tbody tr:last-child td {
|
|
border-bottom: none;
|
|
}
|
|
|
|
.container-name {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.75rem;
|
|
}
|
|
|
|
.container-icon {
|
|
width: 32px;
|
|
height: 32px;
|
|
background: #e0e7ff;
|
|
border-radius: 8px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
font-size: 0.875rem;
|
|
color: #5b5fcf;
|
|
}
|
|
|
|
.status-badge {
|
|
padding: 0.25rem 0.75rem;
|
|
border-radius: 20px;
|
|
font-size: 0.75rem;
|
|
font-weight: 600;
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.05em;
|
|
}
|
|
|
|
.status-running {
|
|
background: #d1fae5;
|
|
color: #065f46;
|
|
}
|
|
|
|
.status-stopped {
|
|
background: #fee2e2;
|
|
color: #991b1b;
|
|
}
|
|
|
|
.action-buttons {
|
|
display: flex;
|
|
gap: 0.5rem;
|
|
flex-wrap: wrap;
|
|
}
|
|
|
|
.loading-spinner {
|
|
width: 20px;
|
|
height: 20px;
|
|
border: 3px solid #e8e9ff;
|
|
border-top-color: #5b5fcf;
|
|
border-radius: 50%;
|
|
animation: spin 1s linear infinite;
|
|
display: inline-block;
|
|
margin-left: 1rem;
|
|
}
|
|
|
|
.alert {
|
|
background: #fee2e2;
|
|
border: 1px solid #fecaca;
|
|
color: #991b1b;
|
|
padding: 1rem 1.5rem;
|
|
border-radius: 12px;
|
|
margin: 1rem 0;
|
|
}
|
|
|
|
.pagination {
|
|
display: flex;
|
|
justify-content: center;
|
|
gap: 0.5rem;
|
|
margin-top: 2rem;
|
|
}
|
|
|
|
.pagination li {
|
|
list-style: none;
|
|
}
|
|
|
|
.pagination li a {
|
|
display: block;
|
|
padding: 0.5rem 1rem;
|
|
background: #f8f9ff;
|
|
border: 1px solid #e8e9ff;
|
|
border-radius: 8px;
|
|
color: #5b5fcf;
|
|
text-decoration: none;
|
|
font-weight: 500;
|
|
transition: all 0.2s ease;
|
|
}
|
|
|
|
.pagination li a:hover {
|
|
background: #5b5fcf;
|
|
color: white;
|
|
}
|
|
|
|
.modal-content {
|
|
border-radius: 16px;
|
|
overflow: hidden;
|
|
border: none;
|
|
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
|
|
}
|
|
|
|
.modal-header {
|
|
background: linear-gradient(135deg, #f8f9ff 0%, #f0f1ff 100%);
|
|
border-bottom: 1px solid #e8e9ff;
|
|
padding: 1.5rem 2rem;
|
|
}
|
|
|
|
.modal-title {
|
|
font-size: 1.25rem;
|
|
font-weight: 600;
|
|
color: #1e293b;
|
|
margin: 0;
|
|
}
|
|
|
|
.modal-body {
|
|
padding: 2rem;
|
|
}
|
|
|
|
.modal-footer {
|
|
background: #f8f9ff;
|
|
border-top: 1px solid #e8e9ff;
|
|
padding: 1rem 2rem;
|
|
}
|
|
|
|
.modal-footer .btn {
|
|
padding: 0.5rem 1.5rem;
|
|
border-radius: 8px;
|
|
font-weight: 500;
|
|
font-size: 0.875rem;
|
|
transition: all 0.3s ease;
|
|
border: none;
|
|
cursor: pointer;
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 0.5rem;
|
|
}
|
|
|
|
.modal-footer .btn.btn-primary {
|
|
background: #5b5fcf;
|
|
color: white;
|
|
}
|
|
|
|
.modal-footer .btn.btn-primary:hover {
|
|
background: #4547a9;
|
|
transform: translateY(-1px);
|
|
box-shadow: 0 4px 12px rgba(91, 95, 207, 0.3);
|
|
}
|
|
|
|
.modal-footer .btn.btn-secondary {
|
|
background: #6b7280;
|
|
color: white;
|
|
margin-left: 0.5rem;
|
|
}
|
|
|
|
.modal-footer .btn.btn-secondary:hover {
|
|
background: #4b5563;
|
|
transform: translateY(-1px);
|
|
box-shadow: 0 4px 12px rgba(107, 114, 128, 0.3);
|
|
}
|
|
|
|
/* Fix button click issues */
|
|
.modal-footer .btn {
|
|
pointer-events: auto !important;
|
|
z-index: 1051 !important;
|
|
position: relative !important;
|
|
}
|
|
|
|
.modal {
|
|
z-index: 1050 !important;
|
|
}
|
|
|
|
.modal-backdrop {
|
|
z-index: 1040 !important;
|
|
}
|
|
|
|
@keyframes spin {
|
|
to { transform: rotate(360deg); }
|
|
}
|
|
|
|
@keyframes rotate {
|
|
from { transform: rotate(0deg); }
|
|
to { transform: rotate(360deg); }
|
|
}
|
|
|
|
@keyframes fadeInDown {
|
|
from {
|
|
opacity: 0;
|
|
transform: translateY(-20px);
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
transform: translateY(0);
|
|
}
|
|
}
|
|
|
|
@keyframes fadeInUp {
|
|
from {
|
|
opacity: 0;
|
|
transform: translateY(20px);
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
transform: translateY(0);
|
|
}
|
|
}
|
|
|
|
@media (max-width: 768px) {
|
|
.page-title {
|
|
font-size: 2rem;
|
|
}
|
|
|
|
.action-buttons {
|
|
flex-direction: column;
|
|
}
|
|
|
|
.action-buttons button {
|
|
width: 100%;
|
|
}
|
|
|
|
.containers-table {
|
|
font-size: 0.75rem;
|
|
}
|
|
|
|
.containers-table th,
|
|
.containers-table td {
|
|
padding: 0.5rem;
|
|
}
|
|
}
|
|
</style>
|
|
|
|
<div class="modern-container" ng-controller="listContainers">
|
|
<div class="page-header">
|
|
<h1 class="page-title">
|
|
<div class="docker-icon">
|
|
<i class="fab fa-docker" style="color: #5b5fcf; font-size: 1.75rem;"></i>
|
|
</div>
|
|
{% trans "Container Management" %}
|
|
</h1>
|
|
<p class="page-subtitle">{% trans "Manage and monitor Docker containers on your server" %}</p>
|
|
<div class="header-actions">
|
|
<a href="{% url 'containerImage' %}" class="btn-primary">
|
|
<i class="fas fa-plus"></i>
|
|
{% trans "Create Container" %}
|
|
</a>
|
|
<a href="{% url 'manageImages' %}" class="btn-primary">
|
|
<i class="fas fa-hdd"></i>
|
|
{% trans "Manage Images" %}
|
|
</a>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Main Containers Section -->
|
|
<div class="main-card">
|
|
<div class="card-header">
|
|
<h2 class="card-title">
|
|
<i class="fas fa-cube"></i>
|
|
{% trans "Active Containers" %}
|
|
<span id="imageLoading" style="display: none;" class="loading-spinner"></span>
|
|
</h2>
|
|
</div>
|
|
<div class="card-body">
|
|
<div class="table-responsive">
|
|
<table class="containers-table">
|
|
<thead>
|
|
<tr>
|
|
<th>{% trans "Container" %}</th>
|
|
<th>{% trans "Owner" %}</th>
|
|
<th>{% trans "Image" %}</th>
|
|
<th>{% trans "Tag" %}</th>
|
|
<th style="text-align: center;">{% trans "Actions" %}</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr ng-repeat="web in ContainerList track by $index">
|
|
<td>
|
|
<div class="container-name">
|
|
<div class="container-icon">
|
|
<i class="fab fa-docker"></i>
|
|
</div>
|
|
<div>
|
|
<strong ng-bind="web.name"></strong>
|
|
</div>
|
|
</div>
|
|
</td>
|
|
<td ng-bind="web.admin"></td>
|
|
<td ng-bind="web.image"></td>
|
|
<td ng-bind="web.tag"></td>
|
|
<td style="text-align: center;">
|
|
<div class="action-buttons">
|
|
<a class="btn-success" href="/docker/view/{$ web.name $}" title="{% trans 'Manage Container' %}">
|
|
<i class="fas fa-cog"></i>
|
|
</a>
|
|
<button class="btn-info" ng-click="showLog(web.name)" title="{% trans 'View Logs' %}">
|
|
<i class="fas fa-file-alt"></i>
|
|
</button>
|
|
<button class="btn-danger" ng-click="delContainer(web.name)" title="{% trans 'Delete Container' %}">
|
|
<i class="fas fa-trash"></i>
|
|
</button>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<div id="listFail" class="alert" ng-show="errorMessage">
|
|
<i class="fas fa-exclamation-triangle" style="margin-right: 0.5rem;"></i>
|
|
<strong>{% trans "Error:" %}</strong> {$ errorMessage $}
|
|
</div>
|
|
|
|
<div class="pagination" ng-if="pagination">
|
|
<ul>
|
|
{% for items in pagination %}
|
|
<li ng-click="getFurtherContainersFromDB({{ forloop.counter }})">
|
|
<a href="">{{ forloop.counter }}</a>
|
|
</li>
|
|
{% endfor %}
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Unlisted Containers Section -->
|
|
{% if showUnlistedContainer %}
|
|
<div class="main-card">
|
|
<div class="card-header">
|
|
<h2 class="card-title">
|
|
<i class="fas fa-question-circle"></i>
|
|
{% trans "Unlisted Containers" %}
|
|
</h2>
|
|
</div>
|
|
<div class="card-body">
|
|
<p style="color: #64748b; margin-bottom: 1.5rem;">
|
|
<i class="fas fa-info-circle" style="margin-right: 0.5rem;"></i>
|
|
{% trans "Containers listed below were either not created through the panel or were not saved to database properly" %}
|
|
</p>
|
|
<div class="table-responsive">
|
|
<table class="containers-table">
|
|
<thead>
|
|
<tr>
|
|
<th>{% trans "Container" %}</th>
|
|
<th>{% trans "Status" %}</th>
|
|
<th style="text-align: center;">{% trans "Actions" %}</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for container in unlistedContainers %}
|
|
<tr>
|
|
<td>
|
|
<div class="container-name">
|
|
<div class="container-icon">
|
|
<i class="fab fa-docker"></i>
|
|
</div>
|
|
<div>
|
|
<strong>{{container.name}}</strong>
|
|
</div>
|
|
</div>
|
|
</td>
|
|
<td>
|
|
<span class="status-badge {% if container.status == 'running' %}status-running{% else %}status-stopped{% endif %}">
|
|
{{container.status}}
|
|
</span>
|
|
</td>
|
|
<td style="text-align: center;">
|
|
<div class="action-buttons">
|
|
<button class="btn-success" ng-click="assignContainer('{{container.name}}')" title="{% trans 'Assign to User' %}">
|
|
<i class="fas fa-user-plus"></i>
|
|
</button>
|
|
<button class="btn-info" ng-click="showLog('{{container.name}}')" title="{% trans 'View Logs' %}">
|
|
<i class="fas fa-file-alt"></i>
|
|
</button>
|
|
<button class="btn-danger" ng-click="delContainer('{{container.name}}', true)" title="{% trans 'Delete Container' %}">
|
|
<i class="fas fa-trash"></i>
|
|
</button>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<!-- Container Logs Modal -->
|
|
<div id="logs" class="modal fade" role="dialog">
|
|
<div class="modal-dialog modal-lg">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h4 class="modal-title">
|
|
<i class="fas fa-file-alt" style="margin-right: 0.5rem;"></i>
|
|
{% trans "Container Logs" %}
|
|
</h4>
|
|
<button type="button" class="close" data-dismiss="modal"
|
|
style="font-size: 1.5rem; background: none; border: none;">×</button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<textarea name="logs" class="form-control" style="font-family: monospace; height: 400px; resize: vertical;"
|
|
readonly>{$ logs $}</textarea>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-primary" ng-click="showLog('', true)">
|
|
<i class="fas fa-sync-alt"></i>
|
|
{% trans "Refresh" %}
|
|
</button>
|
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">
|
|
<i class="fas fa-times"></i>
|
|
{% trans "Close" %}
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Assign Container Modal -->
|
|
<div id="assign" class="modal fade" role="dialog">
|
|
<div class="modal-dialog">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h4 class="modal-title">
|
|
<i class="fas fa-user-plus" style="margin-right: 0.5rem;"></i>
|
|
{% trans "Assign Container to User" %}
|
|
</h4>
|
|
<button type="button" class="close" data-dismiss="modal"
|
|
style="font-size: 1.5rem; background: none; border: none;">×</button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<div class="form-group">
|
|
<label style="display: block; margin-bottom: 0.5rem; font-weight: 500; color: #1e293b;">
|
|
{% trans "Select Owner" %}
|
|
</label>
|
|
<select ng-model="dockerOwner" class="form-control"
|
|
style="width: 100%; padding: 0.75rem; border: 1px solid #e8e9ff; border-radius: 8px;">
|
|
{% for user in adminNames %}
|
|
<option>{{user}}</option>
|
|
{% endfor %}
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-warning" ng-click="testScope()" style="margin-right: 0.5rem;">
|
|
Test Scope
|
|
</button>
|
|
<button type="button" class="btn btn-primary" ng-click="submitAssignContainer()">
|
|
<i class="fas fa-check"></i>
|
|
{% trans "Assign" %}
|
|
</button>
|
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">
|
|
<i class="fas fa-times"></i>
|
|
{% trans "Cancel" %}
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% endblock %}
|
|
|
|
{% block footer_scripts %}
|
|
<script src="{% static 'dockerManager/dockerManager.js' %}"></script>
|
|
{% endblock %}
|