Skip to content

Commit bfc7e5d

Browse files
Merge branch 'stage' for release v1.4.2
2 parents a398d2a + 3fefd6e commit bfc7e5d

File tree

2 files changed

+36
-32
lines changed

2 files changed

+36
-32
lines changed

src/app/device-model/device-model-edit/device-model-edit.component.html

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<!-- Name -->
1111
<div class="row mb-2">
1212
<div class="form-group mt-3 col-12">
13-
<label class="form-label" for="name">{{'QUESTION.DEVICE-MODEL.GIVE-NAME' | translate}}</label>
13+
<label class="form-label" for="name">{{'QUESTION.DEVICE-MODEL.GIVE-NAME' | translate}}</label>*
1414
<input type="text" class="form-control" id="name" name="name"
1515
[placeholder]="'QUESTION.DEVICE-MODEL.GIVE-NAME-PLACEHOLDER' | translate" maxlength="50" required
1616
[(ngModel)]="deviceModel.body.name"
@@ -63,14 +63,14 @@
6363
<div class="row mb-2">
6464
<div class="form-group mt-3 col-12">
6565
<label class="form-label" for="controlledProperty">{{'QUESTION.DEVICE-MODEL.SELECT-CONTROLLEDPROPERTY' | translate}}</label>*
66-
<mat-select
66+
<mat-select
6767
class="form-control"
68-
multiple
68+
multiple
6969
[compareWith]="compare"
7070
name="controlledProperty"
7171
[(ngModel)]="deviceModel.body.controlledProperty">
72-
<mat-option
73-
*ngFor="let control of controlledPropperties"
72+
<mat-option
73+
*ngFor="let control of controlledPropperties"
7474
[value]="control">
7575
{{control}}
7676
</mat-option>
@@ -81,13 +81,13 @@
8181
<div class="row mb-2">
8282
<div class="form-group mt-3 col-12">
8383
<label class="form-label" for="categories">{{'QUESTION.DEVICE-MODEL.SELECT-CATEGORY' | translate}}</label>*
84-
<mat-select
85-
class="form-control"
84+
<mat-select
85+
class="form-control"
8686
name="categories"
8787
[compareWith]="compare"
8888
[(ngModel)]="deviceModel.body.category">
89-
<mat-option
90-
*ngFor="let category of categories"
89+
<mat-option
90+
*ngFor="let category of categories"
9191
[value]="category">
9292
{{category}}
9393
</mat-option>
@@ -98,14 +98,14 @@
9898
<div class="row mb-2">
9999
<div class="form-group mt-3 col-12">
100100
<label class="form-label" for="supportedUnits">{{'QUESTION.DEVICE-MODEL.SELECT-SUPPORTEDUNITS' | translate}}</label>
101-
<mat-select
102-
class="form-control"
101+
<mat-select
102+
class="form-control"
103103
name="supportedUnits"
104-
multiple
104+
multiple
105105
[compareWith]="compare"
106106
[(ngModel)]="deviceModel.body.supportedUnits">
107-
<mat-option
108-
*ngFor="let unit of supportedUnits.units"
107+
<mat-option
108+
*ngFor="let unit of supportedUnits.units"
109109
[value]="unit.code">
110110
{{unit.name}}
111111
</mat-option>
@@ -116,13 +116,13 @@
116116
<div class="row mb-2">
117117
<div class="form-group mt-3 col-12">
118118
<label class="form-label" for="devicefunction">{{'QUESTION.DEVICE-MODEL.SELECT-DEVICEFUNCTIONS' | translate}}</label>
119-
<mat-select
120-
class="form-control"
119+
<mat-select
120+
class="form-control"
121121
name="devicefunction"
122122
multiple [compareWith]="compare"
123123
[(ngModel)]="deviceModel.body.function">
124-
<mat-option
125-
*ngFor="let function of deviceFunctions"
124+
<mat-option
125+
*ngFor="let function of deviceFunctions"
126126
[value]="function">
127127
{{function}}
128128
</mat-option>
@@ -133,13 +133,13 @@
133133
<div class="row mb-2">
134134
<div class="form-group mt-3 col-12">
135135
<label class="form-label" for="energyLimitationClass">{{'QUESTION.DEVICE-MODEL.SELECT-ENERGYLIMITATIONCLASS' | translate}}</label>
136-
<mat-select
137-
class="form-control"
136+
<mat-select
137+
class="form-control"
138138
name="energyLimitationClass"
139139
[compareWith]="compare"
140140
[(ngModel)]="deviceModel.body.energyLimitationClass">
141-
<mat-option
142-
*ngFor="let elclass of energyLimitationClass.energyLimits"
141+
<mat-option
142+
*ngFor="let elclass of energyLimitationClass.energyLimits"
143143
[value]="elclass.code">
144144
{{elclass.name}}
145145
</mat-option>
@@ -150,13 +150,13 @@
150150
<div class="row mb-2">
151151
<div class="form-group mt-3 col-12">
152152
<label class="form-label" for="supportedProtocol">{{'QUESTION.DEVICE-MODEL.SELECT-SUPPORTEDPROTOCOL' | translate}}</label>
153-
<mat-select
154-
class="form-control"
153+
<mat-select
154+
class="form-control"
155155
name="supportedProtocol"
156156
multiple [compareWith]="compare"
157157
[(ngModel)]="deviceModel.body.supportedProtocol">
158-
<mat-option
159-
*ngFor="let protocol of supportedProtocol"
158+
<mat-option
159+
*ngFor="let protocol of supportedProtocol"
160160
[value]="protocol">
161161
{{protocol}}
162162
</mat-option>
@@ -168,11 +168,11 @@
168168
<div class="form-group mt-3 col-12">
169169
<a href="https://github.com/smart-data-models/dataModel.Device" target="_blank">
170170
{{'QUESTION.DEVICE-MODEL.FIWARE-LINK-TEXT' | translate}}
171-
</a>
171+
</a>
172172
</div>
173173
</div>
174174
<div class="form-group mt-5">
175175
<button (click)="routeBack()" class="btn btn-secondary" type="button">{{ 'GEN.CANCEL' | translate}}</button>
176176
<button class="btn btn-primary ml-2" type="submit">{{ 'GEN.SAVE' | translate}}</button>
177177
</div>
178-
</form>
178+
</form>

src/app/device-model/device-model-table/device-model-table.component.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,14 @@ export class DeviceModelTableComponent implements OnInit, AfterViewInit {
6565
// Flip flag to show that loading has finished.
6666
this.isLoadingResults = false;
6767
this.resultsLength = data.count;
68-
69-
return data.data.sort((a, b) =>
70-
a.body.name.localeCompare(b.body.name, 'en', { numeric: true })
71-
);
68+
return data.data.sort((a, b) => {
69+
if (a.body.name === undefined || b.body.name === undefined) {
70+
return -1;
71+
}
72+
return a.body.name.localeCompare(b.body.name, 'en', {
73+
numeric: true,
74+
});
75+
});
7276
}),
7377
catchError(() => {
7478
this.isLoadingResults = false;

0 commit comments

Comments
 (0)