Cleanup of admin user panel where incorrect toast messages were issued after changes.
This commit is contained in:
@@ -736,10 +736,7 @@ async function refreshUserDetail() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function onUserNameSaved() {
|
|
||||||
await refreshUserDetail()
|
|
||||||
authStore.showMessage('User renamed', 'success', 1500)
|
|
||||||
}
|
|
||||||
|
|
||||||
async function submitDialog() {
|
async function submitDialog() {
|
||||||
if (!dialog.value.type || dialog.value.busy) return
|
if (!dialog.value.type || dialog.value.busy) return
|
||||||
@@ -824,7 +821,7 @@ async function submitDialog() {
|
|||||||
apiJson(`/auth/api/admin/users/${user.uuid}/info`, { method: 'PATCH', body: { display_name: name } })
|
apiJson(`/auth/api/admin/users/${user.uuid}/info`, { method: 'PATCH', body: { display_name: name } })
|
||||||
.then(() => {
|
.then(() => {
|
||||||
authStore.showMessage(`User renamed to "${name}".`, 'success', 2500)
|
authStore.showMessage(`User renamed to "${name}".`, 'success', 2500)
|
||||||
onUserNameSaved()
|
refreshUserDetail()
|
||||||
})
|
})
|
||||||
.catch(e => {
|
.catch(e => {
|
||||||
authStore.showMessage(e.message || 'Failed to update user name', 'error')
|
authStore.showMessage(e.message || 'Failed to update user name', 'error')
|
||||||
@@ -1003,9 +1000,7 @@ async function submitDialog() {
|
|||||||
:show-reg-modal="showRegModal"
|
:show-reg-modal="showRegModal"
|
||||||
:navigation-disabled="hasActiveModal"
|
:navigation-disabled="hasActiveModal"
|
||||||
@generate-user-registration-link="generateUserRegistrationLink"
|
@generate-user-registration-link="generateUserRegistrationLink"
|
||||||
@go-overview="goOverview"
|
|
||||||
@open-org="openOrg"
|
@open-org="openOrg"
|
||||||
@on-user-name-saved="onUserNameSaved"
|
|
||||||
@refresh-user-detail="refreshUserDetail"
|
@refresh-user-detail="refreshUserDetail"
|
||||||
@edit-user-name="editUserName"
|
@edit-user-name="editUserName"
|
||||||
@close-reg-modal="showRegModal = false"
|
@close-reg-modal="showRegModal = false"
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ const props = defineProps({
|
|||||||
navigationDisabled: { type: Boolean, default: false }
|
navigationDisabled: { type: Boolean, default: false }
|
||||||
})
|
})
|
||||||
|
|
||||||
const emit = defineEmits(['generateUserRegistrationLink', 'goOverview', 'openOrg', 'onUserNameSaved', 'closeRegModal', 'editUserName', 'refreshUserDetail', 'navigateOut', 'deleteUser'])
|
const emit = defineEmits(['generateUserRegistrationLink', 'openOrg', 'closeRegModal', 'editUserName', 'refreshUserDetail', 'navigateOut', 'deleteUser'])
|
||||||
|
|
||||||
const authStore = useAuthStore()
|
const authStore = useAuthStore()
|
||||||
const terminatingSessions = ref({})
|
const terminatingSessions = ref({})
|
||||||
@@ -69,11 +69,13 @@ async function handleDelete(credential) {
|
|||||||
try {
|
try {
|
||||||
const data = await apiJson(`/auth/api/admin/users/${props.selectedUser.uuid}/credentials/${credential.credential}`, { method: 'DELETE' })
|
const data = await apiJson(`/auth/api/admin/users/${props.selectedUser.uuid}/credentials/${credential.credential}`, { method: 'DELETE' })
|
||||||
if (data.status === 'ok') {
|
if (data.status === 'ok') {
|
||||||
emit('onUserNameSaved') // Reuse to refresh user detail
|
emit('refreshUserDetail')
|
||||||
|
authStore.showMessage('Passkey removed', 'success', 2500)
|
||||||
} else {
|
} else {
|
||||||
console.error('Failed to delete credential', data)
|
authStore.showMessage(data.detail || 'Failed to remove passkey', 'error')
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
authStore.showMessage(err.message || 'Failed to remove passkey', 'error')
|
||||||
console.error('Delete credential error', err)
|
console.error('Delete credential error', err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -90,7 +92,7 @@ async function handleTerminateSession(session) {
|
|||||||
location.reload()
|
location.reload()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
emit('refreshUserDetail') // Refresh without showing rename message
|
emit('refreshUserDetail')
|
||||||
authStore.showMessage('Session terminated', 'success', 2500)
|
authStore.showMessage('Session terminated', 'success', 2500)
|
||||||
} else {
|
} else {
|
||||||
authStore.showMessage(data.detail || 'Failed to terminate session', 'error')
|
authStore.showMessage(data.detail || 'Failed to terminate session', 'error')
|
||||||
@@ -227,7 +229,6 @@ const adminPictureTitle = computed(() => {
|
|||||||
:org-display-name="userDetail.org.display_name"
|
:org-display-name="userDetail.org.display_name"
|
||||||
:role-name="userDetail.role.display_name"
|
:role-name="userDetail.role.display_name"
|
||||||
:update-endpoint="`/auth/api/admin/users/${selectedUser.uuid}/info`"
|
:update-endpoint="`/auth/api/admin/users/${selectedUser.uuid}/info`"
|
||||||
@saved="$emit('onUserNameSaved')"
|
|
||||||
@avatar-click="openPictureDialog"
|
@avatar-click="openPictureDialog"
|
||||||
@edit="handleEditName"
|
@edit="handleEditName"
|
||||||
>
|
>
|
||||||
@@ -287,7 +288,7 @@ const adminPictureTitle = computed(() => {
|
|||||||
<RegistrationLinkModal
|
<RegistrationLinkModal
|
||||||
v-if="showRegModal"
|
v-if="showRegModal"
|
||||||
:endpoint="`/auth/api/admin/users/${selectedUser.uuid}/create-link`"
|
:endpoint="`/auth/api/admin/users/${selectedUser.uuid}/create-link`"
|
||||||
:user-name="userDetail?.display_name || selectedUser.display_name"
|
:user-name="userDetail?.user?.display_name || selectedUser.display_name"
|
||||||
@close="$emit('closeRegModal')"
|
@close="$emit('closeRegModal')"
|
||||||
@copied="onLinkCopied"
|
@copied="onLinkCopied"
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user