@steedos/standard-ui 2.5.0-beta.8 → 2.5.0
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/applications/admin.app.yml +22 -12
- package/main/default/client/history_paths.client.js +199 -0
- package/main/default/objects/apps/buttons/amis_nav_schema_design.button.js +31 -0
- package/main/default/objects/apps/buttons/amis_nav_schema_design.button.yml +4 -0
- package/main/default/objects/apps.object.yml +13 -2
- package/main/default/objects/tabs.object.yml +1 -2
- package/main/default/routers/amis_app_nav_schema_design.ejs +165 -0
- package/main/default/routers/amis_app_nav_schema_design.router.js +53 -0
- package/main/default/tabs/{admin_stimulsoft_reports.tab.yml → admin_developer_graphql.tab.yml} +4 -4
- package/main/default/tabs/{admin_license.tab.yml → admin_developer_triggers.tab.yml} +4 -4
- package/main/default/triggers/apps.trigger.js +11 -63
- package/main/default/triggers/tabs_api_name.trigger.js +9 -2
- package/package.json +2 -2
|
@@ -12,6 +12,7 @@ tab_groups:
|
|
|
12
12
|
- group_name: 对象设置
|
|
13
13
|
- group_name: 用户界面
|
|
14
14
|
- group_name: 统计分析
|
|
15
|
+
- group_name: 开发
|
|
15
16
|
- group_name: 流程自动化
|
|
16
17
|
- group_name: 审批王
|
|
17
18
|
- group_name: 高级设置
|
|
@@ -53,8 +54,8 @@ tab_items:
|
|
|
53
54
|
group: 对象设置
|
|
54
55
|
index: 13
|
|
55
56
|
admin_queue_import:
|
|
56
|
-
group:
|
|
57
|
-
index:
|
|
57
|
+
group: 高级设置
|
|
58
|
+
index: 38
|
|
58
59
|
admin_pages:
|
|
59
60
|
group: 用户界面
|
|
60
61
|
index: 15
|
|
@@ -70,6 +71,15 @@ tab_items:
|
|
|
70
71
|
admin_stimulsoft_reports:
|
|
71
72
|
group: 统计分析
|
|
72
73
|
index: 19
|
|
74
|
+
admin_developer:
|
|
75
|
+
group: 开发
|
|
76
|
+
index: 19.50
|
|
77
|
+
admin_developer_triggers:
|
|
78
|
+
group: 开发
|
|
79
|
+
index: 19.51
|
|
80
|
+
admin_developer_graphql:
|
|
81
|
+
group: 开发
|
|
82
|
+
index: 19.52
|
|
73
83
|
admin_process_definition:
|
|
74
84
|
group: 流程自动化
|
|
75
85
|
index: 20
|
|
@@ -118,29 +128,29 @@ tab_items:
|
|
|
118
128
|
admin_sessions:
|
|
119
129
|
group: 高级设置
|
|
120
130
|
index: 34
|
|
121
|
-
admin_dashboard:
|
|
122
|
-
|
|
123
|
-
|
|
131
|
+
# admin_dashboard:
|
|
132
|
+
# group: 高级设置
|
|
133
|
+
# index: 35
|
|
124
134
|
admin_audit_records:
|
|
125
135
|
group: 高级设置
|
|
126
136
|
index: 36
|
|
127
137
|
admin_autonumber:
|
|
128
138
|
group: 高级设置
|
|
129
139
|
index: 37
|
|
130
|
-
admin_web_forms:
|
|
131
|
-
|
|
132
|
-
|
|
140
|
+
# admin_web_forms:
|
|
141
|
+
# group: 高级设置
|
|
142
|
+
# index: 38
|
|
133
143
|
admin_holidays:
|
|
134
144
|
group: 高级设置
|
|
135
145
|
index: 39
|
|
136
146
|
admin_business_hours:
|
|
137
147
|
group: 高级设置
|
|
138
148
|
index: 40
|
|
139
|
-
admin_object_webhooks:
|
|
140
|
-
|
|
141
|
-
|
|
149
|
+
# admin_object_webhooks:
|
|
150
|
+
# group: 高级设置
|
|
151
|
+
# index: 41
|
|
142
152
|
admin_api_keys:
|
|
143
|
-
group:
|
|
153
|
+
group: 开发
|
|
144
154
|
index: 42
|
|
145
155
|
objects: []
|
|
146
156
|
sort: 9100
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
3
|
+
* @Date: 2023-05-16 17:00:38
|
|
4
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
5
|
+
* @LastEditTime: 2023-05-28 10:13:45
|
|
6
|
+
*/
|
|
7
|
+
var buttonTriggerHistoryPathsChange;
|
|
8
|
+
; (function () {
|
|
9
|
+
try {
|
|
10
|
+
var rootId = "steedosHistoryPathsRoot";
|
|
11
|
+
var modalRoot = document.getElementById(rootId);
|
|
12
|
+
if (!modalRoot) {
|
|
13
|
+
modalRoot = document.createElement('div');
|
|
14
|
+
modalRoot.setAttribute('id', rootId);
|
|
15
|
+
$("body")[0].appendChild(modalRoot);
|
|
16
|
+
}
|
|
17
|
+
const page = {
|
|
18
|
+
name: "pageSteedosHistoryPaths",
|
|
19
|
+
render_engine: "amis",
|
|
20
|
+
schema: {
|
|
21
|
+
name: "serviceSteedosHistoryPaths",
|
|
22
|
+
id: "serviceSteedosHistoryPaths",
|
|
23
|
+
type: "service",
|
|
24
|
+
className: "service-steedos-history-paths",
|
|
25
|
+
body: [{
|
|
26
|
+
"type": "button",
|
|
27
|
+
"label": "触发@history_paths.changed",
|
|
28
|
+
"name": "buttonTriggerHistoryPathsChange",
|
|
29
|
+
"className": "button-trigger-history-paths-change hidden",
|
|
30
|
+
"onEvent": {
|
|
31
|
+
"click": {
|
|
32
|
+
"actions": [
|
|
33
|
+
{
|
|
34
|
+
"actionType": "broadcast",
|
|
35
|
+
"args": {
|
|
36
|
+
"eventName": "@history_paths.changed"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}]
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
Meteor.startup(function () {
|
|
46
|
+
const root = $("#" + rootId)[0];
|
|
47
|
+
Tracker.autorun(function (c) {
|
|
48
|
+
if (Creator.steedosInit.get() && Creator.validated.get()) {
|
|
49
|
+
Steedos.Page.render(root, page, {});
|
|
50
|
+
const findVars = (obj, vars) => {
|
|
51
|
+
try {
|
|
52
|
+
return vars.length === vars.filter(function (item) {
|
|
53
|
+
return item.split(".").reduce(function (sum, n) {
|
|
54
|
+
return sum[n];
|
|
55
|
+
}, obj) !== undefined;
|
|
56
|
+
}).length;
|
|
57
|
+
}
|
|
58
|
+
catch (ex) {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
const waittingVars = ["SteedosUI.refs.serviceSteedosHistoryPaths.getComponentByName"];
|
|
63
|
+
Promise.all([
|
|
64
|
+
waitForThing(window, waittingVars, findVars)
|
|
65
|
+
]).then(() => {
|
|
66
|
+
var scope = SteedosUI.refs["serviceSteedosHistoryPaths"];
|
|
67
|
+
buttonTriggerHistoryPathsChange = scope.getComponentByName("serviceSteedosHistoryPaths.buttonTriggerHistoryPathsChange");
|
|
68
|
+
Object.assign(Steedos, {
|
|
69
|
+
goBack
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
} catch (error) {
|
|
77
|
+
console.error(error)
|
|
78
|
+
};
|
|
79
|
+
})();
|
|
80
|
+
|
|
81
|
+
let historyPathsStoreKey = "history_paths";
|
|
82
|
+
|
|
83
|
+
// 使用debounce防抖动函数,连续多次自动触发enter事件时,只需要捕获最后一次
|
|
84
|
+
FlowRouter.triggers.enter(debounce(function (context, redirect, stop) {
|
|
85
|
+
if(!!window.opener){
|
|
86
|
+
// 记录详细页面点击右上角查看审批单等打开新窗口情况下,新窗口的history path继承了opener页面的history path,所以需要区别出来,否则会报错
|
|
87
|
+
historyPathsStoreKey = "history_paths_opener_level" + getOpenerLevel(window,0);
|
|
88
|
+
}
|
|
89
|
+
const path = context.path;
|
|
90
|
+
const params = context.params || {};
|
|
91
|
+
// const pathDef = context.route.pathDef;
|
|
92
|
+
const recordId = params.record_id;
|
|
93
|
+
if (recordId) {
|
|
94
|
+
// 触发广播事件,把当前path和params累加存入amis变量historyPaths中
|
|
95
|
+
pushHistoryPath(path, params);
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
// 触发广播事件重围amis变量historyPaths值为空数组,并把当前path和params存入amis变量historyPaths中
|
|
99
|
+
resetHistoryPath(path, params);
|
|
100
|
+
}
|
|
101
|
+
triggerBroadcastHistoryPathsChanged(buttonTriggerHistoryPathsChange);
|
|
102
|
+
}, 200));
|
|
103
|
+
|
|
104
|
+
function goBack(){
|
|
105
|
+
let prevPath = popHistoryPath();
|
|
106
|
+
if(prevPath && prevPath.path){
|
|
107
|
+
FlowRouter.go(prevPath.path);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* 移除最后一个path,并且返回要返回的上一个path
|
|
113
|
+
* 如果是从推送通知中点开进入记录详细页面,则返回当前记录所属对象的列表页面
|
|
114
|
+
*/
|
|
115
|
+
function popHistoryPath() {
|
|
116
|
+
var paths = getHistoryPaths() || [];
|
|
117
|
+
let lastPath = paths && paths[paths.length - 1];
|
|
118
|
+
paths.pop();
|
|
119
|
+
setHistoryPaths(paths);
|
|
120
|
+
let prevPath = paths && paths[paths.length - 1];
|
|
121
|
+
if(!prevPath && lastPath){
|
|
122
|
+
// 如果是从推送通知中点开进入记录详细页面,在paths.pop()前的paths肯定只有当前记录详细页面的path
|
|
123
|
+
// 此时lastPath肯定是记录详细页面,值如以下格式:
|
|
124
|
+
/**{
|
|
125
|
+
"path": "/app/projects/project_program/view/6465c790f85da77bbccefbe6",
|
|
126
|
+
"params": {
|
|
127
|
+
"app_id": "projects",
|
|
128
|
+
"object_name": "project_program",
|
|
129
|
+
"record_id": "6465c790f85da77bbccefbe6"
|
|
130
|
+
}
|
|
131
|
+
}**/
|
|
132
|
+
prevPath = {
|
|
133
|
+
path: `/app/${lastPath.params.app_id || "-"}/${lastPath.params.object_name}`,
|
|
134
|
+
params: {
|
|
135
|
+
app_id: lastPath.params.app_id,
|
|
136
|
+
object_name: lastPath.params.object_name
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return prevPath;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function pushHistoryPath(path, params) {
|
|
144
|
+
let paths = getHistoryPaths() || [];
|
|
145
|
+
let lastPath = paths && paths[paths.length - 1];
|
|
146
|
+
if(lastPath && lastPath.path === path){
|
|
147
|
+
// 点返回按钮执行goBack函数触发FlowRouter.triggers.enter从而进入该函数,此时lastPath肯定跟传入的path值一样,正好排除掉不重复加入paths
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
paths.push({ path, params });
|
|
151
|
+
setHistoryPaths(paths);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function resetHistoryPath(path, params) {
|
|
155
|
+
setHistoryPaths([{ path, params }]);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function getHistoryPaths() {
|
|
159
|
+
if (!window.historyPaths) {
|
|
160
|
+
var paths = sessionStorage.getItem(historyPathsStoreKey);
|
|
161
|
+
if (paths) {
|
|
162
|
+
window.historyPaths = JSON.parse(paths);
|
|
163
|
+
}else{
|
|
164
|
+
window.historyPaths = [];
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return window.historyPaths;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
function setHistoryPaths(paths) {
|
|
171
|
+
window.historyPaths = paths;
|
|
172
|
+
sessionStorage.setItem(historyPathsStoreKey, JSON.stringify(paths));
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function triggerBroadcastHistoryPathsChanged(button) {
|
|
176
|
+
if (button) {
|
|
177
|
+
button.props.dispatchEvent('click', {});
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
function debounce(fn, delay) {
|
|
182
|
+
let time = null;
|
|
183
|
+
return function (...args) {
|
|
184
|
+
if (time) {
|
|
185
|
+
clearTimeout(time);
|
|
186
|
+
}
|
|
187
|
+
time = setTimeout(() => {
|
|
188
|
+
fn.apply(this, args);
|
|
189
|
+
}, delay)
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
function getOpenerLevel(opener,level){
|
|
194
|
+
if (!!opener['opener']) {
|
|
195
|
+
return getOpenerLevel(opener['opener'], level + 1);
|
|
196
|
+
}else{
|
|
197
|
+
return level;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: baozhoutao@steedos.com
|
|
3
|
+
* @Date: 2023-04-11 14:05:42
|
|
4
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
5
|
+
* @LastEditTime: 2023-04-11 14:08:41
|
|
6
|
+
* @Description:
|
|
7
|
+
*/
|
|
8
|
+
module.exports = {
|
|
9
|
+
amis_nav_schema_design: function (object_name, record_id) {
|
|
10
|
+
document.location = Steedos.absoluteUrl(`/api/amisAppNavSchemaDesign?id=${record_id}&object=${this.record.object_name}&assetUrls=${Builder.settings.assetUrls}`);
|
|
11
|
+
},
|
|
12
|
+
amis_nav_schema_designVisible: function (object_name, record_id, record_permissions) {
|
|
13
|
+
var perms= {};
|
|
14
|
+
var record = Creator.getObjectRecord(object_name, record_id);
|
|
15
|
+
if(!record){
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
if(!record.enable_nav_schema){
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
if (record_permissions) {
|
|
22
|
+
perms = record_permissions;
|
|
23
|
+
} else {
|
|
24
|
+
record_permissions = Creator.getRecordPermissions(object_name, record, Meteor.userId());
|
|
25
|
+
if (record_permissions) {
|
|
26
|
+
perms = record_permissions;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return perms["allowEdit"];
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -63,6 +63,8 @@ fields:
|
|
|
63
63
|
hidden: true
|
|
64
64
|
tab_groups.$.group_name:
|
|
65
65
|
type: text
|
|
66
|
+
tab_groups.$.default_open:
|
|
67
|
+
type: boolean
|
|
66
68
|
tab_items:
|
|
67
69
|
label: Tabs
|
|
68
70
|
type: object
|
|
@@ -124,10 +126,18 @@ fields:
|
|
|
124
126
|
# defaultValue: true
|
|
125
127
|
|
|
126
128
|
showSidebar:
|
|
127
|
-
label:
|
|
129
|
+
label: 显示左侧导航
|
|
128
130
|
type: boolean
|
|
129
131
|
defaultValue: false
|
|
130
|
-
|
|
132
|
+
enable_nav_schema:
|
|
133
|
+
label: 启用自定义导航
|
|
134
|
+
type: boolean
|
|
135
|
+
required: false
|
|
136
|
+
nav_schema:
|
|
137
|
+
label: 自定义导航
|
|
138
|
+
type: code
|
|
139
|
+
language: json
|
|
140
|
+
visible_on: "{{false}}"
|
|
131
141
|
# members:
|
|
132
142
|
# type: object
|
|
133
143
|
# label: Members
|
|
@@ -159,6 +169,7 @@ fields:
|
|
|
159
169
|
label: Open with iframe
|
|
160
170
|
defaultValue: false
|
|
161
171
|
group: External Application
|
|
172
|
+
visible_on: "{{false}}"
|
|
162
173
|
is_new_window:
|
|
163
174
|
type: boolean
|
|
164
175
|
label: Open in New Window
|
|
@@ -29,7 +29,6 @@ fields:
|
|
|
29
29
|
icon: svg
|
|
30
30
|
});
|
|
31
31
|
});
|
|
32
|
-
|
|
33
32
|
return options;
|
|
34
33
|
}
|
|
35
34
|
parent:
|
|
@@ -73,7 +72,7 @@ fields:
|
|
|
73
72
|
required: "{{'object' === formData.type ? true: false}}"
|
|
74
73
|
visible_on: "{{'object' === formData.type ? true: false}}"
|
|
75
74
|
url:
|
|
76
|
-
type:
|
|
75
|
+
type: text
|
|
77
76
|
label: Url
|
|
78
77
|
required: "{{'url' === formData.type ? true: false}}"
|
|
79
78
|
visible_on: "{{'url' === formData.type ? true: false}}"
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: baozhoutao@steedos.com
|
|
3
|
+
* @Date: 2022-06-02 17:45:15
|
|
4
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
5
|
+
* @LastEditTime: 2023-04-11 14:02:31
|
|
6
|
+
* @Description:
|
|
7
|
+
-->
|
|
8
|
+
<html>
|
|
9
|
+
<head>
|
|
10
|
+
<script src="/unpkg.com/@steedos-builder/fiddle@0.0.5/dist/builder-fiddle.umd.js"></script>
|
|
11
|
+
<script src="/unpkg.com/axios@0.26.1/dist/axios.min.js"></script>
|
|
12
|
+
</head>
|
|
13
|
+
|
|
14
|
+
<body>
|
|
15
|
+
<builder-fiddle host="<%=builderHost%>"></builder-fiddle>
|
|
16
|
+
<script>
|
|
17
|
+
const settings = {
|
|
18
|
+
assetUrls: "<%=assetUrls%>",
|
|
19
|
+
rootUrl: "<%=rootUrl%>",
|
|
20
|
+
userId: "<%=userId%>",
|
|
21
|
+
tenantId: "<%=tenantId%>",
|
|
22
|
+
authToken: "<%=authToken%>",
|
|
23
|
+
id: "<%=id%>",
|
|
24
|
+
pageId: "<%=id%>",
|
|
25
|
+
messageOnly: true,
|
|
26
|
+
hiddenDeploy: true
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
let comp = document.querySelector("builder-fiddle");
|
|
30
|
+
|
|
31
|
+
const loadPage = async () => {
|
|
32
|
+
const { assetUrls, rootUrl, userId, tenantId, authToken, id } = settings;
|
|
33
|
+
|
|
34
|
+
// 如果传入 steedos rooturl
|
|
35
|
+
if (rootUrl && !authToken) return;
|
|
36
|
+
|
|
37
|
+
const initialContent = {
|
|
38
|
+
type: "nav"
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
if (id) {
|
|
42
|
+
const result = await axios.post(
|
|
43
|
+
`${rootUrl}/graphql`,
|
|
44
|
+
{
|
|
45
|
+
query: `
|
|
46
|
+
{
|
|
47
|
+
record:apps__findOne(id: "${id}"){
|
|
48
|
+
_id,
|
|
49
|
+
code,
|
|
50
|
+
name,
|
|
51
|
+
nav_schema
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
`
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
withCredentials: true,
|
|
58
|
+
headers: { Authorization: `Bearer ${tenantId},${authToken}` },
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
if (result?.data?.data) {
|
|
62
|
+
const record = result.data.data.record;
|
|
63
|
+
let schema = record?.nav_schema ;
|
|
64
|
+
if(!schema){
|
|
65
|
+
schema = initialContent;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
let objectName = result.data.object;
|
|
69
|
+
if (typeof schema === "string") {
|
|
70
|
+
schema = JSON.parse(schema);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (!schema.data) {
|
|
74
|
+
schema.data = {};
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (!schema.data.context) {
|
|
78
|
+
schema.data.context = {};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
schema.data.app_id = '';
|
|
82
|
+
schema.data.tab_id = '';
|
|
83
|
+
schema.data.dataComponentId = '';
|
|
84
|
+
schema.data.record_id = '';
|
|
85
|
+
schema.data.record = {};
|
|
86
|
+
schema.data.permissions = {};
|
|
87
|
+
|
|
88
|
+
schema.data.context.rootUrl = rootUrl;
|
|
89
|
+
schema.data.context.tenantId = tenantId;
|
|
90
|
+
schema.data.context.userId = userId;
|
|
91
|
+
schema.data.context.authToken = authToken;
|
|
92
|
+
|
|
93
|
+
return schema || initialContent
|
|
94
|
+
}
|
|
95
|
+
} else {
|
|
96
|
+
return initialContent
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
const savePage = async (data) => {
|
|
101
|
+
const { rootUrl, userId, tenantId, authToken, id } = settings;
|
|
102
|
+
|
|
103
|
+
if (!id) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// 保存schema时,清理context下的认证信息
|
|
108
|
+
const schema = JSON.parse(
|
|
109
|
+
JSON.stringify(data.data.AmisSchema, null, 4)
|
|
110
|
+
);
|
|
111
|
+
if (schema.data && typeof schema.data.context === 'object' ) {
|
|
112
|
+
delete schema.data.context.userId;
|
|
113
|
+
delete schema.data.context.tenantId;
|
|
114
|
+
delete schema.data.context.authToken;
|
|
115
|
+
delete schema.data.context.user;
|
|
116
|
+
delete schema.data.context.rootUrl;
|
|
117
|
+
}
|
|
118
|
+
return await axios.post(
|
|
119
|
+
`${rootUrl}/graphql`,
|
|
120
|
+
{
|
|
121
|
+
query: `
|
|
122
|
+
mutation{
|
|
123
|
+
apps__update(id: "${id}", doc: {nav_schema: ${JSON.stringify(JSON.stringify(schema, null, 4))}}){_id}
|
|
124
|
+
}
|
|
125
|
+
`,
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
withCredentials: true,
|
|
129
|
+
headers: { Authorization: `Bearer ${tenantId},${authToken}` },
|
|
130
|
+
}
|
|
131
|
+
)
|
|
132
|
+
.catch(function (error) {
|
|
133
|
+
// handle error
|
|
134
|
+
console.log(error);
|
|
135
|
+
});
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
const deployPageVersion = async () => {
|
|
139
|
+
|
|
140
|
+
};
|
|
141
|
+
window.addEventListener('message', function (event) {
|
|
142
|
+
const { data } = event;
|
|
143
|
+
if (data) {
|
|
144
|
+
if (data.type === 'builder.loadContent') {
|
|
145
|
+
loadPage().then((content)=>{
|
|
146
|
+
comp.messageFrame('builder.contentChanged', { AmisSchema : content } )
|
|
147
|
+
})
|
|
148
|
+
}
|
|
149
|
+
if (data.type === 'builder.saveContent') {
|
|
150
|
+
savePage(data.data).then(()=>{
|
|
151
|
+
comp.messageFrame('builder.contentSaved')
|
|
152
|
+
})
|
|
153
|
+
}
|
|
154
|
+
if(data.type === "builder.deployContent"){
|
|
155
|
+
deployPageVersion().then(()=>{
|
|
156
|
+
comp.messageFrame('builder.contentDeployed')
|
|
157
|
+
})
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
})
|
|
161
|
+
|
|
162
|
+
comp.settings = settings;
|
|
163
|
+
</script>
|
|
164
|
+
</body>
|
|
165
|
+
</html>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: baozhoutao@steedos.com
|
|
3
|
+
* @Date: 2022-04-04 16:34:28
|
|
4
|
+
* @Description:
|
|
5
|
+
*/
|
|
6
|
+
const express = require("express");
|
|
7
|
+
const router = express.Router();
|
|
8
|
+
const core = require('@steedos/core');
|
|
9
|
+
const ejs = require('ejs');
|
|
10
|
+
const fs = require('fs');
|
|
11
|
+
const _ = require('lodash');
|
|
12
|
+
const path = require('path');
|
|
13
|
+
const objectql = require('@steedos/objectql');
|
|
14
|
+
|
|
15
|
+
router.get('/api/amisAppNavSchemaDesign', core.requireAuthentication, async function (req, res) {
|
|
16
|
+
try {
|
|
17
|
+
res.set('Content-Type', 'text/html');
|
|
18
|
+
const userSession = req.user;
|
|
19
|
+
let assetUrls = req.query.assetUrls;
|
|
20
|
+
const assetUrl = `assetUrl=${assetUrls.split(',').join("&assetUrl=")}&`;
|
|
21
|
+
// const dataContext = {
|
|
22
|
+
// rootUrl: __meteor_runtime_config__.ROOT_URL,
|
|
23
|
+
// tenantId: userSession.spaceId,
|
|
24
|
+
// userId: userSession.userId,
|
|
25
|
+
// authToken: userSession.authToken
|
|
26
|
+
// }
|
|
27
|
+
|
|
28
|
+
const retUrl = __meteor_runtime_config__.ROOT_URL + `/app/admin/apps/view/${req.query.id}`
|
|
29
|
+
const steedosBuilderUrl = process.env.STEEDOS_BUILDER_URL || 'https://builder.steedos.cn';
|
|
30
|
+
const builderHost = `${steedosBuilderUrl}/amis?${assetUrl}retUrl=${retUrl}`;
|
|
31
|
+
|
|
32
|
+
const filename = __dirname+'/amis_app_nav_schema_design.ejs'
|
|
33
|
+
const data = {
|
|
34
|
+
builderHost,
|
|
35
|
+
assetUrls,
|
|
36
|
+
rootUrl: __meteor_runtime_config__.ROOT_URL,
|
|
37
|
+
tenantId: userSession.spaceId,
|
|
38
|
+
userId: userSession.userId,
|
|
39
|
+
authToken: userSession.authToken,
|
|
40
|
+
id: req.query.id
|
|
41
|
+
}
|
|
42
|
+
const options = {}
|
|
43
|
+
ejs.renderFile(filename, data, options, function(err, str){
|
|
44
|
+
// str => Rendered HTML string
|
|
45
|
+
res.send(str);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
} catch (error) {
|
|
49
|
+
res.status(500).send({ message: error.message });
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
});
|
|
53
|
+
exports.default = router;
|
package/main/default/tabs/{admin_stimulsoft_reports.tab.yml → admin_developer_graphql.tab.yml}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
name:
|
|
1
|
+
name: admin_developer_graphql
|
|
2
2
|
desktop: true
|
|
3
3
|
icon: entity
|
|
4
|
-
is_new_window:
|
|
5
|
-
label:
|
|
4
|
+
is_new_window: true
|
|
5
|
+
label: Graphql IDE
|
|
6
6
|
mobile: true
|
|
7
7
|
permissions:
|
|
8
8
|
- permission: 'on'
|
|
@@ -18,4 +18,4 @@ permissions:
|
|
|
18
18
|
- permission: 'off'
|
|
19
19
|
permission_set: workflow_admin
|
|
20
20
|
type: url
|
|
21
|
-
url: /
|
|
21
|
+
url: /graphql
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
name:
|
|
1
|
+
name: admin_developer_triggers
|
|
2
2
|
desktop: true
|
|
3
|
-
icon:
|
|
3
|
+
icon: choice
|
|
4
4
|
is_new_window: false
|
|
5
|
-
label:
|
|
5
|
+
label: 触发器
|
|
6
6
|
mobile: true
|
|
7
7
|
permissions:
|
|
8
8
|
- permission: 'on'
|
|
@@ -18,4 +18,4 @@ permissions:
|
|
|
18
18
|
- permission: 'off'
|
|
19
19
|
permission_set: workflow_admin
|
|
20
20
|
type: url
|
|
21
|
-
url: /app/admin/
|
|
21
|
+
url: /app/admin/object_triggers/grid/all
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Author: baozhoutao@steedos.com
|
|
3
|
+
* @Date: 2022-08-05 14:17:44
|
|
4
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
5
|
+
* @LastEditTime: 2023-05-06 11:52:46
|
|
6
|
+
* @Description:
|
|
7
|
+
*/
|
|
1
8
|
const _ = require('underscore');
|
|
2
9
|
const clone = require("clone");
|
|
3
10
|
const objectql = require("@steedos/objectql");
|
|
@@ -38,37 +45,8 @@ module.exports = {
|
|
|
38
45
|
let allApps = clone(await objectql.getAppConfigs(this.spaceId));
|
|
39
46
|
let apps = {}
|
|
40
47
|
_.each(allApps, function(app){
|
|
41
|
-
if(app.is_creator){
|
|
48
|
+
if(app.is_creator || app.mobile){
|
|
42
49
|
apps[app._id] = app
|
|
43
|
-
}
|
|
44
|
-
})
|
|
45
|
-
i18n.translationApps(lng, apps)
|
|
46
|
-
_.each(apps, function(app){
|
|
47
|
-
app.name = app.label
|
|
48
|
-
if(!_.find(self.data.values, function(item){return item.code === app._id || item._id === app._id})){
|
|
49
|
-
self.data.values.push(Object.assign({code: app._id}, clone(app), baseRecord));
|
|
50
|
-
}
|
|
51
|
-
})
|
|
52
|
-
// console.log(`find this.query`, self.query, objectql.getSteedosSchema().metadataDriver.find(self.data.values, this.query, spaceId))
|
|
53
|
-
self.data.values = objectql.getSteedosSchema().metadataDriver.find(self.data.values, self.query, spaceId);
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
afterAggregate: async function () {
|
|
57
|
-
const { spaceId } = this;
|
|
58
|
-
let query = InternalData.parserFilters(this.query.filters);
|
|
59
|
-
let isSystem = query.is_system;
|
|
60
|
-
if(!_.isEmpty(isSystem) || _.isBoolean(isSystem)){
|
|
61
|
-
if(_.isObject(isSystem) && isSystem["$ne"]){
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
if(_.isArray(this.data.values)){
|
|
66
|
-
let lng = await getLng(this.userId);
|
|
67
|
-
let self = this;
|
|
68
|
-
let allApps = clone(await objectql.getAppConfigs(this.spaceId));
|
|
69
|
-
let apps = {}
|
|
70
|
-
_.each(allApps, function(app){
|
|
71
|
-
if(app.is_creator){
|
|
72
50
|
apps[app._id] = app
|
|
73
51
|
}
|
|
74
52
|
})
|
|
@@ -79,16 +57,10 @@ module.exports = {
|
|
|
79
57
|
self.data.values.push(Object.assign({code: app._id}, clone(app), baseRecord));
|
|
80
58
|
}
|
|
81
59
|
})
|
|
60
|
+
self.data.values = objectql.getSteedosSchema().metadataDriver.find(self.data.values, self.query, spaceId);
|
|
82
61
|
}
|
|
83
|
-
// 获取的apps根据保存的值进行过滤
|
|
84
|
-
// const allData = this.data.values;
|
|
85
|
-
// const firstFilterKey = _.keys(query)[0];
|
|
86
|
-
// this.data.values = _.filter(allData, (item)=>{
|
|
87
|
-
// return item[firstFilterKey] === query[firstFilterKey];
|
|
88
|
-
// })
|
|
89
|
-
// console.log(`afterAggregate this.query`, this.query, objectql.getSteedosSchema().metadataDriver.find(this.data.values, this.query, spaceId))
|
|
90
|
-
this.data.values = objectql.getSteedosSchema().metadataDriver.find(this.data.values, this.query, spaceId);
|
|
91
62
|
},
|
|
63
|
+
|
|
92
64
|
afterCount: async function () {
|
|
93
65
|
try {
|
|
94
66
|
this.query.fields.push('name');
|
|
@@ -104,32 +76,8 @@ module.exports = {
|
|
|
104
76
|
if(id && _.isEmpty(this.data.values)){
|
|
105
77
|
let lng = await getLng(this.userId);
|
|
106
78
|
let app = await objectql.getAppConfig(id);
|
|
107
|
-
// let allApps = clone(await objectql.getAppConfigs(this.spaceId));
|
|
108
|
-
// let apps = {}
|
|
109
|
-
// _.each(allApps, function(app){
|
|
110
|
-
// if(app._id === id && app.is_creator){
|
|
111
|
-
// apps[app._id] = app
|
|
112
|
-
// }
|
|
113
|
-
// })
|
|
114
79
|
i18n.translationApp(lng, app._id, app)
|
|
115
80
|
Object.assign(this.data.values, Object.assign({code: app._id}, clone(app), baseRecord))
|
|
116
|
-
// let sefl = this;
|
|
117
|
-
// _.each(apps, function(app){
|
|
118
|
-
// app.name = app.label
|
|
119
|
-
// Object.assign(sefl.data.values, Object.assign({code: app._id}, clone(app), baseRecord))
|
|
120
|
-
// })
|
|
121
81
|
}
|
|
122
|
-
}
|
|
123
|
-
// afterInsert: async function () {
|
|
124
|
-
// const record = await this.getObject('apps').findOne(this.doc._id);
|
|
125
|
-
// await objectql.addAppConfig(record, SERVICE_NAME)
|
|
126
|
-
// },
|
|
127
|
-
// afterUpdate: async function () {
|
|
128
|
-
// const record = await this.getObject('apps').findOne(this.id);
|
|
129
|
-
// await objectql.addAppConfig(record, SERVICE_NAME)
|
|
130
|
-
// },
|
|
131
|
-
// afterDelete: async function(){
|
|
132
|
-
// let id = this.id;
|
|
133
|
-
// objectql.removeApp(id)
|
|
134
|
-
// }
|
|
82
|
+
}
|
|
135
83
|
}
|
|
@@ -1,18 +1,25 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* @Author: sunhaolin@hotoa.com
|
|
3
3
|
* @Date: 2021-09-10 16:44:24
|
|
4
|
-
* @LastEditors:
|
|
5
|
-
* @LastEditTime:
|
|
4
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
5
|
+
* @LastEditTime: 2023-04-21 11:09:05
|
|
6
6
|
* @Description:
|
|
7
7
|
*/
|
|
8
8
|
const util = require('@steedos/standard-objects').util;
|
|
9
9
|
const _ = require('lodash');
|
|
10
|
+
const objectql = require('@steedos/objectql')
|
|
10
11
|
module.exports = {
|
|
11
12
|
listenTo: 'tabs',
|
|
12
13
|
|
|
13
14
|
beforeInsert: async function(){
|
|
14
15
|
const { object_name, doc } = this;
|
|
15
16
|
await util.checkAPIName(object_name, 'name', doc.name, undefined);
|
|
17
|
+
if(doc.type === 'object'){
|
|
18
|
+
const records = await objectql.getObject('tabs').count({filters: [['type', '=', 'object'], ['object', '=', doc.object]]});
|
|
19
|
+
if(records > 0){
|
|
20
|
+
throw new Error('对象选项卡已存在')
|
|
21
|
+
}
|
|
22
|
+
}
|
|
16
23
|
},
|
|
17
24
|
|
|
18
25
|
beforeUpdate: async function(){
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steedos/standard-ui",
|
|
3
|
-
"version": "2.5.0
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"main": "package.service.js",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
@@ -12,5 +12,5 @@
|
|
|
12
12
|
"description": "steedos package",
|
|
13
13
|
"repository": {},
|
|
14
14
|
"license": "MIT",
|
|
15
|
-
"gitHead": "
|
|
15
|
+
"gitHead": "c4b366d1366ab52eb53da1a3ff4a80b16fd73cc0"
|
|
16
16
|
}
|