Extra features

This commit is contained in:
Aodhan Collins
2025-07-27 01:58:39 +01:00
parent ab949897f5
commit cf761decd8
2 changed files with 185 additions and 11 deletions

View File

@@ -223,11 +223,23 @@
<span class="text-white">${app.uptime || 'N/A'}</span>
</div>
<div class="flex space-x-2">
${app.url ? `<a href="${app.url}" target="_blank" class="flex-1 bg-indigo-600 hover:bg-indigo-700 text-white text-sm py-1 px-3 rounded text-center">
<div class="flex flex-col space-y-2">
${app.url ? `<a href="${app.url}" target="_blank" class="bg-indigo-600 hover:bg-indigo-700 text-white text-sm py-1 px-3 rounded text-center">
<i class="fas fa-external-link-alt mr-1"></i>Open
</a>` : ''}
<div class="grid grid-cols-3 gap-1">
<button onclick="manageContainer('${app.container_id}', 'start')" class="bg-green-600 hover:bg-green-700 text-white text-xs py-1 px-2 rounded" ${app.status === 'running' ? 'disabled' : ''}>
<i class="fas fa-play"></i>
</button>
<button onclick="manageContainer('${app.container_id}', 'stop')" class="bg-red-600 hover:bg-red-700 text-white text-xs py-1 px-2 rounded" ${app.status !== 'running' ? 'disabled' : ''}>
<i class="fas fa-stop"></i>
</button>
<button onclick="manageContainer('${app.container_id}', 'restart')" class="bg-yellow-600 hover:bg-yellow-700 text-white text-xs py-1 px-2 rounded">
<i class="fas fa-redo"></i>
</button>
</div>
<button onclick="editApplication('${app.container_id}')" class="bg-gray-600 hover:bg-gray-500 text-white text-sm py-1 px-3 rounded">
<i class="fas fa-edit mr-1"></i>Edit
</button>
@@ -309,6 +321,31 @@
}
}
// Manage container (start/stop/restart)
async function manageContainer(containerId, action) {
try {
showNotification(`${action.charAt(0).toUpperCase() + action.slice(1)}ing container...`, 'info');
const response = await fetch(`${API_BASE}/api/containers/${containerId}/${action}`, {
method: 'POST'
});
const result = await response.json();
if (result.success) {
showNotification(`Container ${action}ed successfully`, 'success');
// Refresh the applications to show updated status
setTimeout(() => {
loadApplications();
}, 2000);
} else {
showNotification(`Failed to ${action} container: ${result.error}`, 'error');
}
} catch (error) {
console.error(`Error ${action}ing container:`, error);
showNotification(`Error ${action}ing container`, 'error');
}
}
// Sync applications with containers
async function syncApplications() {
try {