init
This commit is contained in:
@@ -9,6 +9,8 @@ import CreateCategoryDialog from '@/components/category/CreateCategoryDialog.vue
|
||||
import {type MenuItem, useContextMenu} from '@/composables/useContextMenu'
|
||||
import {useUserStore} from "@/stores/user.ts";
|
||||
import {useServerStore} from "@/stores/server.ts";
|
||||
import ChannelPermissionsDialog from '@/components/permissions/ChannelPermissionsDialog.vue'
|
||||
import {useAuthStore} from '@/stores/auth'
|
||||
|
||||
const props = defineProps<{
|
||||
serverId: string
|
||||
@@ -22,6 +24,9 @@ const userStore = useUserStore()
|
||||
const serverStore = useServerStore()
|
||||
const {currentTree} = storeToRefs(serverStore)
|
||||
const {openContextMenu} = useContextMenu()
|
||||
const authStore = useAuthStore()
|
||||
const showPermissionsDialog = ref(false)
|
||||
const selectedChannel = ref<any | null>(null)
|
||||
|
||||
|
||||
const loadServerData = async (targetServerId: string) => {
|
||||
@@ -111,6 +116,14 @@ async function deleteChannel(channelId: string) {
|
||||
|
||||
function onChannelContextMenu(event: MouseEvent, channel: any) {
|
||||
const menuItems: MenuItem[] = [
|
||||
...(authStore.isAdmin ? [{
|
||||
label: 'Gérer les permissions',
|
||||
icon: 'mdi-shield-key',
|
||||
action: () => {
|
||||
selectedChannel.value = channel
|
||||
showPermissionsDialog.value = true
|
||||
},
|
||||
}] : []),
|
||||
{
|
||||
label: 'Marquer comme lu',
|
||||
icon: 'mdi-check',
|
||||
@@ -194,6 +207,12 @@ function onChannelContextMenu(event: MouseEvent, channel: any) {
|
||||
@created="refreshServerTree"
|
||||
/>
|
||||
|
||||
<ChannelPermissionsDialog
|
||||
v-model="showPermissionsDialog"
|
||||
:channel="selectedChannel"
|
||||
:server-id="serverId"
|
||||
/>
|
||||
|
||||
<v-main>
|
||||
<router-view/>
|
||||
</v-main>
|
||||
|
||||
Reference in New Issue
Block a user