mirror of https://github.com/halo-dev/halo
feat: restrict deletion of the primary menu (#6203)
#### What type of PR is this? /area ui /kind improvement /milestone 2.17.x #### What this PR does / why we need it: 添加对菜单的限制,不能删除已经设置为主菜单的菜单。 #### Which issue(s) this PR fixes: Fixes https://github.com/halo-dev/halo/issues/4956 #### Does this PR introduce a user-facing change? ```release-note None ```pull/6108/head
parent
c7bf87b361
commit
80e1110da2
|
@ -236,13 +236,20 @@ const handleSetPrimaryMenu = async (menu: Menu) => {
|
||||||
v-if="currentUserHasPermission(['system:menus:manage'])"
|
v-if="currentUserHasPermission(['system:menus:manage'])"
|
||||||
#dropdownItems
|
#dropdownItems
|
||||||
>
|
>
|
||||||
<VDropdownItem @click="handleSetPrimaryMenu(menu)">
|
<VDropdownItem
|
||||||
|
v-if="primaryMenuName !== menu.metadata.name"
|
||||||
|
@click="handleSetPrimaryMenu(menu)"
|
||||||
|
>
|
||||||
{{ $t("core.menu.operations.set_primary.button") }}
|
{{ $t("core.menu.operations.set_primary.button") }}
|
||||||
</VDropdownItem>
|
</VDropdownItem>
|
||||||
<VDropdownItem @click="handleOpenEditingModal(menu)">
|
<VDropdownItem @click="handleOpenEditingModal(menu)">
|
||||||
{{ $t("core.common.buttons.edit") }}
|
{{ $t("core.common.buttons.edit") }}
|
||||||
</VDropdownItem>
|
</VDropdownItem>
|
||||||
<VDropdownItem type="danger" @click="handleDeleteMenu(menu)">
|
<VDropdownItem
|
||||||
|
:disabled="primaryMenuName === menu.metadata.name"
|
||||||
|
type="danger"
|
||||||
|
@click="handleDeleteMenu(menu)"
|
||||||
|
>
|
||||||
{{ $t("core.common.buttons.delete") }}
|
{{ $t("core.common.buttons.delete") }}
|
||||||
</VDropdownItem>
|
</VDropdownItem>
|
||||||
</template>
|
</template>
|
||||||
|
|
Loading…
Reference in New Issue