Browse Source

Merge branch 'develop' into refactor/nocodb-project-structure

pull/4237/head
Wing-Kam Wong 2 years ago
parent
commit
fc46896fca
  1. 26
      packages/nc-gui/components/smartsheet/Gallery.vue
  2. 6
      packages/nc-gui/lang/zh-Hans.json
  3. 3
      packages/nc-gui/pages/index/index/create-external.vue
  4. 2
      packages/nc-gui/utils/projectCreateUtils.ts
  5. 20
      packages/noco-docs/content/en/engineering/testing.md
  6. 8
      packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/functionMappings/pg.ts
  7. 4
      packages/nocodb/src/lib/plugins/backblaze/Backblaze.ts
  8. 4
      packages/nocodb/src/lib/plugins/gcs/Gcs.ts
  9. 4
      packages/nocodb/src/lib/plugins/linode/LinodeObjectStorage.ts
  10. 4
      packages/nocodb/src/lib/plugins/mino/Minio.ts
  11. 4
      packages/nocodb/src/lib/plugins/ovhCloud/OvhCloud.ts
  12. 4
      packages/nocodb/src/lib/plugins/s3/S3.ts
  13. 3
      packages/nocodb/src/lib/plugins/scaleway/ScalewayObjectStorage.ts
  14. 4
      packages/nocodb/src/lib/plugins/spaces/Spaces.ts
  15. 4
      packages/nocodb/src/lib/plugins/upcloud/UpoCloud.ts
  16. 4
      packages/nocodb/src/lib/plugins/vultr/Vultr.ts
  17. 16
      packages/nocodb/src/lib/utils/pluginUtils.ts

26
packages/nc-gui/components/smartsheet/Gallery.vue

