aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/ng2/components/ui/canvas-zone/zone-instance
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-ui/src/app/ng2/components/ui/canvas-zone/zone-instance')
-rw-r--r--catalog-ui/src/app/ng2/components/ui/canvas-zone/zone-instance/zone-instance.component.html26
-rw-r--r--catalog-ui/src/app/ng2/components/ui/canvas-zone/zone-instance/zone-instance.component.less134
-rw-r--r--catalog-ui/src/app/ng2/components/ui/canvas-zone/zone-instance/zone-instance.component.ts110
3 files changed, 0 insertions, 270 deletions
diff --git a/catalog-ui/src/app/ng2/components/ui/canvas-zone/zone-instance/zone-instance.component.html b/catalog-ui/src/app/ng2/components/ui/canvas-zone/zone-instance/zone-instance.component.html
deleted file mode 100644
index 728764c427..0000000000
--- a/catalog-ui/src/app/ng2/components/ui/canvas-zone/zone-instance/zone-instance.component.html
+++ /dev/null
@@ -1,26 +0,0 @@
-<!--
- ~ Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
- * 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.
- -->
-
-
-<div tooltip="{{zoneInstance.instanceData.name}}" #currentComponent
- class="zone-instance mode-{{zoneInstance.mode}}" [class.locked]="activeInstanceMode > MODE.HOVER" [class.hiding]="hidden"
- (mouseenter)="setMode(MODE.HOVER)" (mouseleave)="setMode(MODE.NONE)" (click)="setMode(MODE.SELECTED, $event)">
- <div *ngIf="zoneInstance.handle" class="target-handle {{zoneInstance.handle}}" (click)="tagHandleClicked($event)"></div>
- <div *ngIf="!isViewOnly" class="zone-instance__handle" (click)="setMode(MODE.TAG, $event)">+</div>
- <div class="zone-instance__body">
- <div class="zone-instance__body-content">{{zoneInstance.assignments.length || defaultIconText}}</div>
- </div>
- <div class="zone-instance__name">{{zoneInstance.instanceData.name}}</div>
-</div> \ No newline at end of file
diff --git a/catalog-ui/src/app/ng2/components/ui/canvas-zone/zone-instance/zone-instance.component.less b/catalog-ui/src/app/ng2/components/ui/canvas-zone/zone-instance/zone-instance.component.less
deleted file mode 100644
index b562c08514..0000000000
--- a/catalog-ui/src/app/ng2/components/ui/canvas-zone/zone-instance/zone-instance.component.less
+++ /dev/null
@@ -1,134 +0,0 @@
-@import '../../../../../../assets/styles/variables';
-
-.zone-instance {
- position:relative;
- width:76px;
- margin:5px;
- opacity:1;
-
- .zone-instance__handle {
- display:none;
- position:absolute;
- right:4px;
- top:10px;
- width:22px;
- height:22px;
- cursor:pointer;
- border: solid @main_color_p 1px;
- border-radius: 2px;
- text-align: center;
- font-weight:bold;
- }
-
- .zone-instance__body {
- margin:0 auto;
- width:43px;
- height:43px;
- display:flex;
- padding:3px;
- }
-
- .zone-instance__body-content {
- border-radius: 2px;
- flex:1;
- color:@main_color_p;
- font-size:16px;
- text-align:center;
- display:flex;
- align-items: center;
- justify-content: center;
- box-shadow:none;
- transition:box-shadow 5s;
- }
-
- .zone-instance__name {
- text-overflow: ellipsis;
- overflow: hidden;
- white-space: nowrap;
- text-align:center;
- }
- /* Dynamic classes below */
-
- .target-handle {
- position:absolute;
- width:18px;
- height:18px;
- display:block;
- top: -4px;
- right: 10px;
- background-size: 100% 100%;
- cursor: url("../../../../../../assets/styles/images/canvas-tagging-icons/policy_2.svg"), pointer;
-
- &.tagged-policy {
- background-image: url('../../../../../../assets/styles/images/canvas-tagging-icons/policy_added.svg');
- }
-
- &.tag-available {
- background-image: url('../../../../../../assets/styles/images/canvas-tagging-icons/indication.svg');
- }
- }
-
-
- &.mode-1, &.mode-2, &.mode-3 { //hover, selected, tag
- .zone-instance__body {
- border:solid 2px;
- border-radius: 2px;
- padding:2px;
- cursor:pointer;
- }
- }
-
- &.mode-1, &.mode-2:hover{
- .zone-instance__handle{
- display:block;
- }
- }
-
- &.locked {
- cursor: inherit;
- }
-
- &.hiding {
- opacity:0;
- .zone-instance__body-content {
- box-shadow: #CCC 0px 0px 15px;
- }
- }
-
-
- &.mode-3 .zone-instance__handle {
- width:24px;
- height:24px;
- right:3px;
- top:9px;
- display:block;
- background-image: linear-gradient(-140deg, #009E98 0%, #97D648 100%);
- border: 2px solid @main_color_p;
- border-radius: 2px;
- box-shadow: inset 2px -2px 3px 0 #007A3E;
- }
-
-}
-.sdc-canvas-zone.group-zone {
- .zone-instance__handle {
- background-color:@main_color_a;
- }
- .zone-instance__body {
- border-color:@main_color_a;
- .zone-instance__body-content {
- background: @main_color_a;
- }
- }
-}
-
-.sdc-canvas-zone.policy-zone {
- .zone-instance__handle {
- background-color:@main_color_r;
- }
- .zone-instance__body {
- border-color:@main_color_r;
- .zone-instance__body-content {
- background: @main_color_r;
- }
- }
-} \ No newline at end of file
diff --git a/catalog-ui/src/app/ng2/components/ui/canvas-zone/zone-instance/zone-instance.component.ts b/catalog-ui/src/app/ng2/components/ui/canvas-zone/zone-instance/zone-instance.component.ts
deleted file mode 100644
index 3c2dd45db5..0000000000
--- a/catalog-ui/src/app/ng2/components/ui/canvas-zone/zone-instance/zone-instance.component.ts
+++ /dev/null
@@ -1,110 +0,0 @@
-import { Component, Input, Output, EventEmitter, ViewEncapsulation, OnInit, SimpleChange, ElementRef, ViewChild, SimpleChanges } from '@angular/core';
-import {
- ZoneInstance, ZoneInstanceMode, ZoneInstanceType,
- IZoneInstanceAssignment
-} from 'app/models/graph/zones/zone-instance';
-import { PoliciesService } from '../../../../services/policies.service';
-import { GroupsService } from '../../../../services/groups.service';
-import { IZoneService } from "../../../../../models/graph/zones/zone";
-import { EventListenerService } from 'app/services';
-import { GRAPH_EVENTS } from '../../../../../utils';
-import { Subject, Observable } from 'rxjs';
-
-@Component({
- selector: 'zone-instance',
- templateUrl: './zone-instance.component.html',
- styleUrls: ['./zone-instance.component.less'],
- encapsulation: ViewEncapsulation.None
-})
-export class ZoneInstanceComponent implements OnInit {
-
- @Input() zoneInstance:ZoneInstance;
- @Input() defaultIconText:string;
- @Input() isActive:boolean;
- @Input() isViewOnly:boolean;
- @Input() activeInstanceMode: ZoneInstanceMode;
- @Input() hidden:boolean;
- @Input() forceSave:Subject<Function>;
- @Output() modeChange: EventEmitter<any> = new EventEmitter<any>();
- @Output() assignmentSaveStart: EventEmitter<void> = new EventEmitter<void>();
- @Output() assignmentSaveComplete: EventEmitter<boolean> = new EventEmitter<boolean>();
- @Output() tagHandleClick: EventEmitter<ZoneInstance> = new EventEmitter<ZoneInstance>();
- @ViewChild('currentComponent') currentComponent: ElementRef;
- private MODE = ZoneInstanceMode;
- private zoneService:IZoneService;
-
- constructor(private policiesService:PoliciesService, private groupsService:GroupsService, private eventListenerService:EventListenerService){}
-
- ngOnInit(){
- if(this.zoneInstance.type == ZoneInstanceType.POLICY){
- this.zoneService = this.policiesService;
- } else {
- this.zoneService = this.groupsService;
- }
- this.forceSave.subscribe((afterSaveFunction:Function) => {
- this.setMode(ZoneInstanceMode.TAG, null, afterSaveFunction);
- })
- }
-
- ngOnChanges(changes:SimpleChanges) {
- if(changes.hidden){
- this.currentComponent.nativeElement.scrollIntoView({behavior: "smooth", block: "nearest", inline:"end"});
- }
- }
-
- ngOnDestroy() {
- this.forceSave.unsubscribe();
- }
-
- private setMode = (mode:ZoneInstanceMode, event?:any, afterSaveCallback?:Function):void => {
-
- if(event){ //prevent event from handle and then repeat event from zone instance
- event.stopPropagation();
- }
-
- if(!this.isActive && this.activeInstanceMode === ZoneInstanceMode.TAG) {
- return; //someone else is tagging. No events allowed
- }
-
- if(this.isActive && this.zoneInstance.mode === ZoneInstanceMode.TAG){
- if(mode !== ZoneInstanceMode.TAG) {
- return; //ignore all other events. The only valid option is saving changes.
- }
-
- let oldAssignments:Array<IZoneInstanceAssignment> = this.zoneInstance.instanceData.getSavedAssignments();
- if(this.zoneInstance.isZoneAssignmentChanged(oldAssignments, this.zoneInstance.assignments)) {
-
- this.assignmentSaveStart.emit();
-
- this.zoneService.updateZoneInstanceAssignments(this.zoneInstance.parentComponentType, this.zoneInstance.parentComponentID, this.zoneInstance.instanceData.uniqueId, this.zoneInstance.assignments).subscribe(
- (success) => {
- this.zoneInstance.instanceData.setSavedAssignments(this.zoneInstance.assignments);
- if(this.zoneInstance.type === ZoneInstanceType.POLICY){
- this.eventListenerService.notifyObservers(GRAPH_EVENTS.ON_POLICY_INSTANCE_UPDATE, this.zoneInstance.instanceData);
- } else {
- this.eventListenerService.notifyObservers(GRAPH_EVENTS.ON_GROUP_INSTANCE_UPDATE, this.zoneInstance.instanceData);
- }
- this.assignmentSaveComplete.emit(true);
- if(afterSaveCallback) afterSaveCallback();
- }, (error) => {
- this.zoneInstance.assignments = oldAssignments;
- this.assignmentSaveComplete.emit(false);
- });
- } else {
- if(afterSaveCallback) afterSaveCallback();
- }
- this.modeChange.emit({newMode: ZoneInstanceMode.NONE, instance: this.zoneInstance});
-
- } else {
- this.modeChange.emit({newMode: mode, instance: this.zoneInstance});
- }
-
-
- }
-
- private tagHandleClicked = (event:Event) => {
- this.tagHandleClick.emit(this.zoneInstance);
- event.stopPropagation();
- };
-
-} \ No newline at end of file