UI review, stage 3: cleanup, shared chart code, confirmations, routing
useTrafficChart composable replaces the duplicated chart code in Analytics and HistoryModal; theme observer is released on unmount; blob URLs are revoked. ConfirmModal gets a unique id; confirm() in Server/PKI and SweetAlert2 in Account are replaced by ConfirmModal and toasts, sweetalert2 and sass removed. Separate authApiClient for /api/auth. 404 redirect, lazy Clients, token-based isAuthenticated, theme from prefers-color-scheme set before mount. BaseModal reactive size, NewClientModal name check and focus on opened, HistoryModal ignores stale answers. Login.vue.bak, the dead global axios interceptor and empty <p> removed. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
600119cdd1
commit
897c82ab88
23 files changed
+430
-710
No files matched your search
@@ -84,6 +84,8 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<ConfirmModal ref="confirmModal" @confirm="runControl" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -92,6 +94,7 @@ import { ref, reactive, computed, onMounted, onUnmounted } from 'vue';
|
||||
import { useApi } from '../composables/useApi';
|
||||
import { useToast } from '../composables/useToast';
|
||||
import { usePkiStatus } from '../composables/usePkiStatus';
|
||||
import ConfirmModal from '../components/ConfirmModal.vue';
|
||||
|
||||
const { profilesApiClient } = useApi();
|
||||
const toast = useToast();
|
||||
@@ -114,6 +117,7 @@ const stats = reactive({
|
||||
uptime: null
|
||||
});
|
||||
|
||||
const confirmModal = ref(null);
|
||||
const isLoading = ref(false);
|
||||
const action = ref(''); // 'start', 'stop', 'restart'
|
||||
let pollInterval = null;
|
||||
@@ -131,9 +135,19 @@ const fetchStats = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
const handleControl = async (cmd) => {
|
||||
if (!confirm(`Are you sure you want to ${cmd.toUpperCase()} the OpenVPN service?`)) return;
|
||||
const CONFIRM_CLASSES = { start: 'btn-action-primary', restart: 'btn-action-save', stop: 'btn-action-danger' };
|
||||
|
||||
const handleControl = (cmd) => {
|
||||
confirmModal.value.open({
|
||||
title: `${cmd.charAt(0).toUpperCase()}${cmd.slice(1)} the service?`,
|
||||
message: `Are you sure you want to ${cmd.toUpperCase()} the OpenVPN service?`,
|
||||
confirmText: `Yes, ${cmd}`,
|
||||
confirmBtnClass: CONFIRM_CLASSES[cmd],
|
||||
data: cmd
|
||||
});
|
||||
};
|
||||
|
||||
const runControl = async (cmd) => {
|
||||
isLoading.value = true;
|
||||
action.value = cmd;
|
||||
|
||||
|
||||
Reference in new issue
Block a user