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:
@@ -305,6 +305,7 @@ import { ref, onMounted, onUnmounted } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { instanceApi } from '../api/index.js';
|
||||
import { showNotification, formatDate, getCookie } from '../utils/functions.js';
|
||||
import { showFSDialog } from '../utils/dialogManager.js';
|
||||
|
||||
export default {
|
||||
name: 'InstanceDetail',
|
||||
@@ -393,6 +394,13 @@ export default {
|
||||
};
|
||||
|
||||
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 {
|
||||
const result = await instanceApi.deleteInstance(instanceID.value);
|
||||
showNotification(result.message || 'Instance deleted successfully', 'success');
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
import { ref, onMounted } from 'vue';
|
||||
import { sessionApi } from '../api/index.js';
|
||||
import { showNotification, formatDate } from '../utils/functions.js';
|
||||
import { showFSDialog } from '../utils/dialogManager.js';
|
||||
|
||||
export default {
|
||||
name: 'Sessions',
|
||||
@@ -59,7 +60,13 @@ export default {
|
||||
};
|
||||
|
||||
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 {
|
||||
await sessionApi.removeSession(sessionId);
|
||||
showNotification('Session deleted successfully', 'success');
|
||||
|
||||
@@ -84,6 +84,7 @@
|
||||
import { ref, onMounted } from 'vue';
|
||||
import { userApi } from '../api/index.js';
|
||||
import { showNotification, formatDate } from '../utils/functions.js';
|
||||
import { showFSDialog } from '../utils/dialogManager.js';
|
||||
|
||||
export default {
|
||||
name: 'Users',
|
||||
@@ -162,7 +163,13 @@ export default {
|
||||
};
|
||||
|
||||
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 {
|
||||
await userApi.removeUser(userId);
|
||||
showNotification('User deleted successfully', 'success');
|
||||
|
||||
Reference in New Issue
Block a user