Skip to content

Commit

Permalink
fix report issues export/edit and paginator
Browse files Browse the repository at this point in the history
  • Loading branch information
Kacper committed Dec 20, 2024
1 parent ef0e732 commit d6555f4
Show file tree
Hide file tree
Showing 7 changed files with 108 additions and 93 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"angular.enable-strict-mode-prompt": false
"angular.enable-strict-mode-prompt": false,
"typescript.tsdk": "node_modules\\typescript\\lib"
}
11 changes: 9 additions & 2 deletions src/app/dialog-exportissues/dialog-exportissues.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,18 @@ export class DialogExportissuesComponent implements OnInit {
ngOnInit() {

if (this.data.sel) {

this.data.sel.forEach((item, index) => {
if (item === true) {
this.isReturn.push(this.data.orig[index]);
if (item.data) {

const index2: number = this.data.orig.findIndex(i => i === item.data)
if (index2 !== -1) {
this.isReturn.push(this.data.orig[index2]);
}

}
});

} else {
this.isReturn = this.data;
}
Expand Down
7 changes: 4 additions & 3 deletions src/app/dialog-issues-edit/dialog-issues-edit.component.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<mat-card appearance="outlined">
<mat-card-header>
<mat-icon mat-card-avatar class="vertical-align-middle padding-bottom-3 size-45">edit</mat-icon>
<mat-card-title>Edit selected ({{selected_items_true.length}})</mat-card-title>
<mat-card-title>Edit selected ({{data.sel.length}})</mat-card-title>
<mat-card-subtitle>Make changes on multiple issues</mat-card-subtitle>
</mat-card-header>

Expand Down Expand Up @@ -32,9 +32,10 @@

</div>
<p>
<button mat-raised-button color="primary" (click)="closedialog()">Close</button>
<button mat-raised-button color="accent" (click)="applychanges()"><mat-icon>save</mat-icon> Apply changes</button>

&nbsp;&nbsp;
<button mat-raised-button color="accent" (click)="applychanges()"><mat-icon>save</mat-icon> Apply changes</button>
<button mat-raised-button color="primary" (click)="closedialog()">Close</button>
</p>

</mat-card-content>
Expand Down
12 changes: 7 additions & 5 deletions src/app/dialog-issues-edit/dialog-issues-edit.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { UtilsService } from '../utils.service';
export class DialogIssuesEditComponent implements OnInit {

isReturn = [];
selected_items_true = [];
selseverity = '';
selstatus = '';

Expand All @@ -25,14 +24,17 @@ export class DialogIssuesEditComponent implements OnInit {


ngOnInit() {

this.data.sel.forEach((item, index) => {
if (item === true) {
this.isReturn.push(this.data.orig[index]);
if (item.data) {

const index2: number = this.data.orig.findIndex(i => i === item.data)
if (index2 !== -1) {
this.isReturn.push(this.data.orig[index2]);
}

}
});

this.selected_items_true = this.data.sel.filter(item => item === true);

this.tableseverity = this.utilsService.severitytable;
this.tablestatus = this.utilsService.issueStatustable;
Expand Down
11 changes: 8 additions & 3 deletions src/app/dialog-removeitems/dialog-removeitems.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,15 @@ export class DialogRemoveitemsComponent implements OnInit {
ngOnInit() {

this.data.sel.forEach((item, index) => {
if (item === true) {
this.isReturn.push(this.data.orig[index]);
if (item.data) {

const index2: number = this.data.orig.findIndex(i => i === item.data)
if (index2 !== -1) {
this.isReturn.push(this.data.orig[index2]);
}
});

}
});

}

Expand Down
26 changes: 10 additions & 16 deletions src/app/report/report.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ <h1 style="margin: 0 0 0;" class="mat-headline-3">{{reportdesc?.report_name}} <a
</button>

<mat-menu #dropdownMenuOne="matMenu">
<button *ngIf="getselectedissues(selected3) == 0" mat-menu-item (click)="export_issues(selected3, decryptedReportDataChanged.report_vulns)">Export all</button>
<button *ngIf="getselectedissues(selected3) >= 1" mat-menu-item (click)="export_issues(selected3, decryptedReportDataChanged.report_vulns)">Export selected ({{getselectedissues(selected3)}})</button>
<button mat-menu-item (click)="export_issues(decryptedReportDataChanged.report_vulns, 'all')">Export all</button>
<button *ngIf="selectedIssues.length >= 1" mat-menu-item (click)="export_issues(decryptedReportDataChanged.report_vulns, 'selected')">Export selected ({{selectedIssues.length}})</button>
<button mat-menu-item [matMenuTriggerFor]="bysev">Export by Severity</button>
<button *ngIf="getTags(decryptedReportDataChanged.report_vulns) >= 1" mat-menu-item [matMenuTriggerFor]="bytag">Export by Tag</button>
</mat-menu>
Expand Down Expand Up @@ -253,7 +253,7 @@ <h1 style="margin: 0 0 0;" class="mat-headline-3">{{reportdesc?.report_name}} <a
<mat-expansion-panel-header fxLayout="row wrap" cdkDragHandle>
<mat-panel-title fxLayoutAlign="start">
<div style="white-space: nowrap;">
<mat-checkbox [(ngModel)]="selected3[i]" (change)="toggle()"
<mat-checkbox [checked]="checkcheckbox(i)" (change)="toggle(i,$event.checked)"
(click)="$event.stopPropagation()"></mat-checkbox>&nbsp;&nbsp;
<span
class="label {{dec_data.severity | lowercase}}">{{dec_data.severity}}</span>
Expand Down Expand Up @@ -537,30 +537,24 @@ <h1 style="margin: 0 0 0;" class="mat-headline-3">{{reportdesc?.report_name}} <a
<mat-icon style="margin-right: inherit;" class="vertical-align-middle padding-bottom-3" matSuffix>
settings</mat-icon>


<button mat-stroked-button color="accent" [routerLink]="[]" (click)="selectall()">
<mat-icon>done_all</mat-icon>
Select all
<button mat-stroked-button color="accent" [routerLink]="[]" (click)="openissuesedit(selectedIssues)">
<mat-icon>edit</mat-icon>
Edit ({{ selectedIssues.length }})
</button>

&nbsp;

<button mat-stroked-button color="accent" [routerLink]="[]" (click)="deselectall()">
<mat-icon>done_all</mat-icon>
Unselect all
Clear selected ({{ selectedIssues.length }})
</button>

&nbsp;

<button mat-stroked-button color="accent" [routerLink]="[]" (click)="openissuesedit(selected3)">
<mat-icon>edit</mat-icon>
Edit ({{ selected3_true.length }})
</button>


&nbsp;&nbsp;

<button mat-stroked-button color="warn" (click)="removeSelecteditems(selected3)">
<mat-icon class="vertical-align-middle padding-bottom-3" matSuffix>remove_circle</mat-icon> REMOVE ({{ selected3_true.length }})
<button mat-stroked-button color="warn" (click)="removeSelecteditems(selectedIssues)">
<mat-icon class="vertical-align-middle padding-bottom-3" matSuffix>remove_circle</mat-icon> Remove ({{ selectedIssues.length }})
</button>

</mat-panel-title>
Expand Down
Loading

0 comments on commit d6555f4

Please sign in to comment.