Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
313 changes: 168 additions & 145 deletions modules/ui/src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,93 +14,120 @@
limitations under the License.
-->
<app-bypass></app-bypass>
<mat-drawer-container
*ngIf="viewModel$ | async as vm"
[class.active-menu]="vm.isMenuOpen"
hasBackdrop="false"
class="app-container"
autosize>
<mat-drawer mode="side" role="navigation" opened cdkFocusInitial>
<div class="app-sidebar" #navigation>
<ng-container
*ngTemplateOutlet="
navButtonRoute;
context: {
route: Routes.Testing,
svgIcon: 'testrun_logo_small',
label: 'Testing',
name: 'testrun'
}
">
</ng-container>
<ng-container
*ngTemplateOutlet="
navButtonRoute;
context: {
route: Routes.Devices,
svgIcon: 'devices',
label: 'Devices',
name: 'devices'
}
">
</ng-container>
<ng-container
*ngTemplateOutlet="
navButtonRoute;
context: {
route: Routes.Reports,
svgIcon: 'reports',
label: 'Reports',
name: 'reports'
}
">
</ng-container>
<app-version
[consentShown]="vm.consentShown"
(consentShownEvent)="consentShown()"></app-version>
</div>
</mat-drawer>
<ng-container *ngIf="viewModel$ | async as vm">
<mat-drawer-container
[class.active-menu]="vm.isMenuOpen"
hasBackdrop="false"
class="app-container"
autosize>
<mat-drawer mode="side" role="navigation" opened cdkFocusInitial>
<div class="app-sidebar" #navigation>
<ng-container
*ngTemplateOutlet="
navButtonRoute;
context: {
route: Routes.Testing,
svgIcon: 'testrun_logo_small',
label: 'Testing',
name: 'testrun'
}
">
</ng-container>
<ng-container
*ngTemplateOutlet="
navButtonRoute;
context: {
route: Routes.Devices,
svgIcon: 'devices',
label: 'Devices',
name: 'devices'
}
">
</ng-container>
<ng-container
*ngTemplateOutlet="
navButtonRoute;
context: {
route: Routes.Reports,
svgIcon: 'reports',
label: 'Reports',
name: 'reports'
}
">
</ng-container>
<app-version
[consentShown]="vm.consentShown"
(consentShownEvent)="consentShown()"></app-version>
</div>
</mat-drawer>

<mat-drawer-content class="app-content" role="region">
<mat-toolbar class="app-toolbar">
<button
mat-button
class="app-toolbar-button app-toolbar-button-menu"
aria-label="Menu"
(click)="toggleMenu($event)"
(keydown.tab)="skipToNavigation($event)">
<mat-icon>menu</mat-icon>
</button>
<a
class="logo-link"
routerLink="{{ Routes.Testing }}"
aria-label="Testrun ui logo">
<mat-icon svgIcon="testrun_logo_color"></mat-icon>
<h1 class="main-heading">Testrun</h1>
</a>
<span class="spacer"></span>
<button
#toggleSettingsBtn
class="app-toolbar-button app-toolbar-button-general-settings"
mat-icon-button
aria-label="System settings"
(click)="openGeneralSettings(true)">
<mat-icon>tune</mat-icon>
</button>
</mat-toolbar>
<div class="app-content-main" role="main" id="main">
<ng-container *ngIf="vm.settingMissedError as error">
<app-callout [type]="CalloutType.Error" *ngIf="error.isSettingMissed">
<ng-container
*ngIf="
error.devicePortMissed && error.internetPortMissed;
else onePortMissed
">
No ports are detected. Please define a valid ones using
</ng-container>
<ng-template #onePortMissed>
Selected port is missing! Please define a valid one using
</ng-template>
<mat-drawer-content class="app-content" role="region">
<mat-toolbar class="app-toolbar">
<button
mat-button
class="app-toolbar-button app-toolbar-button-menu"
aria-label="Menu"
(click)="toggleMenu($event)"
(keydown.tab)="skipToNavigation($event)">
<mat-icon>menu</mat-icon>
</button>
<a
class="logo-link"
routerLink="{{ Routes.Testing }}"
aria-label="Testrun ui logo">
<mat-icon svgIcon="testrun_logo_color"></mat-icon>
<h1 class="main-heading">Testrun</h1>
</a>
<span class="spacer"></span>
<button
#toggleCertificatesBtn
class="app-toolbar-button app-toolbar-button-certificates"
mat-icon-button
aria-label="Certificates"
(click)="openCert()">
<mat-icon fontSet="material-symbols-outlined"
>workspace_premium</mat-icon
>
</button>
<button
#toggleSettingsBtn
class="app-toolbar-button app-toolbar-button-general-settings"
mat-icon-button
aria-label="System settings"
(click)="openGeneralSettings(true)">
<mat-icon>tune</mat-icon>
</button>
</mat-toolbar>
<div class="app-content-main" role="main" id="main">
<ng-container *ngIf="vm.settingMissedError as error">
<app-callout [type]="CalloutType.Error" *ngIf="error.isSettingMissed">
<ng-container
*ngIf="
error.devicePortMissed && error.internetPortMissed;
else onePortMissed
">
No ports are detected. Please define a valid ones using
</ng-container>
<ng-template #onePortMissed>
Selected port is missing! Please define a valid one using
</ng-template>
<a
(click)="openSetting()"
(keydown.enter)="openSetting()"
(keydown.space)="openSetting()"
aria-label="The System settings link opens the panel. No redirect to other pages."
tabindex="0"
role="link"
class="message-link"
>System settings</a
>
panel.
</app-callout>
</ng-container>
<app-callout
[type]="CalloutType.Info"
*ngIf="vm.hasConnectionSettings === false">
Step 1: To perform a device test, please, select ports in
<a
(click)="openSetting()"
(keydown.enter)="openSetting()"
Expand All @@ -113,64 +140,49 @@ <h1 class="main-heading">Testrun</h1>
>
panel.
</app-callout>
</ng-container>
<app-callout
[type]="CalloutType.Info"
*ngIf="vm.hasConnectionSettings === false">
Step 1: To perform a device test, please, select ports in
<a
(click)="openSetting()"
(keydown.enter)="openSetting()"
(keydown.space)="openSetting()"
aria-label="The System settings link opens the panel. No redirect to other pages."
tabindex="0"
role="link"
class="message-link"
>System settings</a
>
panel.
</app-callout>
<app-callout
[type]="CalloutType.Info"
*ngIf="vm.hasConnectionSettings === true && vm.hasDevices === false">
Step 2: To perform a device test please
<a
(click)="navigateToDeviceRepository()"
(keydown.enter)="navigateToDeviceRepository()"
(keydown.space)="navigateToDeviceRepository()"
aria-label="The Create a Device link redirects to the Devices page and opens the dialogue there."
tabindex="0"
role="link"
class="message-link"
>Create a Device</a
>
first.
</app-callout>
<app-callout
[type]="CalloutType.Info"
*ngIf="
vm.hasConnectionSettings === true &&
vm.hasDevices &&
(!vm.systemStatus?.status ||
vm.systemStatus?.status === StatusOfTestrun.Idle) &&
vm.isStatusLoaded === true &&
vm.isTestrunStarted === false
">
Step 3: Once device is created, you are able to
<a
(click)="navigateToRuntime()"
(keydown.enter)="navigateToRuntime()"
(keydown.space)="navigateToRuntime()"
aria-label="The start testing link redirects to the Testing page and opens the dialogue there."
tabindex="0"
role="link"
class="message-link"
>start testing</a
>.
</app-callout>
<router-outlet></router-outlet>
</div>
</mat-drawer-content>
<app-callout
[type]="CalloutType.Info"
*ngIf="vm.hasConnectionSettings === true && vm.hasDevices === false">
Step 2: To perform a device test please
<a
(click)="navigateToDeviceRepository()"
(keydown.enter)="navigateToDeviceRepository()"
(keydown.space)="navigateToDeviceRepository()"
aria-label="The Create a Device link redirects to the Devices page and opens the dialogue there."
tabindex="0"
role="link"
class="message-link"
>Create a Device</a
>
first.
</app-callout>
<app-callout
[type]="CalloutType.Info"
*ngIf="
vm.hasConnectionSettings === true &&
vm.hasDevices &&
(!vm.systemStatus?.status ||
vm.systemStatus?.status === StatusOfTestrun.Idle) &&
vm.isStatusLoaded === true &&
vm.isTestrunStarted === false
">
Step 3: Once device is created, you are able to
<a
(click)="navigateToRuntime()"
(keydown.enter)="navigateToRuntime()"
(keydown.space)="navigateToRuntime()"
aria-label="The start testing link redirects to the Testing page and opens the dialogue there."
tabindex="0"
role="link"
class="message-link"
>start testing</a
>.
</app-callout>
<router-outlet></router-outlet>
</div>
</mat-drawer-content>
</mat-drawer-container>

