local-triage 0.0.0-stage → 0.10.0-dev.32
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/LICENSE +21 -0
- package/README.md +90 -2
- package/THIRD-PARTY-NOTICES.md +48 -0
- package/app/__init__.py +3 -0
- package/app/affiliation.py +137 -0
- package/app/ask.py +300 -0
- package/app/build_info.py +98 -0
- package/app/capec.py +168 -0
- package/app/capec_view.py +27 -0
- package/app/codecmp.py +59 -0
- package/app/config.py +411 -0
- package/app/context.py +1451 -0
- package/app/cvss.py +357 -0
- package/app/db.py +6234 -0
- package/app/defect.py +670 -0
- package/app/defect_check.py +323 -0
- package/app/defect_drafts.py +612 -0
- package/app/defect_dto.py +149 -0
- package/app/defect_fields.py +248 -0
- package/app/defect_form.py +124 -0
- package/app/defect_links.py +107 -0
- package/app/defect_local_text.py +103 -0
- package/app/defect_references.py +164 -0
- package/app/defect_where.py +147 -0
- package/app/ecosystem.py +51 -0
- package/app/executors.py +660 -0
- package/app/feeds.py +1231 -0
- package/app/guard.py +164 -0
- package/app/hub_block_builder.py +200 -0
- package/app/hub_block_version.py +220 -0
- package/app/hub_defects.py +4469 -0
- package/app/hub_effects.py +421 -0
- package/app/hub_entity_versions.py +108 -0
- package/app/hub_import.py +2054 -0
- package/app/hub_onboarding.py +114 -0
- package/app/hub_ops.py +330 -0
- package/app/hub_pull.py +1195 -0
- package/app/hub_state.py +255 -0
- package/app/hub_status.py +237 -0
- package/app/hub_sync.py +619 -0
- package/app/hub_sync_api.py +241 -0
- package/app/hub_sync_compare.py +1054 -0
- package/app/hub_sync_contract.py +75 -0
- package/app/hub_template_model.py +74 -0
- package/app/hub_text_scale.py +159 -0
- package/app/journal.py +250 -0
- package/app/llm.py +850 -0
- package/app/llm_chat.py +596 -0
- package/app/llm_http.py +319 -0
- package/app/llm_messages.py +401 -0
- package/app/llm_net.py +764 -0
- package/app/llm_ollama.py +571 -0
- package/app/lockfile.py +505 -0
- package/app/logsafe.py +54 -0
- package/app/main.py +367 -0
- package/app/mask_display.py +132 -0
- package/app/masking.py +814 -0
- package/app/metrics.py +194 -0
- package/app/model_traffic.py +519 -0
- package/app/models.py +483 -0
- package/app/navigation.py +121 -0
- package/app/osv.py +279 -0
- package/app/package_identity.py +189 -0
- package/app/package_transition.py +824 -0
- package/app/profile_gate.py +71 -0
- package/app/prompts.py +1108 -0
- package/app/provider_keys.py +189 -0
- package/app/providers.py +511 -0
- package/app/routes/__init__.py +10 -0
- package/app/routes/api.py +153 -0
- package/app/routes/capec.py +186 -0
- package/app/routes/common.py +407 -0
- package/app/routes/components.py +1499 -0
- package/app/routes/cwe.py +168 -0
- package/app/routes/decision_selected.py +153 -0
- package/app/routes/defect_add.py +223 -0
- package/app/routes/defect_card_routes.py +363 -0
- package/app/routes/defect_selected.py +342 -0
- package/app/routes/feeds.py +155 -0
- package/app/routes/findings.py +2736 -0
- package/app/routes/hub.py +402 -0
- package/app/routes/hub_bulk.py +288 -0
- package/app/routes/hub_defect_routes.py +1945 -0
- package/app/routes/hub_status_routes.py +1132 -0
- package/app/routes/hub_sync_routes.py +463 -0
- package/app/routes/journal.py +132 -0
- package/app/routes/projects.py +1601 -0
- package/app/routes/providers.py +336 -0
- package/app/routes/references.py +26 -0
- package/app/routes/runs.py +219 -0
- package/app/routes/sca.py +2722 -0
- package/app/routes/settings.py +163 -0
- package/app/run_errors.py +151 -0
- package/app/sca.py +1662 -0
- package/app/sca_contract.py +1289 -0
- package/app/sca_research.py +1089 -0
- package/app/sca_research_net.py +1007 -0
- package/app/sca_text.py +965 -0
- package/app/serve.py +70 -0
- package/app/settings_store.py +262 -0
- package/app/static/app.css +2802 -0
- package/app/static/app.js +3772 -0
- package/app/static/capec-license.txt +9 -0
- package/app/static/favicon.svg +1 -0
- package/app/static/fonts/Golos-Text_DemiBold.woff2 +0 -0
- package/app/static/fonts/Golos-Text_Regular.woff2 +0 -0
- package/app/static/fonts/OFL.txt +90 -0
- package/app/static/navigation.js +234 -0
- package/app/static/observability.js +121 -0
- package/app/static/theme.js +49 -0
- package/app/storage/__init__.py +16 -0
- package/app/storage/local_state.py +246 -0
- package/app/storage/migrate.py +110 -0
- package/app/storage/migrations/postgresql/0001_baseline.sql +896 -0
- package/app/storage/migrations/postgresql/0002_feeds_and_secrets.sql +55 -0
- package/app/storage/migrations/postgresql/0003_project_mask_display.sql +5 -0
- package/app/storage/migrations/postgresql/0004_package_identity.sql +36 -0
- package/app/storage/postgresql.py +573 -0
- package/app/storage/schema.py +619 -0
- package/app/storage/sql.py +57 -0
- package/app/storage/tools.py +254 -0
- package/app/telemetry.py +307 -0
- package/app/templates/base.html +91 -0
- package/app/templates/capec/context.html +3 -0
- package/app/templates/capec/detail.html +27 -0
- package/app/templates/capec/index.html +128 -0
- package/app/templates/components/_archive.html +11 -0
- package/app/templates/components/archived.html +19 -0
- package/app/templates/components/batch.html +35 -0
- package/app/templates/components/detail.html +332 -0
- package/app/templates/components/index.html +338 -0
- package/app/templates/components/research_preview.html +80 -0
- package/app/templates/components/research_run.html +54 -0
- package/app/templates/cwe/bdu.html +56 -0
- package/app/templates/cwe/detail.html +233 -0
- package/app/templates/cwe/index.html +97 -0
- package/app/templates/error.html +8 -0
- package/app/templates/feeds/index.html +65 -0
- package/app/templates/findings/card.html +639 -0
- package/app/templates/findings/decision_selected.html +41 -0
- package/app/templates/findings/defect_add.html +46 -0
- package/app/templates/findings/defect_selected.html +47 -0
- package/app/templates/findings/list.html +153 -0
- package/app/templates/findings/send_selected.html +53 -0
- package/app/templates/findings/trace.html +72 -0
- package/app/templates/journal/detail.html +19 -0
- package/app/templates/journal/index.html +19 -0
- package/app/templates/macros.html +440 -0
- package/app/templates/navigation-fields.html +1 -0
- package/app/templates/navigation.html +11 -0
- package/app/templates/projects/_identity_summary.html +42 -0
- package/app/templates/projects/defect_card.html +153 -0
- package/app/templates/projects/defect_create_preview.html +17 -0
- package/app/templates/projects/defect_fields_diff.html +6 -0
- package/app/templates/projects/defect_fields_form.html +40 -0
- package/app/templates/projects/defect_references.html +17 -0
- package/app/templates/projects/defect_sync_preview.html +28 -0
- package/app/templates/projects/defect_update_actions.html +6 -0
- package/app/templates/projects/defect_update_preview.html +24 -0
- package/app/templates/projects/defects.html +126 -0
- package/app/templates/projects/delete.html +31 -0
- package/app/templates/projects/external.html +61 -0
- package/app/templates/projects/folders.html +64 -0
- package/app/templates/projects/hub_accepted.html +10 -0
- package/app/templates/projects/hub_assignment.html +50 -0
- package/app/templates/projects/hub_pending.html +20 -0
- package/app/templates/projects/hub_pending_list.html +17 -0
- package/app/templates/projects/hub_state_note.html +23 -0
- package/app/templates/projects/hub_step_note.html +5 -0
- package/app/templates/projects/hub_sync.html +105 -0
- package/app/templates/projects/hub_sync_confirm.html +32 -0
- package/app/templates/projects/hub_sync_worker.html +5 -0
- package/app/templates/projects/hub_text_rules.html +64 -0
- package/app/templates/projects/identity_report.html +74 -0
- package/app/templates/projects/list.html +90 -0
- package/app/templates/projects/project.html +433 -0
- package/app/templates/reference-missing.html +14 -0
- package/app/templates/runs/run.html +166 -0
- package/app/templates/sca/card.html +476 -0
- package/app/templates/sca/index.html +321 -0
- package/app/templates/settings/hub_url.html +31 -0
- package/app/templates/settings/index.html +216 -0
- package/app/templates/settings/provider.html +229 -0
- package/app/templates/settings/providers.html +37 -0
- package/app/templates/worklists.html +52 -0
- package/app/textsafe.py +117 -0
- package/app/timing.py +245 -0
- package/app/triage.py +1743 -0
- package/app/view.py +430 -0
- package/app/worklists.py +204 -0
- package/examples/demo/demo-hub-report-v2.xlsx +0 -0
- package/examples/demo/demo-hub-report.xlsx +0 -0
- package/examples/demo/repos/billing-core/pom.xml +30 -0
- package/examples/demo/repos/billing-core/src/main/java/org/example/billing/Invoice.java +9 -0
- package/examples/demo/repos/billing-core/src/main/java/org/example/billing/InvoiceRepository.java +51 -0
- package/examples/demo/repos/billing-core/src/main/java/org/example/billing/InvoiceStatus.java +11 -0
- package/examples/demo/repos/billing-core/src/main/java/org/example/billing/config/DatabaseSettings.java +18 -0
- package/examples/demo/repos/billing-core/src/main/java/org/example/billing/payment/PaymentTokenService.java +35 -0
- package/examples/demo/repos/billing-core/src/main/java/org/example/billing/web/InvoiceExportController.java +57 -0
- package/examples/demo/repos/catalog-api/catalog_api/__init__.py +1 -0
- package/examples/demo/repos/catalog-api/catalog_api/products.py +24 -0
- package/examples/demo/repos/catalog-api/catalog_api/tasks.py +24 -0
- package/examples/demo/repos/catalog-api/catalog_api/views.py +17 -0
- package/examples/demo/repos/catalog-api/requirements.txt +3 -0
- package/npm/build.json +5 -0
- package/npm/cli.js +346 -0
- package/npm/files.manifest +224 -0
- package/npm/lib/binding.js +64 -0
- package/npm/lib/cluster.js +330 -0
- package/npm/lib/env.js +88 -0
- package/npm/lib/fsx.js +125 -0
- package/npm/lib/http.js +53 -0
- package/npm/lib/metrics.js +73 -0
- package/npm/lib/paths.js +150 -0
- package/npm/lib/pg.js +351 -0
- package/npm/lib/proc.js +101 -0
- package/npm/lib/python.js +133 -0
- package/npm/lib/stand.js +46 -0
- package/npm/lib/supervisor.js +1141 -0
- package/npm/lib/version.js +21 -0
- package/npm/requirements.txt +476 -0
- package/npm-shrinkwrap.json +111 -0
- package/package.json +37 -4
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
CAPEC™ – Common Attack Pattern Enumeration and Classification
|
|
2
|
+
Copyright © 2023 The MITRE Corporation.
|
|
3
|
+
Source: https://capec.mitre.org/about/termsofuse.html
|
|
4
|
+
|
|
5
|
+
LICENSE
|
|
6
|
+
The MITRE Corporation (MITRE) hereby grants you a non-exclusive, royalty-free license to use Common Attack Pattern Enumeration and Classification (CAPEC™) for research, development, and commercial purposes. Any copy you make for such purposes is authorized provided that you reproduce MITRE’s copyright designation and this license in any such copy.
|
|
7
|
+
|
|
8
|
+
DISCLAIMERS
|
|
9
|
+
ALL DOCUMENTS AND THE INFORMATION CONTAINED THEREIN ARE PROVIDED ON AN "AS IS" BASIS AND THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS OR IS SPONSORED BY (IF ANY), THE MITRE CORPORATION, ITS BOARD OF TRUSTEES, OFFICERS, AGENTS, AND EMPLOYEES, DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION THEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24"><style>@media (prefers-color-scheme: dark){rect{fill:#ff5c85}path{stroke:#1a0008}}</style><rect x="1" y="1" width="22" height="22" rx="6" fill="#b80038"/><path d="m7 12.5 3.2 3.2L17 9" fill="none" stroke="#ffffff" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round"/></svg>
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
Golos Text – шрифт интерфейса «Локального триажа» (файлы Golos-Text_Regular.woff2, Golos-Text_DemiBold.woff2).
|
|
2
|
+
Авторы шрифта – Paratype и соавторы. Распространяется по лицензии SIL Open Font License, версия 1.1.
|
|
3
|
+
Полный текст лицензии: https://openfontlicense.org/open-font-license-official-text/
|
|
4
|
+
|
|
5
|
+
-----------------------------------------------------------
|
|
6
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
7
|
+
-----------------------------------------------------------
|
|
8
|
+
|
|
9
|
+
PREAMBLE
|
|
10
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
11
|
+
development of collaborative font projects, to support the font creation
|
|
12
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
13
|
+
open framework in which fonts may be shared and improved in partnership
|
|
14
|
+
with others.
|
|
15
|
+
|
|
16
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
17
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
18
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
19
|
+
redistributed and/or sold with any software provided that any reserved
|
|
20
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
21
|
+
however, cannot be released under any other type of license. The
|
|
22
|
+
requirement for fonts to remain under this license does not apply
|
|
23
|
+
to any document created using the fonts or their derivatives.
|
|
24
|
+
|
|
25
|
+
DEFINITIONS
|
|
26
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
27
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
28
|
+
include source files, build scripts and documentation.
|
|
29
|
+
|
|
30
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
31
|
+
copyright statement(s).
|
|
32
|
+
|
|
33
|
+
"Original Version" refers to the collection of Font Software components as
|
|
34
|
+
distributed by the Copyright Holder(s).
|
|
35
|
+
|
|
36
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
37
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
38
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
39
|
+
new environment.
|
|
40
|
+
|
|
41
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
42
|
+
writer or other person who contributed to the Font Software.
|
|
43
|
+
|
|
44
|
+
PERMISSION & CONDITIONS
|
|
45
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
46
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
47
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
48
|
+
Software, subject to the following conditions:
|
|
49
|
+
|
|
50
|
+
1) Neither the Font Software nor any of its individual components,
|
|
51
|
+
in Original or Modified Versions, may be sold by itself.
|
|
52
|
+
|
|
53
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
54
|
+
redistributed and/or sold with any software, provided that each copy
|
|
55
|
+
contains the above copyright notice and this license. These can be
|
|
56
|
+
included either as stand-alone text files, human-readable headers or
|
|
57
|
+
in the appropriate machine-readable metadata fields within text or
|
|
58
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
59
|
+
|
|
60
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
61
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
62
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
63
|
+
presented to the users.
|
|
64
|
+
|
|
65
|
+
4) The name(s) of the Copyright Holder(s) and the Author(s) of the Font
|
|
66
|
+
Software shall not be used to promote, endorse or advertise any
|
|
67
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
68
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
69
|
+
permission.
|
|
70
|
+
|
|
71
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
72
|
+
must be distributed entirely under this license, and must not be
|
|
73
|
+
distributed under any other license. The requirement for fonts to
|
|
74
|
+
remain under this license does not apply to any document created
|
|
75
|
+
using the Font Software.
|
|
76
|
+
|
|
77
|
+
TERMINATION
|
|
78
|
+
This license becomes null and void if any of the above conditions are
|
|
79
|
+
not met.
|
|
80
|
+
|
|
81
|
+
DISCLAIMER
|
|
82
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
83
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
84
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
85
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
86
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
87
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
88
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
89
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
90
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
/* Возврат к месту работы и черновик решения компонента. sessionStorage изолирует вкладки. */
|
|
2
|
+
(function () {
|
|
3
|
+
"use strict";
|
|
4
|
+
function read(key) { try { return JSON.parse(sessionStorage.getItem(key)); } catch (e) { return null; } }
|
|
5
|
+
function write(key, value) {
|
|
6
|
+
try { sessionStorage.setItem(key, JSON.stringify(value)); return true; } catch (e) { return false; }
|
|
7
|
+
}
|
|
8
|
+
function remove(key) { try { sessionStorage.removeItem(key); } catch (e) { /* недоступное хранилище */ } }
|
|
9
|
+
function rememberPosition(key, value) {
|
|
10
|
+
var index = read("work-position-index") || [];
|
|
11
|
+
index = index.filter(function (x) { return x !== key; }); index.push(key);
|
|
12
|
+
while (index.length > 160) remove(index.shift());
|
|
13
|
+
write("work-position-index", index); write(key, value);
|
|
14
|
+
}
|
|
15
|
+
function address(value) {
|
|
16
|
+
var u = new URL(value, location.href);
|
|
17
|
+
var params = new URLSearchParams(u.search); params.sort();
|
|
18
|
+
if (params.get("page") === "1") params.delete("page");
|
|
19
|
+
return decodeURIComponent(u.pathname) + (params.toString() ? "?" + params.toString() : "");
|
|
20
|
+
}
|
|
21
|
+
function here() { return address(location.href); }
|
|
22
|
+
|
|
23
|
+
// Положение хранится по полному отбору; прямой вход по закладке не прыгает к старому месту.
|
|
24
|
+
var positionKey = "work-position:" + here();
|
|
25
|
+
var focusedLink = "", focusedRow = "", positionAlias = "";
|
|
26
|
+
document.addEventListener("click", function (event) {
|
|
27
|
+
var link = event.target.closest("a[href]");
|
|
28
|
+
if (!link || event.defaultPrevented || event.button !== 0 || event.ctrlKey || event.metaKey || link.target === "_blank") return;
|
|
29
|
+
var target = new URL(link.href, location.href);
|
|
30
|
+
if (target.origin !== location.origin || address(target.href) === here()) return;
|
|
31
|
+
// Отбор/сброс/пагинация сами задают новое состояние списка. Старые раскрытия при этом не восстанавливаются.
|
|
32
|
+
if (target.pathname === location.pathname) { remove("work-restore"); return; }
|
|
33
|
+
if (link.closest("table")) {
|
|
34
|
+
focusedLink = address(target.href);
|
|
35
|
+
focusedRow = (link.closest("tr") || {}).id || "";
|
|
36
|
+
var back = target.searchParams.get("back");
|
|
37
|
+
if (back && back.charAt(0) === "/") positionAlias = "work-position:" + address(back);
|
|
38
|
+
}
|
|
39
|
+
write("work-restore", address(target.href));
|
|
40
|
+
});
|
|
41
|
+
window.addEventListener("pagehide", function () {
|
|
42
|
+
var position = {y: window.scrollY, focus: focusedLink, row: focusedRow,
|
|
43
|
+
open: Array.from(document.querySelectorAll("details[id][open]")).map(function (x) { return x.id; })};
|
|
44
|
+
rememberPosition(positionKey, position);
|
|
45
|
+
if (positionAlias) rememberPosition(positionAlias, position);
|
|
46
|
+
});
|
|
47
|
+
var pending = read("work-restore");
|
|
48
|
+
remove("work-restore");
|
|
49
|
+
var entry = performance.getEntriesByType("navigation")[0];
|
|
50
|
+
if (pending === here() || (entry && (entry.type === "back_forward" || entry.type === "reload"))) {
|
|
51
|
+
var saved = read(positionKey);
|
|
52
|
+
if (saved && typeof saved.y === "number") {
|
|
53
|
+
(saved.open || []).forEach(function (id) { var x = document.getElementById(id); if (x && x.tagName === "DETAILS") x.open = true; });
|
|
54
|
+
requestAnimationFrame(function () { requestAnimationFrame(function () {
|
|
55
|
+
window.scrollTo(0, saved.y);
|
|
56
|
+
if (!saved.focus) return;
|
|
57
|
+
var row = saved.row ? document.getElementById(saved.row) : null;
|
|
58
|
+
var link = (row ? row.querySelector("a[href]") : null) || Array.from(document.querySelectorAll("table a[href]")).find(function (a) {
|
|
59
|
+
return address(a.href) === saved.focus;
|
|
60
|
+
});
|
|
61
|
+
if (link) {
|
|
62
|
+
link.focus({preventScroll: true});
|
|
63
|
+
row = link.closest("tr"); if (row) row.classList.add("is-returned");
|
|
64
|
+
} else {
|
|
65
|
+
var note = document.getElementById("sr-status");
|
|
66
|
+
if (note) note.textContent = "Исходная строка больше не входит в текущую выборку. Показан обновлённый список.";
|
|
67
|
+
}
|
|
68
|
+
}); });
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function decisionFields(target) {
|
|
73
|
+
if (!target) return function () {};
|
|
74
|
+
var action = target.elements.namedItem("action");
|
|
75
|
+
function sync() {
|
|
76
|
+
["target_version", "replacement_name", "replacement_version"].forEach(function (name) {
|
|
77
|
+
var field = target.elements.namedItem(name);
|
|
78
|
+
var active = action.value === (name === "target_version" ? "update" : "replace");
|
|
79
|
+
field.closest("label").hidden = !active;
|
|
80
|
+
field.disabled = !active;
|
|
81
|
+
field.required = active && name !== "replacement_version";
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
action.addEventListener("change", sync); sync(); return sync;
|
|
85
|
+
}
|
|
86
|
+
var batch = document.getElementById("batch-decision-form");
|
|
87
|
+
var syncBatchFields = decisionFields(batch);
|
|
88
|
+
if (batch) {
|
|
89
|
+
// страница «Решение по выбранным версиям» – те же быстрые сроки и черновик по исследованию, что у карточки
|
|
90
|
+
// компонента
|
|
91
|
+
batch.querySelectorAll("[data-review-date]").forEach(function (button) {
|
|
92
|
+
button.addEventListener("click", function () {
|
|
93
|
+
batch.elements.namedItem("review_at").value = button.getAttribute("data-review-date");
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
var batchFill = document.getElementById("fill-from-research");
|
|
97
|
+
var batchStatus = document.getElementById("batch-draft-status");
|
|
98
|
+
if (batchFill) batchFill.addEventListener("click", function () {
|
|
99
|
+
var draft = {};
|
|
100
|
+
try { draft = JSON.parse(batchFill.getAttribute("data-draft") || "{}") || {}; } catch (e) { draft = {}; }
|
|
101
|
+
var filled = 0;
|
|
102
|
+
["action", "rationale", "target_version", "review_at", "replacement_name", "replacement_version"].forEach(function (name) {
|
|
103
|
+
var field = batch.elements.namedItem(name);
|
|
104
|
+
if (field && typeof draft[name] === "string" && draft[name] && !field.value) { field.value = draft[name]; filled += 1; }
|
|
105
|
+
});
|
|
106
|
+
syncBatchFields();
|
|
107
|
+
if (batchStatus) batchStatus.textContent = filled
|
|
108
|
+
? "Пустые поля заполнены по исследованию – проверьте и поправьте их, затем примените решение."
|
|
109
|
+
: "Заполнять нечего: поля уже заполнены. Очистите поле, чтобы взять значение из исследования.";
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
var form = document.getElementById("decision-form");
|
|
113
|
+
if (!form) return;
|
|
114
|
+
var syncDecisionFields = decisionFields(form);
|
|
115
|
+
var status = document.getElementById("component-draft-status");
|
|
116
|
+
var check = document.getElementById("component-draft-check");
|
|
117
|
+
var confirm = document.getElementById("component-draft-confirm");
|
|
118
|
+
var discard = document.getElementById("discard-component-draft");
|
|
119
|
+
var key = "component-draft:1:" + location.pathname;
|
|
120
|
+
var names = ["action", "rationale", "target_version", "review_at", "replacement_name", "replacement_version"];
|
|
121
|
+
var seenNames = ["revision", "expected_input_sig", "expected_research_sig", "expected_research_revision"];
|
|
122
|
+
var buttons = [document.getElementById("save-component-decision"), document.getElementById("save-component-next"),
|
|
123
|
+
document.getElementById("save-component-apply")].filter(Boolean);
|
|
124
|
+
var edits = 0, sending = false, dirty = false, stored = false;
|
|
125
|
+
function values(fields) {
|
|
126
|
+
var result = {}; fields.forEach(function (name) { result[name] = form.elements.namedItem(name).value; }); return result;
|
|
127
|
+
}
|
|
128
|
+
var baseline = values(names), seen = values(seenNames);
|
|
129
|
+
function say(text, error) { status.textContent = text; status.classList.toggle("text-warn", !!error); }
|
|
130
|
+
function updateButtons() { buttons.forEach(function (b) { b.disabled = sending || (!check.hidden && !confirm.checked); }); }
|
|
131
|
+
function saveDraft() {
|
|
132
|
+
stored = write(key, {v: 1, fields: values(names), seen: values(seenNames), needsCheck: !check.hidden && !confirm.checked});
|
|
133
|
+
return stored;
|
|
134
|
+
}
|
|
135
|
+
function changed() {
|
|
136
|
+
edits += 1;
|
|
137
|
+
dirty = JSON.stringify(values(names)) !== JSON.stringify(baseline);
|
|
138
|
+
discard.hidden = !dirty;
|
|
139
|
+
if (dirty) {
|
|
140
|
+
if (saveDraft()) say("Черновик сохранён в этой вкладке; решение ещё не сохранено.");
|
|
141
|
+
else say("Хранилище вкладки недоступно. Не закрывайте страницу до сохранения решения.", true);
|
|
142
|
+
} else { remove(key); say("Изменений нет. Показано сохранённое решение."); }
|
|
143
|
+
}
|
|
144
|
+
names.forEach(function (name) {
|
|
145
|
+
var field = form.elements.namedItem(name); field.addEventListener("input", changed); field.addEventListener("change", changed);
|
|
146
|
+
});
|
|
147
|
+
confirm.addEventListener("change", function () { saveDraft(); updateButtons(); });
|
|
148
|
+
// быстрый срок пересмотра (вариант А): даты посчитаны сервером от даты приложения
|
|
149
|
+
form.querySelectorAll("[data-review-date]").forEach(function (button) {
|
|
150
|
+
button.addEventListener("click", function () {
|
|
151
|
+
var field = form.elements.namedItem("review_at");
|
|
152
|
+
field.value = button.getAttribute("data-review-date");
|
|
153
|
+
changed();
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
// черновик по исследованию (вариант Б): только пустые поля, решение сохраняет человек
|
|
157
|
+
var fill = document.getElementById("fill-from-research");
|
|
158
|
+
if (fill) fill.addEventListener("click", function () {
|
|
159
|
+
var draft = {};
|
|
160
|
+
try { draft = JSON.parse(fill.getAttribute("data-draft") || "{}") || {}; } catch (e) { draft = {}; }
|
|
161
|
+
var filled = 0;
|
|
162
|
+
names.forEach(function (name) {
|
|
163
|
+
var field = form.elements.namedItem(name);
|
|
164
|
+
if (typeof draft[name] === "string" && draft[name] && !field.value) { field.value = draft[name]; filled += 1; }
|
|
165
|
+
});
|
|
166
|
+
syncDecisionFields();
|
|
167
|
+
changed();
|
|
168
|
+
say(filled ? "Пустые поля заполнены по исследованию – проверьте и поправьте их, затем сохраните решение."
|
|
169
|
+
: "Заполнять нечего: поля уже заполнены. Очистите поле, чтобы взять значение из исследования.");
|
|
170
|
+
});
|
|
171
|
+
discard.addEventListener("click", function () {
|
|
172
|
+
names.forEach(function (name) { form.elements.namedItem(name).value = baseline[name]; });
|
|
173
|
+
syncDecisionFields();
|
|
174
|
+
dirty = false; check.hidden = true; confirm.checked = false; discard.hidden = true;
|
|
175
|
+
remove(key); updateButtons(); say("Черновик отброшен. Восстановлены значения с открытой страницы.");
|
|
176
|
+
});
|
|
177
|
+
var draft = read(key);
|
|
178
|
+
if (draft && draft.v === 1 && draft.fields && JSON.stringify(draft.fields) !== JSON.stringify(baseline)) {
|
|
179
|
+
names.forEach(function (name) { if (typeof draft.fields[name] === "string") form.elements.namedItem(name).value = draft.fields[name]; });
|
|
180
|
+
syncDecisionFields();
|
|
181
|
+
dirty = true; stored = true; discard.hidden = false;
|
|
182
|
+
if (draft.needsCheck || JSON.stringify(draft.seen) !== JSON.stringify(seen)) check.hidden = false;
|
|
183
|
+
say("Черновик восстановлен в форму, но не сохранён как решение." + (check.hidden ? "" : " Сверьте изменившиеся сведения."), !check.hidden);
|
|
184
|
+
updateButtons();
|
|
185
|
+
} else if (draft) { remove(key); }
|
|
186
|
+
window.addEventListener("beforeunload", function (event) {
|
|
187
|
+
if (!dirty || saveDraft()) return;
|
|
188
|
+
event.preventDefault(); event.returnValue = "";
|
|
189
|
+
});
|
|
190
|
+
form.addEventListener("submit", function (event) {
|
|
191
|
+
event.preventDefault();
|
|
192
|
+
if (sending || (!check.hidden && !confirm.checked)) return;
|
|
193
|
+
var data = new FormData(form), sent = edits, fields = values(names);
|
|
194
|
+
form.querySelectorAll("[aria-invalid]").forEach(function (field) { field.removeAttribute("aria-invalid"); field.removeAttribute("aria-errormessage"); });
|
|
195
|
+
if (event.submitter && event.submitter.name) data.set(event.submitter.name, event.submitter.value);
|
|
196
|
+
sending = true; updateButtons(); say("Сохраняется решение…");
|
|
197
|
+
fetch(form.getAttribute("action"), {method: "POST", body: data, headers: {Accept: "application/json"}, credentials: "same-origin"})
|
|
198
|
+
.then(function (response) { return response.json().then(function (answer) {
|
|
199
|
+
if (!response.ok || !answer.ok) {
|
|
200
|
+
var box = document.getElementById("decision-error");
|
|
201
|
+
if (!box) { box = document.createElement("div"); box.id = "decision-error"; box.className = "callout callout-warn"; box.setAttribute("role", "alert"); form.parentNode.insertBefore(box, form); }
|
|
202
|
+
box.setAttribute("tabindex", "-1");
|
|
203
|
+
box.textContent = (answer.detail || "Решение не сохранено.") + " Введённый текст оставлен в форме." +
|
|
204
|
+
(response.status === 409 ? " Обновите страницу и сверьте сведения перед повторным сохранением." :
|
|
205
|
+
response.status === 422 ? " Исправьте указанное поле и сохраните решение снова." : " Повторите сохранение.");
|
|
206
|
+
var invalid = answer.error_field && form.elements.namedItem(answer.error_field);
|
|
207
|
+
if (invalid && !invalid.disabled) {
|
|
208
|
+
invalid.setAttribute("aria-invalid", "true"); invalid.setAttribute("aria-errormessage", "decision-error");
|
|
209
|
+
invalid.focus();
|
|
210
|
+
} else { box.focus(); }
|
|
211
|
+
throw new Error(answer.detail || "Решение не сохранено.");
|
|
212
|
+
}
|
|
213
|
+
form.elements.namedItem("revision").value = String(answer.revision);
|
|
214
|
+
baseline = fields;
|
|
215
|
+
if (edits === sent) {
|
|
216
|
+
dirty = false; remove(key);
|
|
217
|
+
// сбой записи находкам (apply_message): оба итога показываются здесь – странице карточки нужна база
|
|
218
|
+
if (answer.apply_message) { say("Решение сохранено. " + answer.apply_message); }
|
|
219
|
+
else { location.assign(answer.redirect); }
|
|
220
|
+
} else {
|
|
221
|
+
saveDraft(); check.hidden = true; confirm.checked = false;
|
|
222
|
+
// «Сохранить и применить к находкам»: итог записи находкам сообщается и при оставшемся черновике
|
|
223
|
+
var applyNote = answer.apply_message
|
|
224
|
+
? " " + answer.apply_message
|
|
225
|
+
: (answer.apply_error
|
|
226
|
+
? " Находкам решение не записано: сохраните правки, обновите страницу и примените решение ещё раз."
|
|
227
|
+
: (answer.applied ? " Находкам этой версии решение записано: " + answer.applied + "." : ""));
|
|
228
|
+
say("Отправленное решение сохранено; новые правки остались черновиком и ещё не сохранены." + applyNote);
|
|
229
|
+
}
|
|
230
|
+
}); })
|
|
231
|
+
.catch(function (error) { say(error.message + (stored ? " Черновик сохранён в этой вкладке." : " Не закрывайте страницу: решение не сохранено."), true); })
|
|
232
|
+
.finally(function () { sending = false; updateButtons(); });
|
|
233
|
+
});
|
|
234
|
+
})();
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
(function () {
|
|
2
|
+
'use strict';
|
|
3
|
+
var runNode = document.getElementById('run');
|
|
4
|
+
var runId = runNode ? runNode.dataset.events.split('/')[2] : null;
|
|
5
|
+
var current = null, arrived = null, lastRun = null, dismissed = null, activeBusy = false, historyBusy = false;
|
|
6
|
+
var bar = document.getElementById('active-run-bar');
|
|
7
|
+
function set(id, value) { var e=document.getElementById(id); if(e) e.textContent=value; }
|
|
8
|
+
function age(stamp) { if(!stamp) return null; var t=typeof stamp==='number'?stamp*1000:Date.parse(stamp); return Number.isFinite(t)?Math.max(0,Math.floor((Date.now()-t)/1000)):null; }
|
|
9
|
+
function ago(stamp) { var s=age(stamp); return s===null?'ещё не было':s<60?s+' с назад':Math.floor(s/60)+' мин назад'; }
|
|
10
|
+
function number(n) { return typeof n==='number'&&Number.isFinite(n)?n.toLocaleString('ru-RU',{maximumFractionDigits:1}):'–'; }
|
|
11
|
+
function finalState(s) { return ['done','stopped','error'].indexOf(s)>=0; }
|
|
12
|
+
function get(url) { var c=new AbortController(), t=setTimeout(function(){c.abort();},5000); return fetch(url,{signal:c.signal,cache:'no-store'}).then(function(r){if(!r.ok) throw new Error('HTTP'); return r.json();}).finally(function(){clearTimeout(t);}); }
|
|
13
|
+
function status(s) {
|
|
14
|
+
if(!s || !s.run) return;
|
|
15
|
+
current=s;arrived=performance.now();lastRun=s.run.id;
|
|
16
|
+
if(bar && dismissed!==s.run.id) {
|
|
17
|
+
bar.hidden=false;
|
|
18
|
+
var link=document.getElementById('active-run-link');link.href='/runs/'+s.run.id;
|
|
19
|
+
link.textContent=(s.project_name?s.project_name+' · ':'')+(s.run.state==='done'?(s.run.failed?'Завершён с ошибками':'Разбор завершён'):(s.run.state_label||s.run.state))+' · '+s.run.done+' / '+s.run.total+' · открыть ход разбора'+(s.slow_model&&s.slow_model.text?' · '+s.slow_model.text:'');
|
|
20
|
+
}
|
|
21
|
+
if(runNode) {
|
|
22
|
+
var m=s.metrics||{}, host=m.host||{}, mem=host.memory;
|
|
23
|
+
set('obs-ram',mem?number(mem.used_bytes/1073741824)+' / '+number(mem.total_bytes/1073741824)+' GiB':'Недоступно');
|
|
24
|
+
set('obs-ram-source',host.status==='fresh'?'Windows · '+ago(host.sampled_at):host.status==='stale'?'Данные хоста устарели · '+ago(host.sampled_at):host.status==='remote'?'Модель на сервере в сети: память и процессор этого компьютера не показываются':'Сборщик хоста не передал измерение');
|
|
25
|
+
set('obs-cpu',host.cpu_pct!==null&&host.cpu_pct!==undefined?number(host.cpu_pct)+'%':'Недоступно');
|
|
26
|
+
// сборщик метрик компьютера не работает (HOSTCOL-01): предупреждение появляется и уходит вместе с ним
|
|
27
|
+
// у прогона внешним провайдером – своё предупреждение: без сборщика не уходят внешние запросы (ревью круг 18)
|
|
28
|
+
var cwx=document.getElementById('collector-warning-external');
|
|
29
|
+
if(cwx){var cx=s.collector||{};cwx.hidden=!(cx.state==='stale'||cx.state==='missing');}
|
|
30
|
+
var cw=document.getElementById('collector-warning'), c=s.collector||{};
|
|
31
|
+
if(cw) {
|
|
32
|
+
cw.hidden=!((c.state==='stale'||c.state==='missing')&&host.status!=='remote');
|
|
33
|
+
var cd=cw.querySelector('[data-collector-detail]'), cdw=cw.querySelector('[data-collector-detail-wrap]');
|
|
34
|
+
if(cd)cd.textContent=c.detail||'';if(cdw)cdw.hidden=!c.detail;
|
|
35
|
+
// внешние запросы встают только в контейнере без свежих адресов компьютера (те же условия, что у отказа)
|
|
36
|
+
var ce=cw.querySelector('[data-collector-external]');
|
|
37
|
+
if(ce)ce.hidden=!(cw.getAttribute('data-external-on')==='1'&&c.expected&&!c.addresses);
|
|
38
|
+
}
|
|
39
|
+
var devices=((m.gpu||{}).gpus||[]), details=document.getElementById('obs-gpus'), list=document.getElementById('obs-gpu-list');
|
|
40
|
+
if(details && list) {
|
|
41
|
+
details.hidden=devices.length<2;
|
|
42
|
+
while(list.children.length>devices.length) list.lastChild.remove();
|
|
43
|
+
devices.forEach(function(g,i){
|
|
44
|
+
var row=list.children[i];if(!row){row=document.createElement('li');list.appendChild(row);}
|
|
45
|
+
row.textContent=(g.name||'Неизвестная видеокарта')+' · '+number(g.utilization_pct)+(g.utilization_pct==null?'':'%')+' · '+number(g.memory_used_mb)+' / '+number(g.memory_total_mb)+' MiB · '+number(g.temperature_c)+' °C · '+number(g.power_w)+' Вт';
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
var tiles=document.querySelector('section.tiles');if(tiles) tiles.classList.toggle('measurements-stale',m.resource_status!=='fresh');
|
|
49
|
+
set('obs-resource-time','Ресурсы: '+(m.pending?'измерение ещё не готово':m.resource_status==='fresh'?'измерение '+ago(m.observed_at):m.resource_status==='stale'?'снимок устарел':'недоступны')+(m.error?' · Ollama: '+m.error:'')+(m.history_error?' · '+m.history_error:''));
|
|
50
|
+
health();
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
var MODEL_SILENCE_S=180; // тот же порог «модель молчит», что и в подсказке ниже
|
|
54
|
+
function health() {
|
|
55
|
+
if(!current||!runNode) return;
|
|
56
|
+
var r=current.run,c=current.current||{};
|
|
57
|
+
var stale=arrived===null||performance.now()-arrived>15000;
|
|
58
|
+
var signal=c.last_model_event_at||c.request_started_at;
|
|
59
|
+
var silent=!stale && r.state==='running' && !!signal && age(signal)>MODEL_SILENCE_S;
|
|
60
|
+
var message=stale?'Нет свежих данных страницы. Переподключение…':r.state==='done'?(r.failed?'Разбор завершён с ошибками: '+r.failed:'Разбор завершён'):finalState(r.state)?(r.state_label||r.state):r.state==='paused'?'Разбор на паузе':c.last_model_event_at?'Последние данные модели: '+ago(c.last_model_event_at):'Ожидаем данные модели. Это может включать загрузку модели и обработку входа.';
|
|
61
|
+
if(silent) message='Долго нет новых данных модели: '+ago(signal)+'. Проверьте состояние запроса.';
|
|
62
|
+
set('obs-health',message);
|
|
63
|
+
var el=document.getElementById('obs-health');if(el)el.classList.toggle('text-warn',stale||silent);
|
|
64
|
+
set('obs-result-time','Последний сохранённый результат: '+ago(current.last_result_at)+' · связь со страницей '+(stale?'устарела':Math.floor((performance.now()-arrived)/1000)+' с назад'));
|
|
65
|
+
}
|
|
66
|
+
function poll() {
|
|
67
|
+
if(activeBusy||document.hidden) return;
|
|
68
|
+
activeBusy=true;
|
|
69
|
+
get(runId?'/runs/'+runId+'/status':'/api/runs/active').then(function(s){if(s.run)status(s);else if(lastRun&&!finalState((current||{}).run.state))return get('/runs/'+lastRun+'/status').then(status);}).catch(function(){}).finally(function(){activeBusy=false;});
|
|
70
|
+
}
|
|
71
|
+
function graph(id,points,key) {
|
|
72
|
+
var svg=document.getElementById(id);if(!svg)return;
|
|
73
|
+
while(svg.firstChild)svg.removeChild(svg.firstChild);
|
|
74
|
+
var values=points.map(function(p){return p[key];}).filter(function(v){return typeof v==='number'&&Number.isFinite(v);});
|
|
75
|
+
if(!values.length){var t=document.createElementNS('http://www.w3.org/2000/svg','text');t.setAttribute('x','8');t.setAttribute('y','45');t.textContent='Нет измерений';svg.appendChild(t);return;}
|
|
76
|
+
var max=key==='gpu'?100:Math.max.apply(null,values)*1.1||1;
|
|
77
|
+
var d='',previous=null,begin=points[0].at,end=points[points.length-1].at;
|
|
78
|
+
points.forEach(function(p){var v=p[key];if(typeof v!=='number'||!Number.isFinite(v)){previous=null;return;}var x=8+(p.at-begin)*304/Math.max(1,end-begin), y=77-v/max*52;var join=previous&&p.source_epoch===previous.source_epoch&&p.at-previous.at<130;d+=(join?' L':' M')+x.toFixed(1)+','+y.toFixed(1);previous=p;});
|
|
79
|
+
var label=document.createElementNS('http://www.w3.org/2000/svg','text');label.setAttribute('x','8');label.setAttribute('y','15');label.textContent='Последний замер '+number(values[values.length-1])+' · пик '+number(Math.max.apply(null,values));svg.appendChild(label);
|
|
80
|
+
var path=document.createElementNS('http://www.w3.org/2000/svg','path');path.setAttribute('d',d);path.setAttribute('fill','none');path.setAttribute('stroke','currentColor');path.setAttribute('stroke-width','2');svg.appendChild(path);
|
|
81
|
+
}
|
|
82
|
+
function history() {
|
|
83
|
+
var choice=document.getElementById('obs-window');
|
|
84
|
+
if(!runNode||!choice||historyBusy||document.hidden)return; // у удалённого исполнителя истории ресурсов нет
|
|
85
|
+
historyBusy=true;
|
|
86
|
+
get('/api/metrics/history?window='+choice.value+(runId?'&run='+runId:'')).then(function(s){graph('obs-gpu-chart',s.points,'gpu');graph('obs-vram-chart',s.points,'vram');graph('obs-ram-chart',s.points,'ram');}).catch(function(){}).finally(function(){historyBusy=false;});
|
|
87
|
+
}
|
|
88
|
+
// Полоса «идёт получение» исследования компонентов – на любой странице, как «ход разбора» у прогона (страницу
|
|
89
|
+
// хода получения долго искать). Получение закончилось – полоса говорит итог, пока её не
|
|
90
|
+
// скроют; «Скрыть» – до следующего получения.
|
|
91
|
+
var researchBar=document.getElementById('active-research-bar'), researchLast=null, researchDismissed=null, researchBusy=false;
|
|
92
|
+
function researchText(s) {
|
|
93
|
+
var r=s.run, parts=[(s.project_name?s.project_name+' · ':'')+'Исследование компонентов №'+r.id+': '+(r.state_label||r.state)];
|
|
94
|
+
parts.push('сохранено '+(r.rows_saved||0)+' из '+(r.rows_total||0));
|
|
95
|
+
if(r.rows_unchanged) parts.push('без изменений '+r.rows_unchanged);
|
|
96
|
+
if(r.rows_failed) parts.push('не получено '+r.rows_failed);
|
|
97
|
+
if(r.rows_unknown) parts.push('результат неизвестен '+r.rows_unknown);
|
|
98
|
+
return parts.join(' · ')+' · открыть ход получения';
|
|
99
|
+
}
|
|
100
|
+
function researchPoll() {
|
|
101
|
+
if(!researchBar||researchBusy||document.hidden) return;
|
|
102
|
+
researchBusy=true;
|
|
103
|
+
get('/api/research/active'+(researchLast?'?last='+researchLast:'')).then(function(s){
|
|
104
|
+
if(!s.run){researchBar.hidden=true;return;}
|
|
105
|
+
researchLast=s.run.id;
|
|
106
|
+
if(researchDismissed===s.run.id) return;
|
|
107
|
+
var link=document.getElementById('active-research-link');
|
|
108
|
+
link.href=s.url; link.textContent=researchText(s);
|
|
109
|
+
researchBar.hidden=false;
|
|
110
|
+
researchBar.classList.toggle('is-done',s.run.state!=='running');
|
|
111
|
+
}).catch(function(){}).finally(function(){researchBusy=false;});
|
|
112
|
+
}
|
|
113
|
+
var researchClose=document.getElementById('active-research-dismiss');
|
|
114
|
+
if(researchClose)researchClose.onclick=function(){researchDismissed=researchLast;researchBar.hidden=true;};
|
|
115
|
+
document.addEventListener('triage:status',function(e){status(e.detail);});
|
|
116
|
+
document.addEventListener('visibilitychange',function(){if(!document.hidden){poll();history();researchPoll();}});
|
|
117
|
+
var close=document.getElementById('active-run-dismiss');if(close)close.onclick=function(){dismissed=lastRun;bar.hidden=true;};
|
|
118
|
+
var choice=document.getElementById('obs-window');if(choice)choice.onchange=history;
|
|
119
|
+
poll();history();researchPoll();setInterval(health,1000);setInterval(poll,5000);setInterval(researchPoll,5000);
|
|
120
|
+
if(runNode)setInterval(history,10000);
|
|
121
|
+
})();
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/* Тема оформления: выбор пользователя хранится в localStorage, по умолчанию – как в системе.
|
|
2
|
+
Файл подключается в <head> без defer, чтобы тема применилась до отрисовки страницы. Здесь же у <html>
|
|
3
|
+
появляется класс js: без скрипта видны элементы .no-js-only, со скриптом – .js-only. */
|
|
4
|
+
(function () {
|
|
5
|
+
"use strict";
|
|
6
|
+
var KEY = "local-triage-theme";
|
|
7
|
+
var root = document.documentElement;
|
|
8
|
+
root.classList.add("js");
|
|
9
|
+
|
|
10
|
+
function load() {
|
|
11
|
+
try { return window.localStorage.getItem(KEY); } catch (e) { return null; }
|
|
12
|
+
}
|
|
13
|
+
function save(value) {
|
|
14
|
+
try { window.localStorage.setItem(KEY, value); } catch (e) { /* хранилище недоступно – выбор не запоминается */ }
|
|
15
|
+
}
|
|
16
|
+
function current() {
|
|
17
|
+
var chosen = root.getAttribute("data-theme");
|
|
18
|
+
if (chosen === "light" || chosen === "dark") return chosen;
|
|
19
|
+
return window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
20
|
+
}
|
|
21
|
+
// Значок кнопки – по атрибуту data-mode (луна в светлой теме, солнце в тёмной); кнопка без значков – знаком
|
|
22
|
+
function paint(button) {
|
|
23
|
+
var dark = current() === "dark";
|
|
24
|
+
button.setAttribute("data-mode", dark ? "dark" : "light");
|
|
25
|
+
if (!button.querySelector("svg")) button.textContent = dark ? "☀" : "☾";
|
|
26
|
+
button.setAttribute("aria-label", dark ? "Включить светлую тему" : "Включить тёмную тему");
|
|
27
|
+
button.setAttribute("title", dark ? "Светлая тема" : "Тёмная тема");
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
var stored = load();
|
|
31
|
+
if (stored === "light" || stored === "dark") root.setAttribute("data-theme", stored);
|
|
32
|
+
|
|
33
|
+
document.addEventListener("DOMContentLoaded", function () {
|
|
34
|
+
var button = document.getElementById("theme-toggle");
|
|
35
|
+
if (!button) return;
|
|
36
|
+
paint(button);
|
|
37
|
+
button.addEventListener("click", function () {
|
|
38
|
+
var next = current() === "dark" ? "light" : "dark";
|
|
39
|
+
root.setAttribute("data-theme", next);
|
|
40
|
+
save(next);
|
|
41
|
+
paint(button);
|
|
42
|
+
});
|
|
43
|
+
if (window.matchMedia) {
|
|
44
|
+
var query = window.matchMedia("(prefers-color-scheme: dark)");
|
|
45
|
+
var repaint = function () { paint(button); };
|
|
46
|
+
if (query.addEventListener) query.addEventListener("change", repaint);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
})();
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"""Хранилище основной базы: PostgreSQL (ADR-0128, редакция 3). app/db.py – прикладной фасад поверх этого слоя."""
|
|
2
|
+
|
|
3
|
+
from app.storage.postgresql import (
|
|
4
|
+
BUSY_TEXT,
|
|
5
|
+
CommitUnknown,
|
|
6
|
+
DatabaseBusy,
|
|
7
|
+
DatabaseUnavailable,
|
|
8
|
+
IntegrityError,
|
|
9
|
+
PostgresStore,
|
|
10
|
+
Row,
|
|
11
|
+
SerializationFailure,
|
|
12
|
+
conninfo_for,
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
__all__ = ["BUSY_TEXT", "CommitUnknown", "DatabaseBusy", "DatabaseUnavailable", "IntegrityError", "PostgresStore", "Row",
|
|
16
|
+
"SerializationFailure", "conninfo_for"]
|