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
104 changes: 40 additions & 64 deletions modules/ui/src/app/components/device-item/device-item.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,85 +18,61 @@
[tabIndex]="tabIndex"
(click)="itemClick()"
[attr.aria-label]="label"
class="device-item"
class="device-item device-item-basic"
type="button">
<ng-container *ngTemplateOutlet="basicView"></ng-container>
<ng-container
*ngTemplateOutlet="basicView; context: { editable: false }"></ng-container>
</button>

<div
*ngIf="deviceView === DeviceView.Basic && tabIndex !== 0"
[attr.aria-label]="label"
class="device-item non-interactive">
<ng-container *ngTemplateOutlet="basicView"></ng-container>
class="device-item device-item-basic non-interactive">
<ng-container
*ngTemplateOutlet="basicView; context: { editable: false }"></ng-container>
</div>

<ng-template #basicView>
<p class="item-manufacturer">
<span class="visually-hidden">{{ device.test_pack }}</span>
<app-program-type-icon
*ngIf="device.test_pack === TestingType.Qualification"
[type]="ProgramType.Qualification"
matTooltip="This device will be tested for Qualification."></app-program-type-icon>
<app-program-type-icon
*ngIf="device.test_pack === TestingType.Pilot"
[type]="ProgramType.Pilot"
matTooltip="This device will be tested for the Pilot program."></app-program-type-icon>
<span>{{ device.manufacturer }}</span>
</p>
<p class="item-name">
{{ device.model }}
</p>
<p class="item-mac-address">
{{ device.mac_addr }}
</p>
</ng-template>

<div
style="height: 100%"
*ngIf="deviceView === DeviceView.WithActions"
[class.device-item-outdated]="device.status === DeviceStatus.INVALID"
class="device-item-with-actions">
[class.device-item-outdated]="device.status === DeviceStatus.INVALID">
<button
[disabled]="disabled"
[tabIndex]="tabIndex"
(click)="itemClick()"
attr.aria-label="Edit device {{ label }}"
class="button-edit"
class="device-item button-edit"
type="button">
<div class="item-manufacturer">
<app-program-type-icon
*ngIf="device.test_pack === TestingType.Qualification"
[type]="ProgramType.Qualification"
matTooltip="This device will be tested for Qualification."
aria-label="This device will be tested for Qualification."></app-program-type-icon>
<app-program-type-icon
*ngIf="device.test_pack === TestingType.Pilot"
[type]="ProgramType.Pilot"
matTooltip="This device will be tested for the Pilot program."
aria-label="This device will be tested for the Pilot program."></app-program-type-icon>
<p class="item-manufacturer-text">{{ device.manufacturer }}</p>
<mat-icon
class="item-manufacturer-icon"
fontSet="material-symbols-outlined">
edit_square</mat-icon
>
</div>
<div *ngIf="device.status === DeviceStatus.INVALID" class="item-status">
{{ INVALID_DEVICE }}
</div>
<div class="item-name">
{{ device.model }}
</div>
<div class="item-mac-address">
{{ device.mac_addr }}
</div>
</button>
<button
[disabled]="disabled || device.status === DeviceStatus.INVALID"
(click)="startTestrunClick()"
attr.aria-label="Start new testrun for device {{ label }}"
matTooltip="Test device"
class="button-start"
mat-flat-button>
<mat-icon class="button-start-icon" [svgIcon]="'device_run'"></mat-icon>
<ng-container
*ngTemplateOutlet="basicView; context: { editable: true }"></ng-container>
</button>
</div>

<ng-template #basicView let-editable="editable">
<span class="visually-hidden">{{ device.test_pack }}</span>
<app-program-type-icon
*ngIf="device.test_pack === TestingType.Qualification"
[type]="ProgramType.Qualification"
matTooltip="This device will be tested for Qualification."></app-program-type-icon>
<app-program-type-icon
*ngIf="device.test_pack === TestingType.Pilot"
[type]="ProgramType.Pilot"
matTooltip="This device will be tested for the Pilot program."></app-program-type-icon>
<p class="item-manufacturer" *ngIf="!editable">
<span>{{ device.manufacturer }}</span>
</p>
<div class="item-manufacturer" *ngIf="editable">
<p class="item-manufacturer-text">{{ device.manufacturer }}</p>
<mat-icon
class="item-manufacturer-icon"
fontSet="material-symbols-outlined">
edit_square</mat-icon
>
</div>
<div *ngIf="device.status === DeviceStatus.INVALID" class="item-status">
{{ INVALID_DEVICE }}
</div>
<p class="item-name">
{{ device.model }}
</p>
</ng-template>
173 changes: 49 additions & 124 deletions modules/ui/src/app/components/device-item/device-item.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,74 +23,73 @@ $border-radius: 12px;

.device-item {
display: grid;
width: variables.$device-item-width;
height: 80px;
border-radius: $border-radius;
border: 1px solid colors.$blue-300;
background: colors.$white;
grid-column-gap: 24px;
box-sizing: border-box;
grid-template-columns: 1fr 1fr;
padding: 0;
grid-column-gap: 8px;
grid-row-gap: 4px;
font-family: variables.$font-primary;
border-radius: variables.$corner-large;
align-items: center;
border: none;
}

