From 8f802c3a1709f57ece81a890c3553aefe5de7a82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CNaeel=E2=80=9D?= Date: Wed, 29 Jul 2026 09:05:23 +0400 Subject: [PATCH] v1.1.13: service highlight, dynamic btn text, defaultValue in dataDescriptor --- site/app.py | 2 +- site/operations/get_params.py | 1 + site/routes/api_test.py | 2 +- site/static/app.js | 5 ++++- site/templates/index.html | 2 +- 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/site/app.py b/site/app.py index b98992b..a9fdca7 100644 --- a/site/app.py +++ b/site/app.py @@ -18,7 +18,7 @@ from routes.api import bp as api_bp from routes.api_test import bp as api_test_bp # Версия — меняется при КАЖДОМ изменении кода. Показывается в топбаре UI. -VERSION = "1.1.12" +VERSION = "1.1.13" app = Flask(__name__, template_folder="templates", static_folder="static") app.config["NUBES_API_ENDPOINT"] = os.getenv("NUBES_API_ENDPOINT", "https://lk-api-gateway-test.ngcloud.ru/api/v1/svc") diff --git a/site/operations/get_params.py b/site/operations/get_params.py index 42719fa..56b94b6 100644 --- a/site/operations/get_params.py +++ b/site/operations/get_params.py @@ -72,6 +72,7 @@ def get_params_with_current_values(client, op_id, instance_uid): k: { "dataType": v.get("dataType", ""), "valueList": _normalize_value_list(v.get("valueList", "")), + "defaultValue": v.get("defaultValue", ""), "isRequired": v.get("isRequired", False), } for k, v in dd.items() diff --git a/site/routes/api_test.py b/site/routes/api_test.py index 2800547..48c9d7b 100644 --- a/site/routes/api_test.py +++ b/site/routes/api_test.py @@ -178,7 +178,7 @@ def api_params(op_id): "defaultValue": p.get("defaultValue"), "valueList": _normalize_value_list(p.get("valueList")), "refSvcId": p.get("refSvcId"), - "dataDescriptor": {k: {"dataType": v.get("dataType",""), "valueList": _normalize_value_list(v.get("valueList","")), "isRequired": v.get("isRequired", False)} for k, v in dd.items()} if isinstance(dd, dict) else None, + "dataDescriptor": {k: {"dataType": v.get("dataType",""), "valueList": _normalize_value_list(v.get("valueList","")), "defaultValue": v.get("defaultValue",""), "isRequired": v.get("isRequired", False)} for k, v in dd.items()} if isinstance(dd, dict) else None, }) _log(f"[api_params] DEFAULT returning {len(result)} params") return jsonify({"params": result}) diff --git a/site/static/app.js b/site/static/app.js index 3582205..6bc5e54 100644 --- a/site/static/app.js +++ b/site/static/app.js @@ -47,6 +47,9 @@ async function selectService(svcId){ const d=await r.json(); svcInstances=d.instances||[]; currentSvcName=d.svc||''; + // Обновить текст кнопки создания + const btnSpan=document.querySelector('#create-btn-area span'); + if(btnSpan) btnSpan.textContent='+ Создать новый инстанс '+(currentSvcName||'сервиса'); let html=''; svcInstances.forEach(i=>{ @@ -180,7 +183,7 @@ function showParams(opId,opName){ try{dflObj=JSON.parse(dfl||'{}');}catch(e){} Object.keys(dd).forEach(subKey=>{ const sub=dd[subKey]; - const subDfl=dflObj[subKey]!==undefined?dflObj[subKey]:''; + const subDfl=dflObj[subKey]!==undefined?dflObj[subKey]:(sub.defaultValue||''); const subVl=sub.valueList; const subReq=sub.isRequired; const subNoDfl=subReq&&!subDfl&&subDfl!==0&&subDfl!==false; diff --git a/site/templates/index.html b/site/templates/index.html index 4c6c965..0cc8f16 100644 --- a/site/templates/index.html +++ b/site/templates/index.html @@ -12,7 +12,7 @@ .col-svc { width:240px; flex-shrink:0; max-height:calc(100vh - 50px); overflow-y:auto; } .col-main { flex:1; min-width:0; } .svc-item { cursor:pointer; padding:4px 8px; font-size:12px; border-radius:4px; } - .svc-item:hover, .svc-item.active { background:var(--brand-grey-light); } + .svc-item:hover, .svc-item.active { background:#dbeafe; font-weight:600; } .inst-item { cursor:pointer; display:flex; align-items:center; gap:6px; padding:4px 8px; font-size:12px; border-radius:4px; } .inst-item:hover, .inst-item.active { background:var(--brand-grey-light); } .inst-ops { display:none; margin-left:16px; }