Skip to content

Commit

Permalink
Fetch object permissions in lazy-load of object table
Browse files Browse the repository at this point in the history
  • Loading branch information
TimCsaky committed Feb 14, 2024
1 parent d2a260d commit e902525
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
19 changes: 13 additions & 6 deletions frontend/src/components/object/ObjectTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,6 @@ const filters = ref({
meta: { value: undefined, matchMode: 'contains' }
});
const loading = ref(false);
const lazyParams: Ref<DataTableObjectSource> = ref({});
const totalRecords = ref(0);
const first = ref(0);
const selectedObjects: any = ref();
// Actions
const toast = useToast();
const formatShortUuid = (uuid: string) => uuid?.slice(0, 8) ?? uuid;
Expand Down Expand Up @@ -134,6 +128,19 @@ const loadLazyData = (event?: any) => {
tableData.value = r.data;
totalRecords.value = +r?.headers['x-total-rows'];
loading.value = false;
// add to object store
r.data.forEach((o: COMSObject) => {
console.log(o);
objectStore.$patch((state) => {
state.objects.push(o);
});
});
return r.data;
})
// add objects' permissions to store
.then((objects: Array<COMSObjectDataSource>) => {
permissionStore.fetchObjectPermissions({ objectId: objects.map((o: COMSObject) => o.id) });
});
};
const onPage = (event?: any) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export type ObjectSearchPermissionsOptions = {
bucketId?: string;
bucketPerms?: boolean;
objectId?: string;
objectId?: string | Array<string>;
permCode?: string;
userId?: string;
};

0 comments on commit e902525

Please sign in to comment.