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
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<!-- Name -->
<div class="row mb-2">
<div class="form-group mt-3 col-12">
<label class="form-label" for="name">{{'QUESTION.DEVICE-MODEL.GIVE-NAME' | translate}}</label>
<label class="form-label" for="name">{{'QUESTION.DEVICE-MODEL.GIVE-NAME' | translate}}</label>*
<input type="text" class="form-control" id="name" name="name"
[placeholder]="'QUESTION.DEVICE-MODEL.GIVE-NAME-PLACEHOLDER' | translate" maxlength="50" required
[(ngModel)]="deviceModel.body.name"
Expand Down Expand Up @@ -63,14 +63,14 @@
<div class="row mb-2">
<div class="form-group mt-3 col-12">
<label class="form-label" for="controlledProperty">{{'QUESTION.DEVICE-MODEL.SELECT-CONTROLLEDPROPERTY' | translate}}</label>*
<mat-select
<mat-select
class="form-control"
multiple
multiple
[compareWith]="compare"
name="controlledProperty"
[(ngModel)]="deviceModel.body.controlledProperty">
<mat-option
*ngFor="let control of controlledPropperties"
<mat-option
*ngFor="let control of controlledPropperties"
[value]="control">
{{control}}
</mat-option>
Expand All @@ -81,13 +81,13 @@
<div class="row mb-2">
<div class="form-group mt-3 col-12">
<label class="form-label" for="categories">{{'QUESTION.DEVICE-MODEL.SELECT-CATEGORY' | translate}}</label>*
<mat-select
class="form-control"
<mat-select
class="form-control"
name="categories"
[compareWith]="compare"
[(ngModel)]="deviceModel.body.category">
<mat-option
*ngFor="let category of categories"
<mat-option
*ngFor="let category of categories"
[value]="category">
{{category}}
</mat-option>
Expand All @@ -98,14 +98,14 @@
<div class="row mb-2">
<div class="form-group mt-3 col-12">
<label class="form-label" for="supportedUnits">{{'QUESTION.DEVICE-MODEL.SELECT-SUPPORTEDUNITS' | translate}}</label>
<mat-select
class="form-control"
<mat-select
class="form-control"
name="supportedUnits"
multiple
multiple
[compareWith]="compare"
[(ngModel)]="deviceModel.body.supportedUnits">
<mat-option
*ngFor="let unit of supportedUnits.units"
<mat-option
*ngFor="let unit of supportedUnits.units"
[value]="unit.code">
{{unit.name}}
</mat-option>
Expand All @@ -116,13 +116,13 @@
<div class="row mb-2">
<div class="form-group mt-3 col-12">
<label class="form-label" for="devicefunction">{{'QUESTION.DEVICE-MODEL.SELECT-DEVICEFUNCTIONS' | translate}}</label>
<mat-select
class="form-control"
<mat-select
class="form-control"
name="devicefunction"
multiple [compareWith]="compare"
[(ngModel)]="deviceModel.body.function">
<mat-option
*ngFor="let function of deviceFunctions"
<mat-option
*ngFor="let function of deviceFunctions"
[value]="function">
{{function}}
</mat-option>
Expand All @@ -133,13 +133,13 @@
<div class="row mb-2">
<div class="form-group mt-3 col-12">
<label class="form-label" for="energyLimitationClass">{{'QUESTION.DEVICE-MODEL.SELECT-ENERGYLIMITATIONCLASS' | translate}}</label>
<mat-select
class="form-control"
<mat-select
class="form-control"
name="energyLimitationClass"
[compareWith]="compare"
[(ngModel)]="deviceModel.body.energyLimitationClass">
<mat-option
*ngFor="let elclass of energyLimitationClass.energyLimits"
<mat-option
*ngFor="let elclass of energyLimitationClass.energyLimits"
[value]="elclass.code">
{{elclass.name}}
</mat-option>
Expand All @@ -150,13 +150,13 @@
<div class="row mb-2">
<div class="form-group mt-3 col-12">
<label class="form-label" for="supportedProtocol">{{'QUESTION.DEVICE-MODEL.SELECT-SUPPORTEDPROTOCOL' | translate}}</label>
<mat-select
class="form-control"
<mat-select
class="form-control"
name="supportedProtocol"
multiple [compareWith]="compare"
[(ngModel)]="deviceModel.body.supportedProtocol">
<mat-option
*ngFor="let protocol of supportedProtocol"
<mat-option
*ngFor="let protocol of supportedProtocol"
[value]="protocol">
{{protocol}}
</mat-option>
Expand All @@ -168,11 +168,11 @@
<div class="form-group mt-3 col-12">
<a href="https://github.com/smart-data-models/dataModel.Device" target="_blank">
{{'QUESTION.DEVICE-MODEL.FIWARE-LINK-TEXT' | translate}}
</a>
</a>
</div>
</div>
<div class="form-group mt-5">
<button (click)="routeBack()" class="btn btn-secondary" type="button">{{ 'GEN.CANCEL' | translate}}</button>
<button class="btn btn-primary ml-2" type="submit">{{ 'GEN.SAVE' | translate}}</button>
</div>
</form>
</form>
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,14 @@ export class DeviceModelTableComponent implements OnInit, AfterViewInit {
// Flip flag to show that loading has finished.
this.isLoadingResults = false;
this.resultsLength = data.count;

return data.data.sort((a, b) =>
a.body.name.localeCompare(b.body.name, 'en', { numeric: true })
);
return data.data.sort((a, b) => {
if (a.body.name === undefined || b.body.name === undefined) {
return -1;
}
return a.body.name.localeCompare(b.body.name, 'en', {
numeric: true,
});
});
}),
catchError(() => {
this.isLoadingResults = false;
Expand Down