odant-work 1.0.79 → 1.0.81
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/#system/package-manifest.json +14 -12
- package/$server/$folder/lib/explorer/explorer.js +56 -1
- package/$server/$folder/lib/node/node.js +266 -0
- package/$server/$folder/lib/support/support.js +1232 -0
- package/package.json +1 -1
- package/sources/client/folder.js +4 -0
- package/sources/host/auto-updater.js +79 -14
- package/sources/modules/support/index.js +414 -0
- package/sources/server/access/gateway.js +5 -2
- package/sources/server/class.js +11 -0
- package/sources/server/server.js +85 -6
- package/sources/work.js +9 -4
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"packageName": "odant-work",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.81",
|
|
4
4
|
"createdAt": 1795100682741,
|
|
5
|
-
"updatedAt":
|
|
5
|
+
"updatedAt": 1795682593545,
|
|
6
6
|
"files": {
|
|
7
7
|
"run.mjs": "f8918c612e8641e9beee06221be6680aa6fd21f25468451f2ac857fd51772266",
|
|
8
|
-
"package.json": "
|
|
9
|
-
"package-lock.json": "
|
|
8
|
+
"package.json": "eff87865b2777af1e4bcb8b0bc4e13c628f23438644f4153ec97589b096a6170",
|
|
9
|
+
"package-lock.json": "0227f01356a435cc88aba46c5e26de0a2365b172a7798df5008d7db299c472c9",
|
|
10
10
|
"sources/client/class.js": "c3fb8f143fc83aaa2df1ddeddd412d2d4dfe88656578095babe2df34fb3b3922",
|
|
11
11
|
"sources/client/field.js": "ffdd50fa8b6ec515cc42da5fca96658ff2b20e274601a1f926e0031372467a19",
|
|
12
12
|
"sources/client/file.js": "667101d75fa30840370d5be232e518aaac7c1fd52ca05a12da560eef6c0848b0",
|
|
13
|
-
"sources/client/folder.js": "
|
|
13
|
+
"sources/client/folder.js": "68d7c1b6987f4e01a453742499e6bbc734a4c2f5a92e73987bdeafc847e60a89",
|
|
14
14
|
"sources/client/handler.js": "8c19284248fbe61272ef9e59c72e5beaf5cfd3cfab1ee03d0796901d95679b6c",
|
|
15
15
|
"sources/client/index.js": "037ff635b149a617adf1219d34f0ba9dd936d5f60cea59e62d276a49468c3dc3",
|
|
16
16
|
"sources/client/readme.md": "a50aa4aa3a90606b2f446e2d29166aa26175ae87539901299e9347322ae4a2fe",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"sources/data/time.js": "cb34c1137685e83265938bb007859dfc1fca3548588d1663ee01e1affc87a09a",
|
|
37
37
|
"sources/data/workspace.js": "afbc007c16a26e86de2753794e0e7387218e97aba378047a5f37ea7961e3e921",
|
|
38
38
|
"sources/host/auth-methods.js": "d3373f072a0b31f1c689beffba144c334c848cb4a0a0a3a74f6146ff8e1292d0",
|
|
39
|
-
"sources/host/auto-updater.js": "
|
|
39
|
+
"sources/host/auto-updater.js": "be3d3d17f11ab5aeb39db178eef92b7829095557bd35eb0df592f6650293a877",
|
|
40
40
|
"sources/host/babel-merge.js": "11d5b65cae03aeabd09f06f65bee78f6fd0131eab125cc87c0dcaaf2d10e08a5",
|
|
41
41
|
"sources/host/config.js": "f41058d2ef46afc0ac5e262a0f31064d3288ab3794c4d45c0761498e775f60ae",
|
|
42
42
|
"sources/host/email-utils.js": "b15c9dadad3529f48ec9da2312394d321777ed8ec8ce1cb5c4b7946617070fcf",
|
|
@@ -183,6 +183,7 @@
|
|
|
183
183
|
"sources/modules/sandbox/readme.md": "aff13ff47f0a4d8e332cc7718c75382af6bf0514126fa6ff086e413b71880322",
|
|
184
184
|
"sources/modules/sandbox/stream.js": "bfa74c918642e4fa5af170fdde52d825865f4fd09f771da5305898ac4738d4de",
|
|
185
185
|
"sources/modules/sandbox/vnc-proxy.js": "1c75c2b24d579f254de1c4727621fbbcc7e8a10360f638f4cf1c4bd91184d103",
|
|
186
|
+
"sources/modules/support/index.js": "424c130c718819b80850482275a5891456926cc3c58f4fd5042eada382863099",
|
|
186
187
|
"sources/modules/trainer/dataset.js": "e631e1feda2958cf93436cb48a331958d7b029aa52bd42247865e87504b642f7",
|
|
187
188
|
"sources/modules/trainer/downloader.js": "d9e96cb07e7bf64386558be8c2265c482af35a513f42954250add6d5fc87bdc4",
|
|
188
189
|
"sources/modules/trainer/halogen.js": "c23f07259d9c358fe65c9acb5427200f7c69fe29c1d7a3c3f24b4e0ed422f6bf",
|
|
@@ -203,7 +204,7 @@
|
|
|
203
204
|
"sources/reactor.js": "fa132f59bac51e0d7b05a109b83100046eacddfc84576bef6115c2605b57ebf6",
|
|
204
205
|
"sources/readme.md": "045fa4d63779731d4c535deefa7bfb2956b021ab25a4d86b8dc41d6f964386f2",
|
|
205
206
|
"sources/server/access/audit.js": "b3e2cf891faf4ce97f7e8eb96a8482727ed1ad25d0ed5d6cc4e30eb922917952",
|
|
206
|
-
"sources/server/access/gateway.js": "
|
|
207
|
+
"sources/server/access/gateway.js": "b6f32f3f1118500cdec57b28f425c6d8902d989191c8b479aaed7d6799f564d5",
|
|
207
208
|
"sources/server/access/index.js": "c98fd2acc4164e299334ab865a12a07218a81c6197e1021eecb155f0096688b7",
|
|
208
209
|
"sources/server/access/invites.js": "0a500a191eb58c575e31b5d594059aedf8abcf189ba8b36f600564c19f9127aa",
|
|
209
210
|
"sources/server/access/links.js": "6adb41bd50057f28a6298054458611765aafb4336bd28166de129c30c0e36ddc",
|
|
@@ -221,7 +222,7 @@
|
|
|
221
222
|
"sources/server/class/script.js": "146ef61b5a55201c34f80de4bbfcb116922f03348773548c041bdba0e53aba64",
|
|
222
223
|
"sources/server/class/search.js": "63bf696ba049ba0b1cd6e4e40fdfe6e84c92b3a9a778369892ed3457d67e839c",
|
|
223
224
|
"sources/server/class/security.js": "eaac6115653d6ea501b4646745e095e5107eb46270408c6d34f4b157daaa0f37",
|
|
224
|
-
"sources/server/class.js": "
|
|
225
|
+
"sources/server/class.js": "6669cd6abda3efc4071839897f49e958c182bd59d7ecf3df3330be250194cf0c",
|
|
225
226
|
"sources/server/external-source.js": "a576a42d380dc2f4688f5c7b0bcb4ca5e0870c55cd8900b34e9ba4d71eb6eb38",
|
|
226
227
|
"sources/server/file.js": "4ff9c5ff372824a937d4d6782851b0c8ead0c830eb94176e5802bc90fc4ed4a1",
|
|
227
228
|
"sources/server/folder.js": "c7b67c6453e85cfcd32383f7f931655df97aaa6f5988e407ce1b49186908a358",
|
|
@@ -232,12 +233,12 @@
|
|
|
232
233
|
"sources/server/node.js": "c1aba780ddaa077ffcd63cd3387d1a5b96d67396651badfd39c5e65382f3a94d",
|
|
233
234
|
"sources/server/readme.md": "171ab173184008c748d8062f2473e8630b53ebc6a76b220a2547d5ae8bbd4999",
|
|
234
235
|
"sources/server/safe-node-name.js": "8ab1be33347050b09d7b76f0beb02a81e590216116c24096db4d061e9e1de54b",
|
|
235
|
-
"sources/server/server.js": "
|
|
236
|
+
"sources/server/server.js": "34e23e5492f31b24e60867d9bcadc2debbbf3f93354a8c920d6958db6b0baf27",
|
|
236
237
|
"sources/server/upload-mark.js": "8cf8da3e3935b98132485a26a467b072e31a08b14a36e91a5e26c683918286d2",
|
|
237
238
|
"sources/server/user.js": "638a159ab5be43c1b42da48e8643f5dd849de6740b951868285413f9a0e5a3f4",
|
|
238
239
|
"sources/server/zip-guard.js": "c377e9c0ca779764b64614cc0e32a435483c55261a73f144209306be3c15e76c",
|
|
239
240
|
"sources/tester.html": "69ed1c6c68586cb32da9f7939305a1570ddc919a3e6f8d19b74ecfcd13f98f10",
|
|
240
|
-
"sources/work.js": "
|
|
241
|
+
"sources/work.js": "e649c43ae62b657b06bfb457a31349373c4095755ed7eb644411c2c1f17aa8a8",
|
|
241
242
|
"oda/benchmarks/dbmon/index.html": "f7215c6ae05491250f9b628001a5eb85361bf4738224870eda7b992f0aa6aec8",
|
|
242
243
|
"oda/benchmarks/dbmon/lib/ENV.js": "968c7162a59f3fa3e8a90afafdbd81aeda02ee6459edc0eca5438192fbb140c5",
|
|
243
244
|
"oda/benchmarks/dbmon/lib/ga.js": "7f32f81f7d505d1ebf21d1d6fc4c6e5fba58893a567c9caa176d32f79f3c9278",
|
|
@@ -801,7 +802,7 @@
|
|
|
801
802
|
"$server/$folder/lib/dot/readme.md": "22d9981d9b1b39e870623f8eedcc562ed4f6c6638d0ddeb853244bd55df3c60f",
|
|
802
803
|
"$server/$folder/lib/editor-form/editor-form.js": "7dee223a9613df2f7091e0d330142252a87a438062de9cec56002943745e5ba1",
|
|
803
804
|
"$server/$folder/lib/email/settings.js": "25e13ecf12b84e5fd6bcac955b1e0dc47bf09b72a98776e8ce1e1f01617aef9d",
|
|
804
|
-
"$server/$folder/lib/explorer/explorer.js": "
|
|
805
|
+
"$server/$folder/lib/explorer/explorer.js": "1c0f43c111c24d0d4c471e067cba50da6fd259c87fbbb315f7208aa2116a5e7d",
|
|
805
806
|
"$server/$folder/lib/file-viewer/file-viewer.js": "b183fd61b72fcc7baba3e44e16ddf3800553596313711a7bc4dd91f3e1e260ab",
|
|
806
807
|
"$server/$folder/lib/icon/icon.js": "59fdfd832f55e6d8e247bb75009d0fea3d389ab8fa17fa99f8661e18ea880f32",
|
|
807
808
|
"$server/$folder/lib/icon/user/user.js": "481da79de754c244f0151c91d03a503c0452902575e4dc8bc2b3171c0fad3a2e",
|
|
@@ -814,7 +815,7 @@
|
|
|
814
815
|
"$server/$folder/lib/menu/progress.md": "f88ee7fde608ec00a9f2459e11b28328c0c6003f1b365b919c3dd9004296c86a",
|
|
815
816
|
"$server/$folder/lib/menu/readme.md": "2fcd2b1b905ac9cd25264da2cef02d53d181e97b9d02c16772770de82b756eba",
|
|
816
817
|
"$server/$folder/lib/messenger-settings/messenger-settings.js": "0e6237d9724ae4fd33327f9a521b26e698d7b40074d39402d1f4812ad2fbe085",
|
|
817
|
-
"$server/$folder/lib/node/node.js": "
|
|
818
|
+
"$server/$folder/lib/node/node.js": "d22fb78361403156053ed3e6f40a60237a6fb14a7ec9ab256225d6e04131d2e6",
|
|
818
819
|
"$server/$folder/lib/node/progress.md": "eaada60a7d4f72a913369fda6cdad0abb3c8156215eec4d6bd9211f1ccc441ba",
|
|
819
820
|
"$server/$folder/lib/node/readme.md": "ea9b82dc0db4af289b08d2e41399124310cee089cfab5d2107663ee314a23741",
|
|
820
821
|
"$server/$folder/lib/node-explorer/node-explorer.js": "7f30a60186e5aa81d93ceabade522656403066320f3fa439f6a490049270269e",
|
|
@@ -832,6 +833,7 @@
|
|
|
832
833
|
"$server/$folder/lib/site-loc/readme.md": "4e489e8841d3de91df4cfd33980c6134ad524587d00659b30e991e8fab82d8b4",
|
|
833
834
|
"$server/$folder/lib/site-loc/site-loc.js": "250a2bfe9820df8762cda76047691df5fb1a1f7a33ebda1a33b93982af6ce692",
|
|
834
835
|
"$server/$folder/lib/site-user/site-user.js": "d6d54ee2eaf47c28bc475235333012ccaa6770f7c85f18260366822001b81b1d",
|
|
836
|
+
"$server/$folder/lib/support/support.js": "6c5024d957476db722907305e35fe8a49b57d254ef18f6073bf7918929d70bfc",
|
|
835
837
|
"$server/$folder/lib/tools/tools.js": "1f71aea0c6ecfe329e0bcb36bfba3621c3d8323352cf255831d6af405028cce8",
|
|
836
838
|
"$server/$folder/lib/tree/link-nodes.js": "e475b4a61d68829d07d5cc57dacfd030c957873429979b40a29a3947805e19af",
|
|
837
839
|
"$server/$folder/lib/tree/progress.md": "4a9a6aafcb044e3cf2048d46e13be7f9afcb1abc6e5c6b0ff17a82e3491e5c08",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
icon: 'odant:structure',
|
|
3
|
-
imports: 'oda//app-layout.js, oda//tabs.js, oda//icon, oda//button, ~/lib//tree.js, ~/lib//node-explorer.js, ~/lib//consultant.js, ~/lib//class-picker.js',
|
|
3
|
+
imports: 'oda//app-layout.js, oda//tabs.js, oda//icon, oda//button, ~/lib//tree.js, ~/lib//node-explorer.js, ~/lib//consultant.js, ~/lib//class-picker.js, ~/lib//support.js',
|
|
4
4
|
extends: 'oda-app-layout',
|
|
5
5
|
template: /*html*/`
|
|
6
6
|
<item-tree order="0" slot='left-panel' allow-search clean-structure :items-selector :show-size show-status show-users allow-focus :hide-roots :hide-tops :$item style="height: 0"></item-tree>
|
|
@@ -118,6 +118,20 @@ export default {
|
|
|
118
118
|
},
|
|
119
119
|
});
|
|
120
120
|
}
|
|
121
|
+
if (WORK?.uid) {
|
|
122
|
+
const supPending = Number(this._supportUnread || 0) + Number(this._supportRemotePending || 0);
|
|
123
|
+
buttons.push({
|
|
124
|
+
round: true,
|
|
125
|
+
icon: 'icons:help',
|
|
126
|
+
title: supPending > 0
|
|
127
|
+
? `Служба поддержки (${supPending} уведомл.)`
|
|
128
|
+
: 'Служба поддержки (скриншот, видео, удалённый экран)',
|
|
129
|
+
rainbow: Boolean(this._supportRemotePending > 0 || this._supportUnread > 0),
|
|
130
|
+
click: () => {
|
|
131
|
+
this.openSupportPanel?.();
|
|
132
|
+
},
|
|
133
|
+
});
|
|
134
|
+
}
|
|
121
135
|
buttons.push({
|
|
122
136
|
round: true,
|
|
123
137
|
icon: user?.icon || 'icons:account-circle',
|
|
@@ -158,6 +172,42 @@ export default {
|
|
|
158
172
|
}
|
|
159
173
|
return this.left_buttons;
|
|
160
174
|
},
|
|
175
|
+
_supportUnread: 0,
|
|
176
|
+
_supportRemotePending: 0,
|
|
177
|
+
async openSupportPanel() {
|
|
178
|
+
if (typeof document === 'undefined') return;
|
|
179
|
+
const existing = document.querySelector('work-support-panel');
|
|
180
|
+
if (existing) {
|
|
181
|
+
existing.minimized = false;
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
await ODA.waitReg?.('work-support-panel').catch(() => {});
|
|
185
|
+
const panel = document.createElement('work-support-panel');
|
|
186
|
+
if (this._supportUnread > 0 || this._supportRemotePending > 0)
|
|
187
|
+
panel.activeTab = 'list';
|
|
188
|
+
panel.addEventListener('support-closed', (e) => {
|
|
189
|
+
if (typeof e?.detail?.unreadTotal === 'number') {
|
|
190
|
+
this._supportUnread = e.detail.unreadTotal;
|
|
191
|
+
this._refreshLeftButtons();
|
|
192
|
+
}
|
|
193
|
+
this._refreshSupportBadge();
|
|
194
|
+
});
|
|
195
|
+
document.body.appendChild(panel);
|
|
196
|
+
},
|
|
197
|
+
async _refreshSupportBadge() {
|
|
198
|
+
if (!WORK?.uid || typeof WORK?.fetch !== 'function') return;
|
|
199
|
+
try {
|
|
200
|
+
const res = await WORK.fetch('/', 'support_list');
|
|
201
|
+
const nextUnread = Number(res?.unreadTotal || 0);
|
|
202
|
+
const nextRemote = Number(res?.remoteRequests || 0);
|
|
203
|
+
if (nextUnread !== this._supportUnread || nextRemote !== this._supportRemotePending) {
|
|
204
|
+
this._supportUnread = nextUnread;
|
|
205
|
+
this._supportRemotePending = nextRemote;
|
|
206
|
+
this._refreshLeftButtons();
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
catch { /* ignore */ }
|
|
210
|
+
},
|
|
161
211
|
_onFocusedIndexChanged(e) {
|
|
162
212
|
this.visibleMode = 'main';
|
|
163
213
|
const drawer = this.left_drawer;
|
|
@@ -668,10 +718,15 @@ export default {
|
|
|
668
718
|
}
|
|
669
719
|
this._refreshLeftButtons();
|
|
670
720
|
this._initTopLicenseBanner();
|
|
721
|
+
this._refreshSupportBadge();
|
|
722
|
+
if (!this._supportBadgeTimer && typeof window !== 'undefined') {
|
|
723
|
+
this._supportBadgeTimer = setInterval(() => this._refreshSupportBadge(), 60_000);
|
|
724
|
+
}
|
|
671
725
|
WORK.authEvents?.addEventListener('auth', () => {
|
|
672
726
|
this.user_icon = undefined;
|
|
673
727
|
this._refreshLeftButtons();
|
|
674
728
|
this._initTopLicenseBanner();
|
|
729
|
+
this._refreshSupportBadge();
|
|
675
730
|
this.render?.();
|
|
676
731
|
});
|
|
677
732
|
window.execute = async ($item, nav) => {
|
|
@@ -1,5 +1,107 @@
|
|
|
1
1
|
import { isLinkNode } from '../tree/link-nodes.js';
|
|
2
2
|
|
|
3
|
+
const VERSION_CHECK_INTERVAL_MS = 10 * 60_000;
|
|
4
|
+
|
|
5
|
+
async function waitServerRestart() {
|
|
6
|
+
const probe = async () => {
|
|
7
|
+
try {
|
|
8
|
+
const res = await fetch(window.location.origin, { method: 'HEAD', cache: 'no-store' });
|
|
9
|
+
return Boolean(res);
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
const until = async (wantUp, tries, delay) => {
|
|
16
|
+
for (let i = 0; i < tries; i++) {
|
|
17
|
+
if (await probe() === wantUp)
|
|
18
|
+
return true;
|
|
19
|
+
await new Promise(r => setTimeout(r, delay));
|
|
20
|
+
}
|
|
21
|
+
return false;
|
|
22
|
+
};
|
|
23
|
+
await until(false, 150, 200);
|
|
24
|
+
if (!await until(true, 600, 500))
|
|
25
|
+
throw new Error('Сервер не поднялся — проверьте work-restart.log и обновите страницу вручную');
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function getWorkVersionStore() {
|
|
29
|
+
const host = globalThis.WORK || globalThis;
|
|
30
|
+
if (host.__workVersionStore)
|
|
31
|
+
return host.__workVersionStore;
|
|
32
|
+
const store = {
|
|
33
|
+
state: null,
|
|
34
|
+
busyLabel: '',
|
|
35
|
+
error: '',
|
|
36
|
+
events: new EventTarget(),
|
|
37
|
+
_rootItem: null,
|
|
38
|
+
_timer: null,
|
|
39
|
+
_inFlight: null,
|
|
40
|
+
_lastFetchAt: 0,
|
|
41
|
+
_visBound: false,
|
|
42
|
+
emit() {
|
|
43
|
+
this.events.dispatchEvent(new Event('change'));
|
|
44
|
+
},
|
|
45
|
+
setBusy(label) {
|
|
46
|
+
this.busyLabel = label || '';
|
|
47
|
+
this.emit();
|
|
48
|
+
},
|
|
49
|
+
ensureStarted(item) {
|
|
50
|
+
if (!item || typeof item.fetch !== 'function')
|
|
51
|
+
return;
|
|
52
|
+
const changedItem = this._rootItem !== item;
|
|
53
|
+
this._rootItem = item;
|
|
54
|
+
if (changedItem || !this.state)
|
|
55
|
+
this.refresh(item, { check: false });
|
|
56
|
+
if (!this._timer) {
|
|
57
|
+
this._timer = setInterval(() => {
|
|
58
|
+
if (this._rootItem)
|
|
59
|
+
this.refresh(this._rootItem, { check: false });
|
|
60
|
+
}, VERSION_CHECK_INTERVAL_MS);
|
|
61
|
+
}
|
|
62
|
+
if (!this._visBound && typeof document !== 'undefined') {
|
|
63
|
+
this._visBound = true;
|
|
64
|
+
document.addEventListener('visibilitychange', () => {
|
|
65
|
+
if (document.visibilityState === 'visible' && this._rootItem && (Date.now() - this._lastFetchAt) >= VERSION_CHECK_INTERVAL_MS)
|
|
66
|
+
this.refresh(this._rootItem, { check: false });
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
async refresh(item, { check = false } = {}) {
|
|
71
|
+
if (!item || typeof item.fetch !== 'function')
|
|
72
|
+
return this.state;
|
|
73
|
+
if (this._inFlight && !check)
|
|
74
|
+
return this._inFlight;
|
|
75
|
+
const req = (async () => {
|
|
76
|
+
try {
|
|
77
|
+
const res = await item.fetch('version_status', check ? { check: 1 } : {});
|
|
78
|
+
if (res && typeof res === 'object' && res.runningVersion) {
|
|
79
|
+
this.state = res;
|
|
80
|
+
this.error = res.checkError || '';
|
|
81
|
+
this._lastFetchAt = Date.now();
|
|
82
|
+
this.emit();
|
|
83
|
+
}
|
|
84
|
+
return this.state;
|
|
85
|
+
}
|
|
86
|
+
catch (err) {
|
|
87
|
+
this.error = String(err?.message || err);
|
|
88
|
+
this.emit();
|
|
89
|
+
return this.state;
|
|
90
|
+
}
|
|
91
|
+
finally {
|
|
92
|
+
if (this._inFlight === req)
|
|
93
|
+
this._inFlight = null;
|
|
94
|
+
}
|
|
95
|
+
})();
|
|
96
|
+
if (!check)
|
|
97
|
+
this._inFlight = req;
|
|
98
|
+
return req;
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
host.__workVersionStore = store;
|
|
102
|
+
return store;
|
|
103
|
+
}
|
|
104
|
+
|
|
3
105
|
export default {
|
|
4
106
|
imports: '~/lib//icon, ~/lib//users',
|
|
5
107
|
extends: 'item-icon',
|
|
@@ -117,6 +219,37 @@ export default {
|
|
|
117
219
|
align-self: center;
|
|
118
220
|
margin-right: 4px;
|
|
119
221
|
}
|
|
222
|
+
.work-ver{
|
|
223
|
+
@apply --no-flex;
|
|
224
|
+
font-size: 11px;
|
|
225
|
+
font-family: monospace;
|
|
226
|
+
line-height: 1.25;
|
|
227
|
+
padding: 2px 7px;
|
|
228
|
+
margin-left: 6px;
|
|
229
|
+
border-radius: 999px;
|
|
230
|
+
border: 1px solid light-dark(rgba(100, 116, 139, 0.28), rgba(148, 163, 184, 0.28));
|
|
231
|
+
background: light-dark(rgba(100, 116, 139, 0.08), rgba(148, 163, 184, 0.12));
|
|
232
|
+
color: var(--muted-color, light-dark(#64748b, #94a3b8));
|
|
233
|
+
white-space: nowrap;
|
|
234
|
+
align-self: center;
|
|
235
|
+
user-select: none;
|
|
236
|
+
}
|
|
237
|
+
.work-ver.clickable{
|
|
238
|
+
cursor: pointer;
|
|
239
|
+
}
|
|
240
|
+
.work-ver.clickable:hover{
|
|
241
|
+
filter: brightness(0.95);
|
|
242
|
+
}
|
|
243
|
+
.work-ver.has-update{
|
|
244
|
+
border-color: light-dark(rgba(22, 163, 74, 0.45), rgba(74, 222, 128, 0.45));
|
|
245
|
+
background: light-dark(#dcfce7, rgba(22, 163, 74, 0.24));
|
|
246
|
+
color: light-dark(#15803d, #86efac);
|
|
247
|
+
font-weight: 700;
|
|
248
|
+
}
|
|
249
|
+
.work-ver.busy{
|
|
250
|
+
opacity: .75;
|
|
251
|
+
cursor: wait;
|
|
252
|
+
}
|
|
120
253
|
</style>
|
|
121
254
|
<div horizontal flex style="align-items: center; min-width: 0; width: 100%;">
|
|
122
255
|
<div vertical flex style="min-width: 0;">
|
|
@@ -127,6 +260,10 @@ export default {
|
|
|
127
260
|
<span class="history-time" ~if="historyTime" ~show="!hideLabel">{{historyTime}}</span>
|
|
128
261
|
</div>
|
|
129
262
|
</div>
|
|
263
|
+
<span class="work-ver" ~if="showWorkVersion"
|
|
264
|
+
~class="{ 'has-update': workVersionHasUpdate, clickable: workVersionClickable, busy: workVersionBusy }"
|
|
265
|
+
:title="workVersionTitle"
|
|
266
|
+
@tap.stop="onWorkVersionTap($event)">{{workVersionText}}</span>
|
|
130
267
|
<span class="unread-badge" ~if="unreadCount > 0">{{unreadCount > 99 ? '99+' : unreadCount}}</span>
|
|
131
268
|
<span class="obj-count" ~if="objectCount">{{objectCount}}</span>
|
|
132
269
|
<span class="size" ~if="showSize && !($item instanceof CORE.$class) && !isPlace" ~show="$item?.size">{{$item?.size}}</span>
|
|
@@ -272,7 +409,9 @@ export default {
|
|
|
272
409
|
}
|
|
273
410
|
},
|
|
274
411
|
showStatus: false,
|
|
412
|
+
isExplorer: false,
|
|
275
413
|
_unreadVer: 0,
|
|
414
|
+
_workVerTick: 0,
|
|
276
415
|
attached() {
|
|
277
416
|
if (!this._onChatUnreadEvt && globalThis.WORK) {
|
|
278
417
|
globalThis.WORK.chatEvents ??= new EventTarget();
|
|
@@ -280,6 +419,13 @@ export default {
|
|
|
280
419
|
globalThis.WORK.chatEvents.addEventListener('chat:message', this._onChatUnreadEvt);
|
|
281
420
|
globalThis.WORK.chatEvents.addEventListener('chat:read', this._onChatUnreadEvt);
|
|
282
421
|
}
|
|
422
|
+
const store = getWorkVersionStore();
|
|
423
|
+
if (!this._onWorkVerEvt) {
|
|
424
|
+
this._onWorkVerEvt = () => { this._workVerTick++; };
|
|
425
|
+
store.events.addEventListener('change', this._onWorkVerEvt);
|
|
426
|
+
}
|
|
427
|
+
if (this.isWorkServerNode)
|
|
428
|
+
store.ensureStarted(this.$item);
|
|
283
429
|
},
|
|
284
430
|
detached() {
|
|
285
431
|
if (this._onChatUnreadEvt && globalThis.WORK?.chatEvents) {
|
|
@@ -287,6 +433,126 @@ export default {
|
|
|
287
433
|
globalThis.WORK.chatEvents.removeEventListener('chat:read', this._onChatUnreadEvt);
|
|
288
434
|
this._onChatUnreadEvt = null;
|
|
289
435
|
}
|
|
436
|
+
if (this._onWorkVerEvt) {
|
|
437
|
+
getWorkVersionStore().events.removeEventListener('change', this._onWorkVerEvt);
|
|
438
|
+
this._onWorkVerEvt = null;
|
|
439
|
+
}
|
|
440
|
+
},
|
|
441
|
+
get isWorkServerNode() {
|
|
442
|
+
const it = this.$item;
|
|
443
|
+
if (!it || this.isLink || this.hideLabel || this.isExplorer || this.hasAttribute?.('is-explorer'))
|
|
444
|
+
return false;
|
|
445
|
+
const p = String(it.path || it.short || '/').replace(/\/+$/, '') || '/';
|
|
446
|
+
return it.type === '$server' && p === '/';
|
|
447
|
+
},
|
|
448
|
+
get _workVerInfo() {
|
|
449
|
+
void this._workVerTick;
|
|
450
|
+
if (!this.isWorkServerNode)
|
|
451
|
+
return null;
|
|
452
|
+
const store = getWorkVersionStore();
|
|
453
|
+
if (store._rootItem !== this.$item)
|
|
454
|
+
store.ensureStarted(this.$item);
|
|
455
|
+
return store.state ? { ...store.state, busyLabel: store.busyLabel, error: store.error } : null;
|
|
456
|
+
},
|
|
457
|
+
get showWorkVersion() {
|
|
458
|
+
const info = this._workVerInfo;
|
|
459
|
+
return Boolean(info && (info.runningVersion || info.busyLabel));
|
|
460
|
+
},
|
|
461
|
+
get workVersionHasUpdate() {
|
|
462
|
+
return Boolean(this._workVerInfo?.updateAvailable);
|
|
463
|
+
},
|
|
464
|
+
get workVersionBusy() {
|
|
465
|
+
return Boolean(this._workVerInfo?.busyLabel);
|
|
466
|
+
},
|
|
467
|
+
get workVersionClickable() {
|
|
468
|
+
const info = this._workVerInfo;
|
|
469
|
+
return Boolean(info && info.canUpdate && !info.busyLabel);
|
|
470
|
+
},
|
|
471
|
+
get workVersionText() {
|
|
472
|
+
const info = this._workVerInfo;
|
|
473
|
+
if (!info)
|
|
474
|
+
return '';
|
|
475
|
+
if (info.busyLabel)
|
|
476
|
+
return info.busyLabel;
|
|
477
|
+
if (info.updateAvailable && info.latestVersion)
|
|
478
|
+
return `v${info.runningVersion} ↑ ${info.latestVersion}`;
|
|
479
|
+
return `v${info.runningVersion}`;
|
|
480
|
+
},
|
|
481
|
+
get workVersionTitle() {
|
|
482
|
+
const info = this._workVerInfo;
|
|
483
|
+
if (!info)
|
|
484
|
+
return '';
|
|
485
|
+
if (info.busyLabel)
|
|
486
|
+
return info.busyLabel;
|
|
487
|
+
if (info.updateAvailable && info.latestVersion) {
|
|
488
|
+
return info.canUpdate
|
|
489
|
+
? `Доступна новая версия ${info.latestVersion} (текущая ${info.runningVersion}) — нажмите, чтобы обновить и перезапустить`
|
|
490
|
+
: `Доступна новая версия ${info.latestVersion} (текущая ${info.runningVersion})`;
|
|
491
|
+
}
|
|
492
|
+
const errPart = info.error ? `\nОшибка проверки: ${info.error}` : '';
|
|
493
|
+
return info.canUpdate
|
|
494
|
+
? `Версия WORK ${info.runningVersion} — нажмите для проверки обновлений${errPart}`
|
|
495
|
+
: `Версия WORK ${info.runningVersion}${errPart}`;
|
|
496
|
+
},
|
|
497
|
+
async _confirmAndUpdateWork(store, info) {
|
|
498
|
+
if (!info?.updateAvailable || !info?.canUpdate || store.busyLabel)
|
|
499
|
+
return;
|
|
500
|
+
const msg = `Доступна новая версия WORK ${info.latestVersion} (текущая ${info.runningVersion}). Обновить и перезапустить сервер?`;
|
|
501
|
+
let ok = false;
|
|
502
|
+
try {
|
|
503
|
+
if (typeof globalThis.WORK?.showConfirm === 'function')
|
|
504
|
+
ok = await globalThis.WORK.showConfirm(msg);
|
|
505
|
+
else
|
|
506
|
+
ok = window.confirm(msg);
|
|
507
|
+
}
|
|
508
|
+
catch {
|
|
509
|
+
return;
|
|
510
|
+
}
|
|
511
|
+
if (!ok)
|
|
512
|
+
return;
|
|
513
|
+
store.setBusy('Обновление…');
|
|
514
|
+
try {
|
|
515
|
+
const res = await this.$item.fetch('version_update_restart');
|
|
516
|
+
if (!res?.restarted) {
|
|
517
|
+
store.setBusy('');
|
|
518
|
+
await store.refresh(this.$item, { check: false });
|
|
519
|
+
return;
|
|
520
|
+
}
|
|
521
|
+
store.setBusy('Перезапуск…');
|
|
522
|
+
await waitServerRestart();
|
|
523
|
+
window.location.reload();
|
|
524
|
+
}
|
|
525
|
+
catch (err) {
|
|
526
|
+
store.setBusy('');
|
|
527
|
+
store.error = String(err?.message || err);
|
|
528
|
+
store.emit();
|
|
529
|
+
try {
|
|
530
|
+
if (typeof globalThis.WORK?.showToast === 'function')
|
|
531
|
+
globalThis.WORK.showToast(`Не удалось обновить сервер: ${store.error}`, 'error');
|
|
532
|
+
}
|
|
533
|
+
catch { /* ignore */ }
|
|
534
|
+
}
|
|
535
|
+
},
|
|
536
|
+
async onWorkVersionTap(e) {
|
|
537
|
+
e?.stopPropagation?.();
|
|
538
|
+
const store = getWorkVersionStore();
|
|
539
|
+
const info = this._workVerInfo;
|
|
540
|
+
if (!info || !info.canUpdate || store.busyLabel)
|
|
541
|
+
return;
|
|
542
|
+
if (info.updateAvailable) {
|
|
543
|
+
await this._confirmAndUpdateWork(store, info);
|
|
544
|
+
return;
|
|
545
|
+
}
|
|
546
|
+
store.setBusy('Проверка…');
|
|
547
|
+
try {
|
|
548
|
+
const next = await store.refresh(this.$item, { check: true });
|
|
549
|
+
store.setBusy('');
|
|
550
|
+
if (next?.updateAvailable)
|
|
551
|
+
await this._confirmAndUpdateWork(store, { ...next, busyLabel: '' });
|
|
552
|
+
}
|
|
553
|
+
catch {
|
|
554
|
+
store.setBusy('');
|
|
555
|
+
}
|
|
290
556
|
},
|
|
291
557
|
get unreadCount() {
|
|
292
558
|
void this._unreadVer;
|