Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minor update #413

Merged
merged 2 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 46 additions & 2 deletions src/app/dialog-addissue/dialog-addissue.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { HttpClient } from '@angular/common/http';
import { UntypedFormControl } from '@angular/forms';
import { Observable } from 'rxjs';
import { map, startWith } from 'rxjs/operators';
import { DatePipe } from '@angular/common';
import { Router } from '@angular/router';
import { ApiService } from '../api.service';
import {COMMA, ENTER} from '@angular/cdk/keycodes';
Expand All @@ -13,6 +12,8 @@ import {LiveAnnouncer} from '@angular/cdk/a11y';
import {MatAutocompleteSelectedEvent, MatAutocompleteModule} from '@angular/material/autocomplete';
import { CurrentdateService } from '../currentdate.service';
import { IndexeddbService } from '../indexeddb.service';
import { SessionstorageserviceService } from "../sessionstorageservice.service"


export interface Tags {
name: string;
Expand Down Expand Up @@ -88,11 +89,12 @@ export class DialogAddissueComponent implements OnInit {
separatorKeysCodes: number[] = [ENTER, COMMA];
announcer = inject(LiveAnnouncer);
chipsissue: string[] = [];
reportTemplateList_int = [];

constructor(public router: Router,
public dialogRef: MatDialogRef<DialogAddissueComponent>, private http: HttpClient,
private currentdateService: CurrentdateService,
private apiService: ApiService, private datePipe: DatePipe,
private apiService: ApiService, public sessionsub: SessionstorageserviceService,
private indexeddbService: IndexeddbService) {

this.filteredOptions = this.customissueform.valueChanges
Expand Down Expand Up @@ -221,6 +223,7 @@ export class DialogAddissueComponent implements OnInit {
this.options = [...res,...ret];
});
}
this.getAPITemplates();
});

this.http.get<any>('/assets/CWE_V.4.3.json?v=' + + new Date()).subscribe(res => {
Expand Down Expand Up @@ -265,6 +268,47 @@ export class DialogAddissueComponent implements OnInit {
return this.currentdateService.getcurrentDate();
}

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.http.get<any>('/assets/vulns.json?v=' + + new Date()).subscribe(res => {
this.options = [...this.options,...this.reportTemplateList_int];
});

//this.msg = '';
}).catch(() => {});

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

});

}
}

addIssue() {

if (this.customissueform.value !== "" && this.customissueform.value !== null) {
Expand Down
Loading
Loading