@steedos/service-core-objects 3.0.0-beta.52 → 3.0.0-beta.54
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.
|
@@ -42,25 +42,57 @@ socket.on("connection-init", ()=>{
|
|
|
42
42
|
})
|
|
43
43
|
|
|
44
44
|
// 监听自定义事件(根据服务器提供的接口)
|
|
45
|
+
const debounceTimers = new Map();
|
|
46
|
+
|
|
45
47
|
socket.on(SocketEvents.metadataChange, (data) => {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
48
|
+
// 生成唯一 key 的逻辑
|
|
49
|
+
const getKey = () => {
|
|
50
|
+
if (data.type === 'object_fields' || data.type === 'object_listviews') {
|
|
51
|
+
return `objects-${data.objectName}`;
|
|
52
|
+
}
|
|
53
|
+
return `${data.type}-${data.name}`;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
// 处理函数
|
|
57
|
+
const handleRequest = () => {
|
|
58
|
+
if (data.type === 'apps') {
|
|
59
|
+
window.$(`.btn-reload-global-header-${data.name}`).trigger('click');
|
|
60
|
+
window.$(`.btn-reload-app-menu-${data.name}`).trigger('click');
|
|
61
|
+
setTimeout(() => {
|
|
62
|
+
window.$(".btn-reload-app-dashboard").trigger('click');
|
|
63
|
+
}, 1000);
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
let objectName = '';
|
|
68
|
+
if(data.type === 'objects'){
|
|
69
|
+
objectName = data.name;
|
|
70
|
+
}else if(data.type === 'object_actions'){
|
|
71
|
+
objectName = data.objectName;
|
|
72
|
+
}else if(data.type === 'object_fields'){
|
|
73
|
+
objectName = data.objectName;
|
|
74
|
+
}else if(data.type === 'object_listviews'){
|
|
75
|
+
objectName = data.objectName;
|
|
76
|
+
}
|
|
77
|
+
const shouldReloadView = () => {
|
|
78
|
+
return window.location.pathname.endsWith(`/${objectName}`) || window.location.pathname.includes(`/${objectName}/view`);
|
|
79
|
+
};
|
|
80
|
+
window.getUISchema(objectName, true).then(() => {
|
|
81
|
+
if (shouldReloadView()) {
|
|
82
|
+
window.navigate(window.location.pathname, {
|
|
83
|
+
state: { reloadKey: Date.now() }
|
|
84
|
+
});
|
|
62
85
|
}
|
|
63
|
-
})
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
if (data.type === 'apps') {
|
|
90
|
+
// apps 类型不防抖,直接执行
|
|
91
|
+
handleRequest();
|
|
92
|
+
} else {
|
|
93
|
+
const key = getKey();
|
|
94
|
+
clearTimeout(debounceTimers.get(key)); // 清除之前的定时器
|
|
95
|
+
debounceTimers.set(key, setTimeout(handleRequest, 200)); // 设置新的定时器
|
|
64
96
|
}
|
|
65
97
|
});
|
|
66
98
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steedos/service-core-objects",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.54",
|
|
4
4
|
"main": "package.service.js",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
"steedos"
|
|
11
11
|
],
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@steedos/service-package-loader": "3.0.0-beta.
|
|
13
|
+
"@steedos/service-package-loader": "3.0.0-beta.54",
|
|
14
14
|
"json2xls": "^0.1.2",
|
|
15
15
|
"lodash": "^4.17.21"
|
|
16
16
|
},
|
|
17
17
|
"description": "steedos package",
|
|
18
18
|
"repository": {},
|
|
19
19
|
"license": "MIT",
|
|
20
|
-
"gitHead": "
|
|
20
|
+
"gitHead": "d7b9f9d926cc0cfcd3ebc94ee76453667435e5cc"
|
|
21
21
|
}
|