fix: надежное экранирование JSON в data-seg для стабильных тултипов аптайма
Build and deploy / build-deploy (push) Has been cancelled
Build and deploy / build-deploy (push) Has been cancelled
This commit is contained in:
@@ -311,7 +311,8 @@ function uptimeCell(pct, history) {
|
|||||||
const segs = hist.map((h, i) => {
|
const segs = hist.map((h, i) => {
|
||||||
const ok = typeof h === 'boolean' ? h : h && h.ok;
|
const ok = typeof h === 'boolean' ? h : h && h.ok;
|
||||||
const data = typeof h === 'boolean' ? { ok } : h;
|
const data = typeof h === 'boolean' ? { ok } : h;
|
||||||
return `<span class="uptime-seg ${ok ? 'ok' : 'fail'}" data-seg='${JSON.stringify(data).replace(/'/g, "'")}'></span>`;
|
const jsonStr = JSON.stringify(data).replace(/"/g, '"').replace(/'/g, ''');
|
||||||
|
return `<span class="uptime-seg ${ok ? 'ok' : 'fail'}" data-seg='${jsonStr}'></span>`;
|
||||||
}).join('');
|
}).join('');
|
||||||
|
|
||||||
const label = pct === null || pct === undefined ? '—' : `${pct}%`;
|
const label = pct === null || pct === undefined ? '—' : `${pct}%`;
|
||||||
|
|||||||
Reference in New Issue
Block a user