Skip to content

Commit

Permalink
Fix for #279
Browse files Browse the repository at this point in the history
  • Loading branch information
ck-c8y committed Oct 29, 2024
1 parent e57f63d commit 4cdb56b
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,29 +32,30 @@ <h4>Add Mapping</h4>
#addMappingRef
>
<div>
<p
class="text-center text-medium text-16 sticky-top bg-white"
>
<p class="text-center text-medium text-16 sticky-top bg-white">
{{
'Select mapping type for ' +
(direction === Direction.INBOUND ? 'source ' : 'target') | translate
}}
</p>
<div class="p-24 modal-inner-scroll animated fadeIn">
<c8y-list-group class="separator-top">
<c8y-li *ngFor="let q of MappingType | keyvalue">
<c8y-li-radio
<ng-container *ngFor="let q of MappingType | keyvalue">
<c8y-li
*ngIf="
MAPPING_TYPE_DESCRIPTION[q.key].properties[direction]
.directionSupported
"
#liRadioOption1
name="mapping_type_group"
title="{{ q.value }}"
(click)="onSelectMappingType(q.value)"
></c8y-li-radio>
<span>{{ q.value | humanize }}</span>
</c8y-li>
>
<c8y-li-radio
#liRadioOption1
name="mapping_type_group"
title="{{ q.value }}"
(click)="onSelectMappingType(q.value)"
></c8y-li-radio>
<span>{{ q.value | humanize }}</span>
</c8y-li>
</ng-container>
</c8y-list-group>
<!-- <div
#mappingTypes
Expand Down Expand Up @@ -105,9 +106,12 @@ <h4>Add Mapping</h4>
</c8y-form-group>
<!-- <label>Mapping type description</label> -->
<c8y-form-group>
<textarea readonly c8y-textarea-autoresize class="form-control fit-w">{{
mappingTypeDescription
}}</textarea>
<textarea
readonly
c8y-textarea-autoresize
class="form-control fit-w"
>{{ mappingTypeDescription }}</textarea
>
</c8y-form-group>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export class MappingStepPropertiesComponent implements OnInit, OnDestroy {
@Input() stepperConfiguration: StepperConfiguration;
@Input() propertyFormly: FormGroup;

@Output() targetTemplateChanged = new EventEmitter<any>();
@Output() targetAPIChanged = new EventEmitter<any>();
@Output() snoopStatusChanged = new EventEmitter<SnoopStatus>();

ValidationError = ValidationError;
Expand Down Expand Up @@ -462,13 +462,7 @@ export class MappingStepPropertiesComponent implements OnInit, OnDestroy {

onTargetAPIChanged(targetAPI) {
this.mapping.targetAPI = targetAPI;
if (this.stepperConfiguration.direction == Direction.INBOUND) {
this.targetTemplateChanged.emit(
SAMPLE_TEMPLATES_C8Y[this.mapping.targetAPI]
);
} else {
this.targetTemplateChanged.emit(getExternalTemplate(this.mapping));
}
this.targetAPIChanged.emit(targetAPI);
}

ngOnDestroy() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ <h4 class="text-medium">
[deploymentMapEntry]="deploymentMapEntry"
[stepperConfiguration]="stepperConfiguration"
[propertyFormly]="propertyFormly"
(targetTemplateChanged)="onTemplateChanged($event)"
(targetAPIChanged)="onTargetAPIChanged($event)"
>
</d11r-mapping-properties>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -900,8 +900,20 @@ export class MappingStepperComponent implements OnInit, OnDestroy {
this.mapping.snoopStatus = SnoopStatus.STOPPED;
}

async onTargetTemplateChanged(templateTarget) {
this.templateTarget = templateTarget;
async onTargetAPIChanged(changedTargetAPI) {
if (this.stepperConfiguration.direction == Direction.INBOUND) {
this.mapping.target = SAMPLE_TEMPLATES_C8Y[changedTargetAPI];
this.mapping.source = getExternalTemplate(this.mapping);
this.schemaUpdateTarget.emit(
getSchema(this.mapping.targetAPI, this.mapping.direction, true)
);
} else {
this.mapping.source = SAMPLE_TEMPLATES_C8Y[changedTargetAPI];
this.mapping.target = getExternalTemplate(this.mapping);
this.schemaUpdateSource.emit(
getSchema(this.mapping.targetAPI, this.mapping.direction, false)
);
}
}

async updateTestResult(result) {
Expand Down

0 comments on commit 4cdb56b

Please sign in to comment.