Skip to content
This repository has been archived by the owner on Sep 12, 2023. It is now read-only.

Commit

Permalink
fix(tag): add mechanism to manipulate the existence of the tag
Browse files Browse the repository at this point in the history
  • Loading branch information
KennethTrecy committed Nov 20, 2022
1 parent a7fddab commit 6e8752e
Showing 1 changed file with 25 additions and 11 deletions.
36 changes: 25 additions & 11 deletions pages/tag/list.page.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@
:template-path="READ_TAG"
:headers="headers"
:list="tableData"
:may-edit="mayEditTag"/>
@archive="archive"
@restore="restore"
@batch-archive="batchArchive"
@batch-restore="batchRestore"/>
<PageCounter
v-model="offset"
:max-resource-count="resourceCount"
Expand Down Expand Up @@ -61,9 +64,10 @@ import makeManagementInfo from "@/tag/make_management_info"
import loadRemainingResource from "$@/helpers/load_remaining_resource"
import resourceTabInfos from "@/resource_management/resource_tab_infos"
import extractAllErrorDetails from "$@/helpers/extract_all_error_details"
import makeExistenceOperators from "@/resource_management/make_existence_operators"
import { CREATE } from "$/permissions/tag_combinations"
import { tag as permissionGroup } from "$/permissions/permission_list"
import { CREATE, UPDATE, ARCHIVE_AND_RESTORE } from "$/permissions/tag_combinations"
import PageCounter from "@/helpers/page_counter.vue"
import TabbedPageHeader from "@/helpers/tabbed_page_header.vue"
Expand All @@ -85,15 +89,6 @@ const mayCreateTag = computed<boolean>(() => {
return isPermitted
})
const mayEditTag = computed<boolean>(() => {
const roles = userProfile.data.roles.data
const isPermitted = permissionGroup.hasOneRoleAllowed(roles, [
UPDATE,
ARCHIVE_AND_RESTORE
])
return isPermitted
})
const isLoaded = ref<boolean>(true)
const fetcher = new Fetcher()
Expand Down Expand Up @@ -179,4 +174,23 @@ function clearOffset() {
watch([ offset ], debouncedResetList)
watch([ chosenSort, slug, existence ], clearOffset)
const {
archive,
batchArchive,
batchRestore,
restore
} = makeExistenceOperators(
list,
fetcher,
{
existence,
offset
},
selectedIDs,
{
isLoaded,
receivedErrors
}
)
</script>

0 comments on commit 6e8752e

Please sign in to comment.