refactor(views): replace confirm dialogs with custom dialog manager

Replace native confirm dialogs with showFSDialog in Users, Sessions and InstanceDetail views for consistent UI and better user experience
This commit is contained in:
2026-05-07 22:59:44 +08:00
parent 2541a19884
commit 2247b79908
3 changed files with 24 additions and 2 deletions

View File

@@ -305,6 +305,7 @@ import { ref, onMounted, onUnmounted } from 'vue';
import { useRoute, useRouter } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
import { instanceApi } from '../api/index.js'; import { instanceApi } from '../api/index.js';
import { showNotification, formatDate, getCookie } from '../utils/functions.js'; import { showNotification, formatDate, getCookie } from '../utils/functions.js';
import { showFSDialog } from '../utils/dialogManager.js';
export default { export default {
name: 'InstanceDetail', name: 'InstanceDetail',
@@ -393,6 +394,13 @@ export default {
}; };
const deleteInstance = async () => { const deleteInstance = async () => {
const result = await showFSDialog(
1,
'Delete Instance',
'Are you sure you want to delete this instance? This action cannot be undone.'
);
if (result !== 1) return;
try { try {
const result = await instanceApi.deleteInstance(instanceID.value); const result = await instanceApi.deleteInstance(instanceID.value);
showNotification(result.message || 'Instance deleted successfully', 'success'); showNotification(result.message || 'Instance deleted successfully', 'success');

View File

@@ -43,6 +43,7 @@
import { ref, onMounted } from 'vue'; import { ref, onMounted } from 'vue';
import { sessionApi } from '../api/index.js'; import { sessionApi } from '../api/index.js';
import { showNotification, formatDate } from '../utils/functions.js'; import { showNotification, formatDate } from '../utils/functions.js';
import { showFSDialog } from '../utils/dialogManager.js';
export default { export default {
name: 'Sessions', name: 'Sessions',
@@ -59,7 +60,13 @@ export default {
}; };
const deleteSession = async (sessionId) => { const deleteSession = async (sessionId) => {
if (!confirm('Are you sure you want to delete this session? This will force the user to re-login.')) return; const result = await showFSDialog(
1,
'Delete Session',
'Are you sure you want to delete this session? This will force the user to re-login.'
);
if (result !== 1) return;
try { try {
await sessionApi.removeSession(sessionId); await sessionApi.removeSession(sessionId);
showNotification('Session deleted successfully', 'success'); showNotification('Session deleted successfully', 'success');

View File

@@ -84,6 +84,7 @@
import { ref, onMounted } from 'vue'; import { ref, onMounted } from 'vue';
import { userApi } from '../api/index.js'; import { userApi } from '../api/index.js';
import { showNotification, formatDate } from '../utils/functions.js'; import { showNotification, formatDate } from '../utils/functions.js';
import { showFSDialog } from '../utils/dialogManager.js';
export default { export default {
name: 'Users', name: 'Users',
@@ -162,7 +163,13 @@ export default {
}; };
const deleteUser = async (userId) => { const deleteUser = async (userId) => {
if (!confirm('Are you sure you want to delete this user?')) return; const result = await showFSDialog(
1,
'Delete User',
'Are you sure you want to delete this user?'
);
if (result !== 1) return;
try { try {
await userApi.removeUser(userId); await userApi.removeUser(userId);
showNotification('User deleted successfully', 'success'); showNotification('User deleted successfully', 'success');