odant-work 1.0.97 → 1.0.99
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/auto-update.json.4727984.tmp +15 -0
- package/#system/package-manifest.json +859 -863
- package/$server/$folder/$class/$data/handlers/pages/form/objects/$handler/class.js +26 -4
- package/$server/$folder/$class/$data/handlers/pages/form/objects/object/$handler/class.js +7 -2
- package/$server/$folder/$class/$domain/class.js +1 -0
- package/$server/$folder/$class/$module/handlers/pages/form/system/modules/$handler/class.js +1 -1
- package/$server/$folder/$class/$structure/$project/class.js +1 -0
- package/$server/$folder/$class/$structure/{handlers → $project/handlers}/pages/form/system/modules/$handler/class.js +21 -4
- package/$server/$folder/$class/$structure/$server/class.js +1 -0
- package/$server/$folder/$class/$structure/$server/handlers/pages/form/system/license/$handler/class.js +1 -1
- package/$server/$folder/$class/$structure/$user/class.js +1 -0
- package/$server/$folder/$class/$structure/handlers/pages/data/$handler/class.js +14 -1
- package/$server/$folder/$class/$structure/handlers/pages/form/email/$handler/class.js +34 -5
- package/$server/$folder/$class/$structure/handlers/pages/form/system/agent/$handler/class.js +28 -4
- package/$server/$folder/$class/$structure/handlers/pages/form/system/database/$handler/class.js +10 -6
- package/$server/$folder/$class/$structure/handlers/pages/form/system/messengers/$handler/class.js +41 -10
- package/$server/$folder/$class/$structure/handlers/pages/form/system/skills/$handler/class.js +27 -16
- package/$server/$folder/$class/$structure/handlers/pages/form/system/staff/$handler/class.js +19 -6
- package/$server/$folder/$class/ai/system.md +2 -2
- package/$server/$folder/$class/handlers/pages/form/folder/$handler/class.js +4 -1
- package/$server/$folder/$file/$task/handlers/pages/form/file/$handler/ui/feed.js +7 -1
- package/$server/$folder/handlers/pages/form/$handler/class.js +14 -4
- package/$server/$folder/handlers/pages/form/folder/$handler/class.js +100 -2
- package/$server/$folder/handlers/readme.md +1 -1
- package/$server/$folder/lib/explorer/explorer.js +53 -8
- package/$server/$folder/lib/messenger-settings/messenger-settings.js +63 -21
- package/$server/$folder/lib/readme.md +0 -1
- package/$server/$folder/lib/tree/tree.js +67 -11
- package/AGENTS.md +2 -2
- package/PROJECTS/$domain/readme.md +2 -2
- package/package.json +1 -1
- package/sources/client/handler.js +4 -1
- package/sources/modules/agent/node-rules.js +5 -0
- package/sources/server/class/base-template.js +19 -81
- package/sources/server/class/security.js +19 -1
- package/$server/$folder/$class/$structure/$user/handlers/pages/form/system/modules/$handler/class.js +0 -3
- package/$server/$folder/$class/handlers/pages/form/system/files/$handler/class.js +0 -7
- package/$server/$folder/$class/handlers/pages/storage/$handler/class.js +0 -43
- package/$server/$folder/lib/file-viewer/file-viewer.js +0 -9
package/$server/$folder/$class/$structure/handlers/pages/form/system/staff/$handler/class.js
CHANGED
|
@@ -1331,7 +1331,7 @@ export default {
|
|
|
1331
1331
|
<oda-icon ~if="canEdit" class="chev" icon="icons:chevron-right:90" icon-size="14"></oda-icon>
|
|
1332
1332
|
</div>
|
|
1333
1333
|
|
|
1334
|
-
<div ~if="canEdit" class="row-actions">
|
|
1334
|
+
<div ~if="canEdit && canManageRoles" class="row-actions">
|
|
1335
1335
|
<button type="button" class="icon-btn add-role-btn" @tap="promptAddRole('')">
|
|
1336
1336
|
<oda-icon icon="icons:add" icon-size="15"></oda-icon>
|
|
1337
1337
|
<span>Роль</span>
|
|
@@ -1339,9 +1339,9 @@ export default {
|
|
|
1339
1339
|
</div>
|
|
1340
1340
|
</div>
|
|
1341
1341
|
|
|
1342
|
-
<div ~if="!rootRoles.length" class="muted" style="padding:16px;">Ролей пока нет</div>
|
|
1342
|
+
<div ~if="canManageRoles && !rootRoles.length" class="muted" style="padding:16px;">Ролей пока нет</div>
|
|
1343
1343
|
|
|
1344
|
-
<staff-role-node ~for="rootRoles"
|
|
1344
|
+
<staff-role-node ~if="canManageRoles" ~for="rootRoles"
|
|
1345
1345
|
:role="$for.item"
|
|
1346
1346
|
:prefix="''"
|
|
1347
1347
|
:depth="0"
|
|
@@ -1358,10 +1358,18 @@ export default {
|
|
|
1358
1358
|
`,
|
|
1359
1359
|
$item: {
|
|
1360
1360
|
$def: null,
|
|
1361
|
-
set(n) {
|
|
1362
|
-
if (
|
|
1361
|
+
set(n, o) {
|
|
1362
|
+
if (o && this._onChanged) o.unlisten?.('changed', this._onChanged);
|
|
1363
|
+
if (n) {
|
|
1364
|
+
this._onChanged ??= () => this.debounce?.('staff-reload', () => this.reload(), 200) ?? this.reload();
|
|
1365
|
+
n.listen?.('changed', this._onChanged);
|
|
1366
|
+
this.reload();
|
|
1367
|
+
}
|
|
1363
1368
|
}
|
|
1364
1369
|
},
|
|
1370
|
+
get canManageRoles() {
|
|
1371
|
+
return this.$item?.DATA?.allowRoles !== false;
|
|
1372
|
+
},
|
|
1365
1373
|
security: null,
|
|
1366
1374
|
allUsers: [],
|
|
1367
1375
|
usersTree: [],
|
|
@@ -1389,6 +1397,9 @@ export default {
|
|
|
1389
1397
|
async attached() {
|
|
1390
1398
|
if (this.$item) await this.reload();
|
|
1391
1399
|
},
|
|
1400
|
+
detached() {
|
|
1401
|
+
if (this.$item && this._onChanged) this.$item.unlisten?.('changed', this._onChanged);
|
|
1402
|
+
},
|
|
1392
1403
|
async applyNav(nav = {}) {
|
|
1393
1404
|
if (nav.place) this.focusedTrail = String(nav.place);
|
|
1394
1405
|
await this.reload();
|
|
@@ -1935,6 +1946,7 @@ export default {
|
|
|
1935
1946
|
},
|
|
1936
1947
|
async setBoss(uid) {
|
|
1937
1948
|
const sec = JSON.parse(JSON.stringify(this.security || {}));
|
|
1949
|
+
if (!this.canManageRoles) delete sec.ROLES;
|
|
1938
1950
|
const cleanUid = String(uid || '').trim();
|
|
1939
1951
|
sec.BOSS = cleanUid ? [cleanUid] : [];
|
|
1940
1952
|
const label = cleanUid ? this.userLabel(cleanUid) : 'наследуется сверху';
|
|
@@ -1962,7 +1974,7 @@ export default {
|
|
|
1962
1974
|
if (uid) await this.setBoss(uid);
|
|
1963
1975
|
},
|
|
1964
1976
|
async onRoleDrop(e, trail) {
|
|
1965
|
-
if (!this.canEdit) return;
|
|
1977
|
+
if (!this.canEdit || !this.canManageRoles) return;
|
|
1966
1978
|
e.preventDefault();
|
|
1967
1979
|
const dropped = parseDroppedItem(e);
|
|
1968
1980
|
if (!dropped) return;
|
|
@@ -2005,6 +2017,7 @@ export default {
|
|
|
2005
2017
|
return node;
|
|
2006
2018
|
},
|
|
2007
2019
|
async promptAddRole(parentTrail = '') {
|
|
2020
|
+
if (!this.canManageRoles) return;
|
|
2008
2021
|
const raw = window.prompt(parentTrail ? 'Добавить подроль' : 'Добавить роль', 'Название');
|
|
2009
2022
|
const label = String(raw || '').trim();
|
|
2010
2023
|
if (!label || label === 'Название') return;
|
|
@@ -23,11 +23,11 @@
|
|
|
23
23
|
|
|
24
24
|
- **Дерево и типы:** всё — папка или файл единого дерева; адрес узла — его путь. Папка с метапапкой `$тип` — класс: `class.js` (свойства), `readme.md` (контракт), `handlers/`. Ветки типов: `$structure` (кто действует: `$server`, `$project`, `$structure`, `$user`), `$module` (что установлено, в т. ч. `$mcp` и `$provider` с моделями `$ai`), `$data` (где хранятся объекты); `$class` абстрактен. `/X/~/…` отдаёт собранное по слоям: `/X/~/class.js`, `/X/~/readme.md`, `/X/~/handlers/…`.
|
|
25
25
|
- **Ссылки:** только `ancestor` (узел продолжает другой) и `types` (примеси) в `class.js`; из пути ничего не вычисляется.
|
|
26
|
-
- **Роли:** встроенная одна — `BOSS` (владелец узла и
|
|
26
|
+
- **Роли:** встроенная одна — `BOSS` (единственный владелец узла и поддерева на `$server`, `$project` и `$structure`, наследуется вниз). Остальные — записи `#security.ROLES` только подразделений `$structure` (`USERS`, права `LINKS`, маркер `external`), а не дочерние классы.
|
|
27
27
|
- **Учёт:** `$catalog` (листья хранят объекты, группы агрегируют), `$virtual` (`turnover`/`balance` + `OVERLAY`), `$struct` (`table: true` — таблица), `$operation` — двойная запись (Дебет + Кредит в `$account` + `logs`); проведённое исправляется только сторно; поля справочника-аналитики — субаналитики.
|
|
28
28
|
- **Ядро и дерево:** ядро (`sources/`, `oda/`, `run.mjs`, `#system/`) меняется только по явной задаче доработки движка через `developer`-контур (тесты, отложенный перезапуск). Остальное — дерево, включая системный типизатор `/$server/$folder`; оно меняется штатно, без git. Правки типизатора и модулей уровня WORK — только извне проектов, с подтверждением, проверкой последствий и сбросом кэша.
|
|
29
29
|
- **Арены инструментов:** дерево — WORK-инструментами (`ls/read/find/write/edit/delete`, `create_class/update_class/move_class/delete_class`), файлы ОС вне WORK — `os_*`; `shell` не служит обходом WORK-ограничений.
|
|
30
|
-
- **Интерфейс:**
|
|
30
|
+
- **Интерфейс:** две базовые страницы (`explorer` в `$structure`, `form` в `$folder` — единый `work-form`, включая вкладку `form/folder` для `$class` и потомков с режимом «Показать системные» для `BOSS`). Представления и суб-представления — дерево `$handler` в `handlers/pages/form/<view>[/<subview>]/$handler/class.js` (без `tabs/` и без `<имя>.js`: метаданные и `component` в одном `class.js`). Штатные компоненты (`form/objects`, `form/objects/object`, `oda-packets`, `item-class-picker`) не дублируются; дерево `#formClassTree` включается по `objects: true`.
|
|
31
31
|
- **Правило изменений:** новая возможность — файл или папка в нужном типе плюс штатное наследование. Не выражается так — спецслучай не делай, принеси пользователю развилку.
|
|
32
32
|
|
|
33
33
|
## Память и делегирование
|
|
@@ -443,7 +443,7 @@ ODA({ is: 'microchat-tool',
|
|
|
443
443
|
</div>
|
|
444
444
|
<div class="why" ~if="connectMsg">{{connectMsg}}</div>
|
|
445
445
|
<div class="btns">
|
|
446
|
-
<oda-button hide-icon accent-invert :label="data.connect.provider === 'token' ? 'Сохранить' : 'Войти в ' + (data.connect.label || '')" @tap="connect()"></oda-button>
|
|
446
|
+
<oda-button hide-icon accent-invert :disabled="!canConnect" :label="data.connect.provider === 'token' ? 'Сохранить' : 'Войти в ' + (data.connect.label || '')" @tap="connect()"></oda-button>
|
|
447
447
|
<oda-button hide-icon class="ghost danger" label="Не подключать" @tap="approve(false)"></oda-button>
|
|
448
448
|
</div>
|
|
449
449
|
</div>
|
|
@@ -552,6 +552,12 @@ ODA({ is: 'microchat-tool',
|
|
|
552
552
|
openExternal() { window.open(this.data?.page?.url, '_blank'); },
|
|
553
553
|
openUrl(u) { window.open(u, '_blank'); },
|
|
554
554
|
get needClient() { return !!this.data?.connect?.need_client && this.data.connect.provider !== 'token'; },
|
|
555
|
+
get canConnect() {
|
|
556
|
+
const p = this.data?.connect?.provider;
|
|
557
|
+
if (p === 'token') return Boolean(String(this.cred?.token || '').trim());
|
|
558
|
+
if (this.needClient) return Boolean(String(this.cred?.client_id || '').trim() && String(this.cred?.client_secret || '').trim());
|
|
559
|
+
return true;
|
|
560
|
+
},
|
|
555
561
|
get redirectUri() { return location.origin + '/oauth/callback'; },
|
|
556
562
|
cred: {},
|
|
557
563
|
connectMsg: '',
|
|
@@ -255,7 +255,7 @@ ODA({
|
|
|
255
255
|
}
|
|
256
256
|
}
|
|
257
257
|
</style>
|
|
258
|
-
<nav ~if="
|
|
258
|
+
<nav ~if="showSubNav" class="sub-nav" aria-label="Разделы">
|
|
259
259
|
<div ~for="groupedItems" class="sub-row">
|
|
260
260
|
<div ~if="$for.item.isSep" class="sub-sep"></div>
|
|
261
261
|
<button ~if="!$for.item.isSep" type="button" class="sub-btn"
|
|
@@ -363,6 +363,9 @@ ODA({
|
|
|
363
363
|
return res;
|
|
364
364
|
}
|
|
365
365
|
},
|
|
366
|
+
get showSubNav() {
|
|
367
|
+
return this.groupedItems.filter(i => !i.isSep).length > 1;
|
|
368
|
+
},
|
|
366
369
|
get groupedItems() {
|
|
367
370
|
const cur = this.activeId;
|
|
368
371
|
const list = Array.isArray(this.tabs) ? this.tabs : [];
|
|
@@ -1353,9 +1356,16 @@ ODA({is: 'work-form',
|
|
|
1353
1356
|
async loadFormViews($item, role) {
|
|
1354
1357
|
try {
|
|
1355
1358
|
const root = await $item.fetch('handlers', { path: '//form', ...(role ? { role } : {}) });
|
|
1356
|
-
let views = (root?.items || []).filter(item =>
|
|
1357
|
-
item.type
|
|
1358
|
-
|
|
1359
|
+
let views = (root?.items || []).filter(item => {
|
|
1360
|
+
if (!item || item.type !== '$handler' || item.enabled === false || item.usable === false || item.allowUse === false)
|
|
1361
|
+
return false;
|
|
1362
|
+
if ((item.layout || item.DATA?.layout) && Array.isArray(item.items)) {
|
|
1363
|
+
const hasChild = item.items.some(ch => ch && ch.type === '$handler' && ch.enabled !== false && ch.usable !== false && ch.allowUse !== false);
|
|
1364
|
+
if (!hasChild)
|
|
1365
|
+
return false;
|
|
1366
|
+
}
|
|
1367
|
+
return true;
|
|
1368
|
+
});
|
|
1359
1369
|
views.sort((a, b) => (a.order ?? a.DATA?.order ?? 99) - (b.order ?? b.DATA?.order ?? 99));
|
|
1360
1370
|
const ext = $item?.ext;
|
|
1361
1371
|
for (const v of views) {
|
|
@@ -9,14 +9,112 @@ export default {
|
|
|
9
9
|
<style>
|
|
10
10
|
:host {
|
|
11
11
|
@apply --vertical;
|
|
12
|
-
overflow
|
|
12
|
+
overflow: hidden;
|
|
13
13
|
@apply --content;
|
|
14
|
+
min-height: 0;
|
|
15
|
+
}
|
|
16
|
+
.folder-bar {
|
|
17
|
+
@apply --horizontal;
|
|
18
|
+
align-items: center;
|
|
19
|
+
justify-content: flex-end;
|
|
20
|
+
gap: 10px;
|
|
21
|
+
padding: 6px 12px;
|
|
22
|
+
border-bottom: 1px solid var(--subtle-border, var(--border-color));
|
|
23
|
+
background: var(--subtle-background, var(--content-background));
|
|
24
|
+
flex-shrink: 0;
|
|
25
|
+
}
|
|
26
|
+
.sys-toggle {
|
|
27
|
+
@apply --horizontal;
|
|
28
|
+
align-items: center;
|
|
29
|
+
gap: 6px;
|
|
30
|
+
font-size: 12.5px;
|
|
31
|
+
color: var(--content-color);
|
|
32
|
+
cursor: pointer;
|
|
33
|
+
user-select: none;
|
|
34
|
+
}
|
|
35
|
+
.sys-toggle input {
|
|
36
|
+
margin: 0;
|
|
37
|
+
cursor: pointer;
|
|
38
|
+
accent-color: var(--accent-color);
|
|
14
39
|
}
|
|
15
40
|
</style>
|
|
16
|
-
<
|
|
41
|
+
<div ~if="isBoss" class="folder-bar">
|
|
42
|
+
<label class="sys-toggle">
|
|
43
|
+
<input type="checkbox" :checked="showSystem" @change="onShowSystemChange($event)">
|
|
44
|
+
<span>Показать системные</span>
|
|
45
|
+
</label>
|
|
46
|
+
</div>
|
|
47
|
+
<item-tree flex
|
|
48
|
+
:$item="storage"
|
|
49
|
+
:hide-system="!effectiveShowSystem"
|
|
50
|
+
:auto-run="false"
|
|
51
|
+
show-size
|
|
52
|
+
allow-search
|
|
53
|
+
allow-focus
|
|
54
|
+
show-tools
|
|
55
|
+
menu-mode="both"
|
|
56
|
+
items-selector="entries"
|
|
57
|
+
hide-tops="1"
|
|
58
|
+
hide-roots="1"
|
|
59
|
+
:execute="openEntry">
|
|
60
|
+
</item-tree>
|
|
17
61
|
`,
|
|
62
|
+
showSystem: false,
|
|
63
|
+
_isBoss: false,
|
|
64
|
+
$item: {
|
|
65
|
+
$def: null,
|
|
66
|
+
set(n) {
|
|
67
|
+
this._syncIsBoss(n);
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
attached() {
|
|
71
|
+
if (this.$item)
|
|
72
|
+
this._syncIsBoss(this.$item);
|
|
73
|
+
},
|
|
74
|
+
_syncIsBoss(it = this.$item) {
|
|
75
|
+
if (!it) {
|
|
76
|
+
this._isBoss = false;
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
if (WORK?.DEV_MODE) {
|
|
80
|
+
this._isBoss = true;
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
const seq = (this._bossSeq = (this._bossSeq || 0) + 1);
|
|
84
|
+
Promise.resolve(it.isBoss)
|
|
85
|
+
.then(v => {
|
|
86
|
+
if (seq === this._bossSeq)
|
|
87
|
+
this._isBoss = Boolean(v);
|
|
88
|
+
})
|
|
89
|
+
.catch(() => {
|
|
90
|
+
if (seq === this._bossSeq)
|
|
91
|
+
this._isBoss = false;
|
|
92
|
+
});
|
|
93
|
+
},
|
|
94
|
+
get isBoss() {
|
|
95
|
+
return Boolean(this._isBoss);
|
|
96
|
+
},
|
|
97
|
+
get effectiveShowSystem() {
|
|
98
|
+
return Boolean(this._isBoss && this.showSystem);
|
|
99
|
+
},
|
|
100
|
+
onShowSystemChange(e) {
|
|
101
|
+
this.showSystem = Boolean(e?.target?.checked);
|
|
102
|
+
},
|
|
18
103
|
get storage() {
|
|
19
104
|
return this.$item?.storage_folder;
|
|
20
105
|
},
|
|
106
|
+
openEntry(item) {
|
|
107
|
+
if (!item)
|
|
108
|
+
return;
|
|
109
|
+
if (item.type === '$handler') {
|
|
110
|
+
item.execute?.();
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
if (typeof window?.execute === 'function') {
|
|
114
|
+
window.execute(item);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
item.execute?.();
|
|
118
|
+
},
|
|
21
119
|
},
|
|
22
120
|
};
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
Примеры:
|
|
17
17
|
- `pages/form/$handler/` — форма по умолчанию (выбор формы из class.js)
|
|
18
18
|
- `pages/form/chat/$handler/` — чат-интерфейс
|
|
19
|
-
- `pages/form/folder/$handler/` — форма
|
|
19
|
+
- `pages/form/folder/$handler/` — форма папки и файлов класса (`$class`): в обычном режиме показывает пользовательские папки/файлы (скрывая файлы корня метапапки и системные папки), для `BOSS` доступен режим «Показать системные»
|
|
20
20
|
- `pages/site/` — сайт точки оргструктуры (WORK — лендинг, `$project` — организация, `$structure` — рабочая зона подразделения); канон — [`$structure/.../site/$handler/readme.md`](/$server/$folder/$class/$structure/handlers/pages/site/$handler/readme.md/~/handlers/pages/form/)
|
|
21
21
|
|
|
22
22
|
## Вызов
|
|
@@ -3,7 +3,7 @@ export default {
|
|
|
3
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
|
-
<item-tree order="0" slot='left-panel' :clean-structure="cleanStructure" :items-selector :show-size show-status show-users allow-focus :hide-roots :hide-tops :$item style="height: 0"></item-tree>
|
|
6
|
+
<item-tree order="0" slot='left-panel' :clean-structure="cleanStructure" :items-selector :show-size show-status show-users allow-focus :hide-roots :hide-tops :$item="treeRootItem" style="height: 0"></item-tree>
|
|
7
7
|
<item-consultant order="3" slot='left-panel' id="consultant" label="ИИ" icon="bootstrap:robot" :$item hidden style="height: 0"></item-consultant>
|
|
8
8
|
<div flex vertical slot='main' style="overflow: hidden; position: relative;">
|
|
9
9
|
<call-form ~if="showCall" id="callForm"></call-form>
|
|
@@ -255,6 +255,43 @@ export default {
|
|
|
255
255
|
hideRoots: 2,
|
|
256
256
|
hideTops: 0,
|
|
257
257
|
itemsSelector: 'items',
|
|
258
|
+
_treeScopeUser: null,
|
|
259
|
+
get treeRootItem() {
|
|
260
|
+
return this._treeScopeUser || this.$item;
|
|
261
|
+
},
|
|
262
|
+
async _syncExplorerTreeScope() {
|
|
263
|
+
if (!this.$item)
|
|
264
|
+
return;
|
|
265
|
+
if (WORK.DEV_MODE || !WORK.uid) {
|
|
266
|
+
this._treeScopeUser = null;
|
|
267
|
+
this.hideRoots = 2;
|
|
268
|
+
this.hideTops = 0;
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
if (this.$item.type === '$server') {
|
|
272
|
+
try {
|
|
273
|
+
const isAdm = await this.$item.isBoss;
|
|
274
|
+
if (isAdm) {
|
|
275
|
+
this._treeScopeUser = null;
|
|
276
|
+
this.hideRoots = 2;
|
|
277
|
+
this.hideTops = 0;
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
const info = await WORK.fetch(location.origin + '/', 'info', { deep: 1, tree: 'main' }).catch(() => null);
|
|
281
|
+
if (Array.isArray(info?.items) && info.items.length === 0 && WORK.USER) {
|
|
282
|
+
this._treeScopeUser = WORK.USER;
|
|
283
|
+
this.hideRoots = 0;
|
|
284
|
+
this.hideTops = 0;
|
|
285
|
+
}
|
|
286
|
+
else {
|
|
287
|
+
this._treeScopeUser = null;
|
|
288
|
+
this.hideRoots = 2;
|
|
289
|
+
this.hideTops = 1;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
catch { /* ignore */ }
|
|
293
|
+
}
|
|
294
|
+
},
|
|
258
295
|
|
|
259
296
|
_bookmarksStorageKey() {
|
|
260
297
|
const root = this.$item?.short || this.$item?.path || '/';
|
|
@@ -672,6 +709,7 @@ export default {
|
|
|
672
709
|
url.searchParams.delete('invite');
|
|
673
710
|
history.replaceState(null, '', url.pathname + url.search + url.hash);
|
|
674
711
|
if (res?.consumed) {
|
|
712
|
+
await this._syncExplorerTreeScope();
|
|
675
713
|
this.$('item-tree')?.refreshTree?.();
|
|
676
714
|
const p = await WORK.get_item(res.pointPath).catch(() => null);
|
|
677
715
|
if (p)
|
|
@@ -692,15 +730,13 @@ export default {
|
|
|
692
730
|
if(this.left_drawer)
|
|
693
731
|
this.left_drawer.closed = true;
|
|
694
732
|
}
|
|
695
|
-
|
|
696
|
-
try {
|
|
697
|
-
const isAdm = await this.$item.isBoss;
|
|
698
|
-
this.hideTops = isAdm ? 0 : 1;
|
|
699
|
-
}
|
|
700
|
-
catch { /* ignore */ }
|
|
701
|
-
}
|
|
733
|
+
await this._syncExplorerTreeScope();
|
|
702
734
|
})
|
|
703
735
|
window.explorer = this;
|
|
736
|
+
if (this.$item?.listen && !this._onRootChanged) {
|
|
737
|
+
this._onRootChanged = () => this.debounce?.('explorer-scope', () => this._syncExplorerTreeScope(), 250);
|
|
738
|
+
this.$item.listen('changed', this._onRootChanged);
|
|
739
|
+
}
|
|
704
740
|
if (!this._dirtyMsgBound && typeof window !== 'undefined') {
|
|
705
741
|
this._dirtyMsgBound = true;
|
|
706
742
|
window.addEventListener('message', (ev) => {
|
|
@@ -730,6 +766,7 @@ export default {
|
|
|
730
766
|
this._refreshLeftButtons();
|
|
731
767
|
this._initTopLicenseBanner();
|
|
732
768
|
this._refreshSupportBadge();
|
|
769
|
+
this._syncExplorerTreeScope();
|
|
733
770
|
this.render?.();
|
|
734
771
|
});
|
|
735
772
|
window.execute = async ($item, nav) => {
|
|
@@ -868,6 +905,14 @@ export default {
|
|
|
868
905
|
}
|
|
869
906
|
catch { /* ignore */ }
|
|
870
907
|
},
|
|
908
|
+
detached() {
|
|
909
|
+
if (this.$item?.unlisten && this._onRootChanged)
|
|
910
|
+
this.$item.unlisten('changed', this._onRootChanged);
|
|
911
|
+
if (this._supportBadgeTimer) {
|
|
912
|
+
clearInterval(this._supportBadgeTimer);
|
|
913
|
+
this._supportBadgeTimer = null;
|
|
914
|
+
}
|
|
915
|
+
},
|
|
871
916
|
}
|
|
872
917
|
|
|
873
918
|
ODA({ is: 'item-hexagon-layout', imports: 'oda//hexagon-layout.js', extends: 'oda-hexagon-layout',
|
|
@@ -161,7 +161,6 @@ export const MESSENGER_SETTINGS_DEF = {
|
|
|
161
161
|
<span ~if="!effectiveBot" class="badge warn">
|
|
162
162
|
Бот не задан (работает браузерный Web-Push)
|
|
163
163
|
</span>
|
|
164
|
-
<oda-button icon="icons:refresh" title="Обновить и проверить коды привязки" @tap="pollAndReload()"></oda-button>
|
|
165
164
|
</div>
|
|
166
165
|
</div>
|
|
167
166
|
|
|
@@ -195,10 +194,9 @@ export const MESSENGER_SETTINGS_DEF = {
|
|
|
195
194
|
</div>
|
|
196
195
|
|
|
197
196
|
<div ~if="linkCodeInfo && linkCodeInfo.target === 'user'" class="code-box">
|
|
198
|
-
<span>Отправьте боту {{linkCodeInfo.bot?.username ? '@' + linkCodeInfo.bot.username : (linkCodeInfo.bot?.label || 'мессенджера')}}
|
|
197
|
+
<span>Отправьте боту {{linkCodeInfo.bot?.username ? '@' + linkCodeInfo.bot.username : (linkCodeInfo.bot?.label || 'мессенджера')}} команду (привязка определится автоматически):</span>
|
|
199
198
|
<span class="code-mono">{{linkCodeInfo.command}}</span>
|
|
200
199
|
<a ~if="linkCodeInfo.deepLink" class="deep-link" :href="linkCodeInfo.deepLink" target="_blank" rel="noopener">Открыть бота</a>
|
|
201
|
-
<oda-button icon="icons:check" label="Я отправил код — проверить" @tap="pollAndReload()"></oda-button>
|
|
202
200
|
</div>
|
|
203
201
|
</div>
|
|
204
202
|
|
|
@@ -245,9 +243,8 @@ export const MESSENGER_SETTINGS_DEF = {
|
|
|
245
243
|
</div>
|
|
246
244
|
|
|
247
245
|
<div ~if="linkCodeInfo && linkCodeInfo.target === 'group'" class="code-box">
|
|
248
|
-
<span>Добавьте бота в групповой чат подразделения и отправьте
|
|
246
|
+
<span>Добавьте бота в групповой чат подразделения и отправьте туда (привязка определится автоматически):</span>
|
|
249
247
|
<span class="code-mono">{{linkCodeInfo.command}}</span>
|
|
250
|
-
<oda-button icon="icons:check" label="Проверить привязку группы" @tap="pollAndReload()"></oda-button>
|
|
251
248
|
</div>
|
|
252
249
|
|
|
253
250
|
<div class="row">
|
|
@@ -259,7 +256,7 @@ export const MESSENGER_SETTINGS_DEF = {
|
|
|
259
256
|
|
|
260
257
|
<div class="row" style="justify-content: flex-end; gap: 8px;">
|
|
261
258
|
<oda-button ~if="effectiveBot" icon="communication:Send" label="Проверить общую рассылку точки" @tap="testDelivery('department')"></oda-button>
|
|
262
|
-
<oda-button icon="icons:save" label="Сохранить настройки точки" @tap="saveConfig()"></oda-button>
|
|
259
|
+
<oda-button icon="icons:save" :disabled="!isChanged" label="Сохранить настройки точки" @tap="saveConfig()"></oda-button>
|
|
263
260
|
</div>
|
|
264
261
|
</div>
|
|
265
262
|
|
|
@@ -278,11 +275,20 @@ export const MESSENGER_SETTINGS_DEF = {
|
|
|
278
275
|
</div>
|
|
279
276
|
</div>
|
|
280
277
|
`,
|
|
281
|
-
|
|
282
|
-
$
|
|
283
|
-
|
|
284
|
-
|
|
278
|
+
$item: {
|
|
279
|
+
$def: null,
|
|
280
|
+
set(n, o) {
|
|
281
|
+
if (o && this._onChanged) o.unlisten?.('changed', this._onChanged);
|
|
282
|
+
if (n) {
|
|
283
|
+
this._onChanged ??= () => this.debounce?.('ms-reload', () => this.reload(), 200) ?? this.reload();
|
|
284
|
+
n.listen?.('changed', this._onChanged);
|
|
285
|
+
this.reload();
|
|
286
|
+
}
|
|
287
|
+
},
|
|
285
288
|
},
|
|
289
|
+
canEdit: false,
|
|
290
|
+
userMap: {},
|
|
291
|
+
_savedSnap: '',
|
|
286
292
|
pointLabel: '',
|
|
287
293
|
ownBot: null,
|
|
288
294
|
effectiveBot: null,
|
|
@@ -299,16 +305,45 @@ export const MESSENGER_SETTINGS_DEF = {
|
|
|
299
305
|
linkCodeInfo: null,
|
|
300
306
|
notice: '',
|
|
301
307
|
error: '',
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
+
_currentSnap() {
|
|
309
|
+
return JSON.stringify({
|
|
310
|
+
k: this.draftBotKind || 'telegram',
|
|
311
|
+
l: this.draftBotLabel || '',
|
|
312
|
+
t: this.draftBotToken || '',
|
|
313
|
+
u: this.draftBotUsername || '',
|
|
314
|
+
g: this.draftGroupChatId || '',
|
|
315
|
+
gt: this.draftGroupTitle || '',
|
|
316
|
+
b: Boolean(this.draftBroadcastToMembers),
|
|
317
|
+
});
|
|
318
|
+
},
|
|
319
|
+
get isChanged() {
|
|
320
|
+
if (!this._savedSnap) return false;
|
|
321
|
+
return this._currentSnap() !== this._savedSnap;
|
|
322
|
+
},
|
|
308
323
|
attached() {
|
|
309
324
|
if (this.$item)
|
|
310
325
|
this.reload();
|
|
311
326
|
},
|
|
327
|
+
detached() {
|
|
328
|
+
this._stopLinkPolling();
|
|
329
|
+
if (this.$item && this._onChanged) this.$item.unlisten?.('changed', this._onChanged);
|
|
330
|
+
},
|
|
331
|
+
_startLinkPolling() {
|
|
332
|
+
this._stopLinkPolling();
|
|
333
|
+
this._pollTimer = setInterval(() => {
|
|
334
|
+
if (!this.isConnected || !this.linkCodeInfo) {
|
|
335
|
+
this._stopLinkPolling();
|
|
336
|
+
return;
|
|
337
|
+
}
|
|
338
|
+
this.pollAndReload(true);
|
|
339
|
+
}, 3000);
|
|
340
|
+
},
|
|
341
|
+
_stopLinkPolling() {
|
|
342
|
+
if (this._pollTimer) {
|
|
343
|
+
clearInterval(this._pollTimer);
|
|
344
|
+
this._pollTimer = null;
|
|
345
|
+
}
|
|
346
|
+
},
|
|
312
347
|
get hasPersonalLink() {
|
|
313
348
|
return Boolean(this.currentUser?.telegram || this.currentUser?.max);
|
|
314
349
|
},
|
|
@@ -330,6 +365,7 @@ export const MESSENGER_SETTINGS_DEF = {
|
|
|
330
365
|
this.draftGroupChatId = st.groupChatId || '';
|
|
331
366
|
this.draftGroupTitle = st.groupTitle || '';
|
|
332
367
|
this.draftBroadcastToMembers = st.broadcastToMembers !== false;
|
|
368
|
+
this._savedSnap = this._currentSnap();
|
|
333
369
|
},
|
|
334
370
|
async reload() {
|
|
335
371
|
this.error = '';
|
|
@@ -403,27 +439,33 @@ export const MESSENGER_SETTINGS_DEF = {
|
|
|
403
439
|
post: { target, channel: this.effectiveBot?.kind || this.draftBotKind || 'telegram' },
|
|
404
440
|
});
|
|
405
441
|
this.linkCodeInfo = info;
|
|
442
|
+
if (info)
|
|
443
|
+
this._startLinkPolling();
|
|
406
444
|
}
|
|
407
445
|
catch (e) {
|
|
408
446
|
this.error = String(e?.message || e);
|
|
409
447
|
}
|
|
410
448
|
},
|
|
411
|
-
async pollAndReload() {
|
|
412
|
-
|
|
413
|
-
|
|
449
|
+
async pollAndReload(silent = false) {
|
|
450
|
+
if (!silent) {
|
|
451
|
+
this.error = '';
|
|
452
|
+
this.notice = '';
|
|
453
|
+
}
|
|
414
454
|
try {
|
|
415
455
|
const st = await this.$item.fetch('messenger_poll');
|
|
416
456
|
this.applyStatus(st);
|
|
417
457
|
if (Array.isArray(st?.matched) && st.matched.length) {
|
|
418
458
|
this.linkCodeInfo = null;
|
|
459
|
+
this._stopLinkPolling();
|
|
419
460
|
this.notice = `Привязка выполнена (${st.matched.map(m => m.type === 'group' ? 'группа ' + m.chatTitle : 'пользователь ' + m.uid).join(', ')})`;
|
|
420
461
|
}
|
|
421
|
-
else {
|
|
462
|
+
else if (!silent) {
|
|
422
463
|
this.notice = 'Статус обновлён';
|
|
423
464
|
}
|
|
424
465
|
}
|
|
425
466
|
catch (e) {
|
|
426
|
-
|
|
467
|
+
if (!silent)
|
|
468
|
+
this.error = String(e?.message || e);
|
|
427
469
|
}
|
|
428
470
|
},
|
|
429
471
|
async unbind(target = 'user', channel = '') {
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
- `node/` — узел дерева (item-node); «?» в дереве открывает контекстный `readme.md` уровня
|
|
12
12
|
- `node-explorer/` — навигатор по системе
|
|
13
13
|
- `explorer/` — главная страница-исследователь
|
|
14
|
-
- `file-viewer/` — просмотрщик файлов
|
|
15
14
|
- `icon/` — компонент иконки
|
|
16
15
|
- `menu/` — контекстное меню; `hide-files` + «?» на родителе (тот же `item-node`, что дерево)
|
|
17
16
|
- `dialogs/` — диалоговые окна; `popover/` — `item-popover` (наследник `oda-popover`, `ODA.popoverTag`): заголовок-навигатор по `$item`
|