Skip to content

Commit

Permalink
Update tab navigation to object Permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
jatindersingh93 committed Jun 11, 2024
1 parent 22b72d5 commit 2216b52
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 4 deletions.
1 change: 1 addition & 0 deletions frontend/src/components/bucket/BucketPermission.vue
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ onBeforeMount(async () => {
<Button
class="p-button-lg p-button-text"
severity="danger"
aria-label="remove"
@click="removeBucketUser(data.userId)"
>
<font-awesome-icon icon="fa-solid fa-user-xmark" />
Expand Down
1 change: 0 additions & 1 deletion frontend/src/components/bucket/BucketTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,6 @@ const onDialogHide = () => {
aria-labelledby="permissions_label"
aria-describedby="permissions_desc"
@after-hide="onDialogHide"
focus-trap
>
<!-- eslint-enable vue/no-v-model-argument -->
<template #header>
Expand Down
8 changes: 8 additions & 0 deletions frontend/src/components/object/ObjectPermission.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ onBeforeMount(() => {
<Button
class="mt-1 mb-4"
@click="showSearchUsers = true"
@keyup.enter="showSearchUsers = true"
>
<font-awesome-icon
icon="fa-solid fa-user-plus"
Expand All @@ -104,6 +105,7 @@ onBeforeMount(() => {
current-page-report-template="{first}-{last} of {totalRecords}"
:rows-per-page-options="[10, 20, 50]"
sort-field="fullName"
aria-label="File Permissions"
:sort-order="1"
>
<template #empty>
Expand All @@ -117,6 +119,7 @@ onBeforeMount(() => {
<Column
field="fullName"
header="Name"
aria-labelledby="upload_checkbox"
/>
<Column
field="idpName"
Expand Down Expand Up @@ -146,6 +149,7 @@ onBeforeMount(() => {
<Checkbox
v-model="data.update"
input-id="update"
aria-label="update"
:binary="true"
@update:model-value="(value: boolean) => updateObjectPermission(value, data.userId, Permissions.UPDATE)"
/>
Expand All @@ -160,6 +164,7 @@ onBeforeMount(() => {
<Checkbox
v-model="data.delete"
input-id="delete"
aria-label="delete"
:binary="true"
@update:model-value="(value: boolean) => updateObjectPermission(value, data.userId, Permissions.DELETE)"
/>
Expand All @@ -174,6 +179,7 @@ onBeforeMount(() => {
<Checkbox
v-model="data.manage"
input-id="manage"
aria-label="manage"
:binary="true"
@update:model-value="(value: boolean) => updateObjectPermission(value, data.userId, Permissions.MANAGE)"
/>
Expand All @@ -184,7 +190,9 @@ onBeforeMount(() => {
<Button
class="p-button-lg p-button-text"
severity="danger"
aria-label="remove"
@click="removeObjectUser(data.userId)"
@keyup.enter="removeObjectUser(data.userId)"
>
<font-awesome-icon icon="fa-solid fa-user-xmark" />
</Button>
Expand Down
1 change: 1 addition & 0 deletions frontend/src/components/object/ObjectPublicToggle.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ watch(props, () => {
<template>
<InputSwitch
v-model="isPublic"
aria-label="Toggle to make public"
:disabled="
!(
usePermissionStore().isUserElevatedRights() &&
Expand Down
27 changes: 24 additions & 3 deletions frontend/src/components/object/ObjectTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
} from '@/components/object';
import { SyncButton, ShareButton } from '@/components/common';
import { Button, Column, DataTable, Dialog, InputText, useToast } from '@/lib/primevue';
import { useAuthStore, useObjectStore, usePermissionStore } from '@/store';
import { useAuthStore, useObjectStore, useNavStore, usePermissionStore } from '@/store';
import { Permissions, RouteNames } from '@/utils/constants';
import { ButtonMode } from '@/utils/enums';
import { formatDateLong } from '@/utils/formatters';
Expand Down Expand Up @@ -50,6 +50,7 @@ const emit = defineEmits(['show-object-info']);
const objectStore = useObjectStore();
const permissionStore = usePermissionStore();
const { getUserId } = storeToRefs(useAuthStore());
const { focusedElement } = storeToRefs(useNavStore());
// State
const permissionsVisible = ref(false);
Expand Down Expand Up @@ -83,6 +84,7 @@ async function showPermissions(objectId: string) {
permissionsVisible.value = true;
permissionsObjectId.value = objectId;
permissionsObjectName.value = objectStore.getObject(objectId)?.name;
focusedElement.value = document.activeElement;
}
onMounted(() => {
Expand Down Expand Up @@ -176,6 +178,12 @@ const selectedFilters = (payload: any) => {
lazyParams.value.filters = filters;
loadLazyData();
};
const onDialogHide = () => {
focusedElement.value?.focus();
focusedElement.value = null;
permissionsVisible.value = false;
};
</script>

<template>
Expand Down Expand Up @@ -339,6 +347,7 @@ const selectedFilters = (payload: any) => {
v-if="
permissionStore.isObjectActionAllowed(data.id, getUserId, Permissions.MANAGE, props.bucketId as string)
"
id="file_permissions"
v-tooltip.bottom="'File permissions'"
class="p-button-lg p-button-text"
aria-label="File permissions"
Expand Down Expand Up @@ -376,21 +385,33 @@ const selectedFilters = (payload: any) => {

<!-- eslint-disable vue/no-v-model-argument -->
<Dialog
id="permissions_dialog"
v-model:visible="permissionsVisible"
:draggable="false"
:modal="true"
class="bcbox-info-dialog"
aria-labelledby="permissions_label"
aria-describedby="permissions_desc"
@after-hide="onDialogHide"
>
<!-- eslint-enable vue/no-v-model-argument -->
<template #header>
<font-awesome-icon
icon="fas fa-users"
fixed-width
/>
<span class="p-dialog-title">File Permissions</span>
<span
id="permissions_label"
class="p-dialog-title"
>
File Permissions
</span>
</template>

<h3 class="bcbox-info-dialog-subhead">
<h3
id="permissions_desc"
class="bcbox-info-dialog-subhead"
>
{{ permissionsObjectName }}
</h3>

Expand Down

0 comments on commit 2216b52

Please sign in to comment.