ui: harden wizard method callout rendering
This commit is contained in:
+19
-6
@@ -144,9 +144,9 @@ if (window.CrankDiagnostics && typeof window.CrankDiagnostics.bootstrap === 'fun
|
|||||||
var METHOD_CALLOUTS = {
|
var METHOD_CALLOUTS = {
|
||||||
GET: null,
|
GET: null,
|
||||||
DELETE: null,
|
DELETE: null,
|
||||||
POST: { icon: 'info', text: { en: '<strong>POST selected — body encoding required.</strong> In step 4 you will define the JSON schema for the body payload. Crank will automatically serialize MCP tool arguments into the format you specify.', ru: '<strong>Выбран POST — требуется кодирование тела запроса.</strong> На шаге 4 вы зададите JSON-схему для body payload. Crank автоматически сериализует аргументы MCP-инструмента в выбранный формат.' } },
|
POST: { icon: 'info', text: { en: { title: 'POST selected — body encoding required.', body: 'In step 4 you will define the JSON schema for the body payload. Crank will automatically serialize MCP tool arguments into the format you specify.' }, ru: { title: 'Выбран POST — требуется кодирование тела запроса.', body: 'На шаге 4 вы зададите JSON-схему для body payload. Crank автоматически сериализует аргументы MCP-инструмента в выбранный формат.' } } },
|
||||||
PUT: { icon: 'info', text: { en: '<strong>PUT selected — full-resource replacement.</strong> The request body must contain a complete resource representation. Define the body schema in step 4.', ru: '<strong>Выбран PUT — полная замена ресурса.</strong> Request body должен содержать полное представление ресурса. Задайте body schema на шаге 4.' } },
|
PUT: { icon: 'info', text: { en: { title: 'PUT selected — full-resource replacement.', body: 'The request body must contain a complete resource representation. Define the body schema in step 4.' }, ru: { title: 'Выбран PUT — полная замена ресурса.', body: 'Request body должен содержать полное представление ресурса. Задайте body schema на шаге 4.' } } },
|
||||||
PATCH: { icon: 'info', text: { en: '<strong>PATCH selected — partial update.</strong> Only include the fields you want to modify in the body schema defined in step 4.', ru: '<strong>Выбран PATCH — частичное обновление.</strong> В body schema на шаге 4 включайте только те поля, которые хотите изменить.' } },
|
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 selectMethod(btn) {
|
function selectMethod(btn) {
|
||||||
@@ -159,9 +159,22 @@ function selectMethod(btn) {
|
|||||||
if (info) {
|
if (info) {
|
||||||
var lang = localStorage.getItem('crank_lang') || 'en';
|
var lang = localStorage.getItem('crank_lang') || 'en';
|
||||||
var text = typeof info.text === 'string' ? info.text : (info.text[lang] || info.text.en);
|
var text = typeof info.text === 'string' ? info.text : (info.text[lang] || info.text.en);
|
||||||
callout.innerHTML =
|
callout.innerHTML = '';
|
||||||
'<svg width="15" height="15" style="flex-shrink:0;color:var(--accent)"><use href="' + (window.APP_BASE||'') + 'icons/general/info-circle.svg#icon"/></svg>' +
|
var icon = buildIconSvg(
|
||||||
'<span>' + text + '</span>';
|
(window.APP_BASE || '') + 'icons/general/info-circle.svg#icon',
|
||||||
|
15,
|
||||||
|
15
|
||||||
|
);
|
||||||
|
icon.style.flexShrink = '0';
|
||||||
|
icon.style.color = 'var(--accent)';
|
||||||
|
callout.appendChild(icon);
|
||||||
|
|
||||||
|
var content = document.createElement('span');
|
||||||
|
var title = document.createElement('strong');
|
||||||
|
title.textContent = text.title;
|
||||||
|
content.appendChild(title);
|
||||||
|
content.appendChild(document.createTextNode(' ' + text.body));
|
||||||
|
callout.appendChild(content);
|
||||||
callout.style.display = 'flex';
|
callout.style.display = 'flex';
|
||||||
} else {
|
} else {
|
||||||
callout.style.display = 'none';
|
callout.style.display = 'none';
|
||||||
|
|||||||
Reference in New Issue
Block a user