Browse Source

Merge pull request #3547 from nocodb/develop

pull/3548/head
github-actions[bot] 2 years ago committed by GitHub
parent
commit
1a796c1a7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      packages/nc-gui/components.d.ts
  2. 5
      packages/nc-gui/components/cell/attachment/utils.ts
  3. 12
      packages/nc-gui/components/dlg/QuickImport.vue
  4. 1
      packages/nc-gui/components/smartsheet-toolbar/ViewActions.vue
  5. 4
      packages/nc-gui/pages/signup/[[token]].vue
  6. 43
      packages/nocodb/src/lib/meta/api/utilApis.ts

1
packages/nc-gui/components.d.ts vendored

@ -107,6 +107,7 @@ declare module '@vue/runtime-core' {
MdiAccountPlus: typeof import('~icons/mdi/account-plus')['default']
MdiAccountPlusOutline: typeof import('~icons/mdi/account-plus-outline')['default']
MdiAccountSupervisorOutline: typeof import('~icons/mdi/account-supervisor-outline')['default']
MdiAlpha: typeof import('~icons/mdi/alpha')['default']
MdiAlphaA: typeof import('~icons/mdi/alpha-a')['default']
MdiApi: typeof import('~icons/mdi/api')['default']
MdiArrowExpand: typeof import('~icons/mdi/arrow-expand')['default']

5
packages/nc-gui/components/cell/attachment/utils.ts

@ -18,6 +18,7 @@ import {
useProject,
watch,
} from '#imports'
import { IsFormInj } from '~/context'
import MdiPdfBox from '~icons/mdi/pdf-box'
import MdiFileWordOutline from '~icons/mdi/file-word-outline'
import MdiFilePowerpointBox from '~icons/mdi/file-powerpoint-box'
@ -37,6 +38,8 @@ export const [useProvideAttachmentCell, useAttachmentCell] = useInjectionState(
const isPublic = inject(IsPublicInj, ref(false))
const isForm = inject(IsFormInj, ref(false))
const meta = inject(MetaInj)!
const column = inject(ColumnInj)!
@ -162,7 +165,7 @@ export const [useProvideAttachmentCell, useAttachmentCell] = useInjectionState(
}
/** our currently visible items, either the locally stored or the ones from db, depending on isPublicForm status */
const visibleItems = computed<any[]>(() => (isPublic.value ? storedFiles.value : attachments.value))
const visibleItems = computed<any[]>(() => (isPublic.value && isForm.value ? storedFiles.value : attachments.value))
watch(files, (nextFiles) => nextFiles && onFileSelect(nextFiles))

12
packages/nc-gui/components/dlg/QuickImport.vue

@ -270,6 +270,17 @@ function getAdapter(name: string, val: any) {
defineExpose({
handleChange,
})
/** a workaround to override default antd upload api call */
const customReqCbk = (customReqArgs: { file: any; onSuccess: () => void }) => {
importState.fileList.forEach((f) => {
if (f.uid === customReqArgs.file.uid) {
f.status = 'done'
handleChange({ file: f, fileList: importState.fileList })
}
})
customReqArgs.onSuccess()
}
</script>
<template>
@ -308,6 +319,7 @@ defineExpose({
:accept="importMeta.acceptTypes"
:max-count="1"
list-type="picture"
:custom-request="customReqCbk"
@change="handleChange"
@reject="rejectDrop"
>

1
packages/nc-gui/components/smartsheet-toolbar/ViewActions.vue

@ -171,6 +171,7 @@ const { isSqlView } = useSmartsheetStoreOrThrow()
<MdiUploadOutline class="text-gray-500" />
<!-- Upload CSV -->
{{ $t('activity.uploadCSV') }}
<div class="flex items-center text-gray-400"><MdiAlpha />version</div>
</div>
</a-menu-item>
</a-sub-menu>

4
packages/nc-gui/pages/signup/[[token]].vue

@ -78,9 +78,7 @@ async function signUp() {
token: route.params.token,
}
if (subscribe.value) {
data.ignore_subscribe = !subscribe.value
}
data.ignore_subscribe = !subscribe.value
api.auth
.signup(data)

43
packages/nocodb/src/lib/meta/api/utilApis.ts

@ -4,11 +4,18 @@ import { Request, Response } from 'express';
import { packageVersion } from 'nc-help';
import ncMetaAclMw from '../helpers/ncMetaAclMw';
import SqlMgrv2 from '../../db/sql-mgr/v2/SqlMgrv2';
import NcConfigFactory, { defaultConnectionConfig } from '../../utils/NcConfigFactory';
import NcConfigFactory, {
defaultConnectionConfig,
} from '../../utils/NcConfigFactory';
import User from '../../models/User';
import catchError from '../helpers/catchError';
import axios from 'axios';
const versionCache = {
releaseVersion: null,
lastFetched: null,
};
export async function testConnection(req: Request, res: Response) {
res.json(await SqlMgrv2.testConnection(req.body));
}
@ -46,19 +53,31 @@ export async function appInfo(req: Request, res: Response) {
}
export async function versionInfo(_req: Request, res: Response) {
const result = await axios
.get('https://github.com/nocodb/nocodb/releases/latest')
.then((response) => {
return {
currentVersion: packageVersion,
releaseVersion: response.request.res.responseUrl.replace(
if (
!versionCache.lastFetched ||
(versionCache.lastFetched &&
versionCache.lastFetched < Date.now() - 1000 * 60 * 60)
) {
versionCache.releaseVersion = await axios
.get('https://github.com/nocodb/nocodb/releases/latest', {
timeout: 5000,
})
.then((response) =>
response.request.res.responseUrl.replace(
'https://github.com/nocodb/nocodb/releases/tag/',
''
),
};
});
)
)
.catch(() => null);
versionCache.lastFetched = Date.now();
}
res.json(result);
const response = {
currentVersion: packageVersion,
releaseVersion: versionCache.releaseVersion,
};
res.json(response);
}
export async function feedbackFormGet(_req: Request, res: Response) {
@ -154,7 +173,7 @@ export async function urlToDbConfig(req: Request, res: Response) {
connectionConfig = NcConfigFactory.extractXcUrlFromJdbc(url, true);
return res.json(connectionConfig);
} catch (error) {
return res.sendStatus(500)
return res.sendStatus(500);
}
}

Loading…
Cancel
Save