viberadar 0.3.220 → 0.3.222
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +2 -1
- package/dist/server/index.js.map +1 -1
- package/dist/ui/dashboard.html +55 -33
- package/package.json +1 -1
package/dist/ui/dashboard.html
CHANGED
|
@@ -7914,8 +7914,15 @@ function applyLoadConfigToFields(cfg) {
|
|
|
7914
7914
|
loadDurationDraft = cfg.duration || loadDurationDraft;
|
|
7915
7915
|
loadDataDirDraft = cfg.dataDir || loadDataDirDraft;
|
|
7916
7916
|
loadResultDirDraft = cfg.resultDir || loadResultDirDraft;
|
|
7917
|
-
if (cfg
|
|
7918
|
-
|
|
7917
|
+
if (Object.prototype.hasOwnProperty.call(cfg, 'accountsJson')) {
|
|
7918
|
+
loadAccountsJsonDraft = cfg.accountsJson || '';
|
|
7919
|
+
} else if (Object.prototype.hasOwnProperty.call(cfg, 'accounts')) {
|
|
7920
|
+
loadAccountsJsonDraft = cfg.accounts ? (typeof cfg.accounts === 'string' ? cfg.accounts : JSON.stringify(cfg.accounts, null, 2)) : '';
|
|
7921
|
+
}
|
|
7922
|
+
if (cfg.envVars && typeof cfg.envVars === 'object' && !Array.isArray(cfg.envVars)) {
|
|
7923
|
+
const values = Object.values(cfg.envVars);
|
|
7924
|
+
if (!values.some(v => v === '***')) loadImportedEnvVarsDraft = { ...cfg.envVars };
|
|
7925
|
+
}
|
|
7919
7926
|
const baseEl = document.getElementById('loadBaseUrl');
|
|
7920
7927
|
const vusEl = document.getElementById('loadVus');
|
|
7921
7928
|
const durEl = document.getElementById('loadDuration');
|
|
@@ -8368,11 +8375,7 @@ function loadOpenScript(name) {
|
|
|
8368
8375
|
loadScriptDraft = s.script;
|
|
8369
8376
|
loadScriptNameDraft = s.name;
|
|
8370
8377
|
loadImportedEnvVarsDraft = {};
|
|
8371
|
-
|
|
8372
|
-
if (s.vus) loadVusDraft = s.vus;
|
|
8373
|
-
if (s.duration) loadDurationDraft = s.duration;
|
|
8374
|
-
loadDataDirDraft = s.dataDir || loadDataDirDraft;
|
|
8375
|
-
loadResultDirDraft = s.resultDir || loadResultDirDraft;
|
|
8378
|
+
applyLoadConfigToFields(s);
|
|
8376
8379
|
loadView = 'editor';
|
|
8377
8380
|
renderContent();
|
|
8378
8381
|
}
|
|
@@ -8441,23 +8444,37 @@ async function stopLoadTest() {
|
|
|
8441
8444
|
try { await fetch('/api/load/stop', { method: 'POST' }); } catch {}
|
|
8442
8445
|
}
|
|
8443
8446
|
|
|
8444
|
-
async function loadAiAnalysis() {
|
|
8445
|
-
if (!loadState || !loadState.summary) return;
|
|
8446
|
-
const summary = loadState.summary;
|
|
8447
|
-
const logs = loadState.logs || [];
|
|
8448
|
-
const
|
|
8449
|
-
|
|
8450
|
-
|
|
8451
|
-
|
|
8452
|
-
|
|
8453
|
-
|
|
8454
|
-
|
|
8455
|
-
|
|
8456
|
-
|
|
8457
|
-
|
|
8458
|
-
${
|
|
8459
|
-
|
|
8460
|
-
|
|
8447
|
+
async function loadAiAnalysis() {
|
|
8448
|
+
if (!loadState || !loadState.summary) return;
|
|
8449
|
+
const summary = loadState.summary;
|
|
8450
|
+
const logs = loadState.logs || [];
|
|
8451
|
+
const totalRequests = Number(summary.totalRequests || loadState.totalRequests || 0);
|
|
8452
|
+
if (totalRequests <= 0 && logs.length === 0) {
|
|
8453
|
+
alert('Для AI-анализа нет данных: в выбранном прогоне 0 запросов и пустой лог k6. Открой завершённый run с результатами или скопируй лог ошибки вручную.');
|
|
8454
|
+
return;
|
|
8455
|
+
}
|
|
8456
|
+
const prompt = `Проанализируй результаты нагрузочного тестирования k6:
|
|
8457
|
+
|
|
8458
|
+
Run ID: ${loadState.runId || '—'}
|
|
8459
|
+
Status: ${loadState.status || '—'}
|
|
8460
|
+
Result path: ${loadState.config?.resultPath || '—'}
|
|
8461
|
+
Script: ${loadState.config?.scriptName || '—'}
|
|
8462
|
+
VUs: ${loadState.config?.vus || '—'}
|
|
8463
|
+
Duration: ${loadState.config?.duration || '—'}
|
|
8464
|
+
|
|
8465
|
+
RPS: ${(summary.rps||0).toFixed(2)}
|
|
8466
|
+
avg latency: ${Math.round(summary.avgDuration||0)}ms
|
|
8467
|
+
p90 latency: ${Math.round(summary.p90Duration||0)}ms
|
|
8468
|
+
p95 latency: ${Math.round(summary.p95Duration||0)}ms
|
|
8469
|
+
Total requests: ${totalRequests}
|
|
8470
|
+
Error rate: ${(summary.errorPct||0).toFixed(2)}%
|
|
8471
|
+
Checks failed: ${summary.checksFailed ?? '—'}
|
|
8472
|
+
Exit code: ${summary.exitCode ?? '—'}
|
|
8473
|
+
|
|
8474
|
+
Лог k6:
|
|
8475
|
+
${logs.slice(-120).join('\n') || '(лог пустой)'}
|
|
8476
|
+
|
|
8477
|
+
Оцени: производительность, узкие места, рекомендации по оптимизации.`;
|
|
8461
8478
|
|
|
8462
8479
|
// Open agent terminal and send task
|
|
8463
8480
|
document.getElementById('agentPanel').classList.add('open');
|
|
@@ -8646,7 +8663,17 @@ async function loadSaveScript() {
|
|
|
8646
8663
|
const r = await fetch('/api/load/scripts', {
|
|
8647
8664
|
method: 'POST',
|
|
8648
8665
|
headers: { 'Content-Type': 'application/json' },
|
|
8649
|
-
body: JSON.stringify({
|
|
8666
|
+
body: JSON.stringify({
|
|
8667
|
+
name,
|
|
8668
|
+
script,
|
|
8669
|
+
baseUrl,
|
|
8670
|
+
vus,
|
|
8671
|
+
duration,
|
|
8672
|
+
dataDir,
|
|
8673
|
+
resultDir,
|
|
8674
|
+
accountsJson: accountsInfo.text,
|
|
8675
|
+
envVars: loadImportedEnvVarsDraft || {},
|
|
8676
|
+
}),
|
|
8650
8677
|
});
|
|
8651
8678
|
if (!r.ok) { const d = await r.json().catch(() => ({})); alert('Ошибка: ' + (d.error || r.status)); return; }
|
|
8652
8679
|
await loadRefreshScripts();
|
|
@@ -8657,21 +8684,16 @@ async function loadSaveScript() {
|
|
|
8657
8684
|
}
|
|
8658
8685
|
|
|
8659
8686
|
async function loadLoadScript(name) {
|
|
8660
|
-
const s = loadSavedScripts.find(x => x.name === name);
|
|
8661
|
-
if (!s) return;
|
|
8687
|
+
const s = loadSavedScripts.find(x => x.name === name);
|
|
8688
|
+
if (!s) return;
|
|
8662
8689
|
loadScriptDraft = s.script;
|
|
8663
8690
|
loadScriptNameDraft = s.name;
|
|
8664
8691
|
loadImportedEnvVarsDraft = {};
|
|
8665
|
-
|
|
8666
|
-
if (s.vus) loadVusDraft = s.vus;
|
|
8667
|
-
if (s.duration) loadDurationDraft = s.duration;
|
|
8668
|
-
loadDataDirDraft = s.dataDir || loadDataDirDraft;
|
|
8669
|
-
loadResultDirDraft = s.resultDir || loadResultDirDraft;
|
|
8692
|
+
applyLoadConfigToFields(s);
|
|
8670
8693
|
const ta = document.getElementById('loadScriptEditor');
|
|
8671
8694
|
if (ta) { ta.value = s.script; ta.style.borderColor = 'var(--blue)'; setTimeout(() => { ta.style.borderColor = ''; }, 1500); }
|
|
8672
8695
|
const nameEl = document.getElementById('loadScriptName');
|
|
8673
8696
|
if (nameEl) nameEl.value = s.name;
|
|
8674
|
-
applyLoadConfigToFields(s);
|
|
8675
8697
|
}
|
|
8676
8698
|
|
|
8677
8699
|
async function loadDeleteScript(name) {
|