Browse Source

chore/Added Pr suggestions and removed isShareView page meta

pull/3197/head
Muhammed Mustafa 2 years ago
parent
commit
0df3d84a0e
  1. 3
      packages/nc-gui-v2/components/cell/Checkbox.vue
  2. 11
      packages/nc-gui-v2/composables/useViewColumns.ts
  3. 2
      packages/nc-gui-v2/middleware/auth.global.ts
  4. 3
      packages/nc-gui-v2/pages/[projectType]/view/[viewId].vue

3
packages/nc-gui-v2/components/cell/Checkbox.vue

@ -1,6 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { ColumnInj, IsFormInj, getMdiIcon, inject } from '#imports' import { ColumnInj, IsFormInj, ReadonlyInj, getMdiIcon, inject } from '#imports'
import { ReadonlyInj } from '~/context'
interface Props { interface Props {
modelValue?: boolean | undefined | number modelValue?: boolean | undefined | number

11
packages/nc-gui-v2/composables/useViewColumns.ts

@ -121,16 +121,17 @@ export function useViewColumns(view: Ref<ViewType> | undefined, meta: ComputedRe
reloadData?.() reloadData?.()
} }
const metaColumnById = computed<Record<string, ColumnType>>( const metaColumnById = computed<Record<string, ColumnType>>(() => {
() => if (!meta.value?.columns) return {}
meta.value?.columns?.reduce(
return meta.value?.columns?.reduce(
(acc: ColumnType, curr: ColumnType) => ({ (acc: ColumnType, curr: ColumnType) => ({
...acc, ...acc,
[curr.id!]: curr, [curr.id!]: curr,
}), }),
{}, {} as any,
) || {},
) )
})
const showSystemFields = computed({ const showSystemFields = computed({
get() { get() {

2
packages/nc-gui-v2/middleware/auth.global.ts

@ -26,7 +26,7 @@ export default defineNuxtRouteMiddleware((to, from) => {
/** if shred base allow without validating */ /** if shred base allow without validating */
if (to.params?.projectType === 'base') return if (to.params?.projectType === 'base') return
if (to.meta.isSharedView) return if (to.meta.public) return
/** if auth is required or unspecified (same as required) and user is not signed in, redirect to signin page */ /** if auth is required or unspecified (same as required) and user is not signed in, redirect to signin page */
if ((to.meta.requiresAuth || typeof to.meta.requiresAuth === 'undefined') && !state.signedIn.value) { if ((to.meta.requiresAuth || typeof to.meta.requiresAuth === 'undefined') && !state.signedIn.value) {

3
packages/nc-gui-v2/pages/[projectType]/view/[viewId].vue

@ -5,18 +5,17 @@ import {
ReloadViewDataHookInj, ReloadViewDataHookInj,
createEventHook, createEventHook,
definePageMeta, definePageMeta,
extractSdkResponseErrorMsg,
provide, provide,
ref, ref,
useRoute, useRoute,
useSharedView, useSharedView,
} from '#imports' } from '#imports'
import { extractSdkResponseErrorMsg } from '~/utils'
definePageMeta({ definePageMeta({
public: true, public: true,
requiresAuth: false, requiresAuth: false,
layout: 'shared-view', layout: 'shared-view',
isSharedView: true,
}) })
const route = useRoute() const route = useRoute()

Loading…
Cancel
Save