From bd4408b0fc5b864a2cffec481d80bd49b6713470 Mon Sep 17 00:00:00 2001 From: Kacper Date: Sat, 24 Aug 2024 14:39:30 +0200 Subject: [PATCH] api settings fix --- src/app/settings/settings.component.ts | 41 +++++--------------------- 1 file changed, 8 insertions(+), 33 deletions(-) diff --git a/src/app/settings/settings.component.ts b/src/app/settings/settings.component.ts index 1d7445ea1..f20cb1b7f 100644 --- a/src/app/settings/settings.component.ts +++ b/src/app/settings/settings.component.ts @@ -87,13 +87,8 @@ export class SettingsComponent implements OnInit { ngOnInit() { - this.getProfiles(); - - this.getTemplates(); - this.getVault(); - } foundvault(bool: boolean): boolean { @@ -173,6 +168,7 @@ export class SettingsComponent implements OnInit { this.ReportProfilesdataSource.paginator = this.paginator; this.ReportProfilesdataSource.sort = this.sort; } + this.getAPIReportProfiles(); }); } @@ -184,6 +180,7 @@ export class SettingsComponent implements OnInit { this.ReportTemplatesdataSource.paginator = this.paginator2; this.ReportTemplatesdataSource.sort = this.sort2; } + this.getAPITemplates(); }); } @@ -387,8 +384,8 @@ export class SettingsComponent implements OnInit { this.sessionsub.setSessionStorageItem('VULNREPO-API', JSON.stringify(vaultobj)); - this.getReportProfiles(); - this.getReportTemplates(); + this.getProfiles(); + this.getTemplates(); } removeapikey() { @@ -408,7 +405,7 @@ export class SettingsComponent implements OnInit { this.apiconneted = false; this.status = 'Not connected!'; this.tryconnectdb = true; - this.getReportProfiles(); + this.getProfiles(); } tryconnect() { @@ -608,18 +605,6 @@ export class SettingsComponent implements OnInit { } - getReportProfiles() { - this.indexeddbService.retrieveReportProfile().then(ret => { - if (ret) { - this.ReportProfilesdataSource = new MatTableDataSource(ret); - this.reportProfileList = this.ReportProfilesdataSource.data; - this.getAPIReportProfiles(); - } - - }); - } - - getAPIReportProfiles() { const localkey = this.sessionsub.getSessionStorageItem('VULNREPO-API'); @@ -736,7 +721,7 @@ export class SettingsComponent implements OnInit { this.ReportProfilesdataSource.data = this.reportProfileList; this.indexeddbService.deleteProfile(item).then(ret => { - this.getReportProfiles(); + this.getProfiles(); }); } @@ -782,7 +767,7 @@ export class SettingsComponent implements OnInit { }; this.ReportProfilesdataSource.data = this.reportProfileList; this.indexeddbService.updateProfile(this.reportProfileList[index], result.original[0]._key).then(ret => { }); - this.getReportProfiles(); + this.getProfiles(); } } @@ -839,7 +824,7 @@ export class SettingsComponent implements OnInit { this.indexeddbService.saveReportProfileinDB(parsed).then(ret => { }); } - this.getReportProfiles(); + this.getProfiles(); } downloadProfileItem(element) { @@ -960,16 +945,6 @@ export class SettingsComponent implements OnInit { } - 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');