|
| 1 | +import { ActionParamConfig, Config, ConfigToType, QueryConfig } from "lowcoder-sdk/dataSource"; |
| 2 | +import { AliyunOssI18nTranslator } from "./i18n"; |
| 3 | + |
| 4 | +function getQueryConfig(i18n: AliyunOssI18nTranslator) { |
| 5 | + const bucketActionParam = { |
| 6 | + key: "bucket", |
| 7 | + type: "textInput", |
| 8 | + label: i18n.trans("bucket"), |
| 9 | + } as const; |
| 10 | + |
| 11 | + const queryConfig = { |
| 12 | + type: "query", |
| 13 | + label: i18n.trans("actions"), |
| 14 | + actions: [ |
| 15 | + // { |
| 16 | + // actionName: "listBuckets", |
| 17 | + // label: i18n.trans("actionName.listBuckets"), |
| 18 | + // params: [], |
| 19 | + // }, |
| 20 | + { |
| 21 | + actionName: "listObjects", |
| 22 | + label: i18n.trans("actionName.listObjects"), |
| 23 | + params: [ |
| 24 | + bucketActionParam, |
| 25 | + { |
| 26 | + key: "prefix", |
| 27 | + type: "textInput", |
| 28 | + label: i18n.trans("prefix"), |
| 29 | + }, |
| 30 | + { |
| 31 | + key: "delimiter", |
| 32 | + type: "textInput", |
| 33 | + label: i18n.trans("delimiter"), |
| 34 | + }, |
| 35 | + { |
| 36 | + key: "limit", |
| 37 | + type: "numberInput", |
| 38 | + defaultValue: 10, |
| 39 | + label: i18n.trans("limit"), |
| 40 | + } |
| 41 | + ], |
| 42 | + }, |
| 43 | + { |
| 44 | + actionName: "uploadData", |
| 45 | + label: i18n.trans("actionName.uploadFile"), |
| 46 | + params: [ |
| 47 | + bucketActionParam, |
| 48 | + { |
| 49 | + key: "fileName", |
| 50 | + type: "textInput", |
| 51 | + label: i18n.trans("fileName"), |
| 52 | + }, |
| 53 | + { |
| 54 | + key: "data", |
| 55 | + type: "textInput", |
| 56 | + label: i18n.trans("data"), |
| 57 | + tooltip: i18n.trans("dataTooltip"), |
| 58 | + }, |
| 59 | + ], |
| 60 | + }, |
| 61 | + // { |
| 62 | + // actionName: "deleteFile", |
| 63 | + // label: i18n.trans("actionName.deleteFile"), |
| 64 | + // params: [ |
| 65 | + // bucketActionParam, |
| 66 | + // { |
| 67 | + // key: "fileName", |
| 68 | + // type: "textInput", |
| 69 | + // label: i18n.trans("fileName"), |
| 70 | + // }, |
| 71 | + // ], |
| 72 | + // }, |
| 73 | + ], |
| 74 | + } as const; |
| 75 | + return queryConfig; |
| 76 | +} |
| 77 | + |
| 78 | +export type ActionDataType = ConfigToType<ReturnType<typeof getQueryConfig>>; |
| 79 | + |
| 80 | +export default getQueryConfig; |
0 commit comments