@ -203,23 +203,17 @@ watch(view, async (nextView) => {
<MdiFileImageBox v-else class="w-full h-48 my-4 text-cool-gray-200" /> <MdiFileImageBox v-else class="w-full h-48 my-4 text-cool-gray-200" />
</template> </template>
<div <div v-for="col in fieldsWithoutCover" :key="`record-${record.row.id}-${col.id}`">
v-for="col in fieldsWithoutCover" <div v-if="!isRowEmpty(record, col)" class="flex flex-col space-y-1 px-4 mb-6 bg-gray-50 rounded-lg w-full">
:key="`record-${record.row.id}-${col.id}`" <div class="flex flex-row w-full justify-start border-b-1 border-gray-100 py-2.5">
class="flex flex-col space-y-1 px-4 mb-6 bg-gray-50 rounded-lg w-full" <div class="w-full text-gray-600">
> <LazySmartsheetHeaderVirtualCell v-if="isVirtualCol(col)" :column="col" :hide-menu="true" />
<div class="flex flex-row w-full justify-start border-b-1 border-gray-100 py-2.5">
<div class="w-full text-gray-600"> <LazySmartsheetHeaderCell v-else :column="col" :hide-menu="true" />
<LazySmartsheetHeaderVirtualCell v-if="isVirtualCol(col)" :column="col" :hide-menu="true" /> </div>
<LazySmartsheetHeaderCell v-else :column="col" :hide-menu="true" />
</div> </div>
</div>
<div class="flex flex-row w-full pb-3 pt-2 pl-2 items-center justify-start">
<div v-if="isRowEmpty(record, col)" class="h-3 bg-gray-200 px-5 rounded-lg"></div>
<template v-else> <div class="flex flex-row w-full pb-3 pt-2 pl-2 items-center justify-start">
<LazySmartsheetVirtualCell <LazySmartsheetVirtualCell
v-if="isVirtualCol(col)" v-if="isVirtualCol(col)"
v-model="record.row[col.title]" v-model="record.row[col.title]"
@ -234,7 +228,7 @@ watch(view, async (nextView) => {
:edit-enabled="false" :edit-enabled="false"
:read-only="true" :read-only="true"
/> />
</template> </div>
</div> </div>
</div> </div>
</a-card> </a-card>

6
packages/nc-gui/lang/zh-Hans.json

@ -106,10 +106,10 @@
"commenter": "评论者", "commenter": "评论者",
"viewer": "浏览者" "viewer": "浏览者"
}, },
"sqlVIew": "SQL View" "sqlVIew": "SQL 视图"
}, },
"datatype": { "datatype": {
"ID": "ID", "ID": "编号",
"ForeignKey": "外键", "ForeignKey": "外键",
"SingleLineText": "单行文本", "SingleLineText": "单行文本",
"LongText": "长文本", "LongText": "长文本",
@ -189,7 +189,7 @@
"resetPassword": "重置密码", "resetPassword": "重置密码",
"teamAndSettings": "团队和设置", "teamAndSettings": "团队和设置",
"apiDocs": "API 文档", "apiDocs": "API 文档",
"importFromAirtable": "Import From Airtable", "importFromAirtable": "从 Airtable 导入",
"generateToken": "Generate Token", "generateToken": "Generate Token",
"APIsAndSupport": "APIs & Support", "APIsAndSupport": "APIs & Support",
"helpCenter": "Help center", "helpCenter": "Help center",

3
packages/nc-gui/pages/index/index/create-external.vue

@ -113,6 +113,9 @@ const onSSLModeChange = ((mode: SSLUsage) => {
delete connection.ssl delete connection.ssl
break break
case SSLUsage.Allowed: case SSLUsage.Allowed:
connection.ssl = 'no-verify'
break
case SSLUsage.Preferred:
connection.ssl = 'true' connection.ssl = 'true'
break break
default: default:

2
packages/nc-gui/utils/projectCreateUtils.ts

@ -21,7 +21,7 @@ export interface DefaultConnection {
user: string user: string
password: string password: string
port: number | string port: number | string
ssl?: Record<CertTypes, string> | 'true' ssl?: Record<CertTypes, string> | 'no-verify' | 'true'
} }
export interface SQLiteConnection { export interface SQLiteConnection {

20
packages/noco-docs/content/en/engineering/testing.md

@ -323,3 +323,23 @@ npm run cypress:open
# run test script # run test script
# - quickTest.js # - quickTest.js
``` ```
## Accessing CI-CD CY Screenshots
1. On Jobs link, click on `Summary`
![Screenshot 2022-10-31 at 9 25 23 PM](https://user-images.githubusercontent.com/86527202/199052696-af0bf066-d82f-487a-b487-602f55594fd7.png)
2. Click on `Artifacts`
![Screenshot 2022-10-31 at 9 26 01 PM](https://user-images.githubusercontent.com/86527202/199052712-04508921-32b1-4926-8291-396c804f7c3b.png)
3. Download logs for desired suite
![Screenshot 2022-10-31 at 9 26 34 PM](https://user-images.githubusercontent.com/86527202/199052727-9aebbdd1-749e-4bda-ab00-3cdd0e3f48fe.png)

8
packages/nocodb/src/lib/db/sql-data-mapper/lib/sql/functionMappings/pg.ts

@ -9,7 +9,6 @@ const pg = {
MIN: 'least', MIN: 'least',
MAX: 'greatest', MAX: 'greatest',
CEILING: 'ceil', CEILING: 'ceil',
ROUND: 'round',
POWER: 'pow', POWER: 'pow',
SQRT: 'sqrt', SQRT: 'sqrt',
SEARCH: (args: MapFnArgs) => { SEARCH: (args: MapFnArgs) => {
@ -35,6 +34,13 @@ const pg = {
.raw(`CAST(${fn(pt.arguments[0])} as DOUBLE PRECISION)${colAlias}`) .raw(`CAST(${fn(pt.arguments[0])} as DOUBLE PRECISION)${colAlias}`)
.wrap('(', ')'); .wrap('(', ')');
}, },
ROUND: ({ fn, knex, pt, colAlias }: MapFnArgs) => {
return knex.raw(
`ROUND((${fn(pt.arguments[0])})::numeric, ${
pt?.arguments[1] ? fn(pt.arguments[1]) : 0
}) ${colAlias}`
);
},
DATEADD: ({ fn, knex, pt, colAlias }: MapFnArgs) => { DATEADD: ({ fn, knex, pt, colAlias }: MapFnArgs) => {
return knex.raw( return knex.raw(
`${fn(pt.arguments[0])} + (${fn(pt.arguments[1])} || `${fn(pt.arguments[0])} + (${fn(pt.arguments[1])} ||

4
packages/nocodb/src/lib/plugins/backblaze/Backblaze.ts

@ -1,9 +1,9 @@
import fs from 'fs'; import fs from 'fs';
import path from 'path'; import path from 'path';
import AWS from 'aws-sdk'; import AWS from 'aws-sdk';
import { IStorageAdapterV2, XcFile } from 'nc-plugin'; import { IStorageAdapterV2, XcFile } from 'nc-plugin';
import request from 'request'; import request from 'request';
import { waitForStreamClose } from '../../utils/pluginUtils';
export default class Backblaze implements IStorageAdapterV2 { export default class Backblaze implements IStorageAdapterV2 {
private s3Client: AWS.S3; private s3Client: AWS.S3;
@ -121,7 +121,7 @@ export default class Backblaze implements IStorageAdapterV2 {
try { try {
const tempFile = path.join(process.cwd(), 'temp.txt'); const tempFile = path.join(process.cwd(), 'temp.txt');
const createStream = fs.createWriteStream(tempFile); const createStream = fs.createWriteStream(tempFile);
createStream.end(); await waitForStreamClose(createStream);
await this.fileCreate('nc-test-file.txt', { await this.fileCreate('nc-test-file.txt', {
path: tempFile, path: tempFile,
mimetype: '', mimetype: '',

4
packages/nocodb/src/lib/plugins/gcs/Gcs.ts

@ -1,9 +1,9 @@
import fs from 'fs'; import fs from 'fs';
import path from 'path'; import path from 'path';
import { Storage, StorageOptions } from '@google-cloud/storage'; import { Storage, StorageOptions } from '@google-cloud/storage';
import { IStorageAdapterV2, XcFile } from 'nc-plugin'; import { IStorageAdapterV2, XcFile } from 'nc-plugin';
import request from 'request'; import request from 'request';
import { waitForStreamClose } from '../../utils/pluginUtils';
export default class Gcs implements IStorageAdapterV2 { export default class Gcs implements IStorageAdapterV2 {
private storageClient: Storage; private storageClient: Storage;
@ -87,7 +87,7 @@ export default class Gcs implements IStorageAdapterV2 {
try { try {
const tempFile = path.join(process.cwd(), 'temp.txt'); const tempFile = path.join(process.cwd(), 'temp.txt');
const createStream = fs.createWriteStream(tempFile); const createStream = fs.createWriteStream(tempFile);
createStream.end(); await waitForStreamClose(createStream);
await this.fileCreate('nc-test-file.txt', { await this.fileCreate('nc-test-file.txt', {
path: tempFile, path: tempFile,
mimetype: '', mimetype: '',

4
packages/nocodb/src/lib/plugins/linode/LinodeObjectStorage.ts

@ -1,9 +1,9 @@
import fs from 'fs'; import fs from 'fs';
import path from 'path'; import path from 'path';
import AWS from 'aws-sdk'; import AWS from 'aws-sdk';
import { IStorageAdapterV2, XcFile } from 'nc-plugin'; import { IStorageAdapterV2, XcFile } from 'nc-plugin';
import request from 'request'; import request from 'request';
import { waitForStreamClose } from '../../utils/pluginUtils';
export default class LinodeObjectStorage implements IStorageAdapterV2 { export default class LinodeObjectStorage implements IStorageAdapterV2 {
private s3Client: AWS.S3; private s3Client: AWS.S3;
@ -111,7 +111,7 @@ export default class LinodeObjectStorage implements IStorageAdapterV2 {
try { try {
const tempFile = path.join(process.cwd(), 'temp.txt'); const tempFile = path.join(process.cwd(), 'temp.txt');
const createStream = fs.createWriteStream(tempFile); const createStream = fs.createWriteStream(tempFile);
createStream.end(); await waitForStreamClose(createStream);
await this.fileCreate('nc-test-file.txt', { await this.fileCreate('nc-test-file.txt', {
path: tempFile, path: tempFile,
mimetype: '', mimetype: '',

4
packages/nocodb/src/lib/plugins/mino/Minio.ts

@ -1,9 +1,9 @@
import fs from 'fs'; import fs from 'fs';
import path from 'path'; import path from 'path';
import { Client as MinioClient } from 'minio'; import { Client as MinioClient } from 'minio';
import { IStorageAdapterV2, XcFile } from 'nc-plugin'; import { IStorageAdapterV2, XcFile } from 'nc-plugin';
import request from 'request'; import request from 'request';
import { waitForStreamClose } from '../../utils/pluginUtils';
export default class Minio implements IStorageAdapterV2 { export default class Minio implements IStorageAdapterV2 {
private minioClient: MinioClient; private minioClient: MinioClient;
@ -75,7 +75,7 @@ export default class Minio implements IStorageAdapterV2 {
try { try {
const tempFile = path.join(process.cwd(), 'temp.txt'); const tempFile = path.join(process.cwd(), 'temp.txt');
const createStream = fs.createWriteStream(tempFile); const createStream = fs.createWriteStream(tempFile);
createStream.end(); await waitForStreamClose(createStream);
await this.fileCreate('nc-test-file.txt', { await this.fileCreate('nc-test-file.txt', {
path: tempFile, path: tempFile,
mimetype: '', mimetype: '',

4
packages/nocodb/src/lib/plugins/ovhCloud/OvhCloud.ts

@ -1,9 +1,9 @@
import fs from 'fs'; import fs from 'fs';
import path from 'path'; import path from 'path';
import AWS from 'aws-sdk'; import AWS from 'aws-sdk';
import { IStorageAdapterV2, XcFile } from 'nc-plugin'; import { IStorageAdapterV2, XcFile } from 'nc-plugin';
import request from 'request'; import request from 'request';
import { waitForStreamClose } from '../../utils/pluginUtils';
export default class OvhCloud implements IStorageAdapterV2 { export default class OvhCloud implements IStorageAdapterV2 {
private s3Client: AWS.S3; private s3Client: AWS.S3;
@ -111,7 +111,7 @@ export default class OvhCloud implements IStorageAdapterV2 {
try { try {
const tempFile = path.join(process.cwd(), 'temp.txt'); const tempFile = path.join(process.cwd(), 'temp.txt');
const createStream = fs.createWriteStream(tempFile); const createStream = fs.createWriteStream(tempFile);
createStream.end(); await waitForStreamClose(createStream);
await this.fileCreate('nc-test-file.txt', { await this.fileCreate('nc-test-file.txt', {
path: tempFile, path: tempFile,
mimetype: '', mimetype: '',

4
packages/nocodb/src/lib/plugins/s3/S3.ts

@ -1,9 +1,9 @@
import fs from 'fs'; import fs from 'fs';
import path from 'path'; import path from 'path';
import AWS from 'aws-sdk'; import AWS from 'aws-sdk';
import { IStorageAdapterV2, XcFile } from 'nc-plugin'; import { IStorageAdapterV2, XcFile } from 'nc-plugin';
import request from 'request'; import request from 'request';
import { waitForStreamClose } from '../../utils/pluginUtils';
export default class S3 implements IStorageAdapterV2 { export default class S3 implements IStorageAdapterV2 {
private s3Client: AWS.S3; private s3Client: AWS.S3;
@ -114,7 +114,7 @@ export default class S3 implements IStorageAdapterV2 {
try { try {
const tempFile = path.join(process.cwd(), 'temp.txt'); const tempFile = path.join(process.cwd(), 'temp.txt');
const createStream = fs.createWriteStream(tempFile); const createStream = fs.createWriteStream(tempFile);
createStream.end(); await waitForStreamClose(createStream);
await this.fileCreate('nc-test-file.txt', { await this.fileCreate('nc-test-file.txt', {
path: tempFile, path: tempFile,
mimetype: '', mimetype: '',

3
packages/nocodb/src/lib/plugins/scaleway/ScalewayObjectStorage.ts

@ -3,6 +3,7 @@ import fs from 'fs';
import { IStorageAdapterV2, XcFile } from 'nc-plugin'; import { IStorageAdapterV2, XcFile } from 'nc-plugin';
import AWS from 'aws-sdk'; import AWS from 'aws-sdk';
import request from 'request'; import request from 'request';
import { waitForStreamClose } from '../../utils/pluginUtils';
export default class ScalewayObjectStorage implements IStorageAdapterV2 { export default class ScalewayObjectStorage implements IStorageAdapterV2 {
private s3Client: AWS.S3; private s3Client: AWS.S3;
@ -30,7 +31,7 @@ export default class ScalewayObjectStorage implements IStorageAdapterV2 {
try { try {
const tempFile = path.join(process.cwd(), 'temp.txt'); const tempFile = path.join(process.cwd(), 'temp.txt');
const createStream = fs.createWriteStream(tempFile); const createStream = fs.createWriteStream(tempFile);
createStream.end(); await waitForStreamClose(createStream);
await this.fileCreate('nc-test-file.txt', { await this.fileCreate('nc-test-file.txt', {
path: tempFile, path: tempFile,
mimetype: '', mimetype: '',

4
packages/nocodb/src/lib/plugins/spaces/Spaces.ts

@ -1,9 +1,9 @@
import fs from 'fs'; import fs from 'fs';
import path from 'path'; import path from 'path';
import AWS from 'aws-sdk'; import AWS from 'aws-sdk';
import { IStorageAdapterV2, XcFile } from 'nc-plugin'; import { IStorageAdapterV2, XcFile } from 'nc-plugin';
import request from 'request'; import request from 'request';
import { waitForStreamClose } from '../../utils/pluginUtils';
export default class Spaces implements IStorageAdapterV2 { export default class Spaces implements IStorageAdapterV2 {
private s3Client: AWS.S3; private s3Client: AWS.S3;
@ -119,7 +119,7 @@ export default class Spaces implements IStorageAdapterV2 {
try { try {
const tempFile = path.join(process.cwd(), 'temp.txt'); const tempFile = path.join(process.cwd(), 'temp.txt');
const createStream = fs.createWriteStream(tempFile); const createStream = fs.createWriteStream(tempFile);
createStream.end(); await waitForStreamClose(createStream);
await this.fileCreate('nc-test-file.txt', { await this.fileCreate('nc-test-file.txt', {
path: tempFile, path: tempFile,
mimetype: '', mimetype: '',

4
packages/nocodb/src/lib/plugins/upcloud/UpoCloud.ts

@ -1,9 +1,9 @@
import fs from 'fs'; import fs from 'fs';
import path from 'path'; import path from 'path';
import AWS from 'aws-sdk'; import AWS from 'aws-sdk';
import { IStorageAdapterV2, XcFile } from 'nc-plugin'; import { IStorageAdapterV2, XcFile } from 'nc-plugin';
import request from 'request'; import request from 'request';
import { waitForStreamClose } from '../../utils/pluginUtils';
export default class UpoCloud implements IStorageAdapterV2 { export default class UpoCloud implements IStorageAdapterV2 {
private s3Client: AWS.S3; private s3Client: AWS.S3;
@ -109,7 +109,7 @@ export default class UpoCloud implements IStorageAdapterV2 {
try { try {
const tempFile = path.join(process.cwd(), 'temp.txt'); const tempFile = path.join(process.cwd(), 'temp.txt');
const createStream = fs.createWriteStream(tempFile); const createStream = fs.createWriteStream(tempFile);
createStream.end(); await waitForStreamClose(createStream);
await this.fileCreate('nc-test-file.txt', { await this.fileCreate('nc-test-file.txt', {
path: tempFile, path: tempFile,
mimetype: '', mimetype: '',

4
packages/nocodb/src/lib/plugins/vultr/Vultr.ts

@ -1,9 +1,9 @@
import fs from 'fs'; import fs from 'fs';
import path from 'path'; import path from 'path';
import AWS from 'aws-sdk'; import AWS from 'aws-sdk';
import { IStorageAdapterV2, XcFile } from 'nc-plugin'; import { IStorageAdapterV2, XcFile } from 'nc-plugin';
import request from 'request'; import request from 'request';
import { waitForStreamClose } from '../../utils/pluginUtils';
export default class Vultr implements IStorageAdapterV2 { export default class Vultr implements IStorageAdapterV2 {
private s3Client: AWS.S3; private s3Client: AWS.S3;
@ -111,7 +111,7 @@ export default class Vultr implements IStorageAdapterV2 {
try { try {
const tempFile = path.join(process.cwd(), 'temp.txt'); const tempFile = path.join(process.cwd(), 'temp.txt');
const createStream = fs.createWriteStream(tempFile); const createStream = fs.createWriteStream(tempFile);
createStream.end(); await waitForStreamClose(createStream);
await this.fileCreate('nc-test-file.txt', { await this.fileCreate('nc-test-file.txt', {
path: tempFile, path: tempFile,
mimetype: '', mimetype: '',

16
packages/nocodb/src/lib/utils/pluginUtils.ts

@ -0,0 +1,16 @@
import fs from 'fs';
export async function waitForStreamClose(
stream: fs.WriteStream
): Promise<void> {
return new Promise((resolve, reject) => {
stream
.once('finish', () => {
resolve();
})
.once('error', (err) => {
reject(err);
});
stream.end();
});
}
Loading…
Cancel
Save