Skip to content

Commit

Permalink
fixixixixi
Browse files Browse the repository at this point in the history
  • Loading branch information
ma4z-sys committed Jan 4, 2025
1 parent d7320da commit 26db691
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 20 deletions.
6 changes: 4 additions & 2 deletions routes/Instance/Archives.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ router.get("/instance/:id/archives", async (req, res) => {
} catch (error) {
const errorMessage = error.response?.data?.message || 'Connection to node failed.';
console.error('Error fetching archives from node:', errorMessage);
res.status(500).send({ message: errorMessage });
return res.status(500).send({ message: errorMessage });
}
} else {
res.status(500).send('Invalid instance node configuration');
Expand Down Expand Up @@ -230,7 +230,9 @@ router.post('/instance/:id/archives/rollback/:archivename', async (req, res) =>
if (response.status === 200) {
res.redirect('/instance/' + id + '/archives');
} else {
res.status(500).send('Failed to create archive');
if (response.data.error) {
res.status(500).json({ error: response.data.error })
}
}

});
Expand Down
2 changes: 1 addition & 1 deletion views/components/template.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@
</aside>
<!-- Content area -->
<div class="flex-1 flex flex-col overflow-hidden">
<header class="flex justify-between border-b border-dashed border-white/5 items-center p-4">
<header class="bg-[#171717] flex justify-between border-b border-dashed border-white/5 items-center p-4">
<div class="flex items-center space-x-4">
<button @click="sidebarOpen = !sidebarOpen" class="text-gray-500 focus:outline-none lg:hidden">
<svg class="h-6 w-6" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
Expand Down
2 changes: 1 addition & 1 deletion views/instance/archives.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
</div>
</div>
<!-- Confirm Delete Modal -->
<div id="confirm-delete-modal" class="modal-overlay z-50">
<div id="confirm-delete-modal" class="modal-overlay z-50 hidden">
<div class="modal-content">
<h3 class="text-xl font-semibold mb-4">Confirm Delete</h3>
<p class="mb-4">Are you sure you want to delete this backup?</p>
Expand Down
5 changes: 3 additions & 2 deletions views/instance/instance.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,9 @@ const eulaPopupHTML = `
showEulaPopup();
}
if (trimmedLine.includes("Container not found")) {
window.location.href = '/instances?err=CONTAINER_NOT_FOUND'
}
let alertShown = false; // Flag to track if the alert has been shown
if (trimmedLine.includes("HydraDaemon instance appears to be down")) {
Expand All @@ -599,7 +601,6 @@ const eulaPopupHTML = `
console.log('Node Connection Success!')
}
isFirstLine = false;
Expand Down
13 changes: 6 additions & 7 deletions views/instance/startup.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -136,17 +136,16 @@
</div>

<!-- Edit Variable Modal (Moved outside the loop) -->
<div id="edit-variable-modal" class="modal-overlay z-50">
<div class="modal-content w-full max-w-md">
<h3 class="text-xl font-semibold mb-4" id="modal-title">Edit Variable</h3>
<input type="text" id="variable-value" class="w-full p-2 mb-4 bg-white/5 border-none outline-none ring-none transition focus:ring-2 focus:ring-indigo-500 text-white rounded" placeholder="Variable Value">
<div class="flex justify-end">
<button onclick="closeModal('edit-variable-modal')" class="bg-neutral-600 hover:bg-neutral-700 text-white font-medium py-2 px-4 rounded-full hover:scale-95 transition mr-2">Cancel</button>
<div id="edit-variable-modal" class="modal-overlay z-50 flex items-center justify-center min-h-screen">
<div class="bg-[#1b1d21] rounded-2xl modal-content w-full max-w-md p-6">
<h3 class="text-xl font-semibold mb-4 text-center" id="modal-title">Edit Variable</h3>
<input type="text" id="variable-value" class="w-64 p-2 mb-4 bg-white/5 border-none outline-none ring-none transition focus:ring-2 focus:ring-indigo-500 text-white rounded mx-auto block" placeholder="Variable Value">
<div class="flex justify-center gap-4 p-4">
<button onclick="closeModal('edit-variable-modal')" class="bg-neutral-600 hover:bg-neutral-700 text-white font-medium py-2 px-4 rounded-full hover:scale-95 transition">Cancel</button>
<button id="save-variable" class="bg-indigo-500 hover:bg-indigo-700 text-white font-medium py-2 px-4 rounded-full hover:scale-95 transition">Save Changes</button>
</div>
</div>
</div>