<mat-drawer
#settingsDrawer
mode="over"
Expand All @@ -183,7 +195,18 @@ <h1 class="main-heading">Testrun</h1>
(closeSettingEvent)="closeSetting(vm.hasDevices)">
</app-general-settings>
</mat-drawer>
</mat-drawer-container>

<mat-drawer
#certDrawer
mode="over"
position="end"
autoFocus="#setting-panel-close-button"
class="settings-drawer">
<app-certificates
[certificates]="vm.certificates"
(closeCertificatedEvent)="closeCertificates()"></app-certificates>
</mat-drawer>
</ng-container>

<ng-template
#navButtonRoute
Expand Down
2 changes: 1 addition & 1 deletion modules/ui/src/app/app.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ $nav-open-btn-width: 210px;
border-left: 1px solid $light-grey;
}

.app-toolbar-button-general-settings {
.app-toolbar-button.app-toolbar-button-certificates {
margin-left: 72px;
}

Expand Down
24 changes: 24 additions & 0 deletions modules/ui/src/app/app.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ import {
selectSystemStatus,
} from './store/selectors';
import { MatIconTestingModule } from '@angular/material/icon/testing';
import { CertificatesComponent } from './pages/certificates/certificates.component';

describe('AppComponent', () => {
let component: AppComponent;
Expand Down Expand Up @@ -94,6 +95,7 @@ describe('AppComponent', () => {
'fetchDevices',
'getTestModules',
'testrunInProgress',
'fetchCertificates',
]);

mockFocusManagerService = jasmine.createSpyObj('mockFocusManagerService', [
Expand All @@ -113,6 +115,7 @@ describe('AppComponent', () => {
BypassComponent,
CalloutComponent,
MatIconTestingModule,
CertificatesComponent,
],
providers: [
{ provide: TestRunService, useValue: mockService },
Expand Down Expand Up @@ -648,6 +651,27 @@ describe('AppComponent', () => {

expect(spyToggle).toHaveBeenCalledTimes(0);
});

it('should render certificates button', () => {
const generalSettingsButton = compiled.querySelector(
'.app-toolbar-button-certificates'
);

expect(generalSettingsButton).toBeDefined();
});

it('should call settingsDrawer open on click settings button', () => {
fixture.detectChanges();

const settingsBtn = compiled.querySelector(
'.app-toolbar-button-certificates'
) as HTMLButtonElement;
spyOn(component.certDrawer, 'open');

settingsBtn.click();

expect(component.certDrawer.open).toHaveBeenCalledTimes(1);
});
});

@Component({
Expand Down
Loading