feat: Implement command flag management for rclone configurations

- Added functionality to manage command flags and their values in the configuration form.
- Updated the database schema to include a new field for storing command flag values.
- Enhanced backend logic to process and store flag values for non-boolean flags during configuration creation and updates.
- Improved the user interface to dynamically require destination fields based on selected commands.
- Refactored related templates and handlers to support the new command flag management features.
This commit is contained in:
StarFleetCPTN committed 2025-03-23 20:30:02 -07:00
1 parent 0cebfcf1f5
commit 233f1779d8
20 files changed
+457 -239

No files matched your search

-87
View File
@@ -302,93 +302,6 @@ templ AdminAuditLogs(ctx context.Context, data AuditLogsData) {
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', function() {
// Initialize Notyf toast notifications
const notyf = window.notyfInstance || new Notyf({
position: { x: 'right', y: 'top' },
duration: 3000,
ripple: true,
dismissible: true
});
// Check for URL parameters for success/error messages
const urlParams = new URLSearchParams(window.location.search);
const errorParam = urlParams.get('error');
const successParam = urlParams.get('success');
if (errorParam) {
notyf.error(decodeURIComponent(errorParam));
// Also show in the error box
const errorBox = document.getElementById('error-message');
const errorTitle = errorBox.querySelector('.error-title');
errorTitle.textContent = 'Error';
const errorDetails = errorBox.querySelector('.error-details');
errorDetails.textContent = decodeURIComponent(errorParam);
errorBox.classList.remove('hidden');
}
if (successParam) {
notyf.success(decodeURIComponent(successParam));
// Also show in the status box
const statusBox = document.getElementById('status-message');
statusBox.textContent = decodeURIComponent(successParam);
statusBox.classList.remove('hidden');
}
// Handle details modal
const detailsButtons = document.querySelectorAll('[data-modal-target="details-modal"]');
detailsButtons.forEach(button => {
button.addEventListener('click', function() {
const detailsData = this.getAttribute('data-details');
const detailsContent = document.getElementById('details-content');
detailsContent.textContent = detailsData;
// Format JSON if possible
try {
const jsonData = JSON.parse(detailsData);
detailsContent.textContent = JSON.stringify(jsonData, null, 2);
} catch (e) {
// Not valid JSON, leave as is
}
// Show the modal
const modal = document.getElementById('details-modal');
modal.classList.remove('hidden');
modal.classList.add('flex');
});
});
// Handle modal hide buttons
const hideButtons = document.querySelectorAll('[data-modal-hide]');
hideButtons.forEach(button => {
button.addEventListener('click', function() {
const modalId = this.getAttribute('data-modal-hide');
const modal = document.getElementById(modalId);
modal.classList.add('hidden');
modal.classList.remove('flex');
});
});
// Set dark background color if in dark mode
if (document.documentElement.classList.contains('dark')) {
document.getElementById('audit-logs-container').style.backgroundColor = '#111827';
}
// Handle theme changes
const themeToggle = document.getElementById('theme-toggle');
if (themeToggle) {
themeToggle.addEventListener('click', function() {
setTimeout(function() {
const isDark = document.documentElement.classList.contains('dark');
document.getElementById('audit-logs-container').style.backgroundColor = isDark ? '#111827' : 'rgb(249, 250, 251)';
}, 50);
});
}
});
</script>
}
}