@steedos/service-ui 2.3.1 → 2.3.2-beta.11
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.
- package/main/default/routes/apps.router.js +2 -2
- package/main/default/routes/bootstrap.router.js +23 -18
- package/main/default/routes/objects.router.js +10 -6
- package/main/default/routes/objects.router.todo.js +1 -1
- package/package.json +5 -5
- package/src/routes/apps.router.ts +3 -4
- package/src/routes/bootstrap.router.ts +27 -21
- package/src/routes/objects.router.ts +11 -7
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
const express = require("express");
|
|
5
4
|
const core_1 = require("@steedos/core");
|
|
6
5
|
const objectql_1 = require("@steedos/objectql");
|
|
7
|
-
const
|
|
6
|
+
const SteedosRouter = require('@steedos/router');
|
|
7
|
+
const router = SteedosRouter.staticRouter();
|
|
8
8
|
router.get('/service/api/apps/menus', core_1.requireAuthentication, function (req, res) {
|
|
9
9
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
10
10
|
const userSession = req.user;
|
|
@@ -9,8 +9,8 @@ require("@steedos/license");
|
|
|
9
9
|
const Fiber = require('fibers');
|
|
10
10
|
const clone = require("clone");
|
|
11
11
|
const _ = require('underscore');
|
|
12
|
-
|
|
13
|
-
const
|
|
12
|
+
const SteedosRouter = require('@steedos/router');
|
|
13
|
+
const router = SteedosRouter.staticRouter();
|
|
14
14
|
function getUserProfileObjectsLayout(userId, spaceId, objectName) {
|
|
15
15
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
16
16
|
let spaceUser;
|
|
@@ -136,25 +136,34 @@ function getSpaceBootStrap(req, res) {
|
|
|
136
136
|
let urlParams = req.params;
|
|
137
137
|
const { userId, language: lng } = userSession;
|
|
138
138
|
let spaceId = req.headers['x-space-id'] || urlParams.spaceId;
|
|
139
|
-
let space
|
|
139
|
+
let [space, object_listviews, apps, assigned_apps, spaceProcessDefinition, dbListViews, layouts, objectsFieldsPermissionGroupRole, allRelationsInfo, _dbApps, _dbDashboards, assigned_menus, allImportTemplates] = yield Promise.all([
|
|
140
|
+
(0, objectql_1.getObject)("spaces").findOne(spaceId, { fields: ['name'] }),
|
|
141
|
+
getUserObjectsListViews(userId, spaceId),
|
|
142
|
+
(0, objectql_1.getAppConfigs)(spaceId),
|
|
143
|
+
(0, objectql_1.getAssignedApps)(userSession),
|
|
144
|
+
(0, objectql_1.getObject)("process_definition").find({ filters: [['space', '=', spaceId], ['active', '=', true]] }),
|
|
145
|
+
(0, objectql_1.getObject)("object_listviews").directFind({ filters: [['space', '=', userSession.spaceId], [['owner', '=', userSession.userId], 'or', ['shared', '=', true]]] }),
|
|
146
|
+
(0, objectql_1.getObjectLayouts)(userSession.profile, spaceId),
|
|
147
|
+
objectql_1.FieldPermission.getObjectsFieldsPermissionGroupRole(),
|
|
148
|
+
(0, objectql_1.getAllRelationsInfo)(),
|
|
149
|
+
(0, objectql_1.getObject)("apps").directFind({ filters: [['space', '=', spaceId], ['is_creator', '=', true]] }),
|
|
150
|
+
(0, objectql_1.getObject)("dashboard").directFind({ filters: [['space', '=', spaceId]] }),
|
|
151
|
+
(0, objectql_1.getAssignedMenus)(userSession),
|
|
152
|
+
(0, objectql_1.getSteedosSchema)().broker.call(`~packages-@steedos/data-import.getAllImportTemplates`, {}, { meta: { user: userSession } })
|
|
153
|
+
]);
|
|
140
154
|
let result = Creator.getAllPermissions(spaceId, userId);
|
|
141
155
|
steedosI18n.translationObjects(lng, result.objects);
|
|
142
156
|
result.user = userSession;
|
|
143
157
|
result.space = space;
|
|
144
158
|
result.dashboards = clone(Creator.Dashboards);
|
|
145
159
|
result.object_workflows = Meteor.call('object_workflows.get', spaceId, userId);
|
|
146
|
-
result.object_listviews =
|
|
147
|
-
result.apps =
|
|
148
|
-
result.assigned_apps =
|
|
160
|
+
result.object_listviews = object_listviews;
|
|
161
|
+
result.apps = apps;
|
|
162
|
+
result.assigned_apps = assigned_apps;
|
|
149
163
|
let datasources = Creator.steedosSchema.getDataSources();
|
|
150
|
-
const spaceProcessDefinition = yield (0, objectql_1.getObject)("process_definition").find({ filters: [['space', '=', spaceId], ['active', '=', true]] });
|
|
151
164
|
const spaceObjectsProcessDefinition = _.groupBy(spaceProcessDefinition, 'object_name');
|
|
152
|
-
const dbListViews = yield (0, objectql_1.getObject)("object_listviews").directFind({ filters: [['space', '=', userSession.spaceId], [['owner', '=', userSession.userId], 'or', ['shared', '=', true]]] });
|
|
153
165
|
const dbObjectsListViews = _.groupBy(dbListViews, 'object_name');
|
|
154
|
-
const layouts = yield (0, objectql_1.getObjectLayouts)(userSession.profile, spaceId);
|
|
155
166
|
const objectsLayouts = _.groupBy(layouts, 'object_name');
|
|
156
|
-
const objectsFieldsPermissionGroupRole = yield objectql_1.FieldPermission.getObjectsFieldsPermissionGroupRole();
|
|
157
|
-
const allRelationsInfo = yield (0, objectql_1.getAllRelationsInfo)();
|
|
158
167
|
for (const datasourceName in datasources) {
|
|
159
168
|
let datasource = datasources[datasourceName];
|
|
160
169
|
const datasourceObjects = yield datasource.getObjects();
|
|
@@ -199,7 +208,6 @@ function getSpaceBootStrap(req, res) {
|
|
|
199
208
|
}
|
|
200
209
|
}
|
|
201
210
|
}
|
|
202
|
-
var _dbApps = yield (0, objectql_1.getObject)("apps").directFind({ filters: [['space', '=', spaceId], ['is_creator', '=', true]] });
|
|
203
211
|
let dbApps = {};
|
|
204
212
|
_.each(_dbApps, function (dbApp) {
|
|
205
213
|
if (dbApp.visible) {
|
|
@@ -207,7 +215,6 @@ function getSpaceBootStrap(req, res) {
|
|
|
207
215
|
}
|
|
208
216
|
});
|
|
209
217
|
result.apps = _.extend(result.apps || {}, dbApps);
|
|
210
|
-
var _dbDashboards = yield (0, objectql_1.getObject)("dashboard").directFind({ filters: [['space', '=', spaceId]] });
|
|
211
218
|
let dbDashboards = {};
|
|
212
219
|
_.each(_dbDashboards, function (dashboard) {
|
|
213
220
|
dbDashboards[dashboard._id] = dashboard;
|
|
@@ -231,7 +238,6 @@ function getSpaceBootStrap(req, res) {
|
|
|
231
238
|
});
|
|
232
239
|
steedosI18n.translationApps(lng, _Apps);
|
|
233
240
|
result.apps = _Apps;
|
|
234
|
-
let assigned_menus = yield (0, objectql_1.getAssignedMenus)(userSession);
|
|
235
241
|
steedosI18n.translationMenus(lng, assigned_menus);
|
|
236
242
|
result.assigned_menus = assigned_menus;
|
|
237
243
|
let _Dashboards = {};
|
|
@@ -249,7 +255,6 @@ function getSpaceBootStrap(req, res) {
|
|
|
249
255
|
result.objects[item.object_name].enable_process = true;
|
|
250
256
|
}
|
|
251
257
|
});
|
|
252
|
-
const allImportTemplates = yield (0, objectql_1.getSteedosSchema)().broker.call(`~packages-@steedos/data-import.getAllImportTemplates`, {}, { meta: { user: userSession } });
|
|
253
258
|
for (const key in result.objects) {
|
|
254
259
|
if (Object.prototype.hasOwnProperty.call(result.objects, key)) {
|
|
255
260
|
const objectConfig = result.objects[key];
|
|
@@ -413,6 +418,6 @@ function getSpaceObjectBootStrap(req, res) {
|
|
|
413
418
|
});
|
|
414
419
|
}
|
|
415
420
|
exports.getSpaceObjectBootStrap = getSpaceObjectBootStrap;
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
exports.default =
|
|
421
|
+
router.use('/api/bootstrap/:spaceId/:objectNames', core_1.requireAuthentication, getSpaceObjectBootStrap);
|
|
422
|
+
router.use('/api/bootstrap/:spaceId/', core_1.requireAuthentication, getSpaceBootStrap);
|
|
423
|
+
exports.default = router;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
const objectql_1 = require("@steedos/objectql");
|
|
5
|
-
const
|
|
6
|
-
const router =
|
|
5
|
+
const SteedosRouter = require('@steedos/router');
|
|
6
|
+
const router = SteedosRouter.staticRouter();
|
|
7
7
|
const core = require('@steedos/core');
|
|
8
8
|
const callObjectServiceAction = function (actionName, userSession, data) {
|
|
9
9
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -57,10 +57,14 @@ router.get('/service/api/:objectServiceName/uiSchema', core.requireAuthenticatio
|
|
|
57
57
|
const userSession = req.user;
|
|
58
58
|
try {
|
|
59
59
|
const { objectServiceName } = req.params;
|
|
60
|
-
const
|
|
61
|
-
result
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
const objectName = objectServiceName.substring(1);
|
|
61
|
+
const [result, hasImportTemplates] = yield Promise.all([
|
|
62
|
+
callObjectServiceAction(`${objectServiceName}.getRecordView`, userSession),
|
|
63
|
+
callObjectServiceAction(`~packages-@steedos/data-import.hasImportTemplates`, userSession, {
|
|
64
|
+
objectName: objectName
|
|
65
|
+
})
|
|
66
|
+
]);
|
|
67
|
+
result.hasImportTemplates = hasImportTemplates;
|
|
64
68
|
res.status(200).send(result);
|
|
65
69
|
}
|
|
66
70
|
catch (error) {
|
|
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
const express = require("express");
|
|
11
|
-
const router =
|
|
11
|
+
const router =require('@steedos/router').staticRouter()
|
|
12
12
|
const core = require('@steedos/core');
|
|
13
13
|
router.get('/service/api/:objectServiceName/uiSchema', core.requireAuthentication, function (req, res) {
|
|
14
14
|
return __awaiter(this, void 0, void 0, function* () {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steedos/service-ui",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.2-beta.11",
|
|
4
4
|
"main": "package.service.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"steedos"
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
"description": "steedos package",
|
|
12
12
|
"repository": {},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@steedos/core": "2.3.
|
|
15
|
-
"@steedos/i18n": "2.3.
|
|
16
|
-
"@steedos/objectql": "2.3.
|
|
14
|
+
"@steedos/core": "2.3.2-beta.11",
|
|
15
|
+
"@steedos/i18n": "2.3.2-beta.11",
|
|
16
|
+
"@steedos/objectql": "2.3.2-beta.11",
|
|
17
17
|
"express": "4.18.1"
|
|
18
18
|
},
|
|
19
19
|
"license": "MIT",
|
|
@@ -21,5 +21,5 @@
|
|
|
21
21
|
"publishConfig": {
|
|
22
22
|
"access": "public"
|
|
23
23
|
},
|
|
24
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "d12ce4f403be88d8cce5e7d0de8892c9b92b3899"
|
|
25
25
|
}
|
|
@@ -2,14 +2,13 @@
|
|
|
2
2
|
* @Author: baozhoutao@steedos.com
|
|
3
3
|
* @Date: 2022-06-08 23:28:39
|
|
4
4
|
* @LastEditors: baozhoutao@steedos.com
|
|
5
|
-
* @LastEditTime: 2022-
|
|
5
|
+
* @LastEditTime: 2022-11-15 18:11:07
|
|
6
6
|
* @Description:
|
|
7
7
|
*/
|
|
8
|
-
import * as express from 'express';
|
|
9
8
|
import { requireAuthentication } from '@steedos/core';
|
|
10
9
|
import { getSteedosSchema } from '@steedos/objectql';
|
|
11
|
-
|
|
12
|
-
const router =
|
|
10
|
+
const SteedosRouter = require('@steedos/router');
|
|
11
|
+
const router = SteedosRouter.staticRouter();
|
|
13
12
|
|
|
14
13
|
router.get('/service/api/apps/menus', requireAuthentication, async function (req: any, res: any) {
|
|
15
14
|
const userSession = req.user;
|
|
@@ -7,8 +7,8 @@ const Fiber = require('fibers')
|
|
|
7
7
|
const clone = require("clone");
|
|
8
8
|
const _ = require('underscore');
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
const
|
|
10
|
+
const SteedosRouter = require('@steedos/router');
|
|
11
|
+
const router = SteedosRouter.staticRouter();
|
|
12
12
|
|
|
13
13
|
async function getUserProfileObjectsLayout(userId, spaceId, objectName?) {
|
|
14
14
|
let spaceUser;
|
|
@@ -154,7 +154,23 @@ export async function getSpaceBootStrap(req, res) {
|
|
|
154
154
|
const { userId, language: lng} = userSession;
|
|
155
155
|
|
|
156
156
|
let spaceId = req.headers['x-space-id'] || urlParams.spaceId
|
|
157
|
-
|
|
157
|
+
|
|
158
|
+
let [ space , object_listviews, apps, assigned_apps, spaceProcessDefinition, dbListViews, layouts, objectsFieldsPermissionGroupRole, allRelationsInfo, _dbApps, _dbDashboards, assigned_menus, allImportTemplates] = await Promise.all([
|
|
159
|
+
getObject("spaces").findOne(spaceId, { fields: ['name'] }),
|
|
160
|
+
getUserObjectsListViews(userId, spaceId),
|
|
161
|
+
getAppConfigs(spaceId),
|
|
162
|
+
getAssignedApps(userSession),
|
|
163
|
+
getObject("process_definition").find({ filters: [['space', '=', spaceId], ['active', '=', true]] }),
|
|
164
|
+
getObject("object_listviews").directFind({ filters: [['space', '=', userSession.spaceId], [['owner', '=', userSession.userId], 'or', ['shared', '=', true]]] }),
|
|
165
|
+
getObjectLayouts(userSession.profile, spaceId),
|
|
166
|
+
FieldPermission.getObjectsFieldsPermissionGroupRole(),
|
|
167
|
+
getAllRelationsInfo(),
|
|
168
|
+
getObject("apps").directFind({filters: [['space', '=', spaceId],['is_creator', '=', true]]}),
|
|
169
|
+
getObject("dashboard").directFind({filters: [['space', '=', spaceId]]}),
|
|
170
|
+
getAssignedMenus(userSession),
|
|
171
|
+
getSteedosSchema().broker.call(`~packages-@steedos/data-import.getAllImportTemplates`, {}, { meta: { user: userSession}})
|
|
172
|
+
])
|
|
173
|
+
|
|
158
174
|
//TODO 无需再从getAllPermissions中获取用户的对象权限
|
|
159
175
|
let result = Creator.getAllPermissions(spaceId, userId);
|
|
160
176
|
steedosI18n.translationObjects(lng, result.objects);
|
|
@@ -163,11 +179,12 @@ export async function getSpaceBootStrap(req, res) {
|
|
|
163
179
|
result.space = space
|
|
164
180
|
|
|
165
181
|
result.dashboards = clone(Creator.Dashboards)
|
|
166
|
-
|
|
167
|
-
result.
|
|
182
|
+
// TODO 删除此代码, 逻辑重新调整, 提供单独的接口处理此问题: 对象可创建流程的清单接口
|
|
183
|
+
result.object_workflows = Meteor.call('object_workflows.get', spaceId, userId)
|
|
184
|
+
result.object_listviews = object_listviews
|
|
168
185
|
// result.apps = clone(Creator.Apps)
|
|
169
|
-
result.apps =
|
|
170
|
-
result.assigned_apps =
|
|
186
|
+
result.apps = apps
|
|
187
|
+
result.assigned_apps = assigned_apps;
|
|
171
188
|
let datasources = Creator.steedosSchema.getDataSources();
|
|
172
189
|
// for (const datasourceName in datasources) {
|
|
173
190
|
// if(datasourceName != 'default'){
|
|
@@ -183,17 +200,11 @@ export async function getSpaceBootStrap(req, res) {
|
|
|
183
200
|
// }
|
|
184
201
|
// }
|
|
185
202
|
// }
|
|
186
|
-
const spaceProcessDefinition = await getObject("process_definition").find({ filters: [['space', '=', spaceId], ['active', '=', true]] })
|
|
187
203
|
const spaceObjectsProcessDefinition = _.groupBy(spaceProcessDefinition, 'object_name');
|
|
188
204
|
|
|
189
|
-
const dbListViews = await getObject("object_listviews").directFind({ filters: [['space', '=', userSession.spaceId], [['owner', '=', userSession.userId], 'or', ['shared', '=', true]]] })
|
|
190
205
|
const dbObjectsListViews = _.groupBy(dbListViews, 'object_name');
|
|
191
206
|
|
|
192
|
-
const layouts = await getObjectLayouts(userSession.profile, spaceId)
|
|
193
207
|
const objectsLayouts = _.groupBy(layouts, 'object_name');
|
|
194
|
-
const objectsFieldsPermissionGroupRole = await FieldPermission.getObjectsFieldsPermissionGroupRole();
|
|
195
|
-
|
|
196
|
-
const allRelationsInfo = await getAllRelationsInfo();
|
|
197
208
|
|
|
198
209
|
for (const datasourceName in datasources) {
|
|
199
210
|
let datasource = datasources[datasourceName];
|
|
@@ -237,7 +248,6 @@ export async function getSpaceBootStrap(req, res) {
|
|
|
237
248
|
}
|
|
238
249
|
}
|
|
239
250
|
|
|
240
|
-
var _dbApps = await getObject("apps").directFind({filters: [['space', '=', spaceId],['is_creator', '=', true]]});
|
|
241
251
|
let dbApps = {};
|
|
242
252
|
_.each(_dbApps, function(dbApp){
|
|
243
253
|
if(dbApp.visible){
|
|
@@ -247,7 +257,6 @@ export async function getSpaceBootStrap(req, res) {
|
|
|
247
257
|
|
|
248
258
|
result.apps = _.extend( result.apps || {}, dbApps);
|
|
249
259
|
|
|
250
|
-
var _dbDashboards = await getObject("dashboard").directFind({filters: [['space', '=', spaceId]]});
|
|
251
260
|
let dbDashboards = {};
|
|
252
261
|
_.each(_dbDashboards, function(dashboard){
|
|
253
262
|
dbDashboards[dashboard._id] = dashboard;
|
|
@@ -274,7 +283,6 @@ export async function getSpaceBootStrap(req, res) {
|
|
|
274
283
|
|
|
275
284
|
steedosI18n.translationApps(lng, _Apps);
|
|
276
285
|
result.apps = _Apps;
|
|
277
|
-
let assigned_menus = await getAssignedMenus(userSession);
|
|
278
286
|
steedosI18n.translationMenus(lng, assigned_menus);
|
|
279
287
|
result.assigned_menus = assigned_menus;
|
|
280
288
|
|
|
@@ -296,8 +304,6 @@ export async function getSpaceBootStrap(req, res) {
|
|
|
296
304
|
}
|
|
297
305
|
})
|
|
298
306
|
|
|
299
|
-
const allImportTemplates = await getSteedosSchema().broker.call(`~packages-@steedos/data-import.getAllImportTemplates`, {}, { meta: { user: userSession}})
|
|
300
|
-
|
|
301
307
|
for (const key in result.objects) {
|
|
302
308
|
if (Object.prototype.hasOwnProperty.call(result.objects, key)) {
|
|
303
309
|
const objectConfig = result.objects[key];
|
|
@@ -469,7 +475,7 @@ export async function getSpaceObjectBootStrap(req, res) {
|
|
|
469
475
|
}).run();
|
|
470
476
|
}
|
|
471
477
|
|
|
472
|
-
|
|
473
|
-
|
|
478
|
+
router.use('/api/bootstrap/:spaceId/:objectNames', requireAuthentication, getSpaceObjectBootStrap)
|
|
479
|
+
router.use('/api/bootstrap/:spaceId/', requireAuthentication, getSpaceBootStrap)
|
|
474
480
|
|
|
475
|
-
exports.default =
|
|
481
|
+
exports.default = router;
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
* @Author: baozhoutao@steedos.com
|
|
3
3
|
* @Date: 2022-06-09 10:19:47
|
|
4
4
|
* @LastEditors: baozhoutao@steedos.com
|
|
5
|
-
* @LastEditTime: 2022-
|
|
5
|
+
* @LastEditTime: 2022-11-17 15:26:01
|
|
6
6
|
* @Description:
|
|
7
7
|
*/
|
|
8
8
|
import { getSteedosSchema } from "@steedos/objectql";
|
|
9
|
-
const
|
|
10
|
-
const router =
|
|
9
|
+
const SteedosRouter = require('@steedos/router');
|
|
10
|
+
const router = SteedosRouter.staticRouter();
|
|
11
11
|
const core = require('@steedos/core');
|
|
12
12
|
|
|
13
13
|
|
|
@@ -56,10 +56,14 @@ router.get('/service/api/:objectServiceName/uiSchema', core.requireAuthenticatio
|
|
|
56
56
|
const userSession = req.user;
|
|
57
57
|
try {
|
|
58
58
|
const { objectServiceName } = req.params;
|
|
59
|
-
const
|
|
60
|
-
result
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
const objectName = objectServiceName.substring(1);
|
|
60
|
+
const [ result, hasImportTemplates ] = await Promise.all([
|
|
61
|
+
callObjectServiceAction(`${objectServiceName}.getRecordView`, userSession),
|
|
62
|
+
callObjectServiceAction(`~packages-@steedos/data-import.hasImportTemplates`, userSession, {
|
|
63
|
+
objectName: objectName
|
|
64
|
+
})
|
|
65
|
+
])
|
|
66
|
+
result.hasImportTemplates = hasImportTemplates
|
|
63
67
|
res.status(200).send(result);
|
|
64
68
|
} catch (error) {
|
|
65
69
|
res.status(500).send(error.message);
|