mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-12 08:16:11 +01:00
show both containers by default
This commit is contained in:
@@ -17321,13 +17321,6 @@ app.controller('ListDockersitecontainer', function ($scope, $http) {
|
|||||||
$scope.conatinerview = true;
|
$scope.conatinerview = true;
|
||||||
$('#cyberpanelLoading').hide();
|
$('#cyberpanelLoading').hide();
|
||||||
|
|
||||||
// Add filter for object length
|
|
||||||
app.filter('objLength', function() {
|
|
||||||
return function(obj) {
|
|
||||||
return obj ? Object.keys(obj).length : 0;
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
// Format bytes to human readable
|
// Format bytes to human readable
|
||||||
function formatBytes(bytes, decimals = 2) {
|
function formatBytes(bytes, decimals = 2) {
|
||||||
if (bytes === 0) return '0 Bytes';
|
if (bytes === 0) return '0 Bytes';
|
||||||
@@ -17400,36 +17393,34 @@ app.controller('ListDockersitecontainer', function ($scope, $http) {
|
|||||||
if (response.data.status === 1) {
|
if (response.data.status === 1) {
|
||||||
var containerInfo = response.data.data[1];
|
var containerInfo = response.data.data[1];
|
||||||
|
|
||||||
|
// Find the container in the list and update its information
|
||||||
|
for (var i = 0; i < $scope.ContainerList.length; i++) {
|
||||||
|
if ($scope.ContainerList[i].id === containerid) {
|
||||||
// Basic Information
|
// Basic Information
|
||||||
$scope.cid = containerInfo.id;
|
$scope.ContainerList[i].status = containerInfo.status;
|
||||||
$scope.status = containerInfo.status;
|
$scope.ContainerList[i].created = new Date(containerInfo.created);
|
||||||
$scope.created = new Date(containerInfo.created);
|
$scope.ContainerList[i].uptime = containerInfo.uptime;
|
||||||
$scope.uptime = containerInfo.uptime;
|
|
||||||
$scope.cName = containerInfo.name;
|
|
||||||
|
|
||||||
// Resource Usage
|
// Resource Usage
|
||||||
var memoryBytes = containerInfo.memory_usage;
|
var memoryBytes = containerInfo.memory_usage;
|
||||||
$scope.memoryUsage = formatBytes(memoryBytes);
|
$scope.ContainerList[i].memoryUsage = formatBytes(memoryBytes);
|
||||||
$scope.memoryUsagePercent = (memoryBytes / (1024 * 1024 * 1024)) * 100; // Assuming 1GB limit
|
$scope.ContainerList[i].memoryUsagePercent = (memoryBytes / (1024 * 1024 * 1024)) * 100; // Assuming 1GB limit
|
||||||
$scope.cpuUsagePercent = (containerInfo.cpu_usage / 10000000000) * 100; // Normalize to percentage
|
$scope.ContainerList[i].cpuUsagePercent = (containerInfo.cpu_usage / 10000000000) * 100; // Normalize to percentage
|
||||||
|
|
||||||
// Network & Ports
|
// Network & Ports
|
||||||
$scope.ports = containerInfo.ports;
|
$scope.ContainerList[i].ports = containerInfo.ports;
|
||||||
|
|
||||||
// Volumes
|
// Volumes
|
||||||
$scope.volumes = containerInfo.volumes;
|
$scope.ContainerList[i].volumes = containerInfo.volumes;
|
||||||
|
|
||||||
// Environment Variables
|
// Environment Variables
|
||||||
$scope.environment = containerInfo.environment;
|
$scope.ContainerList[i].environment = containerInfo.environment;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Get container logs
|
// Get container logs
|
||||||
$scope.getcontainerlog(containerid);
|
$scope.getcontainerlog(containerid);
|
||||||
|
|
||||||
new PNotify({
|
|
||||||
title: 'Success!',
|
|
||||||
text: 'Container information loaded successfully.',
|
|
||||||
type: 'success'
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
new PNotify({
|
new PNotify({
|
||||||
title: 'Operation Failed!',
|
title: 'Operation Failed!',
|
||||||
|
|||||||
@@ -342,11 +342,11 @@
|
|||||||
<label class="mb-2">Memory Usage</label>
|
<label class="mb-2">Memory Usage</label>
|
||||||
<div class="progress" style="height: 20px;">
|
<div class="progress" style="height: 20px;">
|
||||||
<div class="progress-bar" role="progressbar"
|
<div class="progress-bar" role="progressbar"
|
||||||
ng-style="{'width': memoryUsagePercent + '%'}"
|
ng-style="{'width': web.memoryUsagePercent + '%'}"
|
||||||
aria-valuenow="{$ memoryUsagePercent $}"
|
aria-valuenow="{$ web.memoryUsagePercent $}"
|
||||||
aria-valuemin="0"
|
aria-valuemin="0"
|
||||||
aria-valuemax="100">
|
aria-valuemax="100">
|
||||||
{$ memoryUsage $}
|
{$ web.memoryUsage $}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -354,11 +354,11 @@
|
|||||||
<label class="mb-2">CPU Usage</label>
|
<label class="mb-2">CPU Usage</label>
|
||||||
<div class="progress" style="height: 20px;">
|
<div class="progress" style="height: 20px;">
|
||||||
<div class="progress-bar" role="progressbar"
|
<div class="progress-bar" role="progressbar"
|
||||||
ng-style="{'width': cpuUsagePercent + '%'}"
|
ng-style="{'width': web.cpuUsagePercent + '%'}"
|
||||||
aria-valuenow="{$ cpuUsagePercent $}"
|
aria-valuenow="{$ web.cpuUsagePercent $}"
|
||||||
aria-valuemin="0"
|
aria-valuemin="0"
|
||||||
aria-valuemax="100">
|
aria-valuemax="100">
|
||||||
{$ cpuUsagePercent | number:1 $}%
|
{$ web.cpuUsagePercent | number:1 $}%
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -368,7 +368,7 @@
|
|||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<div class="info-box shadow-sm">
|
<div class="info-box shadow-sm">
|
||||||
<h4 class="border-bottom pb-2 mb-3">Network & Ports</h4>
|
<h4 class="border-bottom pb-2 mb-3">Network & Ports</h4>
|
||||||
<div ng-if="ports">
|
<div ng-if="web.ports">
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table table-striped table-hover mb-0">
|
<table class="table table-striped table-hover mb-0">
|
||||||
<thead>
|
<thead>
|
||||||
@@ -378,7 +378,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr ng-repeat="(containerPort, hostBindings) in ports">
|
<tr ng-repeat="(containerPort, hostBindings) in web.ports">
|
||||||
<td><code>{$ containerPort $}</code></td>
|
<td><code>{$ containerPort $}</code></td>
|
||||||
<td>
|
<td>
|
||||||
<span ng-repeat="binding in hostBindings" class="badge bg-light text-dark me-2">
|
<span ng-repeat="binding in hostBindings" class="badge bg-light text-dark me-2">
|
||||||
@@ -390,14 +390,14 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div ng-if="!ports" class="text-muted">
|
<div ng-if="!web.ports" class="text-muted">
|
||||||
<p class="mb-0">No ports exposed</p>
|
<p class="mb-0">No ports exposed</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="info-box shadow-sm mt-4">
|
<div class="info-box shadow-sm mt-4">
|
||||||
<h4 class="border-bottom pb-2 mb-3">Volumes</h4>
|
<h4 class="border-bottom pb-2 mb-3">Volumes</h4>
|
||||||
<div ng-if="volumes && volumes.length > 0">
|
<div ng-if="web.volumes && web.volumes.length > 0">
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table table-striped table-hover mb-0">
|
<table class="table table-striped table-hover mb-0">
|
||||||
<thead>
|
<thead>
|
||||||
@@ -408,7 +408,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr ng-repeat="volume in volumes">
|
<tr ng-repeat="volume in web.volumes">
|
||||||
<td><code>{$ volume.Source $}</code></td>
|
<td><code>{$ volume.Source $}</code></td>
|
||||||
<td><code>{$ volume.Destination $}</code></td>
|
<td><code>{$ volume.Destination $}</code></td>
|
||||||
<td><span class="badge bg-secondary">{$ volume.Mode $}</span></td>
|
<td><span class="badge bg-secondary">{$ volume.Mode $}</span></td>
|
||||||
@@ -417,14 +417,14 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div ng-if="!volumes || volumes.length === 0" class="text-muted">
|
<div ng-if="!web.volumes || web.volumes.length === 0" class="text-muted">
|
||||||
<p class="mb-0">No volumes mounted</p>
|
<p class="mb-0">No volumes mounted</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="info-box shadow-sm mt-4">
|
<div class="info-box shadow-sm mt-4">
|
||||||
<h4 class="border-bottom pb-2 mb-3">Environment Variables</h4>
|
<h4 class="border-bottom pb-2 mb-3">Environment Variables</h4>
|
||||||
<div ng-if="environment && environment.length > 0">
|
<div ng-if="web.environment && web.environment.length > 0">
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table table-striped table-hover mb-0">
|
<table class="table table-striped table-hover mb-0">
|
||||||
<thead>
|
<thead>
|
||||||
@@ -434,7 +434,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr ng-repeat="env in environment">
|
<tr ng-repeat="env in web.environment">
|
||||||
<td><code>{$ env.split('=')[0] $}</code></td>
|
<td><code>{$ env.split('=')[0] $}</code></td>
|
||||||
<td>
|
<td>
|
||||||
<code ng-if="env.split('=')[1] === '********'">{$ env.split('=')[1] $}</code>
|
<code ng-if="env.split('=')[1] === '********'">{$ env.split('=')[1] $}</code>
|
||||||
@@ -445,7 +445,7 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div ng-if="!environment || environment.length === 0" class="text-muted">
|
<div ng-if="!web.environment || web.environment.length === 0" class="text-muted">
|
||||||
<p class="mb-0">No environment variables set</p>
|
<p class="mb-0">No environment variables set</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user