Skip to content

Commit 56a9733

Browse files
fix[frontend](socai-analysis): fixed wait status on socai alert analysis
1 parent d725cc1 commit 56a9733

File tree

1 file changed

+29
-3
lines changed

1 file changed

+29
-3
lines changed

frontend/src/app/data-management/alert-management/shared/components/alert-soc-ai/alert-soc-ai.component.ts

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ export class AlertSocAiComponent implements OnInit, OnDestroy {
3131

3232
ngOnInit() {
3333
if (this.socAiActive) {
34-
this.getSocAiResponse();
34+
this.initialLoad()
3535
}
3636
}
3737

38-
getSocAiResponse() {
38+
initialLoad(){
3939
this.loading = true;
4040
this.cdt.markForCheck()
4141
const filter: ElasticFilterType[] = [{
@@ -52,8 +52,34 @@ export class AlertSocAiComponent implements OnInit, OnDestroy {
5252
} else {
5353
this.socAiResponse = res.body[0];
5454
}
55+
},
56+
(_res: HttpResponse<any>) => {
57+
this.loading = false;
58+
this.cdt.markForCheck()
59+
}
60+
);
61+
}
62+
63+
64+
getSocAiResponse() {
65+
this.loading = true;
66+
this.cdt.markForCheck()
67+
const filter: ElasticFilterType[] = [{
68+
field: 'activityId',
69+
operator: ElasticOperatorsEnum.IS,
70+
value: this.alertID
71+
}];
72+
this.elasticDataService.search(1, 1, 1, SOC_AI_INDEX_PATTERN, filter)
73+
.subscribe((res: HttpResponse<any>) => {
74+
if (!res || res.body.length === 0) {
75+
this.socAiResponse = res.body;
76+
} else {
77+
this.socAiResponse = res.body[0];
78+
this.loading = false;
79+
this.cdt.markForCheck()
80+
}
5581

56-
if (this.socAiResponse.status === IndexSocAiStatus.Processing) {
82+
if (res.body.length==0 || this.socAiResponse.status === IndexSocAiStatus.Processing) {
5783
if (!this.interval) {
5884
this.startInterval();
5985
}

0 commit comments

Comments
 (0)