Skip to content

Commit 3bc614c

Browse files
authored
Bugfix/10.5/718 bug update the title of the sophos central integration (#722)
* fix: Update title of Sophos Central integration - Changed the title displayed for the Sophos Central integration from "Sophos" to "Sophos Central" * fix: Update title of Sophos Central integration - Changed the title displayed for the Sophos Central integration from "Sophos" to "Sophos Central" * fix: Update title of Sophos Central integration - Changed the title displayed for the Sophos Central integration from "Sophos" to "Sophos Central" - Refactor modules view component * fix: Update title of Sophos Central integration - Changed the title displayed for the Sophos Central integration from "Sophos" to "Sophos Central" - Refactor modules view component * fix: Update title of Sophos Central integration - Changed the title displayed for the Sophos Central integration from "Sophos" to "Sophos Central" - Refactor modules view component - Ensured that destination details of alerts are properly displayed in the alert details view.
1 parent 0162c96 commit 3bc614c

File tree

6 files changed

+78
-46
lines changed

6 files changed

+78
-46
lines changed

frontend/src/app/app-module/app-module-view/app-module-view.component.html

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ <h5 class="card-title label-header mb-0 text-uppercase label-header">
66
<div class="header-elements d-flex justify-content-end align-items-center">
77
<!-- <app-utm-server-select (serverChange)="filterByServer($event)"-->
88
<!-- [selectFirst]="true"></app-utm-server-select>-->
9-
<ng-select (change)="filterByCategory($event)"
9+
<ng-select *ngIf="categories$ | async as categories" (change)="filterByCategory($event)"
1010
[(ngModel)]="category"
1111
[clearable]="true"
1212
placeholder="Category"
@@ -22,9 +22,12 @@ <h5 class="card-title label-header mb-0 text-uppercase label-header">
2222
</div>
2323
</div>
2424
<div class="d-flex justify-content-center align-items-center flex-wrap mt-2">
25-
<app-app-module-card *ngFor="let mod of modules" [module]="mod"
26-
(showModuleIntegration)="showModule($event)"
27-
class="module-card m-1"></app-app-module-card>
25+
<ng-container *ngIf="modules$ | async as modules">
26+
<app-app-module-card *ngFor="let mod of modules; trackBy: trackByFn" [module]="mod"
27+
(showModuleIntegration)="showModule($event)"
28+
class="module-card m-1">
29+
</app-app-module-card>
30+
</ng-container>
2831
</div>
2932
</div>
3033

frontend/src/app/app-module/app-module-view/app-module-view.component.ts

Lines changed: 58 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
1+
import {HttpResponse} from '@angular/common/http';
12
import {Component, OnInit} from '@angular/core';
23
import {ActivatedRoute} from '@angular/router';
34
import {NgbModal} from '@ng-bootstrap/ng-bootstrap';
5+
import {combineLatest, Observable, of} from 'rxjs';
6+
import {catchError, map, switchMap, tap} from 'rxjs/operators';
47
import {UtmToastService} from '../../shared/alert/utm-toast.service';
5-
import {NavBehavior} from '../../shared/behaviors/nav.behavior';
68
import {SYSTEM_MENU_ICONS_PATH} from '../../shared/constants/menu_icons.constants';
7-
import {UtmRunModeService} from '../../shared/services/active-modules/utm-run-mode.service';
8-
import {UtmConfigSectionService} from '../../shared/services/config/utm-config-section.service';
99
import {ModuleRefreshBehavior} from '../shared/behavior/module-refresh.behavior';
1010
import {UtmModulesEnum} from '../shared/enum/utm-module.enum';
1111
import {UtmModulesService} from '../shared/services/utm-modules.service';
1212
import {UtmServerService} from '../shared/services/utm-server.service';
1313
import {UtmModuleType} from '../shared/type/utm-module.type';
1414
import {UtmServerType} from '../shared/type/utm-server.type';
15-
import { map } from 'rxjs/operators';
1615

1716
@Component({
1817
selector: 'app-app-module-view',
@@ -21,6 +20,7 @@ import { map } from 'rxjs/operators';
2120
})
2221
export class AppModuleViewComponent implements OnInit {
2322
modules: UtmModuleType[];
23+
modules$: Observable<UtmModuleType[]>;
2424
loading = true;
2525
setUpModule: UtmModulesEnum;
2626
utmModulesEnum = UtmModulesEnum;
@@ -30,6 +30,7 @@ export class AppModuleViewComponent implements OnInit {
3030
module: UtmModuleType;
3131
category: any;
3232
categories: string[];
33+
categories$: Observable<string[]>;
3334
req = {
3435
'moduleCategory.equals': null,
3536
'prettyName.contains': null,
@@ -44,13 +45,11 @@ export class AppModuleViewComponent implements OnInit {
4445

4546
constructor(public modalService: NgbModal,
4647
private activatedRoute: ActivatedRoute,
47-
private toastService: UtmToastService,
48-
private navBehavior: NavBehavior,
49-
private utmConfigSectionService: UtmConfigSectionService,
5048
private moduleRefreshBehavior: ModuleRefreshBehavior,
5149
private utmServerService: UtmServerService,
52-
private utmRunModeService: UtmRunModeService,
53-
private utmModulesService: UtmModulesService) {
50+
private utmModulesService: UtmModulesService,
51+
private utmToastService: UtmToastService) {
52+
5453
this.activatedRoute.queryParams.subscribe(params => {
5554
if (params) {
5655
this.req['moduleName.equals'] = params.setUp;
@@ -62,43 +61,68 @@ export class AppModuleViewComponent implements OnInit {
6261
}
6362

6463
ngOnInit() {
65-
this.getServers();
64+
this.loadData();
6665
}
6766

6867
getCategories() {
69-
this.utmModulesService.getModuleCategories({serverId: this.server.id, sort: 'moduleCategory,asc'})
70-
.subscribe(response => {
71-
this.categories = response.body.sort((a, b) => a > b ? 1 : -1);
72-
});
68+
this.categories$ = this.utmModulesService
69+
.getModuleCategories({serverId: this.server.id, sort: 'moduleCategory,asc'})
70+
.pipe(
71+
tap(() => this.loading = !this.loading),
72+
map( res => {
73+
return res.body ? res.body.sort((a, b) => a > b ? 1 : -1) : [];
74+
}),
75+
catchError(error => {
76+
console.log(error);
77+
this.utmToastService.showError('Failed to fetch categories',
78+
'An error occurred while fetching module data.');
79+
return of([]);
80+
})
81+
);
7382
}
7483

75-
getServers() {
76-
this.utmServerService.query({page: 0, size: 100}).subscribe(response => {
77-
this.servers = response.body;
78-
this.server = this.servers[0];
79-
this.req['serverId.equals'] = this.server.id;
80-
this.getCategories();
81-
this.getModules();
82-
});
84+
loadData() {
85+
this.utmServerService.query({page: 0, size: 100})
86+
.pipe(
87+
catchError(error => {
88+
console.log(error);
89+
this.utmToastService.showError('Failed to fetch servers',
90+
'An error occurred while fetching module data.');
91+
return [];
92+
}),
93+
map((resp: HttpResponse<UtmServerType[]>) => resp.body),
94+
tap(servers => {
95+
this.server = servers[0];
96+
this.req['serverId.equals'] = servers[0].id;
97+
this.getModules();
98+
this.getCategories();
99+
})
100+
).subscribe();
83101
}
84102

85103
getModules() {
86-
this.utmModulesService.getModules(this.req)
104+
this.loading = true;
105+
this.modules$ = this.utmModulesService
106+
.getModules(this.req)
87107
.pipe(
88108
map( response => {
89109
response.body.map(m => {
90-
if (m.moduleName === this.utmModulesEnum.BITDEFENDER){
110+
if (m.moduleName === this.utmModulesEnum.BITDEFENDER) {
91111
m.prettyName = m.prettyName + ' GravityZone';
92112
}
93113
});
94-
95114
return response.body;
115+
}),
116+
tap ((modules) => {
117+
this.loading = false;
118+
}),
119+
catchError(error => {
120+
console.log(error);
121+
this.utmToastService.showError('Failed to fetch modules',
122+
'An error occurred while fetching module data.');
123+
return [];
96124
})
97-
)
98-
.subscribe(modules => {
99-
this.loading = false;
100-
this.modules = modules;
101-
});
125+
);
102126
}
103127

104128
showModule($event: UtmModuleType) {
@@ -125,4 +149,8 @@ export class AppModuleViewComponent implements OnInit {
125149
this.getCategories();
126150
this.getModules();
127151
}
152+
153+
trackByFn(index: number, module: UtmModuleType): any {
154+
return module.id;
155+
}
128156
}

frontend/src/app/app-module/guides/guide-sophos/guide-sophos.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<div class="w-100 h-100">
22
<div class="card-header d-flex justify-content-between align-items-center">
33
<h4 class="card-title mb-0 text-primary">
4-
Sophos
4+
Sophos Central
55
</h4>
66
</div>
77

frontend/src/app/app-module/shared/components/app-module-card/app-module-card.component.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
1+
import {ChangeDetectionStrategy, Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
22
import {UtmModuleType} from '../../type/utm-module.type';
33

44
@Component({
55
selector: 'app-app-module-card',
66
templateUrl: './app-module-card.component.html',
7-
styleUrls: ['./app-module-card.component.scss']
7+
styleUrls: ['./app-module-card.component.scss'],
8+
changeDetection: ChangeDetectionStrategy.OnPush
89
})
910
export class AppModuleCardComponent implements OnInit {
1011
@Input() module: UtmModuleType;

frontend/src/app/data-management/alert-management/shared/components/alert-host-detail/alert-host-detail.component.html

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,43 +2,43 @@
22
<span class="p-1 utm-box-label">
33
{{type | titlecase}} detail
44
</span>
5-
<div *ngIf="!hideEmptyField || !hideEmptyField || hideEmptyField && (type==='source' && alert.source && alert.source.host !== '') || (type==='source' && alert.destination && alert.destination.host !== '')" class="alert-details w-100 d-flex justify-content-start mb-2">
5+
<div *ngIf="!hideEmptyField || !hideEmptyField || hideEmptyField && (type==='source' && alert.source && alert.source.host !== '') || (type==='destination' && alert.destination && alert.destination.host !== '')" class="alert-details w-100 d-flex justify-content-start mb-2">
66
<span class="text-blue-800 font-weight-light has-minimum-width">Hostname:</span>&nbsp;
77

88
<app-data-field-render [data]="alert"
99
[field]="getFieldByName(type==='source'?SOURCE_HOSTNAME_FIELD:DESTINATION_HOSTNAME_FIELD)"></app-data-field-render>
1010
</div>
11-
<div *ngIf="!hideEmptyField || hideEmptyField && (type==='source' && alert.source && alert.source.ip !== '') || (type==='source' && alert.destination && alert.destination.ip !== '')" class="alert-details w-100 d-flex justify-content-start mb-2 ">
11+
<div *ngIf="!hideEmptyField || hideEmptyField && (type==='source' && alert.source && alert.source.ip !== '') || (type==='destination' && alert.destination && alert.destination.ip !== '')" class="alert-details w-100 d-flex justify-content-start mb-2 ">
1212
<span class="text-blue-800 font-weight-light has-minimum-width">IP:</span>&nbsp;
1313
<app-data-field-render [data]="alert"
1414
[field]="getFieldByName(type==='source'?SOURCE_IP_FIELD:DESTINATION_IP_FIELD)"></app-data-field-render>
1515
</div>
16-
<div *ngIf="!hideEmptyField || hideEmptyField && (type==='source' && alert.source && alert.source.port > 0) || (type==='source' && alert.destination && alert.destination.port > 0)" class="alert-details w-100 d-flex justify-content-start mb-2 ">
16+
<div *ngIf="!hideEmptyField || hideEmptyField && (type==='source' && alert.source && alert.source.port > 0) || (type==='destination' && alert.destination && alert.destination.port > 0)" class="alert-details w-100 d-flex justify-content-start mb-2 ">
1717
<span class="text-blue-800 font-weight-light has-minimum-width">Port:</span>&nbsp;
1818
<app-data-field-render [data]="alert"
1919
[field]="getFieldByName(type==='source'?SOURCE_PORT_FIELD:DESTINATION_PORT_FIELD)"></app-data-field-render>
2020
</div>
21-
<div *ngIf="!hideEmptyField || hideEmptyField && (type==='source' && alert.source && alert.source.user !== '') || (type==='source' && alert.destination && alert.destination.user !== '')" class="alert-details w-100 d-flex justify-content-start mb-2 ">
21+
<div *ngIf="!hideEmptyField || hideEmptyField && (type==='source' && alert.source && alert.source.user !== '') || (type==='destination' && alert.destination && alert.destination.user !== '')" class="alert-details w-100 d-flex justify-content-start mb-2 ">
2222
<span class="text-blue-800 font-weight-light has-minimum-width">User:</span>&nbsp;
2323
<app-data-field-render [data]="alert"
2424
[field]="getFieldByName(type==='source'?SOURCE_USER_FIELD:DESTINATION_USER_FIELD)"></app-data-field-render>
2525
</div>
26-
<div *ngIf="!hideEmptyField || hideEmptyField && (type==='source' && alert.source && alert.source.asn > 0) || (type==='source' && alert.destination && alert.destination.asn > 0)" class="alert-details w-100 d-flex justify-content-start mb-2 ">
26+
<div *ngIf="!hideEmptyField || hideEmptyField && (type==='source' && alert.source && alert.source.asn > 0) || (type==='destination' && alert.destination && alert.destination.asn > 0)" class="alert-details w-100 d-flex justify-content-start mb-2 ">
2727
<span class="text-blue-800 font-weight-light has-minimum-width">ASN:</span>&nbsp;
2828
<app-data-field-render [data]="alert"
2929
[field]="getFieldByName(type==='source'?SOURCE_ASN:DESTINATION_ASN)"></app-data-field-render>
3030
</div>
31-
<div *ngIf="!hideEmptyField || hideEmptyField && (type==='source' && alert.source && alert.source.aso !== '') || (type==='source' && alert.destination && alert.destination.aso !== '')" class="alert-details w-100 d-flex justify-content-start mb-2 ">
31+
<div *ngIf="!hideEmptyField || hideEmptyField && (type==='source' && alert.source && alert.source.aso !== '') || (type==='destination' && alert.destination && alert.destination.aso !== '')" class="alert-details w-100 d-flex justify-content-start mb-2 ">
3232
<span class="text-blue-800 font-weight-light has-minimum-width">ASO:</span>&nbsp;
3333
<app-data-field-render [data]="alert"
3434
[field]="getFieldByName(type==='source'?SOURCE_ASO:DESTINATION_ASO)"></app-data-field-render>
3535
</div>
36-
<div *ngIf="!hideEmptyField || hideEmptyField && (type==='source' && alert.source && alert.source.country !== '') || (type==='source' && alert.destination && alert.destination.country !== '')" class="alert-details w-100 d-flex justify-content-start mb-2 ">
36+
<div *ngIf="!hideEmptyField || hideEmptyField && (type==='source' && alert.source && alert.source.country !== '') || (type==='destination' && alert.destination && alert.destination.country !== '')" class="alert-details w-100 d-flex justify-content-start mb-2 ">
3737
<span class="text-blue-800 font-weight-light has-minimum-width">Country:</span>&nbsp;
3838
<app-data-field-render [data]="alert"
3939
[field]="getFieldByName(type==='source'?SOURCE_COUNTRY:DESTINATION_COUNTRY)"></app-data-field-render>
4040
</div>
41-
<div *ngIf="(type==='source' && alert.source && alert.source.city !== '') || (type==='source' && alert.destination && alert.destination.city !== '')" class="alert-details w-100 d-flex justify-content-start mb-2 ">
41+
<div *ngIf="(type==='source' && alert.source && alert.source.city !== '') || (type==='destination' && alert.destination && alert.destination.city !== '')" class="alert-details w-100 d-flex justify-content-start mb-2 ">
4242
<span class="text-blue-800 font-weight-light has-minimum-width">City:</span>&nbsp;
4343
<app-data-field-render [data]="alert"
4444
[field]="getFieldByName(type==='source'?SOURCE_CITY:DESTINATION_CITY)"></app-data-field-render>

version.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version: 10.5.0
1+
version: 10.5.1

0 commit comments

Comments
 (0)