Skip to content

Commit 733591c

Browse files
author
Thomasr
committed
Add s3 spec version
1 parent da3c0aa commit 733591c

File tree

3 files changed

+22
-4
lines changed

3 files changed

+22
-4
lines changed

server/node-service/src/plugins/s3/dataSourceConfig.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { ConfigToType } from "lowcoder-sdk/dataSource";
22
import { S3I18nTranslator } from "./i18n";
3+
import { specsToOptions } from "../../common/util";
34

4-
const getDataSourceConfig = (i18n: S3I18nTranslator) => {
5+
const getDataSourceConfig = (i18n: S3I18nTranslator, specs: any) => {
56
const dataSourceConfig = {
67
type: "dataSource",
78
params: [
@@ -30,6 +31,14 @@ const getDataSourceConfig = (i18n: S3I18nTranslator) => {
3031
label: i18n.trans("region"),
3132
defaultValue: "us-west-1",
3233
},
34+
{
35+
label: "Spec Version",
36+
key: "specVersion",
37+
type: "select",
38+
tooltip: "Version of the spec file.",
39+
placeholder: "v1.0",
40+
options: specsToOptions(specs)
41+
},
3342
],
3443
} as const;
3544
return dataSourceConfig;

server/node-service/src/plugins/s3/index.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@ import run, { validateDataSourceConfig } from "./run";
88
import getI18nTranslator from "./i18n";
99
import getDataSourceConfig from "./dataSourceConfig";
1010
import getQueryConfig from "./queryConfig";
11+
import { dirToSpecList } from "../../common/util";
12+
import path from "path";
13+
14+
15+
const specs = {
16+
"V1.0": "Nothing to do",
17+
}
1118

1219
const s3Plugin: DataSourcePluginFactory = (context: PluginContext) => {
1320
const i18n = getI18nTranslator(context.languages);
@@ -17,8 +24,10 @@ const s3Plugin: DataSourcePluginFactory = (context: PluginContext) => {
1724
icon: "s3.svg",
1825
description: i18n.trans("description"),
1926
category: "api",
20-
dataSourceConfig: getDataSourceConfig(i18n),
21-
queryConfig: getQueryConfig(i18n),
27+
dataSourceConfig: getDataSourceConfig(i18n, specs),
28+
queryConfig: async (data) => {
29+
return getQueryConfig(i18n, data.specVersion as keyof typeof specs)
30+
},
2231

2332
validateDataSourceConfig: async (dataSourceConfig: DataSourceDataType) => {
2433
return validateDataSourceConfig(dataSourceConfig);

server/node-service/src/plugins/s3/queryConfig.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ActionParamConfig, Config, ConfigToType, QueryConfig } from "lowcoder-sdk/dataSource";
22
import { S3I18nTranslator } from "./i18n";
33

4-
function getQueryConfig(i18n: S3I18nTranslator) {
4+
function getQueryConfig(i18n: S3I18nTranslator, version: string) {
55
const bucketActionParam = {
66
key: "bucket",
77
type: "textInput",

0 commit comments

Comments
 (0)