From 7e2d183c7d358c09e9025d97626329a2e6601270 Mon Sep 17 00:00:00 2001 From: sagIoTPower Date: Mon, 12 Feb 2024 11:49:25 +0100 Subject: [PATCH] deleted unused custom formly fields --- .../main/resources/application-dev.properties | 8 +- .../src/main/resources/application.properties | 2 +- .../src/dynamic-mapping.module.ts | 22 +---- .../src/mapping/mapping.module.ts | 12 +-- .../shared/formly/button.type.component.ts | 41 --------- .../formly/c8y-switch.type.component.ts | 44 --------- .../checkbox/checkbox.type.component.html | 53 ----------- .../checkbox/checkbox.type.component.ts | 60 ------------- ... custom-form-field.wrapper.component.html} | 0 ...=> custom-form-field.wrapper.component.ts} | 2 +- .../shared/formly/filler.type.component.ts | 29 ------ ...ent.ts => horizontal.wrapper.component.ts} | 2 +- .../formly/select/select.type.component.html | 39 -------- .../formly/select/select.type.component.ts | 89 ------------------- .../step-main/mapping-stepper.component.ts | 9 +- .../step-one/mapping-properties.component.ts | 2 +- 16 files changed, 18 insertions(+), 396 deletions(-) delete mode 100644 dynamic-mapping-ui/src/mapping/shared/formly/button.type.component.ts delete mode 100644 dynamic-mapping-ui/src/mapping/shared/formly/c8y-switch.type.component.ts delete mode 100644 dynamic-mapping-ui/src/mapping/shared/formly/checkbox/checkbox.type.component.html delete mode 100644 dynamic-mapping-ui/src/mapping/shared/formly/checkbox/checkbox.type.component.ts rename dynamic-mapping-ui/src/mapping/shared/formly/{form-field/custom-form.type.component.html => custom-form-field.wrapper.component.html} (100%) rename dynamic-mapping-ui/src/mapping/shared/formly/{form-field/custom-form.type.component.ts => custom-form-field.wrapper.component.ts} (90%) delete mode 100644 dynamic-mapping-ui/src/mapping/shared/formly/filler.type.component.ts rename dynamic-mapping-ui/src/mapping/shared/formly/{horizontal-wrapper.type.component.ts => horizontal.wrapper.component.ts} (96%) delete mode 100644 dynamic-mapping-ui/src/mapping/shared/formly/select/select.type.component.html delete mode 100644 dynamic-mapping-ui/src/mapping/shared/formly/select/select.type.component.ts diff --git a/dynamic-mapping-service/src/main/resources/application-dev.properties b/dynamic-mapping-service/src/main/resources/application-dev.properties index 0d8542fe..29becb6e 100644 --- a/dynamic-mapping-service/src/main/resources/application-dev.properties +++ b/dynamic-mapping-service/src/main/resources/application-dev.properties @@ -20,8 +20,12 @@ # # properties used for local testing -APP.additionalSubscriptionIdTest= +APP.additionalSubscriptionIdTest=herz # C8Y.bootstrap.user=servicebootstrap_mqtt-mapping-service # C8Y.bootstrap.password= # C8Y.bootstrap.tenant= -# C8Y.baseURL= \ No newline at end of file +# C8Y.baseURL= +C8Y.bootstrap.user=servicebootstrap_dynamic-mapping-service +C8Y.bootstrap.password=KPViCgfRXWSr02nRy903L62C1jkoExMl +C8Y.bootstrap.tenant=t14070519 +C8Y.baseURL=https://sag-dach.eu-latest.cumulocity.com \ No newline at end of file diff --git a/dynamic-mapping-service/src/main/resources/application.properties b/dynamic-mapping-service/src/main/resources/application.properties index 262e38f7..e8173d59 100644 --- a/dynamic-mapping-service/src/main/resources/application.properties +++ b/dynamic-mapping-service/src/main/resources/application.properties @@ -19,7 +19,7 @@ # @authors Christof Strack, Stefan Witschel # -spring.profiles.active=prod +spring.profiles.active=dev application.name=dynamic-mapping-service server.port=8080 server.error.include-message=always diff --git a/dynamic-mapping-ui/src/dynamic-mapping.module.ts b/dynamic-mapping-ui/src/dynamic-mapping.module.ts index d6a02ca1..905720a7 100644 --- a/dynamic-mapping-ui/src/dynamic-mapping.module.ts +++ b/dynamic-mapping-ui/src/dynamic-mapping.module.ts @@ -48,17 +48,12 @@ import { checkTopicsInboundAreValid, checkTopicsOutboundAreValid } from './mapping/shared/util'; -import { SelectComponent } from './mapping/shared/formly/select/select.type.component'; -import { FieldCheckbox } from './mapping/shared/formly/checkbox/checkbox.type.component'; -import { FormlyFieldButton } from './mapping/shared/formly/button.type.component'; -import { C8YSwitchField } from './mapping/shared/formly/c8y-switch.type.component'; -import { FormlyFiller } from './mapping/shared/formly/filler.type.component'; -import { WrapperCustomFormField } from './mapping/shared/formly/form-field/custom-form.type.component'; -import { FormlyHorizontalWrapper } from './mapping/shared/formly/horizontal-wrapper.type.component'; +import { WrapperFormlyHorizontal } from './mapping/shared/formly/horizontal.wrapper.component'; import { FieldInputCustom } from './mapping/shared/formly/input-custom.type.component'; import { MessageField } from './mapping/shared/formly/message.type.component'; import { FormlyTextField } from './mapping/shared/formly/text.type.component'; import { FieldTextareaCustom } from './mapping/shared/formly/textarea.type.component'; +import { WrapperCustomFormField } from './mapping/shared/formly/custom-form-field.wrapper.component'; @NgModule({ imports: [ @@ -101,24 +96,15 @@ import { FieldTextareaCustom } from './mapping/shared/formly/textarea.type.compo ], types: [ { name: 'text', component: FormlyTextField }, - { name: 'filler', component: FormlyFiller }, { name: 'textarea-custom', component: FieldTextareaCustom }, { name: 'input-custom', component: FieldInputCustom }, - { name: 'button', component: FormlyFieldButton }, { name: 'message-field', component: MessageField }, - { name: 'c8y-switch', component: C8YSwitchField }, - { - name: 'select', - component: SelectComponent, - wrappers: ['c8y-form-field'] - }, { name: 'enum', extends: 'select' }, - { name: 'checkbox', component: FieldCheckbox }, { name: 'boolean', extends: 'checkbox' } ], wrappers: [ - { name: 'form-field-horizontal', component: FormlyHorizontalWrapper }, - { name: 'custom-form-field', component: WrapperCustomFormField } + { name: 'form-field-horizontal', component: WrapperFormlyHorizontal }, + { name: 'custom-form-field', component: WrapperCustomFormField }, ] } } diff --git a/dynamic-mapping-ui/src/mapping/mapping.module.ts b/dynamic-mapping-ui/src/mapping/mapping.module.ts index 94792da8..1894978f 100644 --- a/dynamic-mapping-ui/src/mapping/mapping.module.ts +++ b/dynamic-mapping-ui/src/mapping/mapping.module.ts @@ -41,19 +41,16 @@ import { SnoopedTemplateRendererComponent } from './renderer/snoopedTemplate.ren import { StatusActivationRendererComponent } from './renderer/status-activation-renderer.component'; import { StatusRendererComponent } from './renderer/status-cell.renderer.component'; import { TemplateRendererComponent } from './renderer/template.renderer.component'; -import { C8YSwitchField } from './shared/formly/c8y-switch.type.component'; -import { FieldCheckbox } from './shared/formly/checkbox/checkbox.type.component'; -import { WrapperCustomFormField } from './shared/formly/form-field/custom-form.type.component'; -import { FormlyHorizontalWrapper } from './shared/formly/horizontal-wrapper.type.component'; +import { WrapperFormlyHorizontal } from './shared/formly/horizontal.wrapper.component'; import { FieldInputCustom } from './shared/formly/input-custom.type.component'; import { MessageField } from './shared/formly/message.type.component'; -import { SelectComponent } from './shared/formly/select/select.type.component'; import { SnoopingModalComponent } from './snooping/snooping-modal.component'; import { MappingStepperComponent } from './step-main/mapping-stepper.component'; import { SubstitutionRendererComponent } from './step-main/substitution/substitution-renderer.component'; import { MappingStepPropertiesComponent } from './step-one/mapping-properties.component'; import { MappingStepTestingComponent } from './step-three/mapping-testing.component'; import { MappingSubscriptionComponent } from './subscription/mapping-subscription.component'; +import { WrapperCustomFormField } from './shared/formly/custom-form-field.wrapper.component'; @NgModule({ declarations: [ @@ -76,11 +73,8 @@ import { MappingSubscriptionComponent } from './subscription/mapping-subscriptio SnoopingModalComponent, MappingTypeComponent, MessageField, - FormlyHorizontalWrapper, + WrapperFormlyHorizontal, WrapperCustomFormField, - C8YSwitchField, - SelectComponent, - FieldCheckbox, FieldInputCustom ], imports: [ diff --git a/dynamic-mapping-ui/src/mapping/shared/formly/button.type.component.ts b/dynamic-mapping-ui/src/mapping/shared/formly/button.type.component.ts deleted file mode 100644 index 0ccdfcb0..00000000 --- a/dynamic-mapping-ui/src/mapping/shared/formly/button.type.component.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2022 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, - * and/or its subsidiaries and/or its affiliates and/or their licensors. - * - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * @authors Christof Strack - */ - -import { Component } from '@angular/core'; -import { FieldType } from '@ngx-formly/core'; - -@Component({ - selector: 'd11r-formly-field-button', - template: ` -
- -
- ` -}) -export class FormlyFieldButton extends FieldType { - onClick($event) { - if (this.to.onClick) { - this.to.onClick($event); - } - } -} diff --git a/dynamic-mapping-ui/src/mapping/shared/formly/c8y-switch.type.component.ts b/dynamic-mapping-ui/src/mapping/shared/formly/c8y-switch.type.component.ts deleted file mode 100644 index 55d8aa7a..00000000 --- a/dynamic-mapping-ui/src/mapping/shared/formly/c8y-switch.type.component.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2022 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, - * and/or its subsidiaries and/or its affiliates and/or their licensors. - * - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * @authors Christof Strack - */ - -import { Component } from '@angular/core'; -import { FieldType } from '@ngx-formly/core'; - -@Component({ - selector: 'd11r-formly-switch', - template: ` -
- -
- -
-
- ` -}) -export class C8YSwitchField extends FieldType {} diff --git a/dynamic-mapping-ui/src/mapping/shared/formly/checkbox/checkbox.type.component.html b/dynamic-mapping-ui/src/mapping/shared/formly/checkbox/checkbox.type.component.html deleted file mode 100644 index 8e369a00..00000000 --- a/dynamic-mapping-ui/src/mapping/shared/formly/checkbox/checkbox.type.component.html +++ /dev/null @@ -1,53 +0,0 @@ - - - - diff --git a/dynamic-mapping-ui/src/mapping/shared/formly/checkbox/checkbox.type.component.ts b/dynamic-mapping-ui/src/mapping/shared/formly/checkbox/checkbox.type.component.ts deleted file mode 100644 index 07f321a3..00000000 --- a/dynamic-mapping-ui/src/mapping/shared/formly/checkbox/checkbox.type.component.ts +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2022 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, - * and/or its subsidiaries and/or its affiliates and/or their licensors. - * - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * @authors Christof Strack - */ - -import { ChangeDetectionStrategy, Component } from '@angular/core'; -import { ConfigOption, FieldType } from '@ngx-formly/core'; - -@Component({ - selector: 'c8y-field-checkbox', - templateUrl: './checkbox.type.component.html', - changeDetection: ChangeDetectionStrategy.OnPush -}) -export class FieldCheckbox extends FieldType { - static readonly CONFIG: ConfigOption = { - types: [ - { - name: 'checkbox', - component: FieldCheckbox - }, - { - name: 'boolean', - extends: 'checkbox' - }, - { - name: 'switch', - extends: 'checkbox', - defaultOptions: { - templateOptions: { - switchMode: false, - indeterminate: false - } - } - } - ] - }; - - defaultOptions = { - templateOptions: { - indeterminate: true, - formCheck: 'custom' // 'custom' | 'custom-inline' | 'custom-switch' | 'stacked' | 'inline' | 'nolabel' - } - }; -} diff --git a/dynamic-mapping-ui/src/mapping/shared/formly/form-field/custom-form.type.component.html b/dynamic-mapping-ui/src/mapping/shared/formly/custom-form-field.wrapper.component.html similarity index 100% rename from dynamic-mapping-ui/src/mapping/shared/formly/form-field/custom-form.type.component.html rename to dynamic-mapping-ui/src/mapping/shared/formly/custom-form-field.wrapper.component.html diff --git a/dynamic-mapping-ui/src/mapping/shared/formly/form-field/custom-form.type.component.ts b/dynamic-mapping-ui/src/mapping/shared/formly/custom-form-field.wrapper.component.ts similarity index 90% rename from dynamic-mapping-ui/src/mapping/shared/formly/form-field/custom-form.type.component.ts rename to dynamic-mapping-ui/src/mapping/shared/formly/custom-form-field.wrapper.component.ts index 9bc23b50..f1ab5dee 100644 --- a/dynamic-mapping-ui/src/mapping/shared/formly/form-field/custom-form.type.component.ts +++ b/dynamic-mapping-ui/src/mapping/shared/formly/custom-form-field.wrapper.component.ts @@ -3,7 +3,7 @@ import { FieldWrapper } from '@ngx-formly/core'; @Component({ selector: 'd11r-wrapper-form-field', - templateUrl: './custom-form.type.component.html' + templateUrl: './custom-form-field.wrapper.component.html' // changeDetection: ChangeDetectionStrategy.OnPush }) export class WrapperCustomFormField extends FieldWrapper implements OnInit { diff --git a/dynamic-mapping-ui/src/mapping/shared/formly/filler.type.component.ts b/dynamic-mapping-ui/src/mapping/shared/formly/filler.type.component.ts deleted file mode 100644 index 238ebc97..00000000 --- a/dynamic-mapping-ui/src/mapping/shared/formly/filler.type.component.ts +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2022 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, - * and/or its subsidiaries and/or its affiliates and/or their licensors. - * - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * @authors Christof Strack - */ - -import { Component } from '@angular/core'; -import { FieldType } from '@ngx-formly/core'; - -@Component({ - selector: 'd11r-formly-filler', - template: '
' -}) -export class FormlyFiller extends FieldType {} diff --git a/dynamic-mapping-ui/src/mapping/shared/formly/horizontal-wrapper.type.component.ts b/dynamic-mapping-ui/src/mapping/shared/formly/horizontal.wrapper.component.ts similarity index 96% rename from dynamic-mapping-ui/src/mapping/shared/formly/horizontal-wrapper.type.component.ts rename to dynamic-mapping-ui/src/mapping/shared/formly/horizontal.wrapper.component.ts index a56ab7ac..a1b08f3b 100644 --- a/dynamic-mapping-ui/src/mapping/shared/formly/horizontal-wrapper.type.component.ts +++ b/dynamic-mapping-ui/src/mapping/shared/formly/horizontal.wrapper.component.ts @@ -41,4 +41,4 @@ import { FieldWrapper } from '@ngx-formly/core'; ` }) -export class FormlyHorizontalWrapper extends FieldWrapper {} +export class WrapperFormlyHorizontal extends FieldWrapper {} diff --git a/dynamic-mapping-ui/src/mapping/shared/formly/select/select.type.component.html b/dynamic-mapping-ui/src/mapping/shared/formly/select/select.type.component.html deleted file mode 100644 index ac143513..00000000 --- a/dynamic-mapping-ui/src/mapping/shared/formly/select/select.type.component.html +++ /dev/null @@ -1,39 +0,0 @@ - - -
- -
diff --git a/dynamic-mapping-ui/src/mapping/shared/formly/select/select.type.component.ts b/dynamic-mapping-ui/src/mapping/shared/formly/select/select.type.component.ts deleted file mode 100644 index d4b367fd..00000000 --- a/dynamic-mapping-ui/src/mapping/shared/formly/select/select.type.component.ts +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2022 Software AG, Darmstadt, Germany and/or Software AG USA Inc., Reston, VA, USA, - * and/or its subsidiaries and/or its affiliates and/or their licensors. - * - * SPDX-License-Identifier: Apache-2.0 - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * @authors Christof Strack - */ - -import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core'; -import { gettext } from '@c8y/ngx-components'; -import { ConfigOption, FieldType } from '@ngx-formly/core'; -import { TranslateService } from '@ngx-translate/core'; -import { get } from 'lodash-es'; -import { defer, isObservable, of } from 'rxjs'; -import { map, startWith, switchMap } from 'rxjs/operators'; - -@Component({ - selector: 'c8y-select-type', - templateUrl: './select.type.component.html', - changeDetection: ChangeDetectionStrategy.OnPush -}) -export class SelectComponent extends FieldType implements OnInit { - static readonly CONFIG: ConfigOption = { - types: [ - { - name: 'select', - component: SelectComponent, - wrappers: ['c8y-form-field'] - }, - { name: 'enum', extends: 'select' } - ] - }; - - labelProp = 'label'; - valueProp = 'value'; - - placeholder$ = defer(() => of(this.to?.placeholder)).pipe( - switchMap((placeholder) => - placeholder - ? of(placeholder) - : this.defaultPlaceholder$.pipe( - startWith( - this.translateService.instant(gettext('Select your option')) - ) - ) - ) - ); - - defaultPlaceholder$ = defer(() => - isObservable(this.to?.options) ? this.to?.options : of(this.to?.options) - ).pipe( - map((data) => get(data[0], this.labelProp)), - map((example) => - this.translateService.instant( - !example - ? gettext('No items') - : gettext('Select your option, for example, {{ example }}'), - { example } - ) - ) - ); - - constructor(private translateService: TranslateService) { - super(); - } - - ngOnInit() { - if (this.to?.labelProp?.length > 0) { - this.labelProp = this.to.labelProp; - } - - if (this.to?.valueProp?.length > 0) { - this.valueProp = this.to.valueProp; - } - } -} diff --git a/dynamic-mapping-ui/src/mapping/step-main/mapping-stepper.component.ts b/dynamic-mapping-ui/src/mapping/step-main/mapping-stepper.component.ts index 5729f2d2..1c05930b 100644 --- a/dynamic-mapping-ui/src/mapping/step-main/mapping-stepper.component.ts +++ b/dynamic-mapping-ui/src/mapping/step-main/mapping-stepper.component.ts @@ -71,10 +71,9 @@ import { SnoopingModalComponent } from '../snooping/snooping-modal.component'; import { EditorMode, StepperConfiguration } from './stepper-model'; import { SubstitutionRendererComponent } from './substitution/substitution-renderer.component'; import { MessageField } from '../shared/formly/message.type.component'; -import { FormlyTextField } from '../shared/formly/text.type.component'; -import { WrapperCustomFormField } from '../shared/formly/form-field/custom-form.type.component'; import { FieldTextareaCustom } from '../shared/formly/textarea.type.component'; import { FieldInputCustom } from '../shared/formly/input-custom.type.component'; +import { WrapperCustomFormField } from '../shared/formly/custom-form-field.wrapper.component'; @Component({ selector: 'd11r-mapping-stepper', @@ -321,12 +320,6 @@ export class MappingStepperComponent implements OnInit, OnDestroy { { fieldGroup: [ - { - // dummy row to start new row - className: 'row', - key: 'textField', - type: FormlyTextField // 'text' - }, { className: 'col-lg-5 col-lg-offset-1 text-monospace font-smaller column-right-border', diff --git a/dynamic-mapping-ui/src/mapping/step-one/mapping-properties.component.ts b/dynamic-mapping-ui/src/mapping/step-one/mapping-properties.component.ts index 018faa78..701571ea 100644 --- a/dynamic-mapping-ui/src/mapping/step-one/mapping-properties.component.ts +++ b/dynamic-mapping-ui/src/mapping/step-one/mapping-properties.component.ts @@ -216,7 +216,7 @@ export class MappingStepPropertiesComponent implements OnInit, OnDestroy { // filler when template topic is not shown { className: 'col-lg-6', - type: 'filler', + template: '
', hideExpression: this.stepperConfiguration.direction != Direction.OUTBOUND },