Skip to content

Commit ae22ab4

Browse files
committed
some more minor fixes
1 parent 372228f commit ae22ab4

File tree

3 files changed

+21
-10
lines changed

3 files changed

+21
-10
lines changed

src/options/opaImport.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ export function showOpaImportModal(onSaveCallback) {
1717
</div>
1818
`;
1919
document.body.appendChild(modal);
20+
// Ensure newly created modal is visible on first open
21+
modal.style.display = 'flex';
2022
} else {
2123
modal.style.display = 'flex';
2224
}

src/options/options.js

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,23 @@ function renderTable() {
4949
const tdKind = document.createElement("td"); tdKind.textContent = r.kind || "";
5050
const tdSeverity = document.createElement("td"); tdSeverity.textContent = r.severity || "";
5151
const tdActions = document.createElement("td");
52-
// Restore delete button
52+
// Edit button
53+
const editBtn = document.createElement("button");
54+
editBtn.textContent = "✏️";
55+
editBtn.title = "Edit";
56+
editBtn.style.padding = "4px 8px";
57+
editBtn.onclick = function() {
58+
if (typeof window.editRule === "function") { window.editRule(idx); }
59+
};
60+
tdActions.appendChild(editBtn);
61+
62+
// Delete button (with confirmation modal)
5363
const delBtn = document.createElement("button");
5464
delBtn.textContent = "🗑";
5565
delBtn.title = "Delete";
5666
delBtn.style.padding = "4px 8px";
5767
delBtn.onclick = function() {
58-
rules.splice(idx, 1);
59-
saveRules();
60-
renderTable();
61-
showToast("Rule deleted", { background: "#b91c1c" });
68+
if (typeof window.deleteRule === "function") { window.deleteRule(idx); }
6269
};
6370
tdActions.appendChild(delBtn);
6471
tr.appendChild(tdId);
@@ -732,7 +739,7 @@ window.editRule = function (idx) {
732739
};
733740

734741
window.deleteRule = function (idx) {
735-
showDeleteConfirmation(idx);
742+
showDeleteConfirmation(idx, rules, saveRules, renderTable, showToast);
736743
};
737744

738745

src/popup/popup.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -353,9 +353,10 @@ async function initPopup() {
353353
}
354354
}
355355
}
356+
const hasSchemas = !!(csData && ((Array.isArray(csData.openapis) && csData.openapis.length > 0) || (Array.isArray(csData.crds) && csData.crds.length > 0) || csData.openapi));
356357
if (schemaResults.length === 0) {
357-
if (csData && csData.openapis && Object.keys(csData.openapis).length > 0) {
358-
schemaDiagnostic = "Schema present, but no matching schema found for this resource. Check apiVersion/kind and schema keys.";
358+
if (hasSchemas) {
359+
schemaDiagnostic = "Schema-based validation: no issues found for this resource.";
359360
} else {
360361
schemaDiagnostic = "No schema present for this resource.";
361362
}
@@ -540,9 +541,10 @@ async function initPopup() {
540541
}
541542
}
542543
// Diagnostic: show what schema was matched and summary of results
544+
const hasSchemas = !!(csData && ((Array.isArray(csData.openapis) && csData.openapis.length > 0) || (Array.isArray(csData.crds) && csData.crds.length > 0) || csData.openapi));
543545
if (schemaResults.length === 0) {
544-
if (csData && csData.openapis && Object.keys(csData.openapis).length > 0) {
545-
schemaDiagnostic = "Schema present, but no matching schema found for this resource. Check apiVersion/kind and schema keys.";
546+
if (hasSchemas) {
547+
schemaDiagnostic = "Schema-based validation: no issues found for this resource.";
546548
} else {
547549
schemaDiagnostic = "No schema present for this resource.";
548550
}

0 commit comments

Comments
 (0)