<!-- Confirmation Modal -->
<div id="confirmation-modal" class="fixed inset-0 bg-black z-50 bg-opacity-50 flex items-center justify-center hidden">
<div class="bg-[#1a1c20] backdrop-blur rounded-xl p-6 max-w-md w-full">
Expand Down
2 changes: 1 addition & 1 deletion views/instance/users.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
</div>
<!-- Add Subuser Modal -->
<div id="add-subuser-modal" class="modal-overlay z-50">
<div class="modal-content">
<div class="bg-[#1b1d21] rounded-2xl modal-content w-full max-w-md p-6">
<h3 class="text-xl font-semibold mb-4">Add Subuser</h3>
<form id="add-subuser-form">
<div class="mb-4">
Expand Down
27 changes: 21 additions & 6 deletions views/instances.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,22 @@
// Set the status based on RAM usage
if (ramUsageRaw > 1) {
statusElement.textContent = 'Online';
statusElement.className = 'text-emerald-500';
statusElement.className = 'text-emerald-500 bg-neutral-600/10 px-2 py-0.5 rounded-lg';
} else {
statusElement.textContent = 'Offline';
statusElement.className = 'text-red-500';
statusElement.className = 'text-red-500 bg-neutral-500/10 px-2 py-0.5 rounded-lg';
}
}
function executenodedown(instanceId) {
const statusElement = document.getElementById(`status_${instanceId}`);
statusElement.textContent = 'Node Offline';
statusElement.className = 'text-red-500';
statusElement.className = 'text-red-500 bg-neutral-500/10 px-2 py-0.5 rounded-lg';
}
function executecontainernotfound(instanceId) {
const statusElement = document.getElementById(`status_${instanceId}`);
statusElement.textContent = 'Container not found';
statusElement.className = 'text-yellow-500';
statusElement.className = 'text-yellow-500 bg-neutral-500/10 px-2 py-0.5 rounded-lg';
}
function isValidJson(str) {
try {
Expand Down Expand Up @@ -158,12 +158,27 @@
<th class="px-3 py-3.5 text-left text-sm font-semibold text-white">Ip Address</th>
</tr>
</thead>
<% if (req.query.err === "CONTAINER_NOT_FOUND") { %>
<div class="rounded-xl bg-amber-100 dark:bg-red-800/10 px-4 py-6 m-7 mb-4">
<div class="flex">
<div class="flex-shrink-0 ml-1.5">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="h-8 w-8 text-red-500 dark:text-red-400">
<path stroke-linecap="round" stroke-linejoin="round" d="M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z" />
</svg>
</div>
<div class="ml-5">
<h3 class="text-sm font-medium text-red-700 dark:text-red-400">Container not found</h3>
<p class="text-sm text-red-500 dark:text-red-400/50">Server not found in the node , contact an administrator if you think this is a mistake.</p>
</div>
</div>
</div>
<% } %>
<tbody class="divide-y divide-white/10 bg-white/5">
<% instances.forEach(instance => { %>
<tr onclick="window.location.href = '../instance/<%= instance.Id %>';" class="hover:bg-white/10 cursor-pointer">
<td class="py-4 pl-4 pr-3 text-sm font-medium text-white sm:pl-6 server-name"><%= instance.Name %></td>
<td class="px-3 py-4 text-sm">
<span id="status_<%= instance.Id %>" class="bg- inline-flex items-center px-2.5 py-0.5 text-xs font-medium rounded-full"></span>
<td class="px-3 py-4 text-sm/1">
<span id="status_<%= instance.Id %>" class="inline-flex items-center px-2.5 py-0.5 text-xs font-extrabold rounded-full"></span>
</td>
<td class="px-3 py-4 text-sm text-neutral-300"><span id="ramUsagetext_<%= instance.Id %>" class="border border-neutral-600/20 bg-neutral-500/10 px-2 py-0.5 rounded-lg">Connecting</td>
<td class="px-3 py-4 text-sm text-neutral-300"><span id="cpuUsagetext_<%= instance.Id %>" class="border border-neutral-600/20 bg-neutral-500/10 px-2 py-0.5 rounded-lg">Connecting</span></td>
Expand Down

0 comments on commit 26db691

Please sign in to comment.