Skip to content

Commit 57e4154

Browse files
OlgaMardvilkosofyakurilova
authored andcommitted
339315842: (feat) add risk assessment tab (#450)
* 339315842: (feat) add risk assessment tab * 339315842: (feat) add risk assessment tab --------- Co-authored-by: Volha Mardvilka <[email protected]>
1 parent 7b2a7bc commit 57e4154

14 files changed

+210
-6
lines changed

modules/ui/src/app/app-routing.module.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ const routes: Routes = [
3737
import('./pages/reports/history.module').then(m => m.HistoryModule),
3838
title: 'Testrun - Reports',
3939
},
40+
{
41+
path: 'risk-assessment',
42+
loadChildren: () =>
43+
import('./pages/risk-assessment/risk-assessment.module').then(
44+
m => m.RiskAssessmentModule
45+
),
46+
title: 'Testrun - Risk Assessment',
47+
},
4048
{
4149
path: '',
4250
redirectTo: 'devices',

modules/ui/src/app/app.component.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,17 @@
5555
}
5656
">
5757
</ng-container>
58+
<ng-container
59+
*ngTemplateOutlet="
60+
navButtonRoute;
61+
context: {
62+
route: Routes.RiskAssessment,
63+
svgIcon: 'risk_assessment',
64+
label: 'Risk Assessment',
65+
name: 'risk-assessment'
66+
}
67+
">
68+
</ng-container>
5869
<app-version
5970
[consentShown]="vm.consentShown"
6071
(consentShownEvent)="consentShown()"></app-version>

modules/ui/src/app/app.component.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import { TestRunService } from './services/test-run.service';
3737
const DEVICES_LOGO_URL = '/assets/icons/devices.svg';
3838
const DEVICES_RUN_URL = '/assets/icons/device_run.svg';
3939
const REPORTS_LOGO_URL = '/assets/icons/reports.svg';
40+
const RISK_ASSESSMENT_LOGO_URL = '/assets/icons/risk-assessment.svg';
4041
const TESTRUN_LOGO_URL = '/assets/icons/testrun_logo_small.svg';
4142
const TESTRUN_LOGO_COLOR_URL = '/assets/icons/testrun_logo_color.svg';
4243
const CLOSE_URL = '/assets/icons/close.svg';
@@ -86,6 +87,10 @@ export class AppComponent {
8687
'reports',
8788
this.domSanitizer.bypassSecurityTrustResourceUrl(REPORTS_LOGO_URL)
8889
);
90+
this.matIconRegistry.addSvgIcon(
91+
'risk_assessment',
92+
this.domSanitizer.bypassSecurityTrustResourceUrl(RISK_ASSESSMENT_LOGO_URL)
93+
);
8994
this.matIconRegistry.addSvgIcon(
9095
'testrun_logo_small',
9196
this.domSanitizer.bypassSecurityTrustResourceUrl(TESTRUN_LOGO_URL)

modules/ui/src/app/model/routes.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ export enum Routes {
1818
Devices = '/devices',
1919
Testing = '/testing',
2020
Reports = '/reports',
21+
RiskAssessment = '/risk-assessment',
2122
}

modules/ui/src/app/pages/devices/device-repository.component.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@
3030
}
3131

3232
.device-repository-toolbar {
33-
padding-left: 32px;
3433
gap: 16px;
3534
background: $white;
36-
height: 72px;
35+
height: 74px;
36+
padding: 24px 0 8px 32px;
3737
}
3838

3939
.device-repository-content {

modules/ui/src/app/pages/reports/history.component.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@
2424
}
2525

2626
.history-toolbar {
27-
padding-left: 32px;
2827
gap: 10px;
2928
background: $white;
30-
height: 72px;
29+
height: 74px;
30+
padding: 24px 0 8px 32px;
3131
}
3232

3333
.history-content {
34-
margin: 0 32px 39px 32px;
34+
margin: 10px 32px 39px 32px;
3535
overflow-y: auto;
3636
border-radius: 4px;
3737
border: 1px solid $lighter-grey;
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/**
2+
* Copyright 2023 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
import { NgModule } from '@angular/core';
17+
import { RouterModule, Routes } from '@angular/router';
18+
import { RiskAssessmentComponent } from './risk-assessment.component';
19+
20+
const routes: Routes = [{ path: '', component: RiskAssessmentComponent }];
21+
22+
@NgModule({
23+
imports: [RouterModule.forChild(routes)],
24+
exports: [RouterModule],
25+
})
26+
export class RiskAssessmentRoutingModule {}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<!--
2+
Copyright 2023 Google LLC
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
https://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
-->
16+
<mat-toolbar class="risk-assessment-toolbar">
17+
<h2 class="title">Risk assessment</h2>
18+
</mat-toolbar>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* Copyright 2023 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
@import 'src/theming/colors';
17+
18+
.risk-assessment-toolbar {
19+
height: 74px;
20+
padding: 24px 0 8px 32px;
21+
background: $white;
22+
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/**
2+
* Copyright 2023 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
import { ComponentFixture, TestBed } from '@angular/core/testing';
17+
18+
import { RiskAssessmentComponent } from './risk-assessment.component';
19+
import { MatToolbarModule } from '@angular/material/toolbar';
20+
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
21+
22+
describe('RiskAssessmentComponent', () => {
23+
let component: RiskAssessmentComponent;
24+
let fixture: ComponentFixture<RiskAssessmentComponent>;
25+
let compiled: HTMLElement;
26+
27+
beforeEach(async () => {
28+
await TestBed.configureTestingModule({
29+
declarations: [RiskAssessmentComponent],
30+
imports: [MatToolbarModule, BrowserAnimationsModule],
31+
}).compileComponents();
32+
33+
fixture = TestBed.createComponent(RiskAssessmentComponent);
34+
component = fixture.componentInstance;
35+
compiled = fixture.nativeElement as HTMLElement;
36+
fixture.detectChanges();
37+
});
38+
39+
it('should create', () => {
40+
expect(component).toBeTruthy();
41+
});
42+
43+
it('should have toolbar with title', () => {
44+
const toolbarEl = compiled.querySelector('.risk-assessment-toolbar');
45+
const title = compiled.querySelector('h2.title');
46+
const titleContent = title?.innerHTML.trim();
47+
48+
expect(toolbarEl).not.toBeNull();
49+
expect(title).toBeTruthy();
50+
expect(titleContent).toContain('Risk assessment');
51+
});
52+
});

0 commit comments

Comments
 (0)