Browse Source

fix/Fixed redirection issues and added project title

pull/3197/head
Muhammed Mustafa 2 years ago
parent
commit
c10484f073
  1. 10
      packages/nc-gui-v2/app.vue
  2. 15
      packages/nc-gui-v2/layouts/shared-view.vue
  3. 2
      packages/nc-gui-v2/middleware/auth.global.ts
  4. 1
      packages/nc-gui-v2/pages/[projectType]/view/[viewId].vue

10
packages/nc-gui-v2/app.vue

@ -1,5 +1,13 @@
<script setup lang="ts">
const route = useRoute()
const disableBaseLayout = $computed(() => {
return route.path.startsWith('/nc/view') || route.path.startsWith('/nc/form')
})
</script>
<template>
<NuxtLayout name="base">
<NuxtLayout :name="disableBaseLayout ? false : 'base'">
<NuxtPage />
</NuxtLayout>
</template>

15
packages/nc-gui-v2/layouts/shared-view.vue

@ -1,5 +1,7 @@
<script lang="ts" setup>
import { navigateTo } from '#app'
const { isLoading } = useGlobal()
const { sharedView } = useSharedView()
</script>
<script lang="ts">
@ -15,7 +17,20 @@ export default {
<div class="transition-all duration-200 p-2 cursor-pointer transform hover:scale-105" @click="navigateTo('/')">
<img width="35" alt="NocoDB" src="~/assets/img/icons/512x512-trans.png" />
</div>
<div>
<div class="flex justify-center items-center">
<div class="flex items-center gap-2 ml-3">
<template v-if="isLoading">
{{ $t('general.loading') }}
<MdiReload :class="{ 'animate-infinite animate-spin': isLoading }" />
</template>
<div v-else class="text-xl font-semibold truncate">
{{ sharedView.title }}
</div>
</div>
</div>
</div>
<div class="flex-1" />
</a-layout-header>

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

@ -26,6 +26,8 @@ export default defineNuxtRouteMiddleware((to, from) => {
/** if shred base allow without validating */
if (to.params?.projectType === 'base') return
if (to.meta.isSharedView) 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) {
return navigateTo('/signin')

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

@ -14,6 +14,7 @@ definePageMeta({
public: true,
requiresAuth: false,
layout: 'shared-view',
isSharedView: true,
})
const route = useRoute()

Loading…
Cancel
Save