aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/ng2/pages/type-workspace/type-workspace-properties/type-workspace-properties.component.ts
diff options
context:
space:
mode:
authorfranciscovila <javier.paradela.vila@est.tech>2023-02-07 17:00:03 +0000
committerMichael Morris <michael.morris@est.tech>2023-02-09 19:17:04 +0000
commitabbc25ad32db4f4c898bdaaea0b66c0a1d5fd8da (patch)
treea760d6e5495b797a8ee28acc42a83439e9b1a68f /catalog-ui/src/app/ng2/pages/type-workspace/type-workspace-properties/type-workspace-properties.component.ts
parentbe850f6e83cbaa5c16f79c2c8732583f42e55429 (diff)
Edit properties of non-normative data types
Develop all necessary changes in the UI to allow editing of non-normative data types Issue-ID: SDC-4373 Signed-off-by: franciscovila <javier.paradela.vila@est.tech> Change-Id: I37749fd3d2992f3134a09c07bb43c0208ce12a23
Diffstat (limited to 'catalog-ui/src/app/ng2/pages/type-workspace/type-workspace-properties/type-workspace-properties.component.ts')
-rw-r--r--catalog-ui/src/app/ng2/pages/type-workspace/type-workspace-properties/type-workspace-properties.component.ts29
1 files changed, 22 insertions, 7 deletions
diff --git a/catalog-ui/src/app/ng2/pages/type-workspace/type-workspace-properties/type-workspace-properties.component.ts b/catalog-ui/src/app/ng2/pages/type-workspace/type-workspace-properties/type-workspace-properties.component.ts
index 83651fc73c..60edd13c2d 100644
--- a/catalog-ui/src/app/ng2/pages/type-workspace/type-workspace-properties/type-workspace-properties.component.ts
+++ b/catalog-ui/src/app/ng2/pages/type-workspace/type-workspace-properties/type-workspace-properties.component.ts
@@ -132,12 +132,20 @@ export class TypeWorkspacePropertiesComponent implements OnInit {
this.filter();
}
+ private updateProperty(oldProperty: PropertyBEModel, newProperty: PropertyBEModel) {
+ this.properties.forEach((value,index)=>{
+ if(value.name == oldProperty.name) this.properties.splice(index,1);
+ });
+ this.properties.push(newProperty);
+ this.filter();
+ }
+
onClickAddProperty() {
- this.openAddPropertyModal();
+ this.openAddPropertyModal(null, false);
}
private openAddPropertyModal(property?: PropertyBEModel, readOnly: boolean = false) {
- const modalTitle = this.translateService.translate('PROPERTY_ADD_MODAL_TITLE');
+ const modalTitle = this.translateService.translate(property ? 'PROPERTY_EDIT_MODAL_TITLE' : 'PROPERTY_ADD_MODAL_TITLE');
const modalButtons = [];
let disableSaveButtonFlag = true;
let propertyFromModal: PropertyBEModel = undefined;
@@ -156,9 +164,16 @@ export class TypeWorkspacePropertiesComponent implements OnInit {
modalButtons.push(new ButtonModel(this.translateService.translate('MODAL_SAVE'), 'blue',
() => {
disableSaveButtonFlag = true;
- this.dataTypeService.createProperty(this.dataType.uniqueId, propertyFromModal).subscribe(property => {
- this.addProperty(new PropertyBEModel(property));
- });
+ if (property) {
+ this.dataTypeService.updateProperty(this.dataType.uniqueId, propertyFromModal).subscribe(property => {
+ this.updateProperty(propertyFromModal, new PropertyBEModel(property));
+ });
+ }
+ else {
+ this.dataTypeService.createProperty(this.dataType.uniqueId, propertyFromModal).subscribe(property => {
+ this.addProperty(new PropertyBEModel(property));
+ });
+ }
this.modalService.closeCurrentModal();
},
(): boolean => {
@@ -185,8 +200,8 @@ export class TypeWorkspacePropertiesComponent implements OnInit {
modal.instance.open();
}
- onRowClick(property: PropertyBEModel) {
- this.openAddPropertyModal(property, true);
+ onNameClick(property: PropertyBEModel) {
+ this.openAddPropertyModal(property, this.isViewOnly);
}
private showPropertiesMap(properties: Array<PropertyBEModel>): void {