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. 21
      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">
import { ColumnInj, IsFormInj, getMdiIcon, inject } from '#imports'
import { ReadonlyInj } from '~/context'
import { ColumnInj, IsFormInj, ReadonlyInj, getMdiIcon, inject } from '#imports'
interface Props {
modelValue?: boolean | undefined | number

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

@ -121,16 +121,17 @@ export function useViewColumns(view: Ref<ViewType> | undefined, meta: ComputedRe
reloadData?.()
}
const metaColumnById = computed<Record<string, ColumnType>>(
() =>
meta.value?.columns?.reduce(
(acc: ColumnType, curr: ColumnType) => ({
...acc,
[curr.id!]: curr,
}),
{},
) || {},
)
const metaColumnById = computed<Record<string, ColumnType>>(() => {
if (!meta.value?.columns) return {}
return meta.value?.columns?.reduce(
(acc: ColumnType, curr: ColumnType) => ({
...acc,
[curr.id!]: curr,
}),
{} as any,
)
})
const showSystemFields = computed({
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 (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 ((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,
createEventHook,
definePageMeta,
extractSdkResponseErrorMsg,
provide,
ref,
useRoute,
useSharedView,
} from '#imports'
import { extractSdkResponseErrorMsg } from '~/utils'
definePageMeta({
public: true,
requiresAuth: false,
layout: 'shared-view',
isSharedView: true,
})
const route = useRoute()

Loading…
Cancel
Save