Skip to content

Commit e921ad6

Browse files
committed
add spinner
1 parent d0df8f0 commit e921ad6

File tree

7 files changed

+125
-40
lines changed

7 files changed

+125
-40
lines changed

src/app/app.module.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ import { DialogOllamaSettingsComponent } from './dialog-ollama-settings/dialog-o
9191
import {MatSliderModule} from '@angular/material/slider';
9292
import { DialogMergeIssuesComponent } from './dialog-merge-issues/dialog-merge-issues.component';
9393
import { DialogReportHistoryComponent } from './dialog-report-history/dialog-report-history.component';
94+
import { DialogSpinnerComponent } from './dialog-spinner/dialog-spinner.component';
9495
import { BbListComponent } from './bb-list/bb-list.component';
9596

9697
@NgModule({ declarations: [
@@ -136,7 +137,8 @@ import { BbListComponent } from './bb-list/bb-list.component';
136137
DialogOllamaSettingsComponent,
137138
DialogMergeIssuesComponent,
138139
DialogReportHistoryComponent,
139-
BbListComponent
140+
BbListComponent,
141+
DialogSpinnerComponent
140142
],
141143
exports: [],
142144
bootstrap: [AppComponent], imports: [BrowserModule,
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<div fxLayout="column wrap">
2+
<div fxLayoutAlign="center center" fxFlex="150px">
3+
<img style="margin-top: 100px;animation: rotate 4s infinite linear;" fxLayoutAlign="center center" src="/assets/logo/vulnrepo_logo.png" width="150px" />
4+
5+
</div>
6+
7+
</div>

src/app/dialog-spinner/dialog-spinner.component.scss

Whitespace-only changes.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { ComponentFixture, TestBed } from '@angular/core/testing';
2+
3+
import { DialogSpinnerComponent } from './dialog-spinner.component';
4+
5+
describe('DialogSpinnerComponent', () => {
6+
let component: DialogSpinnerComponent;
7+
let fixture: ComponentFixture<DialogSpinnerComponent>;
8+
9+
beforeEach(async () => {
10+
await TestBed.configureTestingModule({
11+
imports: [DialogSpinnerComponent]
12+
})
13+
.compileComponents();
14+
15+
fixture = TestBed.createComponent(DialogSpinnerComponent);
16+
component = fixture.componentInstance;
17+
fixture.detectChanges();
18+
});
19+
20+
it('should create', () => {
21+
expect(component).toBeTruthy();
22+
});
23+
});
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { Component } from '@angular/core';
2+
3+
@Component({
4+
selector: 'app-dialog-spinner',
5+
standalone: false,
6+
//imports: [],
7+
templateUrl: './dialog-spinner.component.html',
8+
styleUrl: './dialog-spinner.component.scss'
9+
})
10+
export class DialogSpinnerComponent {
11+
12+
}

src/app/report/report.component.ts

Lines changed: 59 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,13 @@ import { DialogEditorFullscreenComponent } from '../dialog-editor-fullscreen/dia
4343
import { DialogAttachPreviewComponent } from '../dialog-attach-preview/dialog-attach-preview.component';
4444
import { AlignmentType, Document, Footer, Header, Packer, PageBreak, HeadingLevel, ImageRun, PageNumber, NumberFormat, Paragraph, TextRun, TableOfContents, Table, TableCell, TableRow, WidthType } from "docx";
4545
import { UtilsService } from '../utils.service';
46-
import {OllamaServiceService} from '../ollama-service.service';
47-
import {DialogOllamaSettingsComponent} from '../dialog-ollama-settings/dialog-ollama-settings.component';
46+
import { OllamaServiceService } from '../ollama-service.service';
47+
import { DialogOllamaSettingsComponent } from '../dialog-ollama-settings/dialog-ollama-settings.component';
4848
import { DialogOllamaComponent } from '../dialog-ollama/dialog-ollama.component';
4949
import { CurrentdateService } from '../currentdate.service';
5050
import { DialogMergeIssuesComponent } from '../dialog-merge-issues/dialog-merge-issues.component';
5151
import { DialogReportHistoryComponent } from '../dialog-report-history/dialog-report-history.component';
52+
import { DialogSpinnerComponent } from '../dialog-spinner/dialog-spinner.component';
5253

5354
export interface Tags {
5455
name: string;
@@ -122,6 +123,7 @@ export class ReportComponent implements OnInit, OnDestroy, AfterViewInit {
122123
pok = 0;
123124
prev_height = 190;
124125
timerCounter = 0;
126+
spinner:any;
125127
savemsg = '';
126128
report_decryption_in_progress: boolean;
127129
report_encryption_in_progress: boolean;
@@ -182,7 +184,7 @@ export class ReportComponent implements OnInit, OnDestroy, AfterViewInit {
182184

183185
aiprogress = false;
184186
aiconnected = false;
185-
models:any;
187+
models: any;
186188

187189
@HostListener('window:keydown.control.shift.l', ['$event'])
188190
GoToNewReport(event: KeyboardEvent) {
@@ -343,16 +345,16 @@ export class ReportComponent implements OnInit, OnDestroy, AfterViewInit {
343345

344346

345347
this.indexeddbService.getkeybyAiintegration().then(ret => {
346-
347-
if(ret[0]) {
348+
349+
if (ret[0]) {
348350
this.aiconnected = true;
349351
this.models = ret[0];
350352
}
351-
});
353+
});
352354
}
353355

354356

355-
ngAfterViewInit() {}
357+
ngAfterViewInit() { }
356358

357359
calendarDateChanged() {
358360
this.selectedRangeValue = new DateRange<Date>(new Date(this.decryptedReportDataChanged.report_metadata.starttest), new Date(this.decryptedReportDataChanged.report_metadata.endtest));
@@ -705,14 +707,14 @@ export class ReportComponent implements OnInit, OnDestroy, AfterViewInit {
705707
const ret = this.selectedResult[event];
706708
const index: number = this.decryptedReportDataChanged.report_vulns.indexOf(ret);
707709
if (index !== -1) {
708-
if(checked === true) {
709-
this.selectedIssues.push({"index": index, "data": ret});
710+
if (checked === true) {
711+
this.selectedIssues.push({ "index": index, "data": ret });
710712

711-
} else if(checked === false) {
712-
const index2: number = this.selectedIssues.findIndex(i => i.data === ret)
713-
if (index2 !== -1) {
714-
this.selectedIssues.splice(index2, 1);
715-
}
713+
} else if (checked === false) {
714+
const index2: number = this.selectedIssues.findIndex(i => i.data === ret)
715+
if (index2 !== -1) {
716+
this.selectedIssues.splice(index2, 1);
717+
}
716718
}
717719

718720
}
@@ -729,13 +731,13 @@ export class ReportComponent implements OnInit, OnDestroy, AfterViewInit {
729731

730732
checkcheckbox(i) {
731733

732-
let returnVal = false;
733-
const ret = this.selectedResult[i];
734+
let returnVal = false;
735+
const ret = this.selectedResult[i];
734736

735-
const index2: number = this.selectedIssues.findIndex(i => i.data === ret)
736-
if (index2 !== -1) {
737-
returnVal = true;
738-
}
737+
const index2: number = this.selectedIssues.findIndex(i => i.data === ret)
738+
if (index2 !== -1) {
739+
returnVal = true;
740+
}
739741

740742
return returnVal
741743
}
@@ -791,7 +793,7 @@ export class ReportComponent implements OnInit, OnDestroy, AfterViewInit {
791793

792794
this.decryptedReportDataChanged.report_vulns.forEach((element, ind) => {
793795

794-
this.selectedIssues.push({"index": ind, "data": element});
796+
this.selectedIssues.push({ "index": ind, "data": element });
795797

796798
});
797799

@@ -947,7 +949,7 @@ Sample code here\n\
947949

948950
if (this.decryptedReportDataChanged.report_vulns.length > 0) {
949951
setTimeout(() => {
950-
if (this.calendar){
952+
if (this.calendar) {
951953
this.calendar.updateTodaysDate();
952954
}
953955
});
@@ -962,14 +964,14 @@ Sample code here\n\
962964

963965
getData(event?: PageEvent) {
964966

965-
if(event) {
967+
if (event) {
966968
this.pageSize = event.pageSize;
967969
this.pageIndex = event.pageIndex;
968970
}
969971

970972
this.selectedResult = this.decryptedReportDataChanged.report_vulns.slice(this.pageIndex * this.pageSize, this.pageIndex * this.pageSize + this.pageSize);
971973
return event;
972-
974+
973975
}
974976

975977
renderdateformat(inputdate) {
@@ -1368,7 +1370,7 @@ Sample code here\n\
13681370

13691371
for (const [key, value] of Object.entries(this.decryptedReportDataChanged.report_vulns)) {
13701372

1371-
if(value) {
1373+
if (value) {
13721374
if (value["severity"] === "Critical") {
13731375
critical.push(value);
13741376
} else if (value["severity"] === "High") {
@@ -3051,6 +3053,7 @@ Date | Description
30513053
link.setAttribute('download', report_info.report_name + ' ' + report_info.report_id + encryptedtext + ' (vulnrepo.com).html');
30523054
link.style.visibility = 'hidden';
30533055
document.body.appendChild(link);
3056+
this.hidespinner();
30543057
link.click();
30553058
document.body.removeChild(link);
30563059
}
@@ -3075,6 +3078,7 @@ Date | Description
30753078

30763079

30773080
DownloadHTMLv2(report_info, encrypted, type_dep, encpass): void {
3081+
this.showspinner();
30783082
const json = {
30793083
"report_name": report_info.report_name,
30803084
"report_id": report_info.report_id,
@@ -3423,8 +3427,8 @@ Date | Description
34233427

34243428
fastsearchBB(poc, showsnack) {
34253429
this.BBmsg = 'Please wait, searching...';
3426-
let scope=[];
3427-
this.bugbountylist.forEach(function (item:any) {
3430+
let scope = [];
3431+
this.bugbountylist.forEach(function (item: any) {
34283432
scope = scope.concat(item.domains);
34293433
});
34303434

@@ -3441,7 +3445,7 @@ Date | Description
34413445
// get only scope & search
34423446
const findedbounty = scope.find(x => x == match);
34433447
if (findedbounty) {
3444-
this.bugbountylist.forEach(function (item:any) {
3448+
this.bugbountylist.forEach(function (item: any) {
34453449
const findedbounty2 = item.domains.find(x => x == findedbounty);
34463450
if (findedbounty2) {
34473451
arr.push(item);
@@ -3602,7 +3606,7 @@ Date | Description
36023606
}
36033607

36043608

3605-
aiasist(){
3609+
aiasist() {
36063610
console.log('AI start chat');
36073611
this.aiprogress = true;
36083612

@@ -3625,17 +3629,17 @@ Date | Description
36253629
36263630
<ATTACHMENT_FILE>
36273631
<FILE_INDEX>File 1</FILE_INDEX>
3628-
<FILE_NAME>`+this.report_info.report_name+`</FILE_NAME>
3632+
<FILE_NAME>`+ this.report_info.report_name + `</FILE_NAME>
36293633
<FILE_CONTENT>
3630-
`+JSON.stringify(json)+`
3634+
`+ JSON.stringify(json) + `
36313635
</FILE_CONTENT>
36323636
</ATTACHMENT_FILE>
36333637
`;
36343638

36353639
this.decryptedReportDataChanged.report_summary = "";
36363640

36373641
let tempx = "";
3638-
this.ollamaService.chatStream(this.models.ollama_url, msgin, this.models.model, [], [],this.models.defaultprompt).subscribe({
3642+
this.ollamaService.chatStream(this.models.ollama_url, msgin, this.models.model, [], [], this.models.defaultprompt).subscribe({
36393643
next: (text) => {
36403644
this.decryptedReportDataChanged.report_summary += text;
36413645
tempx += text;
@@ -3653,7 +3657,7 @@ Date | Description
36533657
this.aiprogress = false;
36543658
},
36553659
error: () => {
3656-
3660+
36573661
}
36583662
});
36593663

@@ -3667,17 +3671,17 @@ Date | Description
36673671
disableClose: false,
36683672
data: []
36693673
});
3670-
3674+
36713675
dialogRef.afterClosed().subscribe(result => {
36723676
console.log('The AI-Settings dialog was closed');
36733677
if (result) {
36743678

36753679
this.indexeddbService.getkeybyAiintegration().then(ret => {
3676-
3677-
if(ret[0]) {
3680+
3681+
if (ret[0]) {
36783682
this.models = ret[0];
36793683
}
3680-
});
3684+
});
36813685

36823686
}
36833687
});
@@ -3706,7 +3710,7 @@ Date | Description
37063710
const dialogRef = this.dialog.open(DialogOllamaComponent, {
37073711
width: '800px',
37083712
disableClose: true,
3709-
data: [{"prompt": ``, "files": [{ "filename": this.report_info.report_name + ".json", "date": String(this.currentdateService.getcurrentDate()), "filetype": "json", "file": btoa(unescape(encodeURIComponent(xxx))) }], "images": []}]
3713+
data: [{ "prompt": ``, "files": [{ "filename": this.report_info.report_name + ".json", "date": String(this.currentdateService.getcurrentDate()), "filetype": "json", "file": btoa(unescape(encodeURIComponent(xxx))) }], "images": [] }]
37103714
});
37113715

37123716
dialogRef.afterClosed().subscribe(result => {
@@ -3715,6 +3719,23 @@ Date | Description
37153719

37163720
}
37173721

3722+
hidespinner(): void {
3723+
this.spinner.close();
3724+
}
3725+
showspinner(): void {
3726+
3727+
this.spinner = this.dialog.open(DialogSpinnerComponent, {
3728+
maxWidth: '250px',
3729+
maxHeight: '250px',
3730+
height: '250px',
3731+
width: '250px',
3732+
disableClose: false,
3733+
panelClass: 'my-css-class-spinner',
3734+
data: ''
3735+
});
3736+
3737+
}
3738+
37183739

37193740
showHistory(report_id): void {
37203741

src/styles.scss

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,4 +353,24 @@ blockquote p {
353353

354354
.mat-sidenav-content {
355355
background-color: #000 !important;
356-
}
356+
}
357+
358+
359+
@keyframes rotate {
360+
0% {
361+
transform: rotate(0deg);
362+
}
363+
50% {
364+
transform: rotate(180deg);
365+
}
366+
100% {
367+
transform: rotate(360deg);
368+
}
369+
}
370+
371+
.my-css-class-spinner mat-dialog-container .mat-mdc-dialog-inner-container .mat-mdc-dialog-surface {
372+
background-color: black;
373+
border-radius: 50%;
374+
375+
width: 250px;
376+
}

0 commit comments

Comments
 (0)