summaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/ng2/pages/composition/palette/palette-popup-panel/palette-popup-panel.component.ts
diff options
context:
space:
mode:
authorstasys10 <stasys.jurgaitis@est.tech>2022-01-04 14:15:06 +0000
committerMichael Morris <michael.morris@est.tech>2022-02-02 11:34:41 +0000
commitd76c30d1156c7fa52fa9ab8a8df9562181ecacba (patch)
treeed197c4dc5d5e8c09d482706add241a91a97acd7 /catalog-ui/src/app/ng2/pages/composition/palette/palette-popup-panel/palette-popup-panel.component.ts
parent17862485d3475a81aa836f84609ec1a2b69b1d64 (diff)
fix policy and group drag and drop bug
Issue-ID: SDC-3864 Signed-off-by: stasys10 <stasys.jurgaitis@est.tech> Change-Id: Ib45b4a1b650a7d5959e4a6ff70d46d6dee0586c2
Diffstat (limited to 'catalog-ui/src/app/ng2/pages/composition/palette/palette-popup-panel/palette-popup-panel.component.ts')
-rw-r--r--catalog-ui/src/app/ng2/pages/composition/palette/palette-popup-panel/palette-popup-panel.component.ts98
1 files changed, 0 insertions, 98 deletions
diff --git a/catalog-ui/src/app/ng2/pages/composition/palette/palette-popup-panel/palette-popup-panel.component.ts b/catalog-ui/src/app/ng2/pages/composition/palette/palette-popup-panel/palette-popup-panel.component.ts
deleted file mode 100644
index 5d98fc7f78..0000000000
--- a/catalog-ui/src/app/ng2/pages/composition/palette/palette-popup-panel/palette-popup-panel.component.ts
+++ /dev/null
@@ -1,98 +0,0 @@
-import {Component, OnInit} from '@angular/core';
-import {GRAPH_EVENTS, SdcElementType} from "app/utils";
-import {LeftPaletteComponent, Point} from "app/models";
-import {EventListenerService} from "app/services";
-import {LeftPaletteMetadataTypes} from "app/models/components/displayComponent";
-
-@Component({
- selector: 'app-palette-popup-panel',
- templateUrl: './palette-popup-panel.component.html',
- styleUrls: [ './palette-popup-panel.component.less' ],
-})
-export class PalettePopupPanelComponent implements OnInit {
-
- public panelTitle: string;
- public isShowPanel: boolean;
- private component: Component;
- private displayComponent: LeftPaletteComponent;
- private popupPanelPosition:Point = new Point(0,0);
-
- constructor(private eventListenerService: EventListenerService) {
- this.isShowPanel = false;
- }
-
- ngOnInit() {
- this.registerObserverCallbacks();
- }
-
- public onMouseEnter() {
- this.isShowPanel = true;
- }
-
- public getMenuItems = () => {
- return [{
- text: 'Delete',
- iconName: 'trash-o',
- iconType: 'common',
- iconMode: 'secondary',
- iconSize: 'small',
- type: '',
- action: () => this.addZoneInstance()
- }];
- }
-
- public onMouseLeave() {
- this.isShowPanel = false;
- }
-
- public addZoneInstance(): void {
- if(this.displayComponent) {
- this.eventListenerService.notifyObservers(GRAPH_EVENTS.ON_ADD_ZONE_INSTANCE_FROM_PALETTE, this.component, this.displayComponent, this.popupPanelPosition);
- this.hidePopupPanel();
- }
- }
-
- private registerObserverCallbacks() {
-
- this.eventListenerService.registerObserverCallback(GRAPH_EVENTS.ON_PALETTE_COMPONENT_SHOW_POPUP_PANEL,
- (displayComponent: LeftPaletteComponent, sectionElem: HTMLElement) => {
- this.showPopupPanel(displayComponent, sectionElem);
- });
-
- this.eventListenerService.registerObserverCallback(GRAPH_EVENTS.ON_PALETTE_COMPONENT_HIDE_POPUP_PANEL, () => this.hidePopupPanel());
- }
-
- private getPopupPanelPosition (sectionElem: HTMLElement):Point {
- let pos: ClientRect = sectionElem.getBoundingClientRect();
- let offsetX: number = -30;
- const offsetY: number = pos.height / 2;
- return new Point((pos.right + offsetX), (pos.top - offsetY + window.pageYOffset));
- };
-
- private setPopupPanelTitle(component: LeftPaletteComponent): void {
- if (component.componentSubType === SdcElementType.GROUP) {
- this.panelTitle = "Add Group";
- return;
- }
-
- if (component.componentSubType === SdcElementType.POLICY) {
- this.panelTitle = "Add Policy";
- return;
- }
- }
-
- private showPopupPanel(displayComponent:LeftPaletteComponent, sectionElem: HTMLElement) {
- if(!this.isShowPanel){
- this.displayComponent = displayComponent;
- this.setPopupPanelTitle(displayComponent);
- this.popupPanelPosition = this.getPopupPanelPosition(sectionElem);
- this.isShowPanel = true;
- }
- };
-
- private hidePopupPanel() {
- if(this.isShowPanel){
- this.isShowPanel = false;
- }
- };
-}