Browse Source

fix: Added feature flag for create view btn

pull/6802/head
Muhammed Mustafa 9 months ago
parent
commit
74ed70dc2a
  1. 5
      packages/nc-gui/components/dashboard/TreeView/TableNode.vue
  2. 4
      packages/nc-gui/components/dashboard/TreeView/ViewsList.vue
  3. 12
      packages/nc-gui/components/smartsheet/Toolbar.vue
  4. 4
      packages/nc-gui/store/config.ts

5
packages/nc-gui/components/dashboard/TreeView/TableNode.vue

@ -51,6 +51,7 @@ const { setMenuContext, openRenameTableDialog, duplicateTable } = inject(TreeVie
const { loadViews: _loadViews } = useViewsStore()
const { activeView } = storeToRefs(useViewsStore())
const { isLeftSidebarOpen } = storeToRefs(useSidebarStore())
const { showCreateViewAllTimes } = storeToRefs(useConfigStore())
const { viewsByTable } = storeToRefs(useViewsStore())
@ -122,7 +123,7 @@ const onOpenTable = async () => {
isLeftSidebarOpen.value = false
}
emit('openTable', true)
if (!showCreateViewAllTimes.value) emit('openTable', true)
} catch (e) {
message.error(await extractSdkResponseErrorMsg(e))
} finally {
@ -150,6 +151,8 @@ const isTableOpened = computed(() => {
})
watch(activeTableId, () => {
if (showCreateViewAllTimes.value) return
if (activeTableId.value !== table.value.id && views.value.length === 0) {
isExpanded.value = false
}

4
packages/nc-gui/components/dashboard/TreeView/ViewsList.vue

@ -33,6 +33,8 @@ const table = inject(SidebarTableInj)!
const { isLeftSidebarOpen } = storeToRefs(useSidebarStore())
const { showCreateViewAllTimes } = storeToRefs(useConfigStore())
const { activeTableId } = storeToRefs(useTablesStore())
const { isUIAllowed } = useRoles()
@ -387,7 +389,7 @@ function onOpenModal({
<DashboardTreeViewCreateViewBtn
v-if="isUIAllowed('viewCreateOrEdit')"
:class="{
'hidden': activeTableId !== table.id && views.length,
'hidden': activeTableId !== table.id && views.length && !showCreateViewAllTimes,
'!ml-18 !xs:(ml-19.75)': isDefaultSource,
'!ml-23.5 !xs:(ml-27)': !isDefaultSource,
}"

12
packages/nc-gui/components/smartsheet/Toolbar.vue

@ -7,11 +7,21 @@ const isPublic = inject(IsPublicInj, ref(false))
const { isViewsLoading } = storeToRefs(useViewsStore())
const { showCreateViewAllTimes } = storeToRefs(useConfigStore())
const { isMobileMode } = useGlobal()
const { isUIAllowed } = useRoles()
const { allowCSVDownload } = useSharedView()
const toggleCreateViewAllTimes = () => {
showCreateViewAllTimes.value = !showCreateViewAllTimes.value
message.info({
content: showCreateViewAllTimes.value ? 'Create View All Times' : 'Create View Once',
})
}
</script>
<template>
@ -44,6 +54,8 @@ const { allowCSVDownload } = useSharedView()
<div class="flex-1" />
</template>
<div class="h-6 w-6 xs:hidden" @dblclick="toggleCreateViewAllTimes"></div>
<LazySmartsheetToolbarSearchData
v-if="(isGrid || isGallery || isKanban) && !isPublic"
:class="{

4
packages/nc-gui/store/config.ts

@ -21,6 +21,9 @@ export const useConfigStore = defineStore('configStore', () => {
isMobileMode.value = isViewPortMobile()
}
// Feature flag for create view all times
const showCreateViewAllTimes = ref(false)
window.addEventListener('DOMContentLoaded', onViewPortResize)
window.addEventListener('resize', onViewPortResize)
@ -67,6 +70,7 @@ export const useConfigStore = defineStore('configStore', () => {
isViewPortMobile,
handleSidebarOpenOnMobileForNonViews,
projectPageTab,
showCreateViewAllTimes,
}
})

Loading…
Cancel
Save