Browse Source

fix: test errors

Signed-off-by: mertmit <mertmit99@gmail.com>
pull/6307/head
mertmit 1 year ago
parent
commit
eb60a02535
  1. 17
      packages/nc-gui/components/dashboard/Sidebar/UserInfo.vue
  2. 3
      packages/nc-gui/components/workspace/CreateProjectDlg.vue
  3. 4
      packages/nc-gui/composables/useGlobal/state.ts
  4. 2
      packages/nc-gui/package-lock.json
  5. 2
      packages/nc-gui/package.json
  6. 13
      packages/nc-gui/pages/index.vue
  7. 1
      packages/nc-gui/store/projects.ts
  8. 7
      packages/nc-gui/store/workspace.ts
  9. 32
      packages/nocodb/package-lock.json
  10. 2
      tests/playwright/pages/Dashboard/Sidebar/UserMenu/index.ts
  11. 1
      tests/playwright/pages/Dashboard/index.ts

17
packages/nc-gui/components/dashboard/Sidebar/UserInfo.vue

@ -1,5 +1,6 @@
<script lang="ts" setup>
import GithubButton from 'vue-github-button'
const { user, signOut, token, appInfo } = useGlobal()
const { clearWorkspaces } = useWorkspace()
@ -52,12 +53,22 @@ watch(leftSidebarState, () => {
isMenuOpen.value = false
}
})
// This is a hack to prevent github button error (prevents navigateTo if user is not signed in)
const isMounted = ref(false)
onMounted(() => {
isMounted.value = true
})
</script>
<template>
<div class="nc-sidebar-userinfo flex w-full flex-col p-1 border-t-1 border-gray-200 gap-y-2">
<div class="flex w-full flex-col p-1 border-t-1 border-gray-200 gap-y-2">
<NcDropdown v-model:visible="isMenuOpen" placement="topLeft" overlay-class-name="!min-w-64">
<div class="flex flex-row py-2 px-3 gap-x-2 items-center hover:bg-gray-200 rounded-lg cursor-pointer h-10">
<div
class="flex flex-row py-2 px-3 gap-x-2 items-center hover:bg-gray-200 rounded-lg cursor-pointer h-10"
data-testid="nc-sidebar-userinfo"
>
<GeneralUserIcon />
<div class="flex truncate">
{{ name ? name : user?.email }}
@ -130,7 +141,7 @@ watch(leftSidebarState, () => {
</NcDropdown>
<div v-if="appInfo.ee" class="text-gray-500 text-xs pl-3">© 2023 NocoDB. Inc</div>
<div v-else class="flex flex-col gap-y-1 pt-1">
<div v-else-if="isMounted" class="flex flex-col gap-y-1 pt-1">
<div class="flex items-start flex-row justify-center px-2 gap-2">
<GithubButton href="https://github.com/nocodb/nocodb" data-icon="octicon-star" data-show-count="true" data-size="large">
Star

3
packages/nc-gui/components/workspace/CreateProjectDlg.vue

@ -81,9 +81,8 @@ watch(dialogShow, async (n, o) => {
const typeLabel = computed(() => {
switch (props.type) {
case NcProjectType.DB:
return 'Database'
default:
return ''
return 'Database'
}
})
</script>

4
packages/nc-gui/composables/useGlobal/state.ts

@ -78,7 +78,9 @@ export function useGlobalState(storageKey = 'nocodb-gui-v2'): State {
/** current token ref, used by `useJwt` to reactively parse our token payload */
const token = computed({
get: () => storage.value.token || '',
set: (val) => (storage.value.token = val),
set: (val) => {
storage.value.token = val
},
})
const config = useRuntimeConfig()

2
packages/nc-gui/package-lock.json generated

@ -54,7 +54,7 @@
"vue-barcode-reader": "^1.0.3",
"vue-chartjs": "^5.2.0",
"vue-dompurify-html": "^3.0.0",
"vue-github-button": "^3.0.3",
"vue-github-button": "^3.1.0",
"vue-i18n": "^9.2.2",
"vue-qrcode-reader": "3.1.0-vue3-compatibility.2",
"vue3-calendar-heatmap": "^2.0.0",

2
packages/nc-gui/package.json

@ -77,7 +77,7 @@
"vue-barcode-reader": "^1.0.3",
"vue-chartjs": "^5.2.0",
"vue-dompurify-html": "^3.0.0",
"vue-github-button": "^3.0.3",
"vue-github-button": "^3.1.0",
"vue-i18n": "^9.2.2",
"vue-qrcode-reader": "3.1.0-vue3-compatibility.2",
"vue3-calendar-heatmap": "^2.0.0",

13
packages/nc-gui/pages/index.vue

@ -16,6 +16,8 @@ const projectsStore = useProjects()
const { populateWorkspace } = useWorkspace()
const { signedIn } = useGlobal()
const router = useRouter()
const route = router.currentRoute
@ -46,6 +48,17 @@ watch(
return
}
// avoid loading projects for shared base
if (route.value.params.typeOrId === 'base') {
await populateWorkspace()
return
}
if (!signedIn.value) {
navigateTo('/signIn')
return
}
// Load projects
await populateWorkspace()

1
packages/nc-gui/store/projects.ts

@ -40,7 +40,6 @@ export const useProjects = defineStore('projectsStore', () => {
return basesMap
})
const workspaceStore = useWorkspace()
const tableStore = useTablesStore()

7
packages/nc-gui/store/workspace.ts

@ -2,12 +2,11 @@ import type { ProjectType } from 'nocodb-sdk'
import { acceptHMRUpdate, defineStore } from 'pinia'
import { message } from 'ant-design-vue'
import { isString } from '@vue/shared'
import { computed, navigateTo, ref, useCommandPalette, useNuxtApp, useRouter, useTheme } from '#imports'
import { computed, navigateTo, ref, useCommandPalette, useNuxtApp, useProjects, useRouter, useTheme } from '#imports'
import type { ThemeConfig } from '#imports'
export const useWorkspace = defineStore('workspaceStore', () => {
const projectsStore = useProjects()
const { clearProjects } = projectsStore
const collaborators = ref<any[] | null>()
@ -199,8 +198,8 @@ export const useWorkspace = defineStore('workspaceStore', () => {
$e('c:themes:change')
}
const clearWorkspaces = async () => {
await clearProjects()
async function clearWorkspaces() {
await projectsStore.clearProjects()
workspaces.value.clear()
}

32
packages/nocodb/package-lock.json generated

@ -98,7 +98,7 @@
"ncp": "^2.0.0",
"nestjs-kafka": "^1.0.6",
"nestjs-throttler-storage-redis": "^0.3.0",
"nocodb-sdk": "0.111.1",
"nocodb-sdk": "file:../nocodb-sdk",
"nodemailer": "^6.4.10",
"object-hash": "^3.0.0",
"object-sizeof": "^2.6.1",
@ -211,7 +211,6 @@
},
"../nocodb-sdk": {
"version": "0.111.1",
"extraneous": true,
"license": "AGPL-3.0-or-later",
"dependencies": {
"axios": "^0.21.1",
@ -14383,13 +14382,8 @@
}
},
"node_modules/nocodb-sdk": {
"version": "0.111.1",
"resolved": "https://registry.npmjs.org/nocodb-sdk/-/nocodb-sdk-0.111.1.tgz",
"integrity": "sha512-FS5wyWd3XkPtRkqjO7Hdj5HKsco6/oYc8MPrZ7K/JRmqf0Yf1oydtarkv7h+dDTaNtfcp6Qm56b1JdwJP/EWvg==",
"dependencies": {
"axios": "^0.21.1",
"jsep": "^1.3.6"
}
"resolved": "../nocodb-sdk",
"link": true
},
"node_modules/node-abort-controller": {
"version": "3.1.1",
@ -30908,12 +30902,24 @@
"requires": {}
},
"nocodb-sdk": {
"version": "0.111.1",
"resolved": "https://registry.npmjs.org/nocodb-sdk/-/nocodb-sdk-0.111.1.tgz",
"integrity": "sha512-FS5wyWd3XkPtRkqjO7Hdj5HKsco6/oYc8MPrZ7K/JRmqf0Yf1oydtarkv7h+dDTaNtfcp6Qm56b1JdwJP/EWvg==",
"version": "file:../nocodb-sdk",
"requires": {
"@typescript-eslint/eslint-plugin": "^4.0.1",
"@typescript-eslint/parser": "^4.0.1",
"axios": "^0.21.1",
"jsep": "^1.3.6"
"cspell": "^4.1.0",
"eslint": "^7.8.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-functional": "^3.0.2",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-prettier": "^4.0.0",
"jsep": "^1.3.6",
"npm-run-all": "^4.1.5",
"prettier": "^2.1.1",
"rimraf": "^5.0.1",
"tsc-alias": "^1.8.7",
"typescript": "^4.7.4"
}
},
"node-abort-controller": {

2
tests/playwright/pages/Dashboard/Sidebar/UserMenu/index.ts

@ -11,7 +11,7 @@ export class SidebarUserMenuObject extends BasePage {
}
get() {
return this.sidebar.get().locator(`.nc-sidebar-userinfo`);
return this.rootPage.getByTestId('nc-sidebar-userinfo');
}
async click() {

1
tests/playwright/pages/Dashboard/index.ts

@ -186,6 +186,7 @@ export class DashboardPage extends BasePage {
async signOut() {
await this.sidebar.userMenu.click();
await this.rootPage.getByTestId('nc-sidebar-user-logout').waitFor({ state: 'visible' });
await this.sidebar.userMenu.clickLogout();
await this.rootPage.locator('[data-testid="nc-form-signin"]:visible').waitFor();
await new Promise(resolve => setTimeout(resolve, 150));

Loading…
Cancel
Save