@nocobase/plugin-data-source-manager 1.8.0-beta.9 → 1.9.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,24 +8,24 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "1.8.0-beta.9",
11
+ "@nocobase/client": "1.9.0-alpha.1",
12
12
  "react": "18.2.0",
13
- "@nocobase/plugin-acl": "1.8.0-beta.9",
14
- "@nocobase/utils": "1.8.0-beta.9",
15
- "@nocobase/server": "1.8.0-beta.9",
16
- "@nocobase/data-source-manager": "1.8.0-beta.9",
13
+ "@nocobase/plugin-acl": "1.9.0-alpha.1",
14
+ "@nocobase/utils": "1.9.0-alpha.1",
15
+ "@nocobase/server": "1.9.0-alpha.1",
16
+ "@nocobase/data-source-manager": "1.9.0-alpha.1",
17
17
  "lodash": "4.17.21",
18
- "@nocobase/acl": "1.8.0-beta.9",
18
+ "@nocobase/acl": "1.9.0-alpha.1",
19
19
  "@ant-design/icons": "5.6.1",
20
20
  "antd": "5.24.2",
21
21
  "react-router-dom": "6.28.1",
22
+ "@formily/react": "2.3.0",
22
23
  "@formily/shared": "2.3.2",
23
24
  "react-i18next": "11.18.6",
24
- "@formily/react": "2.3.0",
25
25
  "@emotion/css": "11.13.0",
26
- "@nocobase/database": "1.8.0-beta.9",
26
+ "@nocobase/database": "1.9.0-alpha.1",
27
27
  "sequelize": "6.35.2",
28
- "@nocobase/test": "1.8.0-beta.9",
28
+ "@nocobase/test": "1.9.0-alpha.1",
29
29
  "@formily/antd-v5": "1.2.3",
30
30
  "@formily/core": "2.3.0",
31
31
  "@formily/reactive": "2.3.0",
