Skip to content

Commit 6a99abf

Browse files
authored
Merge pull request #1314 from utmstack/backlog/fix_compilance_modal_throwing
fix[frontend](compilance): setted compilance settings only by queryparams
2 parents 5c980e5 + 711db60 commit 6a99abf

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

frontend/src/app/compliance/compliance-report-viewer/compliance-report-viewer.component.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,6 @@ export class ComplianceReportViewerComponent implements OnInit, AfterViewInit, O
115115
}
116116

117117
ngAfterViewInit(): void {
118-
if (!this.standard) {
119-
this.manageStandards();
120-
}
121118
}
122119

123120
manageStandards() {
@@ -127,10 +124,10 @@ export class ComplianceReportViewerComponent implements OnInit, AfterViewInit, O
127124
centered: true
128125
};
129126
const modalRef = this.modalService.open(UtmCpStandardComponent, options);
127+
modalRef.componentInstance.standardId = this.standard.id;
130128

131129
modalRef.result.then((standard) => {
132130
this.standard = standard;
133-
134131
this.router.navigate([], {
135132
relativeTo: this.activatedRoute,
136133
queryParams: { standardId: this.standard.id },

frontend/src/app/compliance/shared/components/utm-cp-standard/utm-cp-standard.component.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {ChangeDetectionStrategy, Component, EventEmitter, Input, OnInit, Output}
33
import {NgbActiveModal} from '@ng-bootstrap/ng-bootstrap';
44
import {LocalStorageService} from 'ngx-webstorage';
55
import {EMPTY, Observable} from 'rxjs';
6-
import {catchError, concatMap, filter, map} from 'rxjs/operators';
6+
import {catchError, concatMap, filter, map,tap} from 'rxjs/operators';
77
import {UtmToastService} from '../../../../shared/alert/utm-toast.service';
88
import {CpStandardService} from '../../services/cp-standard.service';
99
import {ComplianceStandardType} from '../../type/compliance-standard.type';
@@ -33,13 +33,15 @@ export class UtmCpStandardComponent implements OnInit {
3333
.pipe(filter(refresh => !!refresh),
3434
concatMap(() => this.standardService.fetchData({page: 0, size: 1000})),
3535
map((res) => res.body),
36+
tap(standards=>{
37+
this.selectedStandard =standards.find(s=>s.id==this.standardId);
38+
}),
3639
catchError((err: HttpErrorResponse) => {
3740
this.toastService.showError('Error',
3841
'Unable to retrieve the list of compliance standards. Please try again or contact support.');
3942
return EMPTY;
4043
}));
4144

42-
this.selectedStandard = this.$localStorage.retrieve('selectedStandard');
4345
this.standardService.notifyRefresh(true);
4446
}
4547

@@ -54,7 +56,6 @@ export class UtmCpStandardComponent implements OnInit {
5456
}
5557

5658
confirmSelection() {
57-
this.$localStorage.store('selectedStandard', this.selectedStandard);
5859
this.activeModal.close(this.selectedStandard);
5960
}
6061
}

0 commit comments

Comments
 (0)