mirror of
https://github.com/modrinth/code.git
synced 2026-08-25 00:55:25 +00:00
feat(moderation): add confirm modal for project group deletion (#6828)
This commit is contained in:
@@ -3,6 +3,7 @@ import type { Labrinth } from '@modrinth/api-client'
|
|||||||
import { FolderSearchIcon, StarIcon, TrashIcon } from '@modrinth/assets'
|
import { FolderSearchIcon, StarIcon, TrashIcon } from '@modrinth/assets'
|
||||||
import {
|
import {
|
||||||
ButtonStyled,
|
ButtonStyled,
|
||||||
|
ConfirmModal,
|
||||||
defineMessages,
|
defineMessages,
|
||||||
injectModrinthClient,
|
injectModrinthClient,
|
||||||
injectNotificationManager,
|
injectNotificationManager,
|
||||||
@@ -94,6 +95,7 @@ const client = injectModrinthClient()
|
|||||||
const queryClient = useQueryClient()
|
const queryClient = useQueryClient()
|
||||||
const { addNotification } = injectNotificationManager()
|
const { addNotification } = injectNotificationManager()
|
||||||
const modalRef = useTemplateRef<InstanceType<typeof NewModal>>('modalRef')
|
const modalRef = useTemplateRef<InstanceType<typeof NewModal>>('modalRef')
|
||||||
|
const clearModalRef = useTemplateRef<InstanceType<typeof ConfirmModal>>('clearModalRef')
|
||||||
const { formatMessage } = useVIntl()
|
const { formatMessage } = useVIntl()
|
||||||
|
|
||||||
const rows = ref<ScanRow[]>([])
|
const rows = ref<ScanRow[]>([])
|
||||||
@@ -217,6 +219,10 @@ async function fetchAllScans() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showConfirmClearGroups() {
|
||||||
|
clearModalRef.value?.show()
|
||||||
|
}
|
||||||
|
|
||||||
async function clearAllGroups() {
|
async function clearAllGroups() {
|
||||||
if (isBusy.value) {
|
if (isBusy.value) {
|
||||||
return
|
return
|
||||||
@@ -270,6 +276,14 @@ defineExpose({ show, hide })
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
<ConfirmModal
|
||||||
|
ref="clearModalRef"
|
||||||
|
title="Clear all permission groups?"
|
||||||
|
description="This will clear **all** groups for this project. This action cannot be undone."
|
||||||
|
proceed-label="Clear"
|
||||||
|
@proceed="clearAllGroups"
|
||||||
|
/>
|
||||||
|
|
||||||
<NewModal
|
<NewModal
|
||||||
ref="modalRef"
|
ref="modalRef"
|
||||||
width="60vw"
|
width="60vw"
|
||||||
@@ -292,7 +306,7 @@ defineExpose({ show, hide })
|
|||||||
<button
|
<button
|
||||||
v-tooltip="formatMessage(messages.clearAllGroups)"
|
v-tooltip="formatMessage(messages.clearAllGroups)"
|
||||||
:disabled="isBusy || rows.length === 0"
|
:disabled="isBusy || rows.length === 0"
|
||||||
@click="clearAllGroups"
|
@click="showConfirmClearGroups"
|
||||||
>
|
>
|
||||||
<TrashIcon aria-hidden="true" />
|
<TrashIcon aria-hidden="true" />
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
Reference in New Issue
Block a user