.device-item-basic {
padding: 0 24px 0 32px;
width: variables.$device-item-width;
height: 92px;
box-shadow:
0px 1px 2px 0px rgba(0, 0, 0, 0.3),
0px 1px 3px 1px rgba(0, 0, 0, 0.15);
background: colors.$surface-container;
grid-template-columns: auto 1fr;
grid-template-areas:
'manufacturer manufacturer'
'name address';
'icon manufacturer'
'icon name';

&:hover {
cursor: pointer;
background: colors.$primary-container;
}

&.non-interactive {
&:hover {
background: colors.$surface-container;
cursor: default;
}
}
}

.device-item-with-actions {
display: grid;
width: variables.$device-item-width;
min-height: calc($icon-width - 2px);
border-radius: $border-radius;
border: 1px solid colors.$blue-300;
background: colors.$white;
box-sizing: border-box;
grid-template-columns: 1fr $icon-width;
grid-column-gap: 1px;
padding: 0;
font-family: variables.$font-primary;
grid-template-areas: 'edit start';
.item-manufacturer {
display: block;
max-width: 100%;
box-sizing: border-box;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
margin: 0;
}

&.device-item-outdated {
border-color: colors.$red-300;
.item-name {
width: 230px;
box-sizing: border-box;
text-align: start;
margin: 0;
}

.item-mac-address {
margin: 0;
}
}

.button-edit {
display: grid;
grid-area: edit;
background: colors.$white;
box-sizing: border-box;
grid-template-columns: 1fr 1fr;
padding: 0 6px 0 0;
grid-column-gap: 8px;
grid-row-gap: 4px;
font-family: variables.$font-primary;
width: 100%;
height: 100%;
background: inherit;
grid-template-columns: auto 1fr 1fr;
grid-template-areas:
'manufacturer status'
'name address';
border-radius: $border-radius 0 0 $border-radius;
border: none;
'icon manufacturer status'
'icon name name';

&:hover {
cursor: pointer;

.item-manufacturer-text {
max-width: 82px;
}

.item-manufacturer-icon {
visibility: visible;
width: 24px;
Expand All @@ -103,22 +102,6 @@ $border-radius: 12px;
}
}

.device-item:not(.non-interective):hover {
border-color: mat.get-theme-color($light-theme, primary, 35);
}

.device-item-with-actions:not(.device-item-outdated):has(
.button-edit:not(:disabled):hover
) {
border-color: mat.get-theme-color($light-theme, primary, 35);
}

.device-item-with-actions:not(.device-item-outdated):has(
.button-start:not(:disabled):hover
) {
border-color: mat.get-theme-color($light-theme, primary, 35);
}

.item-status {
margin-right: 16px;
grid-area: status;
Expand All @@ -137,11 +120,10 @@ $border-radius: 12px;

.item-manufacturer {
display: flex;
padding: 0 0 0 16px;
grid-area: manufacturer;
justify-self: start;
align-self: end;
color: #1f1f1f;
color: colors.$on-surface;
justify-content: flex-start;
font-size: 16px;
font-weight: 500;
Expand All @@ -153,7 +135,6 @@ $border-radius: 12px;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
max-width: 106px;
}

.item-manufacturer-icon {
Expand All @@ -167,10 +148,10 @@ $border-radius: 12px;
}

.item-name {
padding: 0 2px 0 16px;
align-self: start;
grid-area: name;
justify-self: start;
color: colors.$grey-800;
color: colors.$on-surface-variant;
font-size: 14px;
font-style: normal;
font-weight: 400;
Expand All @@ -184,66 +165,10 @@ $border-radius: 12px;
text-align: left;
}

.item-mac-address {
padding-right: 16px;
grid-area: address;
justify-self: end;
color: colors.$grey-700;
font-family: Roboto, sans-serif;
font-size: 12px;
padding-top: 2px;
line-height: 20px;
max-width: 100%;
app-program-type-icon {
grid-area: icon;
}

.button-start {
grid-area: start;
width: $icon-width;
.device-item-outdated {
height: 100%;
background-color: mat.get-theme-color($light-theme, primary, 95);
justify-self: end;
border-radius: 0 $border-radius $border-radius 0;

&:hover,
&:focus-visible {
background-color: mat.get-theme-color($light-theme, primary, 35);

.button-start-icon {
color: colors.$white;
}
}
&:disabled {
pointer-events: none;
background: rgba(60, 64, 67, 0.12);
}
}

.button-start-icon {
margin: 0;
width: 30px;
height: 24px;
}

.device-item {
.item-manufacturer {
display: block;
max-width: 100%;
box-sizing: border-box;
padding: 0 16px;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
margin: 0;
}

.item-name {
width: 230px;
box-sizing: border-box;
text-align: start;
margin: 0;
}

.item-mac-address {
margin: 0;
}
}
Loading
Loading