From 037f1abbb427f14fa8d25e5c17b35d4332466364 Mon Sep 17 00:00:00 2001 From: Roman Buryan Date: Wed, 18 Nov 2026 17:25:09 +0300 Subject: [PATCH] =?UTF-8?q?[PRISM]=20=D0=9A=D0=BE=D0=BC=D0=BD=D0=B0=D1=82?= =?UTF-8?q?=D0=B0:=20=D0=BA=D0=BE=D0=BB=D0=B8=D1=87=D0=B5=D1=81=D1=82?= =?UTF-8?q?=D0=B2=D0=B0,=20=D0=B4=D0=BE=D0=BF.=20=D0=BF=D0=BE=D1=82=D1=80?= =?UTF-8?q?=D0=B5=D0=B1=D0=BD=D0=BE=D1=81=D1=82=D0=B8=20=D0=B8=D0=B7=20?= =?UTF-8?q?=D0=B3=D1=80=D0=B0=D1=84=D0=B0,=20RCH40=20E2/VCH51/WPP,=20?= =?UTF-8?q?=D1=87=D0=B5=D0=BB=D0=BE=D0=B2=D0=B5=D1=87=D0=B5=D1=81=D0=BA?= =?UTF-8?q?=D0=B8=D0=B5=20=D1=80=D0=BE=D0=BB=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ops/combine/catalog-p0-2026-11-18.yaml | 30 +++++------ ops/combine/vendor-branches/yealink.yaml | 30 +++++------ ops/scripts/fix_rch.py | 27 ++++++++++ ops/work/web/app.py | 69 ++++++++++++++++++++---- ops/work/web/studio.html | 52 +++++++++++++++--- 5 files changed, 160 insertions(+), 48 deletions(-) create mode 100644 ops/scripts/fix_rch.py diff --git a/ops/combine/catalog-p0-2026-11-18.yaml b/ops/combine/catalog-p0-2026-11-18.yaml index 1fbf74e..f40f9a5 100644 --- a/ops/combine/catalog-p0-2026-11-18.yaml +++ b/ops/combine/catalog-p0-2026-11-18.yaml @@ -2694,11 +2694,11 @@ devices: aliases: - RCH40pRCH40 E2 - RCH40&RCH40 E2 - domain: infra + domain: vcs line: infrastructure.switch group: E_infra - role: switch - form_factor: switch + role: sharing_hub + form_factor: accessory native_vcs: false protocols: [] protocols_status: unknown @@ -2706,8 +2706,8 @@ devices: kind: catalog verified: false version: '2026-11-18' - solution_class: infrastructure.network - analog_group: infrastructure.network + solution_class: vcs.accessory + analog_group: vcs.accessory sales_scope: own sip_context: none name: RCH40 E2 @@ -2717,11 +2717,11 @@ devices: model: RCH80 aliases: - RCH80 - domain: infra + domain: vcs line: infrastructure.switch group: E_infra - role: switch - form_factor: switch + role: sharing_hub + form_factor: accessory native_vcs: false protocols: [] protocols_status: unknown @@ -2729,8 +2729,8 @@ devices: kind: catalog verified: false version: '2026-11-18' - solution_class: infrastructure.network - analog_group: infrastructure.network + solution_class: vcs.accessory + analog_group: vcs.accessory sales_scope: own sip_context: none name: RCH80 @@ -2740,11 +2740,11 @@ devices: model: RCH240 aliases: - RCH240 - domain: infra + domain: vcs line: infrastructure.switch group: E_infra - role: switch - form_factor: switch + role: sharing_hub + form_factor: accessory native_vcs: false protocols: [] protocols_status: unknown @@ -2752,8 +2752,8 @@ devices: kind: catalog verified: false version: '2026-11-18' - solution_class: infrastructure.network - analog_group: infrastructure.network + solution_class: vcs.accessory + analog_group: vcs.accessory sales_scope: own sip_context: none name: RCH240 diff --git a/ops/combine/vendor-branches/yealink.yaml b/ops/combine/vendor-branches/yealink.yaml index 49c7581..2dc9477 100644 --- a/ops/combine/vendor-branches/yealink.yaml +++ b/ops/combine/vendor-branches/yealink.yaml @@ -2693,11 +2693,11 @@ devices: aliases: - RCH40pRCH40 E2 - RCH40&RCH40 E2 - domain: infra + domain: vcs line: infrastructure.switch group: E_infra - role: switch - form_factor: switch + role: sharing_hub + form_factor: accessory native_vcs: false protocols: [] protocols_status: unknown @@ -2705,8 +2705,8 @@ devices: kind: catalog verified: false version: '2026-11-18' - solution_class: infrastructure.network - analog_group: infrastructure.network + solution_class: vcs.accessory + analog_group: vcs.accessory sales_scope: own sip_context: none name: RCH40 E2 @@ -2716,11 +2716,11 @@ devices: model: RCH80 aliases: - RCH80 - domain: infra + domain: vcs line: infrastructure.switch group: E_infra - role: switch - form_factor: switch + role: sharing_hub + form_factor: accessory native_vcs: false protocols: [] protocols_status: unknown @@ -2728,8 +2728,8 @@ devices: kind: catalog verified: false version: '2026-11-18' - solution_class: infrastructure.network - analog_group: infrastructure.network + solution_class: vcs.accessory + analog_group: vcs.accessory sales_scope: own sip_context: none name: RCH80 @@ -2739,11 +2739,11 @@ devices: model: RCH240 aliases: - RCH240 - domain: infra + domain: vcs line: infrastructure.switch group: E_infra - role: switch - form_factor: switch + role: sharing_hub + form_factor: accessory native_vcs: false protocols: [] protocols_status: unknown @@ -2751,8 +2751,8 @@ devices: kind: catalog verified: false version: '2026-11-18' - solution_class: infrastructure.network - analog_group: infrastructure.network + solution_class: vcs.accessory + analog_group: vcs.accessory sales_scope: own sip_context: none name: RCH240 diff --git a/ops/scripts/fix_rch.py b/ops/scripts/fix_rch.py new file mode 100644 index 0000000..f3a3723 --- /dev/null +++ b/ops/scripts/fix_rch.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python3 +"""RCH* — VCS-инфраструктура, а не unknown.""" +import os +import yaml + +paths = [ + "/opt/work-hub/compat/catalog.yaml", + "/root/buryan-infra/ops/combine/catalog-p0-2026-11-18.yaml", +] +names = {"RCH40 E2", "RCH80", "RCH240"} +for p in paths: + if not os.path.exists(p): + continue + d = yaml.safe_load(open(p, encoding="utf-8")) + n = 0 + for x in d.get("devices") or []: + if (x.get("name") or x.get("model")) in names: + x["domain"] = "vcs" + x["group"] = "E_infra" + x["line"] = "infrastructure.switch" + x["role"] = "sharing_hub" + x["solution_class"] = "vcs.accessory" + x["analog_group"] = "vcs.accessory" + x["form_factor"] = "accessory" + n += 1 + yaml.safe_dump(d, open(p, "w", encoding="utf-8"), allow_unicode=True, sort_keys=False) + print(p, "fixed", n) diff --git a/ops/work/web/app.py b/ops/work/web/app.py index 176ad07..ab6e4aa 100644 --- a/ops/work/web/app.py +++ b/ops/work/web/app.py @@ -74,6 +74,9 @@ ROLE_LABELS = { "touch": "Панель", "display": "Дисплей", "mount": "Крепление", "sharing_hub": "Презентация", "phone": "Телефон", "headset": "Гарнитура", "power": "Питание", "unknown": "Не разобрано", "accessory": "Аксессуар", + "terminal": "Терминал / ПК", "infra": "Инфраструктура", + "sharing": "Презентация / BYOD", "mic": "Микрофоны", "panel": "Панель", + "extra": "Дополнительно", } @@ -1366,6 +1369,31 @@ def room_roles(): ]} +def room_needs(host): + d = find_device(host) + if not d: + return {"error": "not_found", "host": host} + groups = [] + if norm(_dev_name(d)) in D.devices: + try: + groups = D.groups(_dev_name(d), []).get("groups") or [] + except Exception: + groups = [] + # дополнительные BYOD/презентационные аксессуары, если их нет в графе + if not any(g.get("id") == "sharing" for g in groups): + sharing = [] + for x in D.analog_devices: + if x.get("vendor") != d.get("vendor") or x.get("domain") != "vcs": + continue + if x.get("solution_class") == "vcs.sharing": + sharing.append({"model": _dev_name(x), "role": x.get("role") or "sharing_hub", + "max_qty": 1, "condition": "проверить совместимость"}) + if sharing: + groups.append({"id": "sharing", "name": "Презентация / BYOD", "items": sharing[:10]}) + return {"host": _dev_name(d), "vendor": d.get("vendor"), + "archived": is_archived(d), "groups": groups} + + def compose_room(payload): seats = int(payload.get("seats") or 8) roles = payload.get("roles") or {} @@ -1375,30 +1403,46 @@ def compose_room(payload): expected = {"terminal": ("codec", "pc", "kit"), "camera": ("camera",), "audio": ("audio", "speaker"), "touch": ("touch",), "display": ("display",), "mount": ("mount",)} - items, warnings, seen = [], [], set() - for rid, model in roles.items(): + items, warnings, seen = [], [], {} + + def add_item(rid, model, qty=1): if not model: - continue + return + try: + qty = max(1, min(99, int(qty or 1))) + except Exception: + qty = 1 d = find_device(model) if not d: warnings.append({"level": "warning", "text": "не найдено: %s" % model}) - continue + return if d.get("domain") != "vcs": warnings.append({"level": "blocker", "text": "%s не из VCS — нельзя в комнату" % _dev_name(d)}) - continue + return if rid in expected and d.get("role") not in expected[rid]: warnings.append({"level": "warning", "text": "%s не подходит на роль %s" % (_dev_name(d), rid)}) k = _key(d) if k in seen: - continue - seen.add(k) - items.append({"role": rid, "key": k, "name": _dev_name(d), "vendor": d.get("vendor"), - "solution_class": d.get("solution_class"), "class_label": class_label(d.get("solution_class")), - "role_label": role_label(rid), "form_factor": d.get("form_factor"), - "archived": is_archived(d), "purchasable": not is_archived(d)}) + seen[k]["qty"] += qty + return + item = {"role": rid, "key": k, "name": _dev_name(d), "vendor": d.get("vendor"), + "solution_class": d.get("solution_class"), "class_label": class_label(d.get("solution_class")), + "role_label": role_label(rid), "form_factor": d.get("form_factor"), + "qty": qty, "archived": is_archived(d), "purchasable": not is_archived(d)} + seen[k] = item + items.append(item) if is_archived(d): warnings.append({"level": "warning", "text": "%s снято с продажи — в проект можно, купить нельзя" % _dev_name(d)}) + + for rid, val in roles.items(): + if isinstance(val, dict): + add_item(rid, val.get("model"), val.get("qty") or 1) + else: + add_item(rid, val, 1) + for e in (payload.get("extras") or []): + if isinstance(e, dict): + add_item(e.get("role") or "extra", e.get("model"), e.get("qty") or 1) terminal = next((x for x in items if x["role"] == "terminal"), None) if not terminal: warnings.append({"level": "blocker", "text": "нет терминала/ПК"}) @@ -1420,6 +1464,7 @@ def compose_room(payload): if d and (d.get("role") == "pc" or d.get("solution_class") == "vcs.byod.kit" or d.get("deployment") == "byod"): deployment = "byod" return {"seats": seats, "vendor": vendor, "deployment": deployment, "items": items, + "total_qty": sum(x.get("qty", 1) for x in items), "purchasable": all(x.get("purchasable", True) for x in items), "warnings": warnings, "ready": not any(w["level"] == "blocker" for w in warnings), "note": "Вендор — жёсткая граница: аксессуары и компоненты только этого вендора. Порты — в классическом конструкторе."} @@ -1525,6 +1570,8 @@ class H(BaseHTTPRequestHandler): return self._out({"items": archived_items()}) if p == "/api/room-roles": return self._out(room_roles()) + if p == "/api/room-needs": + return self._out(room_needs(q.get("host", [""])[0])) if p == "/api/hosts": return self._out(D.hosts()) if p == "/api/requirements": diff --git a/ops/work/web/studio.html b/ops/work/web/studio.html index e25ed13..fa00a5f 100644 --- a/ops/work/web/studio.html +++ b/ops/work/web/studio.html @@ -85,6 +85,8 @@ main{max-width:1560px;margin:0 auto;padding:22px 26px 70px}.view{display:none}.v
Роли, а не SKU. Вендор — жёсткая граница: аксессуары другого вендора не подходят.
+
+
BYOD: ПК + камера. Native: кодеки/бары с интегрированным терминалом. Порты проверяются в классическом конструкторе.
@@ -110,10 +112,10 @@ main{max-width:1560px;margin:0 auto;padding:22px 26px 70px}.view{display:none}.v