Skip to content

Commit ad710b1

Browse files
committed
IOT-833 - add select no decoder option
1 parent 4bc2e2e commit ad710b1

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

src/app/shared/components/forms/form-body-datatarget/form-body-datatarget.component.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ <h6> {{'QUESTION.DATATARGET.RELATIONS' | translate}} </h6>
9797
<mat-select matNativeControl
9898
name="payloadDecoderId"
9999
[(value)]="element.payloadDecoderId">
100+
<mat-option [value]="0">
101+
{{'QUESTION.DATATARGET.NO-PAYLOAD-DECODER-SELECTED' | translate}}
102+
</mat-option>
100103
<mat-option *ngFor="let payloadDecoder of payloadDecoders" [value]="payloadDecoder.id">
101104
{{payloadDecoder.name}}
102105
</mat-option>

src/app/shared/components/forms/form-body-datatarget/form-body-datatarget.component.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,13 @@ export class FormBodyDatatargetComponent implements OnInit, OnDestroy {
138138

139139
addPayloadDeviceDatatarget() {
140140
this.counter = this.counter === undefined ? this.payloadDeviceDatatarget.length : this.counter + this.payloadDeviceDatatarget.length;
141+
this.payloadDeviceDatatarget.map(
142+
pdd => {
143+
if (pdd.payloadDecoderId === 0) {
144+
pdd.payloadDecoderId = null;
145+
}
146+
}
147+
)
141148
this.payloadDeviceDatatarget.forEach((relation) => {
142149
if (relation.id) {
143150
this.payloadDeviceDataTargetService.put(relation).subscribe(
@@ -282,7 +289,7 @@ export class FormBodyDatatargetComponent implements OnInit, OnDestroy {
282289
this.payloadDeviceDatatarget.push({
283290
id: element.id,
284291
iotDeviceIds: element.iotDevices.map((x) => x.id),
285-
payloadDecoderId: element.payloadDecoder?.id,
292+
payloadDecoderId: element.payloadDecoder?.id === undefined ? 0 : element.payloadDecoder?.id,
286293
dataTargetId: element.dataTarget.id
287294
});
288295
}

src/assets/i18n/da.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@
356356
"ADD-RELATIONS": "Tilføj device og payload decoder",
357357
"DATATARGET": {
358358
"SELECT-PAYLOADDECODER": "Vælg payload decoder",
359+
"NO-PAYLOAD-DECODER-SELECTED": "Ingen payload decoder valgt",
359360
"SELECT-DEVICES": "Vælg enheder",
360361
"SELECTALLDEVICES": "Vælg alle",
361362
"DESELECTALLDEVICES": "Fravælg alle",

0 commit comments

Comments
 (0)