Browse Source

Merge pull request #3385 from nocodb/fix/gui-v2-url-update

refactor(gui-v2): replace with hash based url
pull/3387/head
աɨռɢӄաօռɢ 2 years ago committed by GitHub
parent
commit
e74d1604af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      packages/nc-gui-v2/components/smartsheet-toolbar/ShareView.vue
  2. 2
      packages/nc-gui-v2/components/smartsheet-toolbar/SharedViewList.vue
  3. 2
      packages/nc-gui-v2/components/tabs/auth/UserManagement.vue
  4. 2
      packages/nc-gui-v2/components/tabs/auth/user-management/ShareBase.vue
  5. 2
      packages/nc-gui-v2/components/tabs/auth/user-management/UsersModal.vue
  6. 3
      packages/nc-gui-v2/package-lock.json
  7. 10
      packages/nc-gui-v2/scripts/updateNuxtRouting.js
  8. 2
      packages/nocodb/src/lib/meta/api/projectUserApis.ts
  9. 2
      packages/nocodb/src/lib/v1-legacy/rest/RestAuthCtrl.ts

3
packages/nc-gui-v2/components/smartsheet-toolbar/ShareView.vue

@ -60,8 +60,7 @@ const sharedViewUrl = computed(() => {
viewType = 'view' viewType = 'view'
} }
// todo: get dashboard url return `${dashboardUrl?.value}#/nc/${viewType}/${shared.value.uuid}`
return `${dashboardUrl?.value}/nc/${viewType}/${shared.value.uuid}`
}) })
async function saveAllowCSVDownload() { async function saveAllowCSVDownload() {

2
packages/nc-gui-v2/components/smartsheet-toolbar/SharedViewList.vue

@ -103,7 +103,7 @@ const deleteLink = async (id: string) => {
<a-table-column key="title" :title="$t('labels.viewLink')" data-index="title"> <a-table-column key="title" :title="$t('labels.viewLink')" data-index="title">
<template #default="{ record }"> <template #default="{ record }">
<nuxt-link :to="sharedViewUrl(record)" class="text-xs"> <nuxt-link :to="sharedViewUrl(record)" class="text-xs">
{{ `${dashboardUrl}/${sharedViewUrl(record)}` }} {{ `${dashboardUrl}#${sharedViewUrl(record)}` }}
</nuxt-link> </nuxt-link>
</template> </template>
</a-table-column> </a-table-column>

2
packages/nc-gui-v2/components/tabs/auth/UserManagement.vue

@ -137,7 +137,7 @@ const resendInvite = async (user: User) => {
const copyInviteUrl = (user: User) => { const copyInviteUrl = (user: User) => {
if (!user.invite_token) return if (!user.invite_token) return
copy(`${dashboardUrl}/signup/${user.invite_token}`) copy(`${dashboardUrl}#/signup/${user.invite_token}`)
message.success('Invite url copied to clipboard') message.success('Invite url copied to clipboard')
} }

2
packages/nc-gui-v2/components/tabs/auth/user-management/ShareBase.vue

@ -26,7 +26,7 @@ const { project } = useProject()
const { copy } = useClipboard() const { copy } = useClipboard()
const url = $computed(() => (base && base.uuid ? `${dashboardUrl}/base/${base.uuid}` : null)) const url = $computed(() => (base && base.uuid ? `${dashboardUrl}#/base/${base.uuid}` : null))
const loadBase = async () => { const loadBase = async () => {
try { try {

2
packages/nc-gui-v2/components/tabs/auth/user-management/UsersModal.vue

@ -103,7 +103,7 @@ const saveUser = async () => {
} }
} }
const inviteUrl = $computed(() => (usersData.invitationToken ? `${dashboardUrl}/signup/${usersData.invitationToken}` : null)) const inviteUrl = $computed(() => (usersData.invitationToken ? `${dashboardUrl}#/signup/${usersData.invitationToken}` : null))
const copyUrl = async () => { const copyUrl = async () => {
if (!inviteUrl) return if (!inviteUrl) return

3
packages/nc-gui-v2/package-lock.json generated

@ -78,6 +78,7 @@
}, },
"../nocodb-sdk": { "../nocodb-sdk": {
"version": "0.92.4", "version": "0.92.4",
"hasInstallScript": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"axios": "^0.21.1", "axios": "^0.21.1",
@ -104,6 +105,7 @@
"open-cli": "^6.0.1", "open-cli": "^6.0.1",
"prettier": "^2.1.1", "prettier": "^2.1.1",
"standard-version": "^9.0.0", "standard-version": "^9.0.0",
"swagger-typescript-api": "^10.0.1",
"ts-node": "^9.0.0", "ts-node": "^9.0.0",
"typedoc": "^0.22.17", "typedoc": "^0.22.17",
"typescript": "^4.0.2" "typescript": "^4.0.2"
@ -22961,6 +22963,7 @@
"open-cli": "^6.0.1", "open-cli": "^6.0.1",
"prettier": "^2.1.1", "prettier": "^2.1.1",
"standard-version": "^9.0.0", "standard-version": "^9.0.0",
"swagger-typescript-api": "^10.0.1",
"ts-node": "^9.0.0", "ts-node": "^9.0.0",
"typedoc": "^0.22.17", "typedoc": "^0.22.17",
"typescript": "^4.0.2" "typescript": "^4.0.2"

10
packages/nc-gui-v2/scripts/updateNuxtRouting.js

@ -11,10 +11,16 @@ const filePath = path.join(__dirname, '..', 'node_modules', 'nuxt', 'dist', 'pag
const content = fs.readFileSync(filePath, 'utf8') const content = fs.readFileSync(filePath, 'utf8')
/** Replace `createWebHistory` with `createWebHashHistory` */ /** Replace `createWebHistory` with `createWebHashHistory` */
const updatedContent = content.replace( const updatedContent = content
.replace(
/createRouter(\s*,\s*)createWebHistory(\s*,\s*)createMemoryHistory/, /createRouter(\s*,\s*)createWebHistory(\s*,\s*)createMemoryHistory/,
`createRouter$1createWebHashHistory as createWebHistory$2createMemoryHistory`, `createRouter$1createWebHashHistory as createWebHistory$2createMemoryHistory`,
) )
/** Replace initial Handle initial routing based on hash path */
.replace(
`const { pathname, search, hash } = location;`,
`const { pathname, search, hash } = new URL((location.hash || '').replace(/^#/, ''), location.origin);`,
)
/** Update file content with updated code */ /** Update file content with updated code */
fs.writeFileSync(filePath, updatedContent, 'utf8') fs.writeFileSync(filePath, updatedContent, 'utf8')

2
packages/nocodb/src/lib/meta/api/projectUserApis.ts

@ -285,7 +285,7 @@ async function sendInviteEmail(
html: ejs.render(template, { html: ejs.render(template, {
signupLink: `${req.ncSiteUrl}${ signupLink: `${req.ncSiteUrl}${
Noco.getConfig()?.dashboardPath Noco.getConfig()?.dashboardPath
}#/user/authentication/signup/${token}`, }#/signup/${token}`,
projectName: req.body?.projectName, projectName: req.body?.projectName,
roles: (req.body?.roles || '') roles: (req.body?.roles || '')
.split(',') .split(',')

2
packages/nocodb/src/lib/v1-legacy/rest/RestAuthCtrl.ts

@ -1497,7 +1497,7 @@ export default class RestAuthCtrl {
to: email, to: email,
subject: 'Verify email', subject: 'Verify email',
html: ejs.render(template, { html: ejs.render(template, {
signupLink: `${req.ncSiteUrl}${this.config?.dashboardPath}#/user/authentication/signup/${token}`, signupLink: `${req.ncSiteUrl}${this.config?.dashboardPath}#/signup/${token}`,
projectName: req.body?.projectName, projectName: req.body?.projectName,
roles: (req.body?.roles || '') roles: (req.body?.roles || '')
.split(',') .split(',')

Loading…
Cancel
Save