viberadar 0.3.170 → 0.3.172
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/ui/dashboard.html +64 -4
- package/package.json +1 -1
package/dist/ui/dashboard.html
CHANGED
|
@@ -810,6 +810,9 @@
|
|
|
810
810
|
.obs-run-selected { padding:8px 16px; font-size:13px; font-weight:600; background:var(--accent); color:var(--bg); border:none; border-radius:4px; cursor:pointer; min-height:36px; }
|
|
811
811
|
.obs-run-selected:hover { opacity:0.85; }
|
|
812
812
|
.obs-run-selected:disabled { opacity:0.4; cursor:not-allowed; }
|
|
813
|
+
.obs-copy-btn { padding:8px 10px; font-size:13px; background:transparent; color:var(--muted); border:1px solid var(--border); border-radius:4px; cursor:pointer; min-height:36px; title-attr:attr(title); }
|
|
814
|
+
.obs-copy-btn:hover { border-color:var(--accent); color:var(--accent); background:rgba(88,166,255,0.08); }
|
|
815
|
+
.obs-copy-btn:disabled { opacity:0.35; cursor:not-allowed; }
|
|
813
816
|
.obs-select-all { font-size:12px; color:var(--dim); cursor:pointer; background:none; border:none; padding:4px 8px; }
|
|
814
817
|
.obs-select-all:hover { color:var(--accent); }
|
|
815
818
|
.obs-tier-badge { display:inline-block; padding:3px 8px; border-radius:3px; font-size:11px; font-weight:700; letter-spacing:0.5px; }
|
|
@@ -2776,6 +2779,7 @@ function obsUpdateSelectedCount(groupId) {
|
|
|
2776
2779
|
}
|
|
2777
2780
|
btn.disabled = checked === 0;
|
|
2778
2781
|
}
|
|
2782
|
+
container.querySelectorAll('.obs-copy-btn.obs-copy-selected').forEach(b => { b.disabled = checked === 0; });
|
|
2779
2783
|
// Update floating action bar
|
|
2780
2784
|
const bar = document.getElementById('obsFloatingBar');
|
|
2781
2785
|
if (!bar) return;
|
|
@@ -2876,6 +2880,60 @@ function obsMissingRunSelected(groupId) {
|
|
|
2876
2880
|
runAgentTask('obs-fix-selected', null, null, null, { missingLogIndices: indices, recommendationType: 'add event' });
|
|
2877
2881
|
}
|
|
2878
2882
|
|
|
2883
|
+
// ─── Obs: Copy prompt to clipboard ────────────────────────────────────────────
|
|
2884
|
+
async function obsCopyPrompt(task, meta) {
|
|
2885
|
+
try {
|
|
2886
|
+
const r = await fetch('/api/obs-build-prompt', {
|
|
2887
|
+
method: 'POST',
|
|
2888
|
+
headers: { 'Content-Type': 'application/json' },
|
|
2889
|
+
body: JSON.stringify({ task, meta }),
|
|
2890
|
+
});
|
|
2891
|
+
const d = await r.json();
|
|
2892
|
+
if (!r.ok || !d.prompt) { alert('Не удалось собрать промпт: ' + (d.error || r.status)); return; }
|
|
2893
|
+
await navigator.clipboard.writeText(d.prompt);
|
|
2894
|
+
showObsCopyToast();
|
|
2895
|
+
} catch (e) { alert('Ошибка: ' + e.message); }
|
|
2896
|
+
}
|
|
2897
|
+
|
|
2898
|
+
// Copy for multi-select groups (missing logs)
|
|
2899
|
+
async function obsCopyMissingSelected(groupId) {
|
|
2900
|
+
const container = document.getElementById('obs-detail-' + groupId);
|
|
2901
|
+
if (!container) return;
|
|
2902
|
+
const indices = [];
|
|
2903
|
+
container.querySelectorAll('input[type="checkbox"]:checked').forEach(cb => {
|
|
2904
|
+
const idx = parseInt(cb.dataset.missingIdx, 10);
|
|
2905
|
+
if (!isNaN(idx)) indices.push(idx);
|
|
2906
|
+
});
|
|
2907
|
+
if (indices.length === 0) { alert('Выбери хотя бы один модуль'); return; }
|
|
2908
|
+
await obsCopyPrompt('obs-fix-selected', { missingLogIndices: indices, recommendationType: 'add event' });
|
|
2909
|
+
}
|
|
2910
|
+
|
|
2911
|
+
// Copy for multi-select groups (catalog paths)
|
|
2912
|
+
async function obsCopySelected(groupId, baseMeta) {
|
|
2913
|
+
const container = document.getElementById('obs-detail-' + groupId);
|
|
2914
|
+
if (!container) return;
|
|
2915
|
+
const paths = [];
|
|
2916
|
+
container.querySelectorAll('input[type="checkbox"]:checked').forEach(cb => {
|
|
2917
|
+
if (cb.dataset.path) paths.push(cb.dataset.path);
|
|
2918
|
+
});
|
|
2919
|
+
if (paths.length === 0) { alert('Выбери хотя бы один модуль'); return; }
|
|
2920
|
+
await obsCopyPrompt('obs-fix-selected', { ...baseMeta, catalogPaths: paths });
|
|
2921
|
+
}
|
|
2922
|
+
|
|
2923
|
+
function showObsCopyToast() {
|
|
2924
|
+
let t = document.getElementById('obsCopyToast');
|
|
2925
|
+
if (!t) {
|
|
2926
|
+
t = document.createElement('div');
|
|
2927
|
+
t.id = 'obsCopyToast';
|
|
2928
|
+
t.style.cssText = 'position:fixed;bottom:24px;left:50%;transform:translateX(-50%);background:#238636;color:#fff;padding:8px 20px;border-radius:8px;font-size:13px;z-index:9999;pointer-events:none;transition:opacity 0.3s';
|
|
2929
|
+
document.body.appendChild(t);
|
|
2930
|
+
}
|
|
2931
|
+
t.textContent = '📋 Промпт скопирован — вставь в IDE';
|
|
2932
|
+
t.style.opacity = '1';
|
|
2933
|
+
clearTimeout(t._to);
|
|
2934
|
+
t._to = setTimeout(() => { t.style.opacity = '0'; }, 2500);
|
|
2935
|
+
}
|
|
2936
|
+
|
|
2879
2937
|
async function runTests(featureKey, testType) {
|
|
2880
2938
|
document.getElementById('agentPanel').classList.add('open');
|
|
2881
2939
|
document.getElementById('termBtn').classList.add('term-active');
|
|
@@ -3882,6 +3940,7 @@ function renderObsGlobalDetail(c, filterFeatureKey) {
|
|
|
3882
3940
|
const btn = hasAgent
|
|
3883
3941
|
? `<button class="obs-action-btn" onclick="event.stopPropagation();showNoisySuppressConfirm(${idx})">${actionLabel}</button>`
|
|
3884
3942
|
: '';
|
|
3943
|
+
const copyBtn = `<button class="obs-copy-btn" title="Скопировать промпт" onclick="event.stopPropagation();obsCopyPrompt('obs-suppress-pattern',window.__noisyPatterns[${idx}])">📋</button>`;
|
|
3885
3944
|
|
|
3886
3945
|
// Module list for detail section
|
|
3887
3946
|
const moduleRows = relatedModules.map(c => {
|
|
@@ -3914,6 +3973,7 @@ function renderObsGlobalDetail(c, filterFeatureKey) {
|
|
|
3914
3973
|
<strong style="flex-shrink:0;color:var(--red)">×${i.count} → ${recLabels[i.recommendation] || i.recommendation}</strong>
|
|
3915
3974
|
${moduleLabel}
|
|
3916
3975
|
${btn}
|
|
3976
|
+
${copyBtn}
|
|
3917
3977
|
${expandBtn}
|
|
3918
3978
|
</div>
|
|
3919
3979
|
<div id="obs-noisy-detail-${idx}" class="obs-noisy-detail">
|
|
@@ -3958,7 +4018,7 @@ function renderObsGlobalDetail(c, filterFeatureKey) {
|
|
|
3958
4018
|
${fpPreview || moreCount ? `<div class="obs-fp-list" style="width:100%">${fpPreview}${moreCount}</div>` : ''}
|
|
3959
4019
|
</label>`;
|
|
3960
4020
|
}).join('');
|
|
3961
|
-
const addBtn = hasAgent ? `<button class="obs-run-selected" disabled onclick="obsMissingRunSelected('${groupId}')">добавить логи выбранным</button>` : '';
|
|
4021
|
+
const addBtn = hasAgent ? `<button class="obs-run-selected" disabled onclick="obsMissingRunSelected('${groupId}')">добавить логи выбранным</button><button class="obs-copy-btn obs-copy-selected" disabled title="Скопировать промпт" onclick="obsCopyMissingSelected('${groupId}')">📋</button>` : '';
|
|
3962
4022
|
const detail = hasAgent ? `
|
|
3963
4023
|
<div id="obs-detail-${groupId}" class="obs-detail" data-obs-action="missing" data-obs-label="${tierLabels[tier]}">
|
|
3964
4024
|
<div class="obs-detail-bar" style="border-top:none;padding-top:0;margin-bottom:4px">
|
|
@@ -4001,7 +4061,7 @@ function renderObsGlobalDetail(c, filterFeatureKey) {
|
|
|
4001
4061
|
</div>
|
|
4002
4062
|
<div class="obs-detail-list">${detailItems}</div>
|
|
4003
4063
|
<div class="obs-detail-bar">
|
|
4004
|
-
<button class="obs-run-selected" disabled data-obs-field-name="${escapeHtml(name)}" onclick="obsRunSelected('${groupId}','obs-fix-selected',{fieldName:'${escapeHtml(name)}'})">Добавить \`${escapeHtml(name)}\`</button>
|
|
4064
|
+
<button class="obs-run-selected" disabled data-obs-field-name="${escapeHtml(name)}" onclick="obsRunSelected('${groupId}','obs-fix-selected',{fieldName:'${escapeHtml(name)}'})">Добавить \`${escapeHtml(name)}\`</button><button class="obs-copy-btn obs-copy-selected" disabled title="Скопировать промпт" onclick="obsCopySelected('${groupId}',{fieldName:'${escapeHtml(name)}'})">📋</button>
|
|
4005
4065
|
</div>
|
|
4006
4066
|
</div>` : '';
|
|
4007
4067
|
return `<div>
|
|
@@ -4018,7 +4078,7 @@ function renderObsGlobalDetail(c, filterFeatureKey) {
|
|
|
4018
4078
|
const missing = (i.missingFields || []);
|
|
4019
4079
|
const missingStr = missing.length ? missing.join(', ') : '—';
|
|
4020
4080
|
const btn = hasAgent
|
|
4021
|
-
? `<button class="obs-action-btn" data-module-path="${escapeHtml(i.modulePath)}" onclick="event.stopPropagation();runAgentTask('obs-fix-module',null,null,null,{modulePath:this.dataset.modulePath})">исправить</button>`
|
|
4081
|
+
? `<button class="obs-action-btn" data-module-path="${escapeHtml(i.modulePath)}" onclick="event.stopPropagation();runAgentTask('obs-fix-module',null,null,null,{modulePath:this.dataset.modulePath})">исправить</button><button class="obs-copy-btn" title="Скопировать промпт" data-module-path="${escapeHtml(i.modulePath)}" onclick="event.stopPropagation();obsCopyPrompt('obs-fix-module',{modulePath:this.dataset.modulePath})">📋</button>`
|
|
4022
4082
|
: '';
|
|
4023
4083
|
return `
|
|
4024
4084
|
<div class="obs-cat-row">
|
|
@@ -4188,7 +4248,7 @@ function renderObsGlobalDetail(c, filterFeatureKey) {
|
|
|
4188
4248
|
</div>
|
|
4189
4249
|
<div class="obs-detail-list">${detailItems}</div>
|
|
4190
4250
|
<div class="obs-detail-bar">
|
|
4191
|
-
<button class="obs-run-selected" disabled onclick="obsRunSelected('${groupId}','obs-fix-selected',{recommendationType:'${rec}'})">исправить выбранные</button>
|
|
4251
|
+
<button class="obs-run-selected" disabled onclick="obsRunSelected('${groupId}','obs-fix-selected',{recommendationType:'${rec}'})">исправить выбранные</button><button class="obs-copy-btn obs-copy-selected" disabled title="Скопировать промпт" onclick="obsCopySelected('${groupId}',{recommendationType:'${rec}'})">📋</button>
|
|
4192
4252
|
</div>
|
|
4193
4253
|
</div>` : '';
|
|
4194
4254
|
return `<div>
|