Skip to content

Commit

Permalink
Merge pull request #441 from kac89/dev
Browse files Browse the repository at this point in the history
fix report issues export/edit and paginator
  • Loading branch information
kac89 authored Dec 20, 2024
2 parents ef0e732 + 652453f commit 3fee1f7
Show file tree
Hide file tree
Showing 7 changed files with 152 additions and 97 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
14 changes: 10 additions & 4 deletions src/app/dialog-removeitems/dialog-removeitems.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,18 @@ export class DialogRemoveitemsComponent implements OnInit {

ngOnInit() {

this.data.sel.forEach((item, index) => {
if (item === true) {
this.isReturn.push(this.data.orig[index]);
if(this.data.sel) {
this.data.sel.forEach((item, 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]);
}

}
});

}
}

cancel(): void {
Expand Down
55 changes: 34 additions & 21 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 @@ -538,30 +538,43 @@ <h1 style="margin: 0 0 0;" class="mat-headline-3">{{reportdesc?.report_name}} <a
settings</mat-icon>


<button mat-stroked-button color="accent" [routerLink]="[]" (click)="selectall()">
<mat-icon>done_all</mat-icon>
Select all
</button>

&nbsp;
<div fxLayout="row wrap" fxLayoutGap="0px" class="example-full-width">

<div fxLayoutAlign="start start" fxFlex="50%" fxFlex.sm="50%" fxFlex.xs="100%">
<button mat-stroked-button color="accent" [routerLink]="[]" (click)="openissuesedit(selectedIssues)">
<mat-icon>edit</mat-icon>
Edit ({{ selectedIssues.length }})
</button>

<button mat-stroked-button color="accent" [routerLink]="[]" (click)="deselectall()">
<mat-icon>done_all</mat-icon>
Unselect all
</button>
&nbsp;

<button mat-stroked-button color="accent" [routerLink]="[]" (click)="selectall()">
<mat-icon>done_all</mat-icon>
Select all
</button>

&nbsp;
&nbsp;

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

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

<div fxLayoutAlign="end end" fxFlex="50%" fxFlex.sm="50%" fxFlex.xs="100%">

&nbsp;&nbsp;
<button mat-stroked-button color="warn" (click)="removeSelecteditems(selectedIssues)" [matMenuTriggerFor]="trewwertwe">
<mat-icon class="vertical-align-middle padding-bottom-3" matSuffix>remove_circle</mat-icon> Remove ({{ selectedIssues.length }})
</button>

<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>
</div>




</div>

</mat-panel-title>
</mat-expansion-panel-header>
Expand Down
Loading

0 comments on commit 3fee1f7

Please sign in to comment.