From 929c85d5c8ab002304c8924dfaea49935b184dc0 Mon Sep 17 00:00:00 2001 From: "a.tolmachev" Date: Sat, 2 May 2026 13:35:17 +0000 Subject: [PATCH] ui: finish template safety cleanup --- TASKS.md | 8 ++++---- apps/ui/html/wizard/index.html | 2 +- apps/ui/js/wizard.js | 29 +++++++++++++++++++++++++++-- 3 files changed, 32 insertions(+), 7 deletions(-) diff --git a/TASKS.md b/TASKS.md index eeb3163..4334d13 100644 --- a/TASKS.md +++ b/TASKS.md @@ -2,14 +2,14 @@ ## Current -### `feat/frontend-template-safety-cleanup` +### `feat/frontend-css-state-cleanup` Status: in_progress DoD: -- local UI helpers do not use `innerHTML` for static SVG or icon insertion -- wizard shell and workspace shell use DOM-based icon and fragment construction -- remaining HTML-bearing i18n/template paths are explicitly isolated and tracked +- UI state visuals are driven by classes or semantic attributes instead of ad-hoc inline style mutation +- button disabled/loading states do not rely on manual style toggles +- wizard and workspace flows keep current behavior after state-class migration ## Next diff --git a/apps/ui/html/wizard/index.html b/apps/ui/html/wizard/index.html index 4ef4df4..a4d168f 100644 --- a/apps/ui/html/wizard/index.html +++ b/apps/ui/html/wizard/index.html @@ -119,7 +119,7 @@
M
-
+
Create operation
diff --git a/apps/ui/js/wizard.js b/apps/ui/js/wizard.js index f308f21..99a5622 100644 --- a/apps/ui/js/wizard.js +++ b/apps/ui/js/wizard.js @@ -36,6 +36,7 @@ var protoParsed = window.protoParsed; var selectedRpcMethod = window.selectedRpcMethod; async function initWizardPage() { + renderSidebarBrand('create'); document.querySelector('.btn-continue').addEventListener('click', function() { if (currentStep < TOTAL_STEPS) { goToStep(currentStep + 1); @@ -149,6 +150,31 @@ var METHOD_CALLOUTS = { PATCH: { icon: 'info', text: { en: { title: 'PATCH selected — partial update.', body: 'Only include the fields you want to modify in the body schema defined in step 4.' }, ru: { title: 'Выбран PATCH — частичное обновление.', body: 'В body schema на шаге 4 включайте только те поля, которые хотите изменить.' } } }, }; +function renderSidebarBrand(mode) { + var sidebarBrand = document.querySelector('.step-sidebar-brand'); + if (!sidebarBrand) return; + var language = localStorage.getItem('crank_lang') || 'en'; + var parts; + if (mode === 'edit') { + parts = language === 'ru' + ? { prefix: 'Редактировать ', suffix: 'операцию' } + : { prefix: 'Edit ', suffix: 'operation' }; + } else { + parts = language === 'ru' + ? { prefix: 'Создать ', suffix: 'операцию' } + : { prefix: 'Create ', suffix: 'operation' }; + } + sidebarBrand.dataset.wizardBrand = mode; + sidebarBrand.textContent = parts.prefix; + var accent = document.createElement('span'); + accent.textContent = parts.suffix; + sidebarBrand.appendChild(accent); +} + +window.addEventListener('crank:langchange', function() { + renderSidebarBrand(wizardMode === 'edit' ? 'edit' : 'create'); +}); + function selectMethod(btn) { document.querySelectorAll('.method-card').forEach(function(b) { b.classList.remove('active'); }); btn.classList.add('active'); @@ -1874,8 +1900,7 @@ async function loadOperationForEdit() { function setEditModePresentation() { var progressLabel = document.querySelector('.progress-label'); if (progressLabel) progressLabel.textContent = tKey('wizard.progress.edit'); - var sidebarBrand = document.querySelector('.step-sidebar-brand'); - if (sidebarBrand) sidebarBrand.innerHTML = tKey('wizard.sidebar.brand.edit'); + renderSidebarBrand('edit'); } function selectProtocol(protocol) {