refactor: review suggestions for web/../integrity.service.ts

Signed-off-by: izzy <me@insrt.uk>
This commit is contained in:
izzy
2026-02-12 10:30:47 +00:00
parent 477d43290b
commit 8cb63ebb51
+15 -13
View File
@@ -11,7 +11,7 @@ export const getIntegrityReportActions = ($t: MessageFormatter, reportType: Inte
type: $t('command'),
title: $t('admin.download_csv'),
icon: mdiDownload,
onAction() {
onAction: () => {
handleDownloadIntegrityReportCsv(reportType);
},
};
@@ -21,7 +21,7 @@ export const getIntegrityReportActions = ($t: MessageFormatter, reportType: Inte
title: $t('trash_page_delete_all'),
icon: mdiTrashCanOutline,
color: 'danger',
onAction() {
onAction: () => {
void handleRemoveAllIntegrityReportItems(reportType);
},
};
@@ -34,22 +34,20 @@ export const getIntegrityReportItemActions = (
reportId: string,
reportType: IntegrityReportType,
) => {
const Download =
reportType === IntegrityReportType.UntrackedFile || reportType === IntegrityReportType.ChecksumMismatch
? {
const Download = {
title: $t('download'),
icon: mdiDownload,
onAction() {
onAction: () => {
void handleDownloadIntegrityReportFile(reportId);
},
}
: undefined;
$if: reportType === IntegrityReportType.UntrackedFile || reportType === IntegrityReportType.ChecksumMismatch,
};
const Delete = {
title: $t('delete'),
icon: mdiTrashCanOutline,
color: 'danger',
onAction() {
onAction: () => {
void handleRemoveIntegrityReportItem(reportId);
},
};
@@ -71,7 +69,10 @@ export const handleRemoveAllIntegrityReportItems = async (reportType: IntegrityR
confirmText: $t('delete'),
});
if (confirm) {
if (!confirm) {
return;
}
let name: ManualJobName;
switch (reportType) {
case IntegrityReportType.UntrackedFile: {
@@ -108,7 +109,6 @@ export const handleRemoveAllIntegrityReportItems = async (reportType: IntegrityR
isDeleting: false,
});
}
}
};
export const handleRemoveIntegrityReportItem = async (reportId: string) => {
@@ -117,7 +117,10 @@ export const handleRemoveIntegrityReportItem = async (reportId: string) => {
confirmText: $t('delete'),
});
if (confirm) {
if (!confirm) {
return;
}
try {
eventManager.emit('IntegrityReportDeleteStatus', {
id: reportId,
@@ -139,5 +142,4 @@ export const handleRemoveIntegrityReportItem = async (reportId: string) => {
isDeleting: false,
});
}
}
};