@@ -0,0 +1 @@
1
+ export declare const ALLOW_MAX_COLLECTIONS_COUNT = 100;
@@ -0,0 +1,36 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ var __defProp = Object.defineProperty;
11
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
+ var __getOwnPropNames = Object.getOwnPropertyNames;
13
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
14
+ var __export = (target, all) => {
15
+ for (var name in all)
16
+ __defProp(target, name, { get: all[name], enumerable: true });
17
+ };
18
+ var __copyProps = (to, from, except, desc) => {
19
+ if (from && typeof from === "object" || typeof from === "function") {
20
+ for (let key of __getOwnPropNames(from))
21
+ if (!__hasOwnProp.call(to, key) && key !== except)
22
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
+ }
24
+ return to;
25
+ };
26
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
+ var constants_exports = {};
28
+ __export(constants_exports, {
29
+ ALLOW_MAX_COLLECTIONS_COUNT: () => ALLOW_MAX_COLLECTIONS_COUNT
30
+ });
31
+ module.exports = __toCommonJS(constants_exports);
32
+ const ALLOW_MAX_COLLECTIONS_COUNT = 100;
33
+ // Annotate the CommonJS export names for ESM import in node:
34
+ 0 && (module.exports = {
35
+ ALLOW_MAX_COLLECTIONS_COUNT
36
+ });
@@ -55,6 +55,7 @@ var import_connections_roles_resources_action = require("./models/connections-ro
55
55
  var import_data_source = require("./models/data-source");
56
56
  var import_data_sources_roles_model = require("./models/data-sources-roles-model");
57
57
  var import_acl = require("@nocobase/acl");
58
+ var import_constants = require("./constants");
58
59
  const canRefreshStatus = ["loaded", "loading-failed", "reloading-failed"];
59
60
  class PluginDataSourceManagerServer extends import_server.Plugin {
60
61
  dataSourceErrors = {};
@@ -191,7 +192,8 @@ class PluginDataSourceManagerServer extends import_server.Plugin {
191
192
  this.app.db.on("dataSources.afterSave", async (model, options) => {
192
193
  if (model.changed("options") && !model.isMainRecord()) {
193
194
  model.loadIntoApplication({
194
- app: this.app
195
+ app: this.app,
196
+ refresh: true
195
197
  });
196
198
  this.sendSyncMessage(
197
199
  {
@@ -310,6 +312,41 @@ class PluginDataSourceManagerServer extends import_server.Plugin {
310
312
  }
311
313
  await next();
312
314
  });
315
+ this.app.resourceManager.use(async function verifyDatasourceCollectionsCount(ctx, next) {
316
+ var _a;
317
+ if (!ctx.action) {
318
+ await next();
319
+ return;
320
+ }
321
+ const { actionName, resourceName, params } = ctx.action;
322
+ if (resourceName === "dataSources" && (actionName === "add" || actionName === "update")) {
323
+ const { values, filterByTk: dataSourceKey } = params;
324
+ if ((_a = values.options) == null ? void 0 : _a.addAllCollections) {
325
+ let introspector = null;
326
+ const dataSourceManager = ctx.app["dataSourceManager"];
327
+ if (actionName === "add") {
328
+ const klass = dataSourceManager.factory.getClass(values.options.type);
329
+ const dataSource = new klass(dbOptions);
330
+ introspector = dataSource.collectionManager.dataSource.createDatabaseIntrospector(
331
+ dataSource.collectionManager.db
332
+ );
333
+ } else {
334
+ const dataSource = dataSourceManager.dataSources.get(dataSourceKey);
335
+ if (!dataSource) {
336
+ throw new Error(`dataSource ${dataSourceKey} not found`);
337
+ }
338
+ introspector = dataSource["introspector"];
339
+ }
340
+ const allCollections = await introspector.getCollections();
341
+ if (allCollections.length > import_constants.ALLOW_MAX_COLLECTIONS_COUNT) {
342
+ throw new Error(
343
+ `The number of collections exceeds the limit of ${import_constants.ALLOW_MAX_COLLECTIONS_COUNT}. Please remove some collections before adding new ones.`
344
+ );
345
+ }
346
+ }
347
+ }
348
+ await next();
349
+ });
313
350
  this.app.use(async function handleAppendDataSourceCollection(ctx, next) {
314
351
  await next();
315
352
  if (!ctx.action) {
@@ -11,6 +11,8 @@ declare const _default: {
11
11
  actions: {
12
12
  list(ctx: any, next: any): Promise<void>;
13
13
  update(ctx: any, next: any): Promise<void>;
14
+ all(ctx: any, next: any): Promise<void>;
15
+ add(ctx: any, next: any): Promise<void>;
14
16
  };
15
17
  };
16
18
  export default _default;
@@ -41,6 +41,8 @@ __export(data_sources_collections_exports, {
41
41
  module.exports = __toCommonJS(data_sources_collections_exports);
42
42
  var import_lodash = __toESM(require("lodash"));
43
43
  var import_database = require("@nocobase/database");
44
+ var import_lodash2 = __toESM(require("lodash"));
45
+ var import_constants = require("../constants");
44
46
  var data_sources_collections_default = {
45
47
  name: "dataSources.collections",
46
48
  actions: {
@@ -134,6 +136,87 @@ var data_sources_collections_default = {
134
136
  });
135
137
  ctx.body = dataSourceCollectionRecord.toJSON();
136
138
  await next();
139
+ },
140
+ async all(ctx, next) {
141
+ const params = ctx.action.params;
142
+ const { associatedIndex: dataSourceKey, isFirst, dbOptions } = params;
143
+ const dataSourceManager = ctx.app.dataSourceManager;
144
+ let introspector = null;
145
+ if (isFirst) {
146
+ const klass = dataSourceManager.factory.getClass(dbOptions.type);
147
+ const dataSource = new klass(dbOptions);
148
+ introspector = dataSource.collectionManager.dataSource.createDatabaseIntrospector(
149
+ dataSource.collectionManager.db
150
+ );
151
+ } else {
152
+ const dataSource = dataSourceManager.dataSources.get(dataSourceKey);
153
+ if (!dataSource) {
154
+ throw new Error(`dataSource ${dataSourceKey} not found`);
155
+ }
156
+ introspector = dataSource["introspector"];
157
+ }
158
+ const allCollections = await introspector.getCollections();
159
+ const selectedCollections = await ctx.db.getRepository("dataSourcesCollections").find({
160
+ filter: { dataSourceKey }
161
+ });
162
+ const selectedMap = import_lodash2.default.keyBy(selectedCollections, (x) => x.name);
163
+ const result = allCollections.map((collection) => {
164
+ return {
165
+ name: collection,
166
+ selected: !!selectedMap[collection]
167
+ };
168
+ });
169
+ ctx.body = result;
170
+ await next();
171
+ },
172
+ async add(ctx, next) {
173
+ const params = ctx.action.params;
174
+ const { associatedIndex: dataSourceKey, values } = params;
175
+ const collections = values.collections || [];
176
+ const dbOptions = values.dbOptions || {};
177
+ if (dbOptions.addAllCollections !== false) {
178
+ await next();
179
+ return;
180
+ }
181
+ if (collections.length > import_constants.ALLOW_MAX_COLLECTIONS_COUNT) {
182
+ throw new Error(
183
+ `The number of collections exceeds the limit of ${import_constants.ALLOW_MAX_COLLECTIONS_COUNT}. Please remove some collections before adding new ones.`
184
+ );
185
+ }
186
+ const transaction = await ctx.db.sequelize.transaction();
187
+ const repo = ctx.db.getRepository("dataSourcesCollections");
188
+ const alreadyInserted = await repo.find({
189
+ filter: {
190
+ dataSourceKey
191
+ },
192
+ transaction
193
+ });
194
+ const alreadyInsertedNames = import_lodash2.default.keyBy(alreadyInserted, (x) => x.name);
195
+ const incomingCollections = import_lodash2.default.keyBy(collections);
196
+ const toBeInserted = collections.filter((collection) => !alreadyInsertedNames[collection]);
197
+ const toBeDeleted = Object.keys(alreadyInsertedNames).filter((name) => !incomingCollections[name]);
198
+ if (toBeInserted.length > 0) {
199
+ const insertCollections = toBeInserted.map((collection) => {
200
+ return { name: collection, dataSourceKey };
201
+ });
202
+ await repo.model.bulkCreate(insertCollections, { transaction });
203
+ }
204
+ if (toBeDeleted.length > 0) {
205
+ await repo.model.destroy({
206
+ where: {
207
+ dataSourceKey,
208
+ name: toBeDeleted
209
+ },
210
+ transaction
211
+ });
212
+ }
213
+ await transaction.commit();
214
+ const dataSource = ctx.app.dataSourceManager.dataSources.get(dataSourceKey);
215
+ if (dataSource) {
216
+ await dataSource.load({ refresh: true });
217
+ }
218
+ ctx.body = true;
219
+ await next();
137
220
  }
138
221
  }
139
222
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-data-source-manager",
3
- "version": "1.8.0-beta.9",
3
+ "version": "1.9.0-alpha.1",
4
4
  "main": "dist/server/index.js",
5
5
  "displayName": "Data source manager",
6
6
  "displayName.zh-CN": "数据源管理",
@@ -17,5 +17,5 @@
17
17
  "keywords": [
18
18
  "Data model tools"
19
19
  ],
20
- "gitHead": "a3449d646c72965845f8c52e52fff9dba759c564"
20
+ "gitHead": "71ebde8a27da3c5c4d64194571804eeab6e95ce0"
21
21
  }
@@ -1,10 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- "use strict";(self.webpackChunk_nocobase_plugin_data_source_manager=self.webpackChunk_nocobase_plugin_data_source_manager||[]).push([["583"],{777:function(e,t,r){r.r(t),r.d(t,{DataSourcePermissionManager:function(){return ep},CurrentRolesContext:function(){return es}});var n,o,a,c,i=r(875),l=r(772),u=r(721),s=r(156),p=r.n(s),m=r(60),d=r(238);function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function y(e,t,r,n,o,a,c){try{var i=e[a](c),l=i.value}catch(e){r(e);return}i.done?t(l):Promise.resolve(l).then(n,o)}function b(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}var v=(0,s.createContext)(null);v.displayName="PermissionContext";var x=function(e){var t,r,n,o=(0,l.useAPIClient)(),a=(0,l.useRecord)(),c=(0,d.useTranslation)().t,i=(0,s.useContext)(es),m=i.snippets;null==m||m.forEach(function(e){i[e]=!0});var x=(t=(0,s.useState)(i),function(e){if(Array.isArray(e))return e}(t)||function(e,t){var r,n,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],c=!0,i=!1;try{for(o=o.call(e);!(c=(r=o.next()).done)&&(a.push(r.value),a.length!==t);c=!0);}catch(e){i=!0,n=e}finally{try{c||null==o.return||o.return()}finally{if(i)throw n}}return a}}(t,2)||function(e,t){if(e){if("string"==typeof e)return f(e,2);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return f(e,t)}}(t,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),g=x[0],h=x[1];return(0,s.useEffect)(function(){h(i)},[i]),p().createElement(v.Provider,{value:{currentDataSource:a,currentRecord:g,update:(r=function(e,t){return function(e,t){var r,n,o,a,c={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function i(a){return function(i){var l=[a,i];if(r)throw TypeError("Generator is already executing.");for(;c;)try{if(r=1,n&&(o=2&l[0]?n.return:l[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,l[1])).done)return o;switch(n=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return c.label++,{value:l[1],done:!1};case 5:c.label++,n=l[1],l=[0];continue;case 7:l=c.ops.pop(),c.trys.pop();continue;default:if(!(o=(o=c.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){c=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){c.label=l[1];break}if(6===l[0]&&c.label<o[1]){c.label=o[1],o=l;break}if(o&&c.label<o[2]){c.label=o[2],c.ops.push(l);break}o[2]&&c.ops.pop(),c.trys.pop();continue}l=t.call(e,c)}catch(e){l=[6,e],n=0}finally{r=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(e){switch(e.label){case 0:return[4,o.request({url:"dataSources/".concat(a.key,"/roles:update"),data:t.values,method:"post",params:{filterByTk:t.values.roleName}})];case 1:return e.sent(),h(b({},g,t.values)),u.message.success(c("Saved successfully")),[2]}})},n=function(){var e=this,t=arguments;return new Promise(function(n,o){var a=r.apply(e,t);function c(e){y(a,n,o,c,i,"next",e)}function i(e){y(a,n,o,c,i,"throw",e)}c(void 0)})},function(e,t){return n.apply(this,arguments)})}},e.children)},g=(0,s.createContext)({dataSourceKey:"main"}),h=function(e){var t=(0,s.useContext)(es),r=(0,l.useRecord)();return p().createElement(l.RecordContext_deprecated.Provider,{value:b({},t)},p().createElement(g.Provider,{value:{dataSourceKey:r.key}},p().createElement(l.SchemaComponentOptions,{scope:{dataSourceKey:r.key}},e.children)))},O=r(505);function S(e,t,r,n,o,a,c){try{var i=e[a](c),l=i.value}catch(e){r(e);return}i.done?t(l):Promise.resolve(l).then(n,o)}function P(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}function w(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}function C(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var j={name:"dataSourcesCollections",targetKey:"name",filterTargetKey:"name",fields:[{type:"integer",name:"title",interface:"input",uiSchema:{title:'{{t("Collection display name")}}',type:"number","x-component":"Input",required:!0}},{type:"string",name:"name",interface:"input",uiSchema:{title:'{{t("Collection name")}}',type:"string","x-component":"Input"}},{type:"string",name:"type",interface:"input",uiSchema:{title:'{{t("Resource type")}}',type:"string","x-component":"Select",enum:[{label:'{{t("Collection")}}',value:"collection",color:"green"},{label:'{{t("Association")}}',value:"association",color:"blue"}]}},{type:"string",name:"usingConfig",interface:"input",uiSchema:{title:'{{t("Permission policy")}}',type:"string","x-component":"Select",enum:[{label:'{{t("Individual")}}',value:"resourceAction",color:"orange"},{label:'{{t("General")}}',value:"strategy",color:"default"}]}},{type:"hasMany",name:"fields",target:"fields",collectionName:"collections",sourceKey:"name",targetKey:"name",uiSchema:{}}]},A={type:"void","x-decorator":"RoleRecordProvider",properties:C({},(0,i.uid)(),{type:"void","x-decorator":function(e){var t=(0,s.useContext)(g).dataSourceKey;console.log(e,(0,l.useRecord)().key,t);var r=w(P({},e.request),{params:w(P({},e.request.params),{filter:w(P({},e.request.params.filter),{dataSourceKey:t})})});return p().createElement(l.ResourceActionProvider,w(P({},e),{request:r}),e.children)},"x-decorator-props":{collection:j,association:{sourceKey:"name",targetKey:"name"},resourceName:"roles.dataSourcesCollections",request:{resource:"roles.dataSourcesCollections",action:"list",params:{pageSize:20,filter:{hidden:{$isFalsy:!0},dataSourceKey:"{{dataSourceKey}}"},sort:["sort"],appends:["fields"]}}},properties:(C(c={},(0,i.uid)(),{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{filter:{type:"void",title:'{{ t("Filter") }}',default:{$and:[{title:{$includes:""}},{name:{$includes:""}}]},"x-action":"filter","x-component":"Filter.Action","x-use-component-props":"cm.useFilterActionProps","x-component-props":{icon:"FilterOutlined"},"x-align":"left"}}}),C(c,"table1",{type:"void","x-uid":"input","x-component":"Table.Void","x-component-props":{rowKey:"name",useDataSource:"{{ cm.useDataSourceFromRAC }}"},properties:{column0:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{title:{type:"number","x-component":"CollectionField","x-read-pretty":!0}}},column2:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{name:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},column3:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{usingConfig:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},column4:{type:"void",title:'{{t("Actions")}}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{configure:{type:"void",title:'{{t("Configure")}}',"x-component":"Action.Link","x-component-props":{type:"primary"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{useValues:function(e){var t,r,n=(0,l.useRecord)(),o=(0,l.useActionContext)().visible,a=(0,s.useContext)(v).currentDataSource,c=(0,l.useRequest)({resource:"roles.dataSourceResources",resourceOf:n.roleName,action:"get",params:{appends:["actions","actions.scope"],filterByTk:n.name,filter:{dataSourceKey:a.key,name:n.name}}},(t=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}({},e),r=r={manual:!0},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}),t));return(0,s.useEffect)(function(){if(!n.exists)return void e.onSuccess({data:{}});o&&c.run()},[o,n.exists]),c}},title:'{{t("Configure permission")}}',properties:{usingActionsConfig:{title:'{{t("Permission policy")}}',"x-component":"Radio.Group","x-decorator":"FormItem",default:!1,enum:[{value:!1,label:'{{t("General")}}'},{value:!0,label:'{{t("Individual")}}'}],"x-reactions":{target:"actions",fulfill:{state:{hidden:"{{!$self.value}}"}}}},actions:{"x-component":"RolesResourcesActions","x-decorator":"FormItem"},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:function(){var e=(0,O.useForm)(),t=(0,l.useAPIClient)(),r=(0,l.useRecord)(),n=(0,l.useActionContext)(),o=(0,l.useResourceActionContext)().refresh,a=(0,s.useContext)(v).currentDataSource;return{run:function(){var c;return(c=function(){return function(e,t){var r,n,o,a,c={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function i(a){return function(i){var l=[a,i];if(r)throw TypeError("Generator is already executing.");for(;c;)try{if(r=1,n&&(o=2&l[0]?n.return:l[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,l[1])).done)return o;switch(n=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return c.label++,{value:l[1],done:!1};case 5:c.label++,n=l[1],l=[0];continue;case 7:l=c.ops.pop(),c.trys.pop();continue;default:if(!(o=(o=c.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){c=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){c.label=l[1];break}if(6===l[0]&&c.label<o[1]){c.label=o[1],o=l;break}if(o&&c.label<o[2]){c.label=o[2],c.ops.push(l);break}o[2]&&c.ops.pop(),c.trys.pop();continue}l=t.call(e,c)}catch(e){l=[6,e],n=0}finally{r=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(c){switch(c.label){case 0:var i,l;return[4,t.resource("roles.dataSourceResources",r.roleName)[r.exists?"update":"create"]({filterByTk:r.name,filter:{dataSourceKey:a.key,name:r.name},values:(i=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}({},e.values),l=l={name:r.name,dataSourceKey:a.key},Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(l)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(l)).forEach(function(e){Object.defineProperty(i,e,Object.getOwnPropertyDescriptor(l,e))}),i)})];case 1:return c.sent(),n.setVisible(!1),o(),[2]}})},function(){var e=this,t=arguments;return new Promise(function(r,n){var o=c.apply(e,t);function a(e){S(o,r,n,a,i,"next",e)}function i(e){S(o,r,n,a,i,"throw",e)}a(void 0)})})()}}}}}}}}}}}}}}}}}),c)})},E={name:"dataSources",filterTargetKey:"name",targetKey:"name",fields:[{type:"string",name:"displayName",interface:"input",uiSchema:{title:'{{t("Display name")}}',type:"number","x-component":"Input",required:!0}},{type:"string",name:"key",interface:"input",uiSchema:{title:'{{t("Name")}}',type:"number","x-component":"Input",required:!0}}]},k=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{type:"object",properties:{block1:{type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:E,resourceName:"dataSources",request:{resource:"dataSources",action:"list",params:{pageSize:50,showAnonymous:!0,appends:[]}}},"x-component":"CollectionProvider_deprecated","x-component-props":{collection:E},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{}},table:{type:"void","x-uid":"input","x-component":"Table.Void","x-component-props":{rowKey:"key",rowSelection:{type:"checkbox"},useDataSource:"{{ cm.useDataSourceFromRAC }}"},properties:{column1:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{displayName:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},column2:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{key:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},column4:{type:"void",title:'{{t("Actions")}}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{view:{type:"void",title:'{{t("Configure")}}',"x-component":"Action.Link","x-decorator":"ACLActionProvider","x-acl-action":"roles:update","x-component-props":{},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"PermissionProvider",title:'{{t("Configure permissions")}}',properties:{tabs1:{type:"void","x-component":"Tabs","x-component-props":{},properties:function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}({tab1:{type:"void",title:'{{t("General action permissions")}}',"x-component":"Tabs.TabPane","x-component-props":{},properties:{role:{"x-component":"RoleConfigure"}}},tab2:{type:"void",title:'{{t("Action permissions")}}',"x-component":"Tabs.TabPane","x-component-props":{},properties:{roleCollectionsSchema:A}}},e)}}}}}}}}}}}}}}}},R=(0,s.createContext)([]);R.displayName="AvailableActionsContext";var D=function(e){var t=(0,l.useRequest)({resource:"availableActions",action:"list"}),r=t.data;return t.loading?p().createElement(u.Spin,null):p().createElement(R.Provider,{value:null==r?void 0:r.data},e.children)},T=function(){return(0,s.useContext)(R)},F={designable:!1},I=function(){var e=(0,l.useRecord)(),t=(0,l.usePlugin)(m.default);return p().createElement("div",null,p().createElement(l.SchemaComponentContext.Provider,{value:F},p().createElement(D,null,p().createElement(l.SchemaComponent,{schema:k(t.getExtendedTabs()),components:{SettingCenterPermissionProvider:l.SettingCenterPermissionProvider,PermissionProvider:x},scope:{dataSourceKey:e.key}}))))},N=r(563);function K(e,t,r,n,o,a,c){try{var i=e[a](c),l=i.value}catch(e){r(e);return}i.done?t(l):Promise.resolve(l).then(n,o)}var B=function(){var e=(0,s.useContext)(v).update,t=(0,d.useTranslation)().t,r=(0,l.useRecord)().key;return p().createElement(l.SchemaComponent,{schema:{type:"void",name:"form","x-component":"Form","x-component-props":{useValues:function(e){var t=(0,l.useAPIClient)(),n=(0,s.useContext)(es);return(0,l.useRequest)(function(){return t.resource("dataSources/".concat(r,"/roles")).get({filterByTk:n.name}).then(function(e){var t,r,n=null==e||null==(t=e.data)?void 0:t.data;return null==(r=n.snippets)||r.forEach(function(e){n[e]=!0}),{data:n}})},e)},effects:function(){var t,r;(0,N.onFieldChange)("*",(t=function(t,r){return function(e,t){var r,n,o,a,c={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function i(a){return function(i){var l=[a,i];if(r)throw TypeError("Generator is already executing.");for(;c;)try{if(r=1,n&&(o=2&l[0]?n.return:l[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,l[1])).done)return o;switch(n=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return c.label++,{value:l[1],done:!1};case 5:c.label++,n=l[1],l=[0];continue;case 7:l=c.ops.pop(),c.trys.pop();continue;default:if(!(o=(o=c.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){c=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){c.label=l[1];break}if(6===l[0]&&c.label<o[1]){c.label=o[1],o=l;break}if(o&&c.label<o[2]){c.label=o[2],c.ops.push(l);break}o[2]&&c.ops.pop(),c.trys.pop();continue}l=t.call(e,c)}catch(e){l=[6,e],n=0}finally{r=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(n){switch(n.label){case 0:if(!r.modified)return[2];return[4,e(t,r)];case 1:return n.sent(),[2]}})},r=function(){var e=this,r=arguments;return new Promise(function(n,o){var a=t.apply(e,r);function c(e){K(a,n,o,c,i,"next",e)}function i(e){K(a,n,o,c,i,"throw",e)}c(void 0)})},function(e,t){return r.apply(this,arguments)}))}},properties:{"strategy.actions":{description:t("All collections use general action permissions by default; permission configured individually will override the default one."),"x-component":"StrategyActions"}}}})},V=r(632),q=r(467);function M(){var e,t,r=(e=["\n .ant-table-cell {\n > .ant-space-horizontal {\n .ant-space-item-split:has(+ .ant-space-item:empty) {\n display: none;\n }\n }\n }\n "],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return M=function(){return r},r}var _=(0,r(202).createStyles)(function(e){return(0,e.css)(M())});function z(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}function $(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}var L=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"main";return{name:"dataSources/".concat(e,"/rolesResourcesScopes"),fields:[{type:"string",name:"name",interface:"input",uiSchema:{title:'{{t("Scope name")}}',type:"string","x-component":"Input",required:!0}}]}},G=function(){var e=(0,s.useContext)(en).name,t=(0,l.useFormBlockContext)();return(0,s.useEffect)(function(){t.form.setInitialValues({resourceName:e})},[e]),{form:t.form}},U=function(e){var t=((0,l.useCollectionRecord)().data||{}).id,r=$(z({},e),{disabled:[1,2].includes(t)});return p().createElement(l.Action.Link,r)},W=function(e){var t=((0,l.useCollectionRecord)().data||{}).id,r=$(z({},e,(0,l.useDestroyActionProps)()),{disabled:[1,2].includes(t)});return p().createElement(l.Action.Link,r)},H=function(e){var t=L(e);return{type:"object",properties:{scope:{"x-component":"RecordPicker","x-component-props":{size:"small",fieldNames:{label:"name",value:"id"},multiple:!1,association:{target:"rolesResourcesScopes"},onChange:"{{ onChange }}"},properties:{selector:{type:"void",title:'{{ t("Select record") }}',"x-component":"RecordPicker.Selector","x-component-props":{className:"nb-record-picker-selector"},properties:{tableBlock:{type:"void","x-decorator":"TableSelectorProvider","x-decorator-props":{collection:t,resource:"dataSources/".concat(e,"/rolesResourcesScopes"),action:"list",params:{pageSize:20},useParams:function(){return{filter:{$or:[{resourceName:(0,s.useContext)(en).name},{resourceName:null}]}}},rowKey:"id"},"x-component":"BlockItem",properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{create:{type:"void",title:'{{ t("Add new") }}',"x-action":"create","x-component":"Action","x-component-props":{icon:"PlusOutlined",openMode:"drawer",type:"primary"},properties:{drawer:{type:"void",title:'{{ t("Add record") }}',"x-component":"Action.Container","x-component-props":{className:"nb-action-popup"},properties:{formBlock:{type:"void","x-decorator":"FormBlockProvider","x-decorator-props":{resource:"dataSources/".concat(e,"/rolesResourcesScopes"),collection:t},"x-component":"CardItem",properties:{form:{type:"void","x-component":"FormV2","x-use-component-props":G,properties:{name:{type:"string","x-component":"CollectionField","x-decorator":"FormItem"},scope:{type:"object",title:'{{t("Data scope")}}',name:"filter","x-decorator":"FormItem","x-component":(0,l.withDynamicSchemaProps)(function(e){return p().createElement(l.FlagProvider,{isVariableParsedInOtherContext:!0},p().createElement(l.Filter,e))}),"x-use-component-props":function(){var e=(0,s.useContext)(en);return{options:(0,l.useFilterFieldOptions)(e.fields)}},"x-component-props":{dynamicComponent:l.VariableInput}},actions:{type:"void","x-component":"ActionBar","x-component-props":{layout:"one-column",style:{marginTop:24}},properties:{create:{title:'{{ t("Submit") }}',"x-action":"submit","x-component":"Action","x-use-component-props":"useCreateActionProps","x-component-props":{type:"primary",htmlType:"submit"}}}}}}}}}}}}}},value:{type:"array","x-component":"TableV2.Selector","x-use-component-props":"useTableSelectorProps","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"}},properties:{column1:{type:"void","x-decorator":"TableV2.Column.Decorator","x-component":"TableV2.Column",properties:{name:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},actions:{type:"void",title:'{{ t("Actions") }}',"x-action-column":"actions","x-component":"TableV2.Column",properties:{actions:{type:"void","x-decorator":"DndContext","x-component":"Space","x-component-props":{split:"|"},properties:{edit:{type:"void",title:'{{ t("Edit") }}',"x-action":"update","x-decorator":"ACLActionProvider","x-component":U,"x-component-props":{openMode:"drawer",icon:"EditOutlined"},properties:{drawer:{type:"void",title:'{{ t("Edit record") }}',"x-component":"Action.Container","x-component-props":{className:"nb-action-popup"},properties:{formBlock:{type:"void","x-decorator":"FormBlockProvider","x-decorator-props":{resource:"dataSources/".concat(e,"/rolesResourcesScopes"),collection:t,action:"get",useParams:"{{ useParamsFromRecord }}"},"x-component":"CardItem",properties:{form:{type:"void","x-component":"FormV2","x-use-component-props":"useFormBlockProps",properties:{name:{type:"string","x-component":"CollectionField","x-decorator":"FormItem"},scope:{type:"object",title:'{{t("Data scope")}}',name:"filter","x-decorator":"FormItem","x-component":(0,l.withDynamicSchemaProps)(function(e){return p().createElement(l.FlagProvider,{isVariableParsedInOtherContext:!0},p().createElement(l.Filter,e))}),"x-use-component-props":function(){var e=(0,s.useContext)(en);return{options:(0,l.useFilterFieldOptions)(e.fields)}},"x-component-props":{dynamicComponent:l.VariableInput}},actions:{type:"void","x-component":"ActionBar","x-component-props":{layout:"one-column",style:{marginTop:24}},properties:{update:{title:'{{ t("Submit") }}',"x-action":"submit","x-component":"Action","x-use-component-props":"useUpdateActionProps","x-component-props":{type:"primary",htmlType:"submit"}}}}}}}}}}}},destroy:{title:'{{ t("Delete") }}',"x-action":"destroy","x-decorator":"ACLActionProvider","x-component-props":{icon:"DeleteOutlined",confirm:{title:"{{t('Delete record')}}",content:"{{t('Are you sure you want to delete it?')}}"}},"x-component":W}}}}}}}}},footer:{"x-component":"Action.Container.Footer","x-component-props":{},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{},properties:{submit:{title:'{{ t("Submit") }}',"x-action":"submit","x-component":"Action","x-use-component-props":"usePickActionProps","x-component-props":{type:"primary",htmlType:"submit"}}}}}}}}}}}}};function J(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var Q=(0,s.createContext)(null);Q.displayName="RolesResourcesScopesSelectedRowKeysContext";var X=function(e){var t,r=(t=(0,s.useState)([]),function(e){if(Array.isArray(e))return e}(t)||function(e,t){var r,n,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],c=!0,i=!1;try{for(o=o.call(e);!(c=(r=o.next()).done)&&(a.push(r.value),a.length!==t);c=!0);}catch(e){i=!0,n=e}finally{try{c||null==o.return||o.return()}finally{if(i)throw n}}return a}}(t,2)||function(e,t){if(e){if("string"==typeof e)return J(e,2);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return J(e,t)}}(t,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),n=r[0],o=r[1];return p().createElement(Q.Provider,{value:[n,o]},e.children)},Y=function(e){var t,r=(0,s.useMemo)(function(){return(0,N.createForm)({values:{scope:e.value}})},[]),n=H(((null==(t=(0,l.useCollectionRecord)())?void 0:t.parentRecord.data)||{}).key);return p().createElement(l.FormProvider,{form:r},p().createElement(l.SchemaComponent,{components:{RolesResourcesScopesSelectedRowKeysProvider:X},scope:{onChange:function(t){var r;null==e||null==(r=e.onChange)||r.call(e,t)}},schema:n}))};function Z(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function ee(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}function et(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}var er=function(e){var t,r={};return null==e||null==(t=e.forEach)||t.call(e,function(e){e.name&&(r[e.name]=e,r[e.name].scope=(0,q.isEmpty)(e.scope)?null:e.scope)}),r},en=(0,s.createContext)({});en.displayName="RoleResourceCollectionContext";var eo=(0,O.connect)(function(e){var t,r=_().styles,n=function(t){var r=t.map(function(e){return et(ee({},e),{scope:(0,q.isEmpty)(e.scope)?null:e.scope})});e.onChange(r)},o=(0,l.useRecord)(),a=T(),c=o.fields,i=(0,l.useCompile)(),s=(0,d.useTranslation)().t,m=er((0,O.useField)().value||[]),f=function(e,t){var r,n=null==m?void 0:m[e];return!!n&&(null==n||null==(r=n.fields)?void 0:r.includes(t))},y=a.filter(function(e){return e.allowConfigureFields}),b=null==c?void 0:c.map(function(e){var t=ee({},e),r=!0,n=!1,o=void 0;try{for(var a,c=y[Symbol.iterator]();!(r=(a=c.next()).done);r=!0){var i=a.value;t[i.name]=f(i.name,e.name)}}catch(e){n=!0,o=e}finally{try{r||null==c.return||c.return()}finally{if(n)throw o}}return t}),v=function(e){if(m[e])delete m[e];else{var t;m[e]={name:e,fields:null==c||null==(t=c.map)?void 0:t.call(c,function(e){return e.name})}}n(Object.values(m))},x=function(e,t){m[e]||v(e),m[e].scope=t,n(Object.values(m))},g={},h=!0,S=!1,P=void 0;try{for(var w,C=y[Symbol.iterator]();!(h=(w=C.next()).done);h=!0){var j,A,E=w.value;g[E.name]=(null==c?void 0:c.length)===(null==m||null==(A=m[E.name])||null==(j=A.fields)?void 0:j.length)}}catch(e){S=!0,P=e}finally{try{h||null==C.return||C.return()}finally{if(S)throw P}}return p().createElement("div",null,p().createElement(en.Provider,{value:o},p().createElement(V.FormLayout,{layout:"vertical"},p().createElement(V.FormItem,{label:s("Action permission")},p().createElement(u.Table,{className:r,size:"small",pagination:!1,columns:[{dataIndex:"displayName",title:s("Action display name"),render:function(e){return i(e)}},{dataIndex:"onNewRecord",title:s("Action type"),render:function(e){return e?p().createElement(u.Tag,{color:"green"},s("Action on new records")):p().createElement(u.Tag,{color:"geekblue"},s("Action on existing records"))}},{dataIndex:"enabled",title:s("Allow"),render:function(e,t){return p().createElement(u.Checkbox,{checked:e,onChange:function(){v(t.name)}})}},{dataIndex:"scope",title:s("Data scope"),render:function(e,t){return!t.onNewRecord&&p().createElement(Y,{value:e,onChange:function(e){x(t.name,e)}})}}],dataSource:null==a?void 0:a.map(function(e){var t=!1,r=null;return m[e.name]&&(t=!0,e.onNewRecord||(r=m[e.name].scope)),et(ee({},e),{enabled:t,scope:r})})})),p().createElement(V.FormItem,{label:s("Field permission")},p().createElement(u.Table,{className:r,pagination:!1,dataSource:b,columns:[{dataIndex:["uiSchema","title"],title:s("Field display name"),render:function(e,t){return i(e)||t.name}}].concat(function(e){if(Array.isArray(e))return Z(e)}(t=y.map(function(e){var t=null==g?void 0:g[e.name];return{dataIndex:e.name,title:p().createElement(p().Fragment,null,p().createElement(u.Checkbox,{checked:t,onChange:function(){var r,o=m[e.name]||{name:e.name};t?o.fields=[]:o.fields=null==c||null==(r=c.map)?void 0:r.call(c,function(e){return e.name}),m[e.name]=o,n(Object.values(m))}}),i(e.displayName)),render:function(t,r){return p().createElement(u.Checkbox,{checked:t,onChange:function(){var o=m[e.name]||{name:e.name},a=o.fields||[];if(t){var c=a.indexOf(r.name);a.splice(c,1)}else a.push(r.name);o.fields=a,m[e.name]=o,n(Object.values(m))}})}}}))||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(t)||function(e,t){if(e){if("string"==typeof e)return Z(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Z(e,t)}}(t)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())})))))});function ea(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}var ec=function(e){if(!e)return{};var t,r={};return null==e||null==(t=e.forEach)||t.call(e,function(e){var t,n=(t=e.split(":"),function(e){if(Array.isArray(e))return e}(t)||function(e,t){var r,n,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],c=!0,i=!1;try{for(o=o.call(e);!(c=(r=o.next()).done)&&(a.push(r.value),a.length!==t);c=!0);}catch(e){i=!0,n=e}finally{try{c||null==o.return||o.return()}finally{if(i)throw n}}return a}}(t,2)||function(e,t){if(e){if("string"==typeof e)return ea(e,2);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ea(e,t)}}(t,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),o=n[0],a=n[1];r[o]=a||"all"}),r},ei=function(e){var t=[];for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var n=e[r];"all"===n?t.push(r):t.push("".concat(r,":").concat(n))}return t},el=(0,O.connect)(function(e){var t=e.onChange,r=T(),n=(0,l.useCompile)(),o=(0,d.useTranslation)().t,a=ec((0,O.useField)().value);return p().createElement("div",null,p().createElement(u.Table,{size:"small",pagination:!1,rowKey:"name",columns:[{dataIndex:"displayName",title:o("Action display name"),render:function(e){return n(e)}},{dataIndex:"onNewRecord",title:o("Action type"),render:function(e){return e?p().createElement(u.Tag,{color:"green"},o("Action on new records")):p().createElement(u.Tag,{color:"geekblue"},o("Action on existing records"))}},{dataIndex:"enabled",title:o("Allow"),render:function(e,r){return p().createElement(u.Checkbox,{checked:e,onChange:function(n){e?delete a[r.name]:a[r.name]="all",t(ei(a))}})}},{dataIndex:"scope",title:o("Data scope"),render:function(e,r){return!r.onNewRecord&&p().createElement(u.Select,{"data-testid":"select-data-scope",popupMatchSelectWidth:!1,size:"small",value:e,options:[{label:o("All records"),value:"all"},{label:o("Own records"),value:"own"}],onChange:function(e){a[r.name]=e,t(ei(a))}})}}],dataSource:null==r?void 0:r.map(function(e){var t,r,n="all",o=!1;return a[e.name]&&(o=!0,n=a[e.name]),t=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}({},e),r=r={enabled:o,scope:n},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r.push.apply(r,n)}return r})(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}),t})}))}),eu={type:"object",properties:(n={},o=(0,i.uid)(),a={"x-component":"DataSourceTable"},o in n?Object.defineProperty(n,o,{value:a,enumerable:!0,configurable:!0,writable:!0}):n[o]=a,n)},es=(0,s.createContext)({});es.displayName="CurrentRolesContext";var ep=function(e){var t=e.role;return p().createElement(u.Card,{"data-testid":"acl-pane-card",bordered:!1},p().createElement(es.Provider,{value:t},p().createElement(l.SchemaComponent,{components:{MenuConfigure:l.MenuConfigure,RoleConfigure:B,RolesResourcesActions:eo,DataSourceTable:I,StrategyActions:el,SettingsCenterConfigure:l.SettingsCenterConfigure,SettingCenterProvider:l.SettingCenterProvider,ResourceActionProvider:l.ResourceActionProvider,RoleRecordProvider:h},schema:eu})))}}}]);
@@ -1,10 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- "use strict";(self.webpackChunk_nocobase_plugin_data_source_manager=self.webpackChunk_nocobase_plugin_data_source_manager||[]).push([["210"],{186:function(e,t,n){n.r(t),n.d(t,{DatabaseConnectionManagerPane:function(){return R}});var r=n(875),o=n(772),a=n(721),i=n(156),c=n.n(i),l=n(238),u=n(60),s=n(421),p=n(382),d=n(482),f=n(212),y=n(573);function m(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function b(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],i=!0,c=!1;try{for(o=o.call(e);!(i=(n=o.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){c=!0,r=e}finally{try{i||null==o.return||o.return()}finally{if(c)throw r}}return a}}(e,t)||h(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(e){return function(e){if(Array.isArray(e))return m(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||h(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function h(e,t){if(e){if("string"==typeof e)return m(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return m(e,t)}}var g=function(){var e=b((0,i.useState)({}),2),t=e[0],n=e[1],s=(0,o.usePlugin)(u.default),p=(0,o.useCompile)(),m=b((0,i.useState)(!1),2),h=m[0],g=m[1],x=(0,l.useTranslation)().t,A=b((0,i.useState)(null),2),C=A[0],S=A[1],k=(0,o.useAPIClient)();return c().createElement("div",null,c().createElement(o.ActionContext.Provider,{value:{visible:h,setVisible:g}},c().createElement(a.Dropdown,{menu:{onClick:function(e){if("__empty__"!==e.key){var t,o,a,i=s.types.get(e.key);S(e.key),g(!0),n({type:"object",properties:(t={},o=(0,r.uid)(),a={type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{initialValue:{type:e.key,key:"d_".concat((0,r.uid)())}},title:p("{{t('Add new')}}")+" - "+p(i.label),properties:{body:{type:"void","x-component":i.DataSourceSettingsForm},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{testConnection:{title:'{{ t("Test Connection",{ ns: "'.concat(y.A7,'" }) }}'),"x-component":"Action","x-component-props":{useAction:"{{ useTestConnectionAction }}"},"x-hidden":null==i?void 0:i.disableTestConnection},cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ cm.useCreateAction }}",actionCallback:"{{ dataSourceCreateCallback }}"}}}}}},o in t?Object.defineProperty(t,o,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[o]=a,t)})}},items:[s.types.size?null:{key:"__empty__",label:c().createElement(a.Empty,{image:a.Empty.PRESENTED_IMAGE_SIMPLE,description:c().createElement(c().Fragment,null,x("No external data source plugin installed",{ns:y.A7}),c().createElement("br",null)," ",c().createElement("a",{target:"_blank",href:"zh-CN"===k.auth.locale?"https://docs-cn.nocobase.com/handbook/data-source-manager":"https://docs.nocobase.com/handbook/data-source-manager",rel:"noreferrer"},x("View documentation",{ns:y.A7})))})}].filter(Boolean).concat(v(s.types.keys()).map(function(e){var t=s.types.get(e);return{key:e,label:p(null==t?void 0:t.label)}}))}},c().createElement(a.Button,{type:"primary",icon:c().createElement(d.PlusOutlined,null)},x("Add new")," ",c().createElement(d.DownOutlined,null))),c().createElement(o.SchemaComponent,{scope:{createOnly:!1,useTestConnectionAction:f.useTestConnectionAction,dialect:C,useDialectDataSource:function(e){e.dataSource=v(s.types.keys()).map(function(e){var t=s.types.get(e);return{value:t.name,label:p(t.label)}})}},schema:t})))},x=n(505);function A(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function C(e,t,n,r,o,a,i){try{var c=e[a](i),l=c.value}catch(e){n(e);return}c.done?t(l):Promise.resolve(l).then(r,o)}function S(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],i=!0,c=!1;try{for(o=o.call(e);!(i=(n=o.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){c=!0,r=e}finally{try{i||null==o.return||o.return()}finally{if(c)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return A(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return A(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var k=function(){var e=(0,o.useRecord)(),t=S((0,i.useState)({}),2),n=t[0],a=t[1],s=(0,o.usePlugin)(u.default),p=(0,o.useCompile)(),d=S((0,i.useState)(!1),2),f=d[0],m=d[1],b=(0,l.useTranslation)().t,v=(0,o.useDataSourceManager)();return c().createElement("div",null,c().createElement(o.ActionContext.Provider,{value:{visible:f,setVisible:m}},"main"!==e.key&&c().createElement("a",{onClick:function(){m(!0);var t,n,o,i=s.types.get(e.type);a({type:"object",properties:(t={},n=(0,r.uid)(),o={type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{initialValue:e},title:p("{{t('Edit')}}")+" - "+p(e.displayName),properties:{body:{type:"void","x-component":i.DataSourceSettingsForm},footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},testConnectiion:{title:'{{ t("Test Connection",{ ns: "'.concat(y.A7,'" }) }}'),"x-component":"Action","x-component-props":{useAction:"{{ useTestConnectionAction }}"},"x-hidden":null==i?void 0:i.disableTestConnection},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useUpdateAction }}"}}}}}},n in t?Object.defineProperty(t,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[n]=o,t)})}},b("Edit")),c().createElement(o.SchemaComponent,{scope:{createOnly:!0,useUpdateAction:function(){var e=(0,x.useField)(),t=(0,x.useForm)(),n=(0,o.useActionContext)(),r=(0,o.useResourceActionContext)().refresh,a=(0,o.useResourceContext)().resource,i=(0,o.useRecord)().key;return{run:function(){var o;return(o=function(){return function(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(a){return function(c){var l=[a,c];if(n)throw TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(o){switch(o.label){case 0:return[4,t.submit()];case 1:o.sent(),e.data=e.data||{},e.data.loading=!0,o.label=2;case 2:return o.trys.push([2,5,6,7]),[4,a.update({filterByTk:i,values:t.values})];case 3:return o.sent(),n.setVisible(!1),v.getDataSource(i).setOptions(t.values),v.getDataSource(i).reload(),[4,t.reset()];case 4:return o.sent(),r(),[3,7];case 5:return console.log(o.sent()),[3,7];case 6:return e.data.loading=!1,[7];case 7:return[2]}})},function(){var e=this,t=arguments;return new Promise(function(n,r){var a=o.apply(e,t);function i(e){C(a,n,r,i,c,"next",e)}function c(e){C(a,n,r,i,c,"throw",e)}i(void 0)})})()}}}},schema:n})))},w=n(964),D=n(128),E=function(e){var t=e.key,n=e.type;return"/admin/settings/data-source-manager/".concat(t,"/collections?type=").concat(n)};function T(){var e,t,n=(e=["\n .ant-btn-link {\n &:hover {\n color: rgba(0, 0, 0, 0.25) !important;\n }\n }\n "],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return T=function(){return n},n}var P=function(){var e=(0,o.useRecord)(),t=(0,D.useNavigate)(),n=(0,l.useTranslation)().t;return c().createElement("div",{className:e.enabled?void 0:(0,w.css)(T())},c().createElement(a.Button,{type:"link",style:{padding:"0px"},disabled:!e.enabled,onClick:function(){t(E(e))},role:"button","aria-label":"".concat(null==e?void 0:e.key,"-Configure")},n("Configure")))};function O(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function j(e,t,n,r,o,a,i){try{var c=e[a](i),l=c.value}catch(e){n(e);return}c.done?t(l):Promise.resolve(l).then(r,o)}function _(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){j(a,r,o,i,c,"next",e)}function c(e){j(a,r,o,i,c,"throw",e)}i(void 0)})}}function I(e){return function(e){if(Array.isArray(e))return O(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return O(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return O(e,t)}}(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function F(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(a){return function(c){var l=[a,c];if(n)throw TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}var R=function(){var e=(0,l.useTranslation)().t,t=(0,o.usePlugin)(u.default),n=I(t.types.keys()).map(function(n){var r=t.types.get(n);return{value:n,label:e(null==r?void 0:r.label)}}).concat([{value:"main",label:e("Main")}]),d=(0,o.useDataSourceManager)(),f=c().useRef([]);(0,i.useEffect)(function(){return function(){d.getDataSources().forEach(function(e){f.current.includes(e.key)&&e.reload()})}},[f]);var y=(0,i.useCallback)(function(e){d.removeDataSources(e)},[d]),m=(0,i.useCallback)(function(e){d.addDataSource(p.F,e),f.current=I(f.current).concat([e.key])},[]);return c().createElement(a.Card,{bordered:!1},c().createElement(o.SchemaComponent,{components:{CreateDatabaseConnectAction:g,EditDatabaseConnectionAction:k,ViewDatabaseConnectionAction:P},scope:{useNewId:function(e){return"".concat(e).concat((0,r.uid)())},types:n,useRefreshActionProps:function(){var e=(0,o.useResourceActionContext)();return{onClick:function(){return _(function(){var t,n,r,o,a;return F(this,function(i){switch(i.label){case 0:if(!(null==(r=null==e||null==(t=e.data)?void 0:t.data.filter(function(e){return"loaded"!==e.status}))?void 0:r.length))return[3,2];return o=d.getDataSources(),a=r.map(function(e){return e.key}),[4,Promise.all(o.filter(function(e){return a.includes(e.key)}).map(function(e){return e.reload()}))];case 1:i.sent(),i.label=2;case 2:return null==e||null==(n=e.refresh)||n.call(e),[2]}})})()}}},useDestroyAction:function(){var e=(0,o.useResourceActionContext)().refresh,t=(0,o.useResourceContext)().resource,n=(0,o.useRecord)().key;return{run:function(){return _(function(){return F(this,function(r){switch(r.label){case 0:return[4,t.destroy({filterByTk:n})];case 1:return r.sent(),y([n]),e(),[2]}})})()}}},dataSourceDeleteCallback:y,dataSourceCreateCallback:m,useIsAbleDelete:function(e){e.visible="main"!==(0,o.useRecord)().key}},schema:s.j}))}},212:function(e,t,n){n.r(t),n.d(t,{useCreateDatabaseServer:function(){return d},useTestConnectionAction:function(){return f}});var r=n(505),o=n(721),a=n(238),i=n(772),c=n(573);function l(e,t,n,r,o,a,i){try{var c=e[a](i),l=c.value}catch(e){n(e);return}c.done?t(l):Promise.resolve(l).then(r,o)}function u(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){l(a,r,o,i,c,"next",e)}function c(e){l(a,r,o,i,c,"throw",e)}i(void 0)})}}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function p(e,t){var n,r,o,a,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return a={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(a){return function(c){var l=[a,c];if(n)throw TypeError("Generator is already executing.");for(;i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}var d=function(e){var t=(0,r.useForm)(),n=(0,i.useActionContext)(),c=(0,i.useAPIClient)(),l=(0,a.useTranslation)().t,d=(0,r.useField)();return d.data=d.data||{},{run:function(){return u(function(){var r,a;return p(this,function(i){switch(i.label){case 0:return[4,t.submit()];case 1:i.sent(),i.label=2;case 2:return i.trys.push([2,5,,6]),d.data.loading=!0,[4,c.resource("databaseServers").create({values:s({},t.values)})];case 3:return r=i.sent().data,d.data.loading=!1,n.setVisible(!1),[4,t.reset()];case 4:return i.sent(),null==e||e(null==r?void 0:r.data),o.message.success(l("Saved successfully")),[3,6];case 5:return a=i.sent(),d.data.loading=!1,console.log(a),[3,6];case 6:return[2]}})})()}}},f=function(){var e=(0,r.useForm)(),t=(0,i.useAPIClient)(),n=(0,a.useTranslation)().t,l=(0,r.useField)();return l.data=l.data||{},{run:function(){return u(function(){var r;return p(this,function(a){switch(a.label){case 0:return[4,e.submit()];case 1:a.sent(),a.label=2;case 2:return a.trys.push([2,4,,5]),l.data.loading=!0,[4,t.resource("dataSources").testConnection({values:s({},e.values)})];case 3:return a.sent(),l.data.loading=!1,o.message.success(n("Connection successful",{ns:c.A7})),[3,5];case 4:return r=a.sent(),l.data.loading=!1,console.log(r),[3,5];case 5:return[2]}})})()}}}},421:function(e,t,n){n.d(t,{$:function(){return l},j:function(){return s}});var r,o,a,i=n(875),c=n(573),l=[{value:"loading",label:'{{t("Loading",{ns:"'.concat(c.A7,'"})}}'),color:"orange"},{value:"loading-failed",label:'{{t("Failed",{ns:"'.concat(c.A7,'"})}}'),color:"red"},{value:"loaded",label:'{{t("Loaded",{ns:"'.concat(c.A7,'"})}}'),color:"green"},{value:"reloading",label:'{{t("Reloading",{ns:"'.concat(c.A7,'"})}}'),color:"orange"}],u={name:"collections-"+(0,i.uid)(),fields:[{type:"string",name:"key",interface:"input",uiSchema:{title:'{{t("Data source name",{ ns: "'.concat(c.A7,'" })}}'),type:"string","x-component":"Input",required:!0}},{type:"string",name:"displayName",interface:"input",uiSchema:{title:'{{t("Data source display name",{ ns: "'.concat(c.A7,'" })}}'),type:"string","x-component":"Input",required:!0}},{type:"string",name:"type",interface:"select",uiSchema:{title:'{{t("Type", { ns: "'.concat(c.A7,'" })}}'),type:"string","x-component":"Select",enum:"{{types}}"}},{type:"string",name:"status",interface:"select",uiSchema:{title:'{{t("Status", { ns: "'.concat(c.A7,'" })}}'),type:"string","x-component":"Select",enum:l}},{type:"boolean",name:"enabled",uiSchema:{type:"boolean",title:'{{t("Enabled")}}',"x-component":"Checkbox"}}]},s={type:"object",properties:(r={},o=(0,i.uid)(),a={type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:u,resourceName:"dataSources",request:{resource:"dataSources",action:"list",params:{pageSize:50,appends:[]}}},"x-component":"CollectionProvider_deprecated","x-component-props":{collection:u},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{refresh:{type:"void",title:'{{ t("Refresh") }}',"x-component":"Action","x-use-component-props":"useRefreshActionProps","x-component-props":{icon:"ReloadOutlined"}},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action","x-component-props":{icon:"DeleteOutlined",useAction:"{{ cm.useBulkDestroyAction }}",confirm:{title:"{{t('Delete')}}",content:"{{t('Are you sure you want to delete it?')}}"},actionCallback:"{{ dataSourceDeleteCallback }}"}},create:{type:"void",title:'{{t("Add new")}}',"x-component":"CreateDatabaseConnectAction","x-component-props":{type:"primary"}}}},table:{type:"void","x-uid":"input","x-component":"Table.Void","x-component-props":{rowKey:"key",rowSelection:{type:"checkbox"},useDataSource:"{{ cm.useDataSourceFromRAC }}"},properties:{key:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{key:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},displayName:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{displayName:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},type:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{type:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},status:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{status:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},enabled:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{enabled:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},actions:{type:"void",title:'{{t("Actions")}}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{},properties:{view:{type:"void",title:'{{t("View")}}',"x-component":"ViewDatabaseConnectionAction","x-component-props":{type:"primary"}},update:{type:"void",title:'{{t("Edit")}}',"x-component":"EditDatabaseConnectionAction","x-component-props":{type:"primary"},"x-reactions":["{{useIsAbleDelete($self)}}"]},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action.Link","x-component-props":{confirm:{title:'{{t("Delete")}}',content:'{{t("Are you sure you want to delete it?")}}'},useAction:"{{useDestroyAction}}"},"x-reactions":["{{useIsAbleDelete($self)}}"]}}}}}}}}},o in r?Object.defineProperty(r,o,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[o]=a,r)}}}]);
@@ -1,10 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- "use strict";(self.webpackChunk_nocobase_plugin_data_source_manager=self.webpackChunk_nocobase_plugin_data_source_manager||[]).push([["721"],{947:function(e,t,n){n.r(t),n.d(t,{DataSourceContext:function(){return s},DatabaseConnectionProvider:function(){return l}});var r=n(772),a=n(156),o=n.n(a),u=n(212);function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var s=(0,a.createContext)(null);s.displayName="DataSourceContext";var l=function(e){var t,n=(t=(0,a.useState)(null),function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n,r,a=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=a){var o=[],u=!0,c=!1;try{for(a=a.call(e);!(u=(n=a.next()).done)&&(o.push(n.value),o.length!==t);u=!0);}catch(e){c=!0,r=e}finally{try{u||null==a.return||a.return()}finally{if(c)throw r}}return o}}(t,2)||function(e,t){if(e){if("string"==typeof e)return c(e,2);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return c(e,t)}}(t,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),l=n[0],i=n[1];return o().createElement(s.Provider,{value:{dataSource:l,setDataSource:i}},o().createElement(r.SchemaComponentOptions,{scope:u,components:{}},e.children))}},212:function(e,t,n){n.r(t),n.d(t,{useCreateDatabaseServer:function(){return d},useTestConnectionAction:function(){return b}});var r=n(505),a=n(721),o=n(238),u=n(772),c=n(573);function s(e,t,n,r,a,o,u){try{var c=e[o](u),s=c.value}catch(e){n(e);return}c.done?t(s):Promise.resolve(s).then(r,a)}function l(e){return function(){var t=this,n=arguments;return new Promise(function(r,a){var o=e.apply(t,n);function u(e){s(o,r,a,u,c,"next",e)}function c(e){s(o,r,a,u,c,"throw",e)}u(void 0)})}}function i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function f(e,t){var n,r,a,o,u={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function c(o){return function(c){var s=[o,c];if(n)throw TypeError("Generator is already executing.");for(;u;)try{if(n=1,r&&(a=2&s[0]?r.return:s[0]?r.throw||((a=r.return)&&a.call(r),0):r.next)&&!(a=a.call(r,s[1])).done)return a;switch(r=0,a&&(s=[2&s[0],a.value]),s[0]){case 0:case 1:a=s;break;case 4:return u.label++,{value:s[1],done:!1};case 5:u.label++,r=s[1],s=[0];continue;case 7:s=u.ops.pop(),u.trys.pop();continue;default:if(!(a=(a=u.trys).length>0&&a[a.length-1])&&(6===s[0]||2===s[0])){u=0;continue}if(3===s[0]&&(!a||s[1]>a[0]&&s[1]<a[3])){u.label=s[1];break}if(6===s[0]&&u.label<a[1]){u.label=a[1],a=s;break}if(a&&u.label<a[2]){u.label=a[2],u.ops.push(s);break}a[2]&&u.ops.pop(),u.trys.pop();continue}s=t.call(e,u)}catch(e){s=[6,e],r=0}finally{n=a=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}}}var d=function(e){var t=(0,r.useForm)(),n=(0,u.useActionContext)(),c=(0,u.useAPIClient)(),s=(0,o.useTranslation)().t,d=(0,r.useField)();return d.data=d.data||{},{run:function(){return l(function(){var r,o;return f(this,function(u){switch(u.label){case 0:return[4,t.submit()];case 1:u.sent(),u.label=2;case 2:return u.trys.push([2,5,,6]),d.data.loading=!0,[4,c.resource("databaseServers").create({values:i({},t.values)})];case 3:return r=u.sent().data,d.data.loading=!1,n.setVisible(!1),[4,t.reset()];case 4:return u.sent(),null==e||e(null==r?void 0:r.data),a.message.success(s("Saved successfully")),[3,6];case 5:return o=u.sent(),d.data.loading=!1,console.log(o),[3,6];case 6:return[2]}})})()}}},b=function(){var e=(0,r.useForm)(),t=(0,u.useAPIClient)(),n=(0,o.useTranslation)().t,s=(0,r.useField)();return s.data=s.data||{},{run:function(){return l(function(){var r;return f(this,function(o){switch(o.label){case 0:return[4,e.submit()];case 1:o.sent(),o.label=2;case 2:return o.trys.push([2,4,,5]),s.data.loading=!0,[4,t.resource("dataSources").testConnection({values:i({},e.values)})];case 3:return o.sent(),s.data.loading=!1,a.message.success(n("Connection successful",{ns:c.A7})),[3,5];case 4:return r=o.sent(),s.data.loading=!1,console.log(r),[3,5];case 5:return[2]}})})()}}}}}]);
@@ -1,10 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- "use strict";(self.webpackChunk_nocobase_plugin_data_source_manager=self.webpackChunk_nocobase_plugin_data_source_manager||[]).push([["927"],{947:function(e,t,n){n.r(t),n.d(t,{DataSourceContext:function(){return l},DatabaseConnectionProvider:function(){return u}});var o=n(772),r=n(156),a=n.n(r),c=n(212);function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n<t;n++)o[n]=e[n];return o}var l=(0,r.createContext)(null);l.displayName="DataSourceContext";var u=function(e){var t,n=(t=(0,r.useState)(null),function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n,o,r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var a=[],c=!0,i=!1;try{for(r=r.call(e);!(c=(n=r.next()).done)&&(a.push(n.value),a.length!==t);c=!0);}catch(e){i=!0,o=e}finally{try{c||null==r.return||r.return()}finally{if(i)throw o}}return a}}(t,2)||function(e,t){if(e){if("string"==typeof e)return i(e,2);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return i(e,t)}}(t,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),u=n[0],s=n[1];return a().createElement(l.Provider,{value:{dataSource:u,setDataSource:s}},a().createElement(o.SchemaComponentOptions,{scope:c,components:{}},e.children))}},580:function(e,t,n){n.r(t),n.d(t,{BreadcumbTitle:function(){return d}});var o=n(482),r=n(772),a=n(721),c=n(156),i=n.n(c),l=n(128),u=n(947),s=n(573),p=n(421),d=function(){var e=(0,r.useApp)(),t=(0,l.useParams)().name,n=(0,r.useCompile)(),d=(0,r.useDataSourceManager)(),m=(d.getDataSource(t)||{}).displayName,y=(0,c.useContext)(u.DataSourceContext).dataSource,f=(0,c.useMemo)(function(){return y&&(null==y?void 0:y.name)===t?y:d.getDataSource(t)},[y,t]),b=(0,c.useMemo)(function(){var t=null==f?void 0:f.status,o=p.$.find(function(e){return e.value===t}),r=[{title:i().createElement(l.Link,{to:e.pluginSettingsManager.getRoutePath(s.A7)},(0,s.KQ)("Data source manager"))}];return f&&r.push({title:i().createElement(a.Space,null,i().createElement("span",null,n(m)),t&&i().createElement(a.Tag,{key:t,color:null==o?void 0:o.color},n(null==o?void 0:o.label)))}),r},[f]);return i().createElement(a.Breadcrumb,{separator:i().createElement(o.RightOutlined,null),items:b})}},212:function(e,t,n){n.r(t),n.d(t,{useCreateDatabaseServer:function(){return d},useTestConnectionAction:function(){return m}});var o=n(505),r=n(721),a=n(238),c=n(772),i=n(573);function l(e,t,n,o,r,a,c){try{var i=e[a](c),l=i.value}catch(e){n(e);return}i.done?t(l):Promise.resolve(l).then(o,r)}function u(e){return function(){var t=this,n=arguments;return new Promise(function(o,r){var a=e.apply(t,n);function c(e){l(a,o,r,c,i,"next",e)}function i(e){l(a,o,r,c,i,"throw",e)}c(void 0)})}}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(t){var o;o=n[t],t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o})}return e}function p(e,t){var n,o,r,a,c={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function i(a){return function(i){var l=[a,i];if(n)throw TypeError("Generator is already executing.");for(;c;)try{if(n=1,o&&(r=2&l[0]?o.return:l[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,l[1])).done)return r;switch(o=0,r&&(l=[2&l[0],r.value]),l[0]){case 0:case 1:r=l;break;case 4:return c.label++,{value:l[1],done:!1};case 5:c.label++,o=l[1],l=[0];continue;case 7:l=c.ops.pop(),c.trys.pop();continue;default:if(!(r=(r=c.trys).length>0&&r[r.length-1])&&(6===l[0]||2===l[0])){c=0;continue}if(3===l[0]&&(!r||l[1]>r[0]&&l[1]<r[3])){c.label=l[1];break}if(6===l[0]&&c.label<r[1]){c.label=r[1],r=l;break}if(r&&c.label<r[2]){c.label=r[2],c.ops.push(l);break}r[2]&&c.ops.pop(),c.trys.pop();continue}l=t.call(e,c)}catch(e){l=[6,e],o=0}finally{n=r=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}var d=function(e){var t=(0,o.useForm)(),n=(0,c.useActionContext)(),i=(0,c.useAPIClient)(),l=(0,a.useTranslation)().t,d=(0,o.useField)();return d.data=d.data||{},{run:function(){return u(function(){var o,a;return p(this,function(c){switch(c.label){case 0:return[4,t.submit()];case 1:c.sent(),c.label=2;case 2:return c.trys.push([2,5,,6]),d.data.loading=!0,[4,i.resource("databaseServers").create({values:s({},t.values)})];case 3:return o=c.sent().data,d.data.loading=!1,n.setVisible(!1),[4,t.reset()];case 4:return c.sent(),null==e||e(null==o?void 0:o.data),r.message.success(l("Saved successfully")),[3,6];case 5:return a=c.sent(),d.data.loading=!1,console.log(a),[3,6];case 6:return[2]}})})()}}},m=function(){var e=(0,o.useForm)(),t=(0,c.useAPIClient)(),n=(0,a.useTranslation)().t,l=(0,o.useField)();return l.data=l.data||{},{run:function(){return u(function(){var o;return p(this,function(a){switch(a.label){case 0:return[4,e.submit()];case 1:a.sent(),a.label=2;case 2:return a.trys.push([2,4,,5]),l.data.loading=!0,[4,t.resource("dataSources").testConnection({values:s({},e.values)})];case 3:return a.sent(),l.data.loading=!1,r.message.success(n("Connection successful",{ns:i.A7})),[3,5];case 4:return o=a.sent(),l.data.loading=!1,console.log(o),[3,5];case 5:return[2]}})})()}}}},421:function(e,t,n){n.d(t,{$:function(){return l},j:function(){return s}});var o,r,a,c=n(875),i=n(573),l=[{value:"loading",label:'{{t("Loading",{ns:"'.concat(i.A7,'"})}}'),color:"orange"},{value:"loading-failed",label:'{{t("Failed",{ns:"'.concat(i.A7,'"})}}'),color:"red"},{value:"loaded",label:'{{t("Loaded",{ns:"'.concat(i.A7,'"})}}'),color:"green"},{value:"reloading",label:'{{t("Reloading",{ns:"'.concat(i.A7,'"})}}'),color:"orange"}],u={name:"collections-"+(0,c.uid)(),fields:[{type:"string",name:"key",interface:"input",uiSchema:{title:'{{t("Data source name",{ ns: "'.concat(i.A7,'" })}}'),type:"string","x-component":"Input",required:!0}},{type:"string",name:"displayName",interface:"input",uiSchema:{title:'{{t("Data source display name",{ ns: "'.concat(i.A7,'" })}}'),type:"string","x-component":"Input",required:!0}},{type:"string",name:"type",interface:"select",uiSchema:{title:'{{t("Type", { ns: "'.concat(i.A7,'" })}}'),type:"string","x-component":"Select",enum:"{{types}}"}},{type:"string",name:"status",interface:"select",uiSchema:{title:'{{t("Status", { ns: "'.concat(i.A7,'" })}}'),type:"string","x-component":"Select",enum:l}},{type:"boolean",name:"enabled",uiSchema:{type:"boolean",title:'{{t("Enabled")}}',"x-component":"Checkbox"}}]},s={type:"object",properties:(o={},r=(0,c.uid)(),a={type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:u,resourceName:"dataSources",request:{resource:"dataSources",action:"list",params:{pageSize:50,appends:[]}}},"x-component":"CollectionProvider_deprecated","x-component-props":{collection:u},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{refresh:{type:"void",title:'{{ t("Refresh") }}',"x-component":"Action","x-use-component-props":"useRefreshActionProps","x-component-props":{icon:"ReloadOutlined"}},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action","x-component-props":{icon:"DeleteOutlined",useAction:"{{ cm.useBulkDestroyAction }}",confirm:{title:"{{t('Delete')}}",content:"{{t('Are you sure you want to delete it?')}}"},actionCallback:"{{ dataSourceDeleteCallback }}"}},create:{type:"void",title:'{{t("Add new")}}',"x-component":"CreateDatabaseConnectAction","x-component-props":{type:"primary"}}}},table:{type:"void","x-uid":"input","x-component":"Table.Void","x-component-props":{rowKey:"key",rowSelection:{type:"checkbox"},useDataSource:"{{ cm.useDataSourceFromRAC }}"},properties:{key:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{key:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},displayName:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{displayName:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},type:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{type:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},status:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{status:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},enabled:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{enabled:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},actions:{type:"void",title:'{{t("Actions")}}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{},properties:{view:{type:"void",title:'{{t("View")}}',"x-component":"ViewDatabaseConnectionAction","x-component-props":{type:"primary"}},update:{type:"void",title:'{{t("Edit")}}',"x-component":"EditDatabaseConnectionAction","x-component-props":{type:"primary"},"x-reactions":["{{useIsAbleDelete($self)}}"]},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action.Link","x-component-props":{confirm:{title:'{{t("Delete")}}',content:'{{t("Are you sure you want to delete it?")}}'},useAction:"{{useDestroyAction}}"},"x-reactions":["{{useIsAbleDelete($self)}}"]}}}}}}}}},r in o?Object.defineProperty(o,r,{value:a,enumerable:!0,configurable:!0,writable:!0}):o[r]=a,o)}}}]);