Skip to content

Commit 3855504

Browse files
authored
Version 4.2.0 : Audit 4 audit (abnamro#69)
1 parent fbd7277 commit 3855504

21 files changed

+1839
-1731
lines changed

openapi.json

+793-1,596
Large diffs are not rendered by default.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "resc-frontend",
3-
"version": "4.1.0",
3+
"version": "4.2.0",
44
"author": "ABN AMRO Bank",
55
"description": "Repository Scanner Frontend",
66
"license": "MIT",

src/assets/font-awesome.ts

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
faThumbsDown,
2020
faMedal,
2121
faAward,
22+
faClipboardCheck,
2223
} from '@fortawesome/free-solid-svg-icons';
2324

2425
import { library } from '@fortawesome/fontawesome-svg-core';
@@ -45,5 +46,6 @@ export function importFA() {
4546
faThumbsDown,
4647
faMedal,
4748
faAward,
49+
faClipboardCheck,
4850
);
4951
}

src/components/Findings/FindingTableHeader.vue

+7-2
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,19 @@
88
:disabled="props.auditButtonDisabled"
99
>AUDIT</Button
1010
>
11-
<Button class="" severity="primary" v-on:click="isColumnSelectorVisible = true"
11+
<Button
12+
v-if="props.hasColumnSelector"
13+
class=""
14+
severity="primary"
15+
v-on:click="isColumnSelectorVisible = true"
1216
>Columns</Button
1317
>
1418
</div>
1519
<div class="w-2/3 text-left">
1620
<InputText
1721
class="opacity-0 hover:opacity-100 focus:opacity-100 valid:opacity-100 w-1/2 transition-all duration-200 ease-in-out"
1822
id="filterFiles"
19-
placeholder="filename"
23+
placeholder="f:filename r:rulename rp:repository"
2024
v-model="filterString"
2125
:required="true"
2226
/>
@@ -29,6 +33,7 @@ import InputText from 'primevue/inputtext';
2933
import type { Ref } from 'vue';
3034
3135
const props = defineProps<{
36+
hasColumnSelector: boolean;
3237
auditButtonDisabled: boolean;
3338
}>();
3439
const isAuditModalVisible = defineModel('isAuditModalVisible') as Ref<boolean>;

src/components/Findings/FindingsTable.vue

+30-115
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,13 @@
1212
v-model:is-audit-modal-visible="isAuditModalVisible"
1313
v-model:is-column-selector-visible="isColumnSelectorVisible"
1414
:audit-button-disabled="auditButtonDisabled"
15+
:has-column-selector="true"
1516
/>
1617

1718
<table class="w-full text-left mt-2">
1819
<thead>
1920
<tr>
20-
<th class="bg-teal-500/20 pl-2">
21-
<!-- <Checkbox binary v-model="selection" /> -->
22-
</th>
21+
<th class="bg-teal-500/20 pl-2"></th>
2322
<th class="bg-teal-500/20"></th>
2423
<th
2524
v-for="col of fields"
@@ -101,11 +100,12 @@ import ColumnSelector from '@/components/Findings/ColumnSelector.vue';
101100
import FindingTableHeader from './FindingTableHeader.vue';
102101
import { useFiltering } from '@/composables/useFiltering';
103102
import { useColumnFiltering } from '@/composables/useColumnFiltering';
104-
import { dispatchError, dispatchMessage } from '@/configuration/config';
103+
import { dispatchError } from '@/configuration/config';
105104
import Panel from 'primevue/panel';
106105
import Checkbox from 'primevue/checkbox';
107106
import Button from 'primevue/button';
108107
import FindingStatusBadge from '../Common/FindingStatusBadge.vue';
108+
import { useAuditFunctions } from '@/composables/useAuditFunctions';
109109
110110
const props = defineProps<{
111111
findings: DetailedFindingRead[] | undefined;
@@ -128,22 +128,32 @@ const { filterString, filteredList } = useFiltering(findingList);
128128
129129
setTableFields();
130130
131-
function toggleExpand(idx: number) {
132-
selectedIndex.value = idx;
133-
expanded.value = expanded.value === idx ? -1 : idx;
134-
}
135-
136-
function toggleAllCheckboxes() {
137-
if (filteredList.value === undefined) {
138-
return;
139-
}
140-
141-
if (selection.value.length < filteredList.value.length) {
142-
selection.value = filteredList.value.map((f) => f.id_);
143-
} else {
144-
selection.value = [];
145-
}
146-
}
131+
const {
132+
toggleExpand,
133+
toggleAllCheckboxes,
134+
selectDown,
135+
selectUp,
136+
openDetails,
137+
closeDetails,
138+
openCommitUrl,
139+
toggleSelect,
140+
markAsFalsePositive,
141+
markAsTruePositive,
142+
markAsGone,
143+
markAllAsFalsePositive,
144+
markAllAsTruePositive,
145+
markAllAsGone,
146+
auditThis,
147+
} = useAuditFunctions(
148+
selection,
149+
selectedIndex,
150+
expanded,
151+
// @ts-expect-error
152+
filteredList,
153+
isAuditModalVisible,
154+
(item) => item.id_,
155+
sendUpdate,
156+
);
147157
148158
function updateAudit(status: FindingStatus, comment: string) {
149159
updateVisualBadge(selection.value, status, comment);
@@ -170,101 +180,6 @@ function updateVisualBadge(selectedIds: number[], status: FindingStatus, comment
170180
selection.value = selection.value.filter((s) => s !== selectedIds[0]);
171181
}
172182
173-
function getCurrentFindingSelected(): DetailedFindingRead {
174-
if (filteredList.value === undefined) {
175-
dispatchMessage('List is empty');
176-
throw new Error('oups!');
177-
}
178-
179-
return filteredList.value[selectedIndex.value];
180-
}
181-
182-
function selectDown(): boolean {
183-
if (filteredList.value === undefined) {
184-
return false;
185-
}
186-
187-
selectedIndex.value = ((selectedIndex.value ?? -1) + 1) % filteredList.value.length;
188-
expanded.value = expanded.value === -1 ? -1 : selectedIndex.value;
189-
190-
return true;
191-
}
192-
193-
function selectUp(): boolean {
194-
if (filteredList.value === undefined) {
195-
return false;
196-
}
197-
198-
selectedIndex.value =
199-
(selectedIndex.value + filteredList.value.length - 1) % filteredList.value.length;
200-
expanded.value = expanded.value === -1 ? -1 : selectedIndex.value;
201-
202-
return true;
203-
}
204-
205-
function openDetails() {
206-
expanded.value = selectedIndex.value;
207-
}
208-
209-
function closeDetails() {
210-
expanded.value = -1;
211-
}
212-
213-
function openCommitUrl() {
214-
const url = getCurrentFindingSelected()?.commit_url;
215-
if (url !== undefined && url !== null) {
216-
window.open(url, '_blank')?.focus();
217-
}
218-
}
219-
220-
function toggleSelect() {
221-
const item = getCurrentFindingSelected();
222-
if (selection.value.filter((idx) => idx === item.id_).length > 0) {
223-
selection.value = selection.value.filter((idx) => idx !== item.id_);
224-
} else {
225-
selection.value.push(item.id_);
226-
}
227-
}
228-
229-
function markAsFalsePositive() {
230-
const item = getCurrentFindingSelected();
231-
sendUpdate([item.id_], 'FALSE_POSITIVE');
232-
selectDown();
233-
}
234-
235-
function markAsTruePositive() {
236-
const item = getCurrentFindingSelected();
237-
sendUpdate([item.id_], 'TRUE_POSITIVE');
238-
selectDown();
239-
}
240-
241-
function markAsGone() {
242-
const item = getCurrentFindingSelected();
243-
sendUpdate([item.id_], 'NOT_ACCESSIBLE');
244-
selectDown();
245-
}
246-
247-
function markAllAsFalsePositive() {
248-
sendUpdate(selection.value, 'FALSE_POSITIVE');
249-
}
250-
251-
function markAllAsTruePositive() {
252-
sendUpdate(selection.value, 'TRUE_POSITIVE');
253-
}
254-
255-
function markAllAsGone() {
256-
sendUpdate(selection.value, 'NOT_ACCESSIBLE');
257-
}
258-
259-
function auditThis() {
260-
if (selection.value.length > 0) {
261-
isAuditModalVisible.value = true;
262-
return;
263-
}
264-
265-
openDetails();
266-
}
267-
268183
function sendUpdate(selectedIds: number[], status: FindingStatus) {
269184
FindingsService.auditFindings(selectedIds, status, '')
270185
.then(() => {

src/components/Navigation/Navigation.ts

+10
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,14 @@ export const sidebarMenu = [
7575
},
7676
},
7777
},
78+
{
79+
href: '/audits',
80+
title: 'AUDIT',
81+
icon: {
82+
element: 'font-awesome-icon',
83+
attributes: {
84+
icon: 'clipboard-check',
85+
},
86+
},
87+
},
7888
];

src/components/ScanFindings/Tabs/HistoryTab.vue

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<td>
66
{{ DateUtils.formatDate(data.timestamp) }}
77
</td>
8-
<td>{{ data.auditor }}</td>
8+
<td>{{ userFormat(data.auditor) }}</td>
99
<td>
1010
<FindingStatusBadge :status="data.status ?? 'NOT_ANALYZED'" />
1111
</td>
@@ -24,12 +24,14 @@ import FindingsService from '@/services/findings-service';
2424
import type { AuditRead, DetailedFindingRead } from '@/services/shema-to-types';
2525
import { onMounted, ref } from 'vue';
2626
import { dispatchError } from '@/configuration/config';
27+
import { useFormatter } from '@/composables/useFormatter';
2728
2829
type Props = {
2930
finding: DetailedFindingRead;
3031
};
3132
const props = defineProps<Props>();
3233
34+
const { userFormat } = useFormatter();
3335
const finding = ref(props.finding);
3436
const auditList = ref<AuditRead[] | undefined>(undefined);
3537
const totalRows = ref(0);

0 commit comments

Comments
 (0)