Add HttpClient.post, dummy-only, remove reconcile, v1.0.7

This commit is contained in:
2026-07-24 07:49:37 +04:00
parent 68306764cf
commit 098cc2ace6
3 changed files with 18 additions and 6 deletions
+6
View File
@@ -15,3 +15,9 @@ class HttpClient:
r = self._session.get(f"{self._endpoint}{path}", **kwargs)
r.raise_for_status()
return r.json()
def post(self, path, data=None, **kwargs):
kwargs.setdefault("timeout", 30)
r = self._session.post(f"{self._endpoint}{path}", json=data, **kwargs)
r.raise_for_status()
return r.json()
+1 -1
View File
@@ -6,7 +6,7 @@ from routes.main import bp as main_bp
from routes.api import bp as api_bp
from routes.api_test import bp as api_test_bp
VERSION = "1.0.6"
VERSION = "1.0.7"
app = Flask(__name__, template_folder="templates", static_folder="static")
app.config["NUBES_API_ENDPOINT"] = os.getenv("NUBES_API_ENDPOINT", "https://lk-api-gateway-dev.ngcloud.ru/api/v1/svc")
+11 -5
View File
@@ -94,11 +94,17 @@
<script>
let selectedSvc=null, selectedOp=null, svcInstances=[];
// Load services
fetch('/api/services').then(r=>r.json()).then(data=>{
// Load services — only dummy for now
(async function(){
const el=document.getElementById('svc-list');
el.innerHTML=data.map(s=>`<div class="svc-item" data-svc-id="${s.svcId}" onclick="selectService(${s.svcId})">${s.svcId}. ${s.svc}${s.svcExtendedName?' — '+s.svcExtendedName:''}</div>`).join('');
});
try{
const r=await fetch('/api/services');
const data=await r.json();
const dummy=data.find(s=>s.svcId===1);
if(dummy) el.innerHTML=`<div class="svc-item active" data-svc-id="1" onclick="selectService(1)">1. ${dummy.svc}</div>`;
selectService(1);
}catch(e){el.innerHTML='<span style="color:var(--destructive);font-size:11px;">Ошибка загрузки</span>';}
})();
async function selectService(svcId){
selectedSvc=svcId; selectedOp=null;
@@ -117,7 +123,7 @@ async function selectService(svcId){
document.getElementById('ops-title').textContent=d.svc+' — операции';
const opsList=document.getElementById('ops-list');
opsList.innerHTML=d.operations.map(o=>{
opsList.innerHTML=d.operations.filter(o=>o.operation!=='reconcile').map(o=>{
let disabled=!hasInstance && o.operation!=='create';
if(hasInstance && o.operation==='create') disabled=true;
if(o.operation==='reconcile') disabled=false;