Browse Source

fix(gui-v2): sort for share base

pull/3234/head
Wing-Kam Wong 2 years ago
parent
commit
ec25499f7c
  1. 14
      packages/nc-gui-v2/composables/useViewSorts.ts

14
packages/nc-gui-v2/composables/useViewSorts.ts

@ -7,11 +7,15 @@ export function useViewSorts(
reloadData?: () => void,
) {
const _sorts = ref<SortType[]>([])
const { sorts: sharedViewSorts, sharedView } = useSharedView()
const reloadHook = inject(ReloadViewDataHookInj)
const isPublic = inject(IsPublicInj, ref(false))
const { isSharedBase } = useProject()
const sorts = computed<SortType[]>({
get: () => (isPublic.value ? sharedViewSorts.value : _sorts.value),
set: (value) => {
@ -39,9 +43,8 @@ export function useViewSorts(
}
const saveOrUpdate = async (sort: SortType, i: number) => {
// TODO:
// if (!this.shared && this._isUIAllowed('sortSync')) {
if (isPublic.value) {
if (isPublic.value || isSharedBase) {
// FIXME: not working for isSharedBase case
sorts.value[i] = sort
sorts.value = [...sorts.value]
return
@ -66,10 +69,7 @@ export function useViewSorts(
}
const deleteSort = async (sort: SortType, i: number) => {
// TOOD:
// if (!this.shared && sort.id && this._isUIAllowed('sortSync')) {
if (isUIAllowed('sortSync') && sort.id && !isPublic.value) {
if (isUIAllowed('sortSync') && sort.id && !isPublic.value && !isSharedBase) {
await $api.dbTableSort.delete(sort.id)
}
sorts.value.splice(i, 1)

Loading…
Cancel
Save