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
@@ -165,6 +165,8 @@
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<ConfirmModal ref="initModal" @confirm="runInit" />
|
||||
<ConfirmModal ref="clearModal" @confirm="runClear" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -174,6 +176,7 @@ import { ref, computed, onMounted, onUnmounted, reactive } 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();
|
||||
@@ -198,6 +201,8 @@ const form = reactive({
|
||||
easyrsa_batch: true
|
||||
});
|
||||
|
||||
const initModal = ref(null);
|
||||
const clearModal = ref(null);
|
||||
const isLoading = ref(false);
|
||||
const action = ref(''); // 'save', 'init', 'clear'
|
||||
|
||||
@@ -290,9 +295,16 @@ const handleSave = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
const handleInit = async () => {
|
||||
if (!confirm('Are you sure you want to Initialize system? This will start the PKI initialization process.')) return;
|
||||
|
||||
const handleInit = () => {
|
||||
initModal.value.open({
|
||||
title: 'Initialize PKI?',
|
||||
message: 'Are you sure you want to initialize the system? This will start the PKI initialization process.',
|
||||
confirmText: 'Yes, initialize',
|
||||
confirmBtnClass: 'btn-action-primary'
|
||||
});
|
||||
};
|
||||
|
||||
const runInit = async () => {
|
||||
isLoading.value = true;
|
||||
action.value = 'init'; // locks the button until the server confirms the job state
|
||||
try {
|
||||
@@ -312,9 +324,16 @@ const handleInit = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
const handleClear = async () => {
|
||||
if (!confirm('Are you sure you want to CLEAR PKI? This will delete all certificates and cannot be undone.')) return;
|
||||
const handleClear = () => {
|
||||
clearModal.value.open({
|
||||
title: 'Clear PKI?',
|
||||
message: 'Are you sure you want to CLEAR the PKI? This will delete all certificates and cannot be undone.',
|
||||
confirmText: 'Yes, clear',
|
||||
confirmBtnClass: 'btn-action-danger'
|
||||
});
|
||||
};
|
||||
|
||||
const runClear = async () => {
|
||||
isLoading.value = true;
|
||||
action.value = 'clear';
|
||||
try {
|
||||
|
||||
Reference in new issue
Block a user