fix(source): add /services/{name}/source endpoint; fix 404 for service code view in funcs-console

This commit is contained in:
Naeel
2026-03-21 07:20:03 +03:00
parent 09b35888d4
commit 50f24565ec
6 changed files with 51 additions and 7 deletions
+4 -3
View File
@@ -416,7 +416,7 @@
icon.style.transform = 'rotate(90deg)';
if (!loaded) {
loaded = true;
loadSource(body, ns, fn.name);
loadSource(body, ns, fn.name, fn.kind);
}
} else {
body.style.display = 'none';
@@ -458,12 +458,13 @@
return btn;
}
function loadSource(body, ns, fnName) {
function loadSource(body, ns, fnName, fnKind) {
var msg = $el('div', 'src-msg');
msg.textContent = 'Загрузка кода…';
body.appendChild(msg);
fetch('/funcs/' + ns + '/source/' + fnName)
var kindParam = fnKind === 'service' ? '?kind=service' : '';
fetch('/funcs/' + ns + '/source/' + fnName + kindParam)
.then(function (r) {
body.removeChild(msg);
if (!r.ok) {