Browse Source

fix: shared url and dashboard url corrections (#9999)

pull/10000/head
Pranav C 3 days ago committed by GitHub
parent
commit
6f4d753299
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 14
      packages/nc-gui/components/dlg/share-and-collaborate/ShareBase.vue
  2. 12
      packages/nc-gui/components/dlg/share-and-collaborate/SharePage.vue
  3. 10
      packages/nocodb/src/run/cloud.ts

14
packages/nc-gui/components/dlg/share-and-collaborate/ShareBase.vue

@ -18,22 +18,12 @@ const sharedBase = ref<null | ShareBase>(null)
const { base } = storeToRefs(useBase())
const { getBaseUrl, appInfo } = useGlobal()
const workspaceStore = useWorkspace()
const { appInfo } = useGlobal()
const url = computed(() => {
if (!sharedBase.value || !sharedBase.value.uuid) return ''
// get base url for workspace
const baseUrl = getBaseUrl(workspaceStore.activeWorkspaceId)
let dashboardUrl1 = dashboardUrl.value
if (baseUrl) {
dashboardUrl1 = `${baseUrl}${appInfo.value?.dashboardPath}`
}
return encodeURI(`${dashboardUrl1}#/base/${sharedBase.value.uuid}`)
return encodeURI(`${dashboardUrl.value}#/base/${sharedBase.value.uuid}`)
})
const loadBase = async () => {

12
packages/nc-gui/components/dlg/share-and-collaborate/SharePage.vue

@ -4,7 +4,7 @@ import { ViewTypes } from 'nocodb-sdk'
const { view: _view, $api } = useSmartsheetStoreOrThrow()
const { $e } = useNuxtApp()
const { getBaseUrl, appInfo } = useGlobal()
const { appInfo } = useGlobal()
const { dashboardUrl } = useDashboard()
@ -203,15 +203,7 @@ function sharedViewUrl() {
viewType = 'view'
}
// get base url for workspace
const baseUrl = getBaseUrl(workspaceStore.activeWorkspaceId)
let dashboardUrl1 = dashboardUrl.value
if (baseUrl) {
dashboardUrl1 = `${baseUrl}${appInfo.value?.dashboardPath}`
}
return `${encodeURI(`${dashboardUrl1}#/nc/${viewType}/${activeView.value.uuid}${surveyMode.value ? '/survey' : ''}`)}${
return `${encodeURI(`${dashboardUrl.value}#/nc/${viewType}/${activeView.value.uuid}${surveyMode.value ? '/survey' : ''}`)}${
viewStore.preFillFormSearchParams && formPreFill.value.preFillEnabled ? `?${viewStore.preFillFormSearchParams}` : ''
}`
}

10
packages/nocodb/src/run/cloud.ts

@ -15,6 +15,16 @@ server.use(
process.env.NC_DASHBOARD_URL ?? '/dashboard',
express.static(path.join(__dirname, 'nc-gui')),
);
// if NC_DASHBOARD_URL is not set to /dashboard, then redirect '/dashboard'
// to the path set in NC_DASHBOARD_URL
if (!/^\/?dashboard\/?$/.test(process.env.NC_DASHBOARD_URL)) {
server.use('/dashboard', (_, res) => {
// redirect to NC_DASHBOARD_URL path
res.redirect(process.env.NC_DASHBOARD_URL);
});
}
server.set('view engine', 'ejs');
(async () => {

Loading…
Cancel
Save