From 4f6b4b87be72dc434b2992c52b9a967d62ebdb34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CNaeel=E2=80=9D?= Date: Mon, 4 May 2026 06:54:18 +0400 Subject: [PATCH] v1.3.47: fix InvokeStrategy in archive handler, modal error display, draggable modals --- console/deploy/console.yaml | 2 +- console/internal/api/handlers.go | 8 +++- console/ui/css/styles.css | 12 ++++++ console/ui/index.html | 6 ++- console/ui/js/fn-archive.js | 2 + console/ui/js/fn-code.js | 2 + console/ui/js/modals.js | 63 +++++++++++++++++++++++++++++ doc/plans/separate-create-modals.md | 14 +++---- 8 files changed, 97 insertions(+), 12 deletions(-) diff --git a/console/deploy/console.yaml b/console/deploy/console.yaml index 4129237..5712461 100644 --- a/console/deploy/console.yaml +++ b/console/deploy/console.yaml @@ -52,7 +52,7 @@ spec: serviceAccountName: fission-console containers: - name: console - image: naeel/fission-console:v1.3.46 + image: naeel/fission-console:v1.3.47 imagePullPolicy: Always ports: - containerPort: 8090 diff --git a/console/internal/api/handlers.go b/console/internal/api/handlers.go index d2f98e8..65d48bf 100644 --- a/console/internal/api/handlers.go +++ b/console/internal/api/handlers.go @@ -1378,8 +1378,12 @@ func (s *Server) handleCreateFunctionFromArchive(w http.ResponseWriter, r *http. "kind": "Function", "metadata": map[string]any{"name": name, "namespace": ns, "annotations": fnAnnotations}, "spec": map[string]any{ - "environment": map[string]any{"name": envName, "namespace": ns}, - "package": map[string]any{"packageref": map[string]any{"name": pkgName, "namespace": ns}}, + "environment": map[string]any{"name": envName, "namespace": ns}, + "package": map[string]any{"packageref": map[string]any{"name": pkgName, "namespace": ns}}, + "InvokeStrategy": map[string]any{ + "ExecutionStrategy": map[string]any{"ExecutorType": "poolmgr"}, + "StrategyType": "execution", + }, "functionTimeout": timeout, }, }} diff --git a/console/ui/css/styles.css b/console/ui/css/styles.css index ba320d1..0f46aa7 100644 --- a/console/ui/css/styles.css +++ b/console/ui/css/styles.css @@ -318,3 +318,15 @@ textarea { white-space: pre-wrap; word-break: break-word; } + +.modal-error { + display: none; + margin-top: 10px; + padding: 8px 12px; + border-radius: 6px; + background: #3a1a1a; + color: #f88; + font-size: 13px; + white-space: pre-wrap; + word-break: break-word; +} diff --git a/console/ui/index.html b/console/ui/index.html index cfcca53..63929d3 100644 --- a/console/ui/index.html +++ b/console/ui/index.html @@ -102,7 +102,7 @@
NUBES
FISSION CONSOLE
-
v1.3.46
+
v1.3.47
@@ -234,6 +234,7 @@ style="display:none;margin-top:8px;padding:10px 12px;border-radius:6px;font-size:13px;line-height:1.5;white-space:pre-wrap;font-family:monospace;">
+
@@ -303,6 +304,7 @@ style="display:none;margin-top:8px;padding:10px 12px;border-radius:6px;font-size:13px;line-height:1.5;white-space:pre-wrap;font-family:monospace;">
+
@@ -460,7 +462,7 @@
- v1.3.46 + v1.3.47
diff --git a/console/ui/js/fn-archive.js b/console/ui/js/fn-archive.js index 2a41020..f671810 100644 --- a/console/ui/js/fn-archive.js +++ b/console/ui/js/fn-archive.js @@ -22,6 +22,7 @@ function openCreateArchive() { if (fileInput) fileInput.value = ''; var aiRes = document.getElementById('ca-ai-result'); if (aiRes) { aiRes.style.display = 'none'; aiRes.textContent = ''; } + hideModalError('ca-error'); document.getElementById('create-archive-modal').classList.add('open'); document.getElementById('ca-name').focus(); } @@ -77,6 +78,7 @@ async function submitCreateArchive() { await reloadAll(); } catch (e) { progress.stop('Ошибка создания: ' + e.message, 'err'); + showModalError('ca-error', 'Ошибка: ' + e.message); } finally { btn.disabled = false; } diff --git a/console/ui/js/fn-code.js b/console/ui/js/fn-code.js index 61d8748..2ac02f1 100644 --- a/console/ui/js/fn-code.js +++ b/console/ui/js/fn-code.js @@ -21,6 +21,7 @@ function openCreateCode() { toggleScheduleFields('cc'); var aiRes = document.getElementById('cc-ai-result'); if (aiRes) { aiRes.style.display = 'none'; aiRes.textContent = ''; } + hideModalError('cc-error'); document.getElementById('create-code-modal').classList.add('open'); document.getElementById('cc-name').focus(); } @@ -65,6 +66,7 @@ async function submitCreateCode() { await reloadAll(); } catch (e) { progress.stop('Ошибка создания: ' + e.message, 'err'); + showModalError('cc-error', 'Ошибка: ' + e.message); } finally { btn.disabled = false; } diff --git a/console/ui/js/modals.js b/console/ui/js/modals.js index a8a4e2d..a7406e7 100644 --- a/console/ui/js/modals.js +++ b/console/ui/js/modals.js @@ -1,5 +1,68 @@ /* modals.js — управление модальными окнами Help и Invoke */ +// makeDraggable — делает .panel внутри modalId перетаскиваемым за заголовок (h3). +function makeDraggable(modalId) { + var modal = document.getElementById(modalId); + if (!modal) return; + var panel = modal.querySelector('.panel'); + if (!panel) return; + var handle = panel.querySelector('h3'); + if (!handle) return; + + handle.style.cursor = 'move'; + handle.style.userSelect = 'none'; + + var startX, startY, startLeft, startTop; + + handle.addEventListener('mousedown', function(e) { + e.preventDefault(); + var rect = panel.getBoundingClientRect(); + // Переводим в position:fixed если ещё не + if (!panel.style.left) { + panel.style.position = 'fixed'; + panel.style.left = rect.left + 'px'; + panel.style.top = rect.top + 'px'; + panel.style.margin = '0'; + } + startX = e.clientX; + startY = e.clientY; + startLeft = parseInt(panel.style.left, 10) || rect.left; + startTop = parseInt(panel.style.top, 10) || rect.top; + + function onMove(e) { + var dx = e.clientX - startX; + var dy = e.clientY - startY; + panel.style.left = (startLeft + dx) + 'px'; + panel.style.top = (startTop + dy) + 'px'; + } + function onUp() { + document.removeEventListener('mousemove', onMove); + document.removeEventListener('mouseup', onUp); + } + document.addEventListener('mousemove', onMove); + document.addEventListener('mouseup', onUp); + }); +} + +// Инициализация после загрузки DOM +document.addEventListener('DOMContentLoaded', function() { + ['create-code-modal', 'create-archive-modal', 'edit-modal', 'help-modal', 'invoke-modal'].forEach(makeDraggable); +}); + +// showModalError — показывает ошибку внутри модалки. +// errorDivId — id элемента с классом modal-error. +function showModalError(errorDivId, message) { + var el = document.getElementById(errorDivId); + if (!el) return; + el.textContent = message; + el.style.display = 'block'; +} + +function hideModalError(errorDivId) { + var el = document.getElementById(errorDivId); + if (el) { el.style.display = 'none'; el.textContent = ''; } +} + function openHelp() { document.getElementById('help-modal').classList.add('open'); } diff --git a/doc/plans/separate-create-modals.md b/doc/plans/separate-create-modals.md index 1f837f1..89dd7c4 100644 --- a/doc/plans/separate-create-modals.md +++ b/doc/plans/separate-create-modals.md @@ -56,13 +56,13 @@ | # | Задача | Статус | |---|--------|--------| -| 1 | Создать `fn-code.js` | [ ] | -| 2 | Создать `fn-archive.js` | [ ] | -| 3 | Изменить `index.html` | [ ] | -| 4 | Изменить `functions.js` | [ ] | -| 5 | rsync + проверка на VM | [ ] | -| 6 | docker build + push + apply | [ ] | -| 7 | git commit + push | [ ] | +| 1 | Создать `fn-code.js` | ✅ | +| 2 | Создать `fn-archive.js` | ✅ | +| 3 | Изменить `index.html` | ✅ | +| 4 | Изменить `functions.js` | ✅ | +| 5 | rsync + проверка на VM | ✅ | +| 6 | docker build + push + apply | ✅ v1.3.46 | +| 7 | git commit + push | ✅ ветка separate-create-modals | ---