Skip to content

Commit

Permalink
Merge pull request #412 from kac89/dev
Browse files Browse the repository at this point in the history
update
  • Loading branch information
kac89 authored Aug 19, 2024
2 parents b8556d7 + dd60d59 commit 24bf975
Showing 1 changed file with 53 additions and 3 deletions.
56 changes: 53 additions & 3 deletions src/app/settings/settings.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export class SettingsComponent implements OnInit {
reportProfileList = [];
reportTemplateList = [];
reportProfileList_int = [];

reportTemplateList_int = [];
ReportProfilesdisplayedColumns: string[] = ['source', 'profile_name', 'profile_settings'];
ReportProfilesdataSource = new MatTableDataSource([]);

Expand Down Expand Up @@ -388,6 +388,7 @@ getTemplates(): void {
this.sessionsub.setSessionStorageItem('VULNREPO-API', JSON.stringify(vaultobj));

this.getReportProfiles();
this.getReportTemplates();
}

removeapikey() {
Expand Down Expand Up @@ -643,8 +644,8 @@ getAPIReportProfiles() {
}).then(() => {

this.ReportProfilesdataSource.data = [...this.reportProfileList, ...this.reportProfileList_int];
//this.dataSource.sort = this.sort;
//this.dataSource.paginator = this.paginator;
this.ReportProfilesdataSource.paginator = this.paginator;
this.ReportProfilesdataSource.sort = this.sort;
this.msg = '';
}).catch(() => {});

Expand Down Expand Up @@ -958,5 +959,54 @@ editTemplateItem(item: any): void {

}

getReportTemplates() {
this.indexeddbService.retrieveReportTemplates().then(ret => {
if (ret) {
this.ReportTemplatesdataSource = new MatTableDataSource(ret);
this.reportTemplateList = this.ReportTemplatesdataSource.data;
}
this.getAPITemplates();
});
}

getAPITemplates() {

const localkey = this.sessionsub.getSessionStorageItem('VULNREPO-API');
if (localkey) {
this.msg = 'API connection please wait...';

const vaultobj = JSON.parse(localkey);

vaultobj.forEach( (element) => {

this.apiService.APISend(element.value, element.apikey, 'getreporttemplates', '').then(resp => {
this.reportTemplateList_int = [];
if (resp.length > 0) {
resp.forEach((ele) => {
ele.api = 'remote';
ele.apiurl = element.value;
ele.apikey = element.apikey;
ele.apiname = element.viewValue;
});
this.reportTemplateList_int.push(...resp);
}

}).then(() => {
this.ReportTemplatesdataSource.data = [...this.reportTemplateList, ...this.reportTemplateList_int];
this.reportTemplateList = this.ReportTemplatesdataSource.data;
this.ReportTemplatesdataSource.paginator = this.paginator2;
this.ReportTemplatesdataSource.sort = this.sort2;
this.msg = '';
}).catch(() => {});

setTimeout(() => {
// console.log('hide progress timeout');
this.msg = '';
}, 10000);

});

}
}

}

0 comments on commit 24bf975

Please sign in to comment.