Browse Source

Nc staing/issues (#8681)

* fix: disable calendar for mobile view fix: disable loading state for notifications polling

* fix: unwanted mutation

---------

Co-authored-by: DarkPhoenix2704 <anbarasun123@gmail.com>
pull/8597/merge
Raju Udava 4 weeks ago committed by GitHub
parent
commit
e3aeae43f5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      packages/nc-gui/components/smartsheet/Gallery.vue
  2. 2
      packages/nc-gui/components/smartsheet/Kanban.vue
  3. 4
      packages/nc-gui/components/smartsheet/Map.vue
  4. 2
      packages/nc-gui/components/smartsheet/Toolbar.vue
  5. 21
      packages/nc-gui/components/smartsheet/calendar/index.vue
  6. 2
      packages/nc-gui/components/smartsheet/grid/index.vue
  7. 8
      packages/nc-gui/composables/useApi/index.ts
  8. 3
      packages/nc-gui/composables/useViewData.ts
  9. 1
      packages/nc-gui/lang/en.json

2
packages/nc-gui/components/smartsheet/Gallery.vue

@ -102,7 +102,6 @@ const attachments = (record: any): Attachment[] => {
const expandForm = (row: RowType, state?: Record<string, any>) => { const expandForm = (row: RowType, state?: Record<string, any>) => {
const rowId = extractPkFromRow(row.row, meta.value!.columns!) const rowId = extractPkFromRow(row.row, meta.value!.columns!)
expandedFormRow.value = row
expandedFormRowState.value = state expandedFormRowState.value = state
if (rowId && !isPublic.value) { if (rowId && !isPublic.value) {
@ -113,6 +112,7 @@ const expandForm = (row: RowType, state?: Record<string, any>) => {
}, },
}) })
} else { } else {
expandedFormRow.value = row
expandedFormDlg.value = true expandedFormDlg.value = true
} }
} }

2
packages/nc-gui/components/smartsheet/Kanban.vue

@ -139,7 +139,6 @@ reloadViewMetaHook?.on(async () => {
const expandForm = (row: RowType, state?: Record<string, any>) => { const expandForm = (row: RowType, state?: Record<string, any>) => {
const rowId = extractPkFromRow(row.row, meta.value!.columns!) const rowId = extractPkFromRow(row.row, meta.value!.columns!)
expandedFormRow.value = row
expandedFormRowState.value = state expandedFormRowState.value = state
if (rowId && !isPublic.value) { if (rowId && !isPublic.value) {
router.push({ router.push({
@ -149,6 +148,7 @@ const expandForm = (row: RowType, state?: Record<string, any>) => {
}, },
}) })
} else { } else {
expandedFormRow.value = row
expandedFormDlg.value = true expandedFormDlg.value = true
} }
} }

4
packages/nc-gui/components/smartsheet/Map.vue

@ -51,9 +51,8 @@ const getMapCenterLocalStorageKey = (viewId: string) => `mapView.${viewId}.cente
const expandForm = (row: Row, state?: Record<string, any>) => { const expandForm = (row: Row, state?: Record<string, any>) => {
const rowId = extractPkFromRow(row.row, meta.value!.columns!) const rowId = extractPkFromRow(row.row, meta.value!.columns!)
expandedFormRow.value = row
if (rowId) { if (rowId && !isPublic.value) {
router.push({ router.push({
query: { query: {
...route.query, ...route.query,
@ -61,6 +60,7 @@ const expandForm = (row: Row, state?: Record<string, any>) => {
}, },
}) })
} else { } else {
expandedFormRow.value = row
expandedFormRowState.value = state expandedFormRowState.value = state
expandedFormDlg.value = true expandedFormDlg.value = true
} }

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

@ -18,7 +18,7 @@ const isTab = computed(() => {
<template> <template>
<div <div
v-if="!isMobileMode || isCalendar" v-if="!isMobileMode"
ref="containerRef" ref="containerRef"
:class="{ :class="{
'px-4': isMobileMode, 'px-4': isMobileMode,

21
packages/nc-gui/components/smartsheet/calendar/index.vue

@ -8,6 +8,8 @@ const meta = inject(MetaInj, ref())
const view = inject(ActiveViewInj, ref()) const view = inject(ActiveViewInj, ref())
const { isMobileMode } = useGlobal()
const reloadViewMetaHook = inject(ReloadViewMetaHookInj) const reloadViewMetaHook = inject(ReloadViewMetaHookInj)
const reloadViewDataHook = inject(ReloadViewDataHookInj) const reloadViewDataHook = inject(ReloadViewDataHookInj)
@ -66,7 +68,6 @@ const expandedFormRowState = ref<Record<string, any>>()
const expandRecord = (row: RowType, state?: Record<string, any>) => { const expandRecord = (row: RowType, state?: Record<string, any>) => {
const rowId = extractPkFromRow(row.row, meta.value!.columns!) const rowId = extractPkFromRow(row.row, meta.value!.columns!)
expandedFormRow.value = row
expandedFormRowState.value = state expandedFormRowState.value = state
if (rowId && !isPublic.value) { if (rowId && !isPublic.value) {
@ -77,6 +78,7 @@ const expandRecord = (row: RowType, state?: Record<string, any>) => {
}, },
}) })
} else { } else {
expandedFormRow.value = row
expandedFormDlg.value = true expandedFormDlg.value = true
} }
} }
@ -118,6 +120,17 @@ reloadViewDataHook?.on(async (params: void | { shouldShowLoading?: boolean }) =>
</script> </script>
<template> <template>
<template v-if="isMobileMode">
<div class="pl-6 pr-[120px] py-6 bg-white flex-col justify-start items-start gap-2.5 inline-flex">
<div class="text-gray-500 text-5xl font-semibold leading-16">
{{ $t('general.available') }}<br />{{ $t('title.inDesktop') }}
</div>
<div class="text-gray-500 text-base font-medium leading-normal">
{{ $t('msg.calendarViewNotSupportedOnMobile') }}
</div>
</div>
</template>
<template v-else>
<div class="flex h-full relative flex-row" data-testid="nc-calendar-wrapper"> <div class="flex h-full relative flex-row" data-testid="nc-calendar-wrapper">
<div class="flex flex-col w-full"> <div class="flex flex-col w-full">
<template v-if="calendarRange?.length && !isCalendarMetaLoading"> <template v-if="calendarRange?.length && !isCalendarMetaLoading">
@ -150,7 +163,10 @@ reloadViewDataHook?.on(async (params: void | { shouldShowLoading?: boolean }) =>
/> />
</template> </template>
<div v-if="isCalendarDataLoading && activeCalendarView !== 'year'" class="flex w-full items-center h-full justify-center"> <div
v-if="isCalendarDataLoading && activeCalendarView !== 'year'"
class="flex w-full items-center h-full justify-center"
>
<GeneralLoader size="xlarge" /> <GeneralLoader size="xlarge" />
</div> </div>
</template> </template>
@ -197,3 +213,4 @@ reloadViewDataHook?.on(async (params: void | { shouldShowLoading?: boolean }) =>
:view="view" :view="view"
/> />
</template> </template>
</template>

2
packages/nc-gui/components/smartsheet/grid/index.vue

@ -88,7 +88,6 @@ const skipRowRemovalOnCancel = ref(false)
function expandForm(row: Row, state?: Record<string, any>, fromToolbar = false) { function expandForm(row: Row, state?: Record<string, any>, fromToolbar = false) {
const rowId = extractPkFromRow(row.row, meta.value?.columns as ColumnType[]) const rowId = extractPkFromRow(row.row, meta.value?.columns as ColumnType[])
expandedFormRow.value = row
expandedFormRowState.value = state expandedFormRowState.value = state
if (rowId && !isPublic.value) { if (rowId && !isPublic.value) {
router.push({ router.push({
@ -98,6 +97,7 @@ function expandForm(row: Row, state?: Record<string, any>, fromToolbar = false)
}, },
}) })
} else { } else {
expandedFormRow.value = row
expandedFormDlg.value = true expandedFormDlg.value = true
skipRowRemovalOnCancel.value = !fromToolbar skipRowRemovalOnCancel.value = !fromToolbar
} }

8
packages/nc-gui/composables/useApi/index.ts

@ -61,7 +61,10 @@ export function useApi<Data = any, RequestConfig = any>({
const api = useGlobalInstance && !!nuxtApp.$api ? nuxtApp.$api : createApiInstance(apiOptions) const api = useGlobalInstance && !!nuxtApp.$api ? nuxtApp.$api : createApiInstance(apiOptions)
/** set loading to true and increment local and global request counter */ /** set loading to true and increment local and global request counter */
function onRequestStart() { // Long Polling causes the loading spinner to never stop
// hence we are excluding the polling request from the loading spinner
function onRequestStart(config) {
if (config.url !== '/api/v1/notifications/poll') {
isLoading.value = true isLoading.value = true
/** local count */ /** local count */
@ -70,6 +73,7 @@ export function useApi<Data = any, RequestConfig = any>({
/** global count */ /** global count */
nuxtApp.$state.runningRequests.inc() nuxtApp.$state.runningRequests.inc()
} }
}
/** decrement local and global request counter and check if we can stop loading */ /** decrement local and global request counter and check if we can stop loading */
function onRequestFinish() { function onRequestFinish() {
@ -99,7 +103,7 @@ export function useApi<Data = any, RequestConfig = any>({
(config) => { (config) => {
reset() reset()
onRequestStart() onRequestStart(config)
return { return {
...config, ...config,

3
packages/nc-gui/composables/useViewData.ts

@ -347,9 +347,8 @@ export function useViewData(
// extract the row id of the sibling row // extract the row id of the sibling row
const rowId = extractPkFromRow(formattedData.value[siblingRowIndex].row, meta.value?.columns as ColumnType[]) const rowId = extractPkFromRow(formattedData.value[siblingRowIndex].row, meta.value?.columns as ColumnType[])
if (rowId) { if (rowId) {
router.push({ await router.push({
query: { query: {
...routeQuery.value, ...routeQuery.value,
rowId, rowId,

1
packages/nc-gui/lang/en.json

@ -1133,6 +1133,7 @@
"thisSharedViewIsProtected": "This shared view is protected", "thisSharedViewIsProtected": "This shared view is protected",
"successfullySubmittedFormData": "Successfully submitted form data", "successfullySubmittedFormData": "Successfully submitted form data",
"formViewNotSupportedOnMobile": "Form view is not supported on mobile", "formViewNotSupportedOnMobile": "Form view is not supported on mobile",
"calendarViewNotSupportedOnMobile": "Calendar view is not supported on mobile",
"newFormWillBeLoaded": "New form will be loaded after {seconds} seconds", "newFormWillBeLoaded": "New form will be loaded after {seconds} seconds",
"optimizedQueryDisabled": "Optimized query is disabled", "optimizedQueryDisabled": "Optimized query is disabled",
"optimizedQueryEnabled": "Optimized query is enabled", "optimizedQueryEnabled": "Optimized query is enabled",

Loading…
Cancel
Save