diff options
Diffstat (limited to 'catalog-ui/src/app/ng2/components/logic/properties-table/properties-table.component.ts')
-rw-r--r-- | catalog-ui/src/app/ng2/components/logic/properties-table/properties-table.component.ts | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/catalog-ui/src/app/ng2/components/logic/properties-table/properties-table.component.ts b/catalog-ui/src/app/ng2/components/logic/properties-table/properties-table.component.ts index b11bc02fb9..167509b1e6 100644 --- a/catalog-ui/src/app/ng2/components/logic/properties-table/properties-table.component.ts +++ b/catalog-ui/src/app/ng2/components/logic/properties-table/properties-table.component.ts @@ -22,6 +22,7 @@ import { Component, Input, Output, EventEmitter} from "@angular/core"; import {PropertyFEModel, DerivedFEProperty, InstanceFePropertiesMap} from "app/models"; import {PropertiesService} from "../../../services/properties.service"; +import {ModalService} from "../../../services/modal.service"; import { InstanceFeDetails } from "../../../../models/instance-fe-details"; @Component({ @@ -40,10 +41,13 @@ export class PropertiesTableComponent { @Input() isLoading:boolean; @Input() hasDeclareOption:boolean; @Input() hidePropertyType:boolean; + @Input() showDelete:boolean; @Output('propertyChanged') emitter: EventEmitter<PropertyFEModel> = new EventEmitter<PropertyFEModel>(); @Output() selectPropertyRow: EventEmitter<PropertyRowSelectedEvent> = new EventEmitter<PropertyRowSelectedEvent>(); @Output() updateCheckedPropertyCount: EventEmitter<boolean> = new EventEmitter<boolean>();//only for hasDeclareOption + @Output() deleteProperty: EventEmitter<PropertyFEModel> = new EventEmitter<PropertyFEModel>(); + private selectedPropertyToDelete: PropertyFEModel; sortBy: String; reverse: boolean; @@ -57,7 +61,7 @@ export class PropertiesTableComponent { this.path = sortBy.split('.'); } - constructor (private propertiesService:PropertiesService ){ + constructor (private propertiesService:PropertiesService, private modalService: ModalService){ } ngOnInit() { @@ -92,6 +96,17 @@ export class PropertiesTableComponent { this.updateCheckedPropertyCount.emit(isChecked); } + onDeleteProperty = () => { + this.deleteProperty.emit(this.selectedPropertyToDelete); + this.modalService.closeCurrentModal(); + }; + + openDeleteModal = (property:PropertyFEModel) => { + this.selectedPropertyToDelete = property; + this.modalService.createActionModal("Delete Property", "Are you sure you want to delete this property?", + "Delete", this.onDeleteProperty, "Close").instance.open(); + } + } export class PropertyRowSelectedEvent { |