fix: v1.3.69 — Info modal curl copy: use data-attr to fix broken onclick with quotes
This commit is contained in:
@@ -55,7 +55,7 @@ spec:
|
||||
serviceAccountName: fission-console
|
||||
containers:
|
||||
- name: console
|
||||
image: naeel/fission-console:v1.3.68
|
||||
image: naeel/fission-console:v1.3.69
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 8090
|
||||
|
||||
@@ -102,7 +102,7 @@
|
||||
<div class="nubes">NUBES</div>
|
||||
<div class="product">FISSION CONSOLE</div>
|
||||
</div>
|
||||
<div style="font-size:0.65rem; color:var(--text-secondary); margin-left:10px; align-self:center; opacity:0.7;">v1.3.68</div>
|
||||
<div style="font-size:0.65rem; color:var(--text-secondary); margin-left:10px; align-self:center; opacity:0.7;">v1.3.69</div>
|
||||
</div>
|
||||
<div class="row" style="margin:0;">
|
||||
<button class="btn ghost" onclick="reloadAll()">Refresh</button>
|
||||
@@ -485,7 +485,7 @@
|
||||
</div>
|
||||
|
||||
<div class="actions" style="justify-content:space-between; align-items:center;">
|
||||
<span style="font-size:0.75rem; color:var(--text-secondary);">v1.3.68</span>
|
||||
<span style="font-size:0.75rem; color:var(--text-secondary);">v1.3.69</span>
|
||||
<button class="btn ghost" onclick="closeHelp()">Закрыть</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -193,11 +193,11 @@ function openInfo(name, btn) {
|
||||
return;
|
||||
}
|
||||
|
||||
// copyBtn — кнопка копирования конкретного значения в буфер.
|
||||
// copyBtn — кнопка копирования конкретного значения через data-атрибут (безопасно для любых символов).
|
||||
function copyBtn(val) {
|
||||
if (!val || val === '-') return '';
|
||||
var safe = val.replace(/\\/g, '\\\\').replace(/'/g, "\\'");
|
||||
return ' <button class="btn ghost" style="padding:1px 6px; font-size:11px;" onclick="navigator.clipboard.writeText(\'' + safe + '\')">📋</button>';
|
||||
var encoded = val.replace(/&/g, '&').replace(/"/g, '"');
|
||||
return ' <button class="btn ghost" style="padding:1px 6px; font-size:11px;" data-copy="' + encoded + '" onclick="navigator.clipboard.writeText(this.dataset.copy)">📋</button>';
|
||||
}
|
||||
|
||||
// Строки без кнопки копирования (только отображение).
|
||||
@@ -221,7 +221,8 @@ function openInfo(name, btn) {
|
||||
var curlFull = 'curl -H "X-Auth-Token: ' + token + '" -X ' + method + ' "' + externalUrl + '"';
|
||||
// В отображении скрываем токен — показываем только метод и URL.
|
||||
var curlDisplay = 'curl ... -X ' + method + ' "' + externalUrl + '"';
|
||||
var curlSafe = curlFull.replace(/\\/g, '\\\\').replace(/'/g, "\\'");
|
||||
// Храним полную команду в data-атрибуте (HTML-encode), читаем через dataset — безопасно для любых символов.
|
||||
var curlAttr = curlFull.replace(/&/g, '&').replace(/"/g, '"');
|
||||
|
||||
var html = [
|
||||
'<tr>' + labelTd('Имя') + withCopy(info.name) + '</tr>',
|
||||
@@ -238,7 +239,7 @@ function openInfo(name, btn) {
|
||||
'<tr>' + labelTd('curl') +
|
||||
'<td class="mono" style="word-break:break-all;padding:4px 0;color:var(--text-secondary);">' +
|
||||
h(curlDisplay) +
|
||||
' <button class="btn ghost" style="padding:1px 6px; font-size:11px;" onclick="navigator.clipboard.writeText(\'' + curlSafe + '\')">📋</button>' +
|
||||
' <button class="btn ghost" style="padding:1px 6px; font-size:11px;" data-curl="' + curlAttr + '" onclick="navigator.clipboard.writeText(this.dataset.curl)">📋</button>' +
|
||||
'</td></tr>',
|
||||
].join('');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user