diff --git a/metron-interface/metron-alerts/src/app/alerts/alert-details/alert-details.component.html b/metron-interface/metron-alerts/src/app/alerts/alert-details/alert-details.component.html index c4bcc88bb5..c013a70fa7 100644 --- a/metron-interface/metron-alerts/src/app/alerts/alert-details/alert-details.component.html +++ b/metron-interface/metron-alerts/src/app/alerts/alert-details/alert-details.component.html @@ -11,8 +11,14 @@ OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> -
-
+
+ +
+
+
Loading...
+
+ +
-
-
+
+
-
-
+
+
{{ getScore(alertSource) }}
-
+
{{ (alertSource.name && alertSource.name.length > 0)? alertSource.name : alertId | centerEllipses:20 }}
@@ -57,12 +63,12 @@
-
+
-
- +
+
@@ -82,7 +88,7 @@
-
+
Alert {{ i + 1 }} of {{ alertSources.length }}
    @@ -94,12 +100,11 @@
-
+
Comments ({{alertCommentsWrapper.length}})
-
{ let component: AlertDetailsComponent; let fixture: ComponentFixture; @@ -91,6 +138,18 @@ describe('AlertDetailsComponent', () => { fixture.detectChanges(); }); + it('should be in a loading state if no alertSources loaded', () => { + component.alertSources = []; + fixture.detectChanges(); + expect(fixture.debugElement.query(By.css('[data-qe-id="preloader"]'))).toBeTruthy(); + }); + + it('should show details if alertSources loaded', () => { + component.alertSources = [alertDetail]; + fixture.detectChanges(); + expect(fixture.debugElement.query(By.css('[data-qe-id="preloader"]'))).toBeFalsy(); + }); + it('should delete a comment.', fakeAsync(() => { const responseMock = new AlertSource(); responseMock.guid = 'guid'; @@ -104,6 +163,10 @@ describe('AlertDetailsComponent', () => { component.alertSource.guid = 'guid'; component.alertSourceType = 'sourceType'; const now = Date.now(); + + component.alertSources = [alertDetail]; + fixture.detectChanges(); + component.alertCommentsWrapper = [ new AlertCommentWrapper( new AlertComment('lorem ipsum', 'user', now), diff --git a/metron-interface/metron-alerts/src/app/alerts/alert-details/alert-details.component.ts b/metron-interface/metron-alerts/src/app/alerts/alert-details/alert-details.component.ts index f5c55faccd..1b40de6d04 100644 --- a/metron-interface/metron-alerts/src/app/alerts/alert-details/alert-details.component.ts +++ b/metron-interface/metron-alerts/src/app/alerts/alert-details/alert-details.component.ts @@ -16,7 +16,7 @@ * limitations under the License. */ import {Component, OnInit} from '@angular/core'; -import {ActivatedRoute, Router} from '@angular/router'; +import {ActivatedRoute, Router, NavigationStart} from '@angular/router'; import * as moment from 'moment/moment'; import {Subscription} from 'rxjs'; @@ -87,6 +87,13 @@ export class AlertDetailsComponent implements OnInit { private dialogService: DialogService, globalConfigService: GlobalConfigService) { this.globalConfigService = globalConfigService; + + router.events.subscribe(event => { + if (event instanceof NavigationStart && /\/alerts-list\(dialog:details\//.test(event.url)) { + this.alertSources = []; + this.alertSource = null; + } + }); } goBack() { diff --git a/metron-interface/metron-alerts/src/slider.scss b/metron-interface/metron-alerts/src/slider.scss index ccb139fd73..9df9a0efc8 100644 --- a/metron-interface/metron-alerts/src/slider.scss +++ b/metron-interface/metron-alerts/src/slider.scss @@ -34,6 +34,7 @@ $dialog-4x-width: 1340px; z-index: 9; background: $edit-child-background; + border-left: 1px solid $edit-background-border; .close-button {
Status ESCALATE