aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-ui/src/app/ng2/pages/service-path-creator
diff options
context:
space:
mode:
authorys9693 <ys9693@att.com>2020-01-19 13:50:02 +0200
committerOfir Sonsino <ofir.sonsino@intl.att.com>2020-01-22 12:33:31 +0000
commit16a9fce0e104a38371a9e5a567ec611ae3fc7f33 (patch)
tree03a2aff3060ddb5bc26a90115805a04becbaffc9 /catalog-ui/src/app/ng2/pages/service-path-creator
parentaa83a2da4f911c3ac89318b8e9e8403b072942e1 (diff)
Catalog alignment
Issue-ID: SDC-2724 Signed-off-by: ys9693 <ys9693@att.com> Change-Id: I52b4aacb58cbd432ca0e1ff7ff1f7dd52099c6fe
Diffstat (limited to 'catalog-ui/src/app/ng2/pages/service-path-creator')
-rw-r--r--catalog-ui/src/app/ng2/pages/service-path-creator/link-row/link-row.component.html61
-rw-r--r--catalog-ui/src/app/ng2/pages/service-path-creator/link-row/link-row.component.less21
-rw-r--r--catalog-ui/src/app/ng2/pages/service-path-creator/link-row/link-row.component.ts103
-rw-r--r--catalog-ui/src/app/ng2/pages/service-path-creator/link-row/link.model.ts36
-rw-r--r--catalog-ui/src/app/ng2/pages/service-path-creator/service-path-creator.component.html56
-rw-r--r--catalog-ui/src/app/ng2/pages/service-path-creator/service-path-creator.component.less45
-rw-r--r--catalog-ui/src/app/ng2/pages/service-path-creator/service-path-creator.component.ts147
-rw-r--r--catalog-ui/src/app/ng2/pages/service-path-creator/service-path-creator.module.ts25
8 files changed, 0 insertions, 494 deletions
diff --git a/catalog-ui/src/app/ng2/pages/service-path-creator/link-row/link-row.component.html b/catalog-ui/src/app/ng2/pages/service-path-creator/link-row/link-row.component.html
deleted file mode 100644
index 0abdda1cc6..0000000000
--- a/catalog-ui/src/app/ng2/pages/service-path-creator/link-row/link-row.component.html
+++ /dev/null
@@ -1,61 +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.
- -->
-
-<ui-element-dropdown
- data-tests-id="linkSrc"
- [readonly]="!link.isFirst || (link.isFirst && !link.canEdit)"
- class="cell link-selector"
- [values]="source"
- [(value)]="link.fromNode"
- (valueChange)="onSourceSelected($event)">
-</ui-element-dropdown>
-
-<ui-element-dropdown
- data-tests-id="linkSrcCP"
- [readonly]="!link.isFirst || (link.isFirst && !link.canEdit)"
- class="cell link-selector"
- [values]="srcCP"
- [(value)]="link.fromCP"
- (valueChange)="onSrcCPSelected($event)">
-</ui-element-dropdown>
-
-<ui-element-dropdown
- data-tests-id="linkTarget"
- [readonly]="!link.canEdit"
- class="cell link-selector"
- [values]="target"
- [(value)]="link.toNode"
- (valueChange)="onTargetSelected($event)">
-</ui-element-dropdown>
-
-<ui-element-dropdown
- data-tests-id="linkTargetCP"
- [readonly]="!link.canEdit"
- class="cell link-selector"
- [values]="targetCP"
- [(value)]="link.toCP"
- (valueChange)="onTargetCPSelected($event)">
-</ui-element-dropdown>
-
-<div
- class="cell remove"
- data-tests-id="removeLnk">
- <span
- *ngIf="link.canRemove"
- class="sprite-new delete-item-icon"
- (click)="removeRow()">
- </span>
-</div>
diff --git a/catalog-ui/src/app/ng2/pages/service-path-creator/link-row/link-row.component.less b/catalog-ui/src/app/ng2/pages/service-path-creator/link-row/link-row.component.less
deleted file mode 100644
index beec9bd567..0000000000
--- a/catalog-ui/src/app/ng2/pages/service-path-creator/link-row/link-row.component.less
+++ /dev/null
@@ -1,21 +0,0 @@
-@import './../../../../../assets/styles/variables.less';
-.remove {
- display: flex;
- align-items: center;
- justify-content: center;
-}
-
-.cell {
- padding: 0;
-}
-
-/deep/ .link-selector {
- select {
- height: 30px;
- border: none;
- stroke: none;
- }
-
-}
-
-
diff --git a/catalog-ui/src/app/ng2/pages/service-path-creator/link-row/link-row.component.ts b/catalog-ui/src/app/ng2/pages/service-path-creator/link-row/link-row.component.ts
deleted file mode 100644
index e4fc1d4522..0000000000
--- a/catalog-ui/src/app/ng2/pages/service-path-creator/link-row/link-row.component.ts
+++ /dev/null
@@ -1,103 +0,0 @@
-import {Component, Input} from '@angular/core';
-import {DropdownValue} from "app/ng2/components/ui/form-components/dropdown/ui-element-dropdown.component";
-import {Link} from './link.model';
-import {ServicePathMapItem} from "app/models/graph/nodes-and-links-map";
-
-@Component({
- selector: 'link-row',
- templateUrl: './link-row.component.html',
- styleUrls: ['./link-row.component.less']
-})
-
-
-export class LinkRowComponent {
- @Input() data:Array<ServicePathMapItem>;
- @Input() link:Link;
- @Input() removeRow:Function;
- source: Array<DropdownValue> = [];
- target: Array<DropdownValue> = [];
- srcCP: Array<DropdownValue> = [];
- targetCP: Array<DropdownValue> = [];
-
- ngOnChanges() {
- if (this.data) {
- this.parseInitialData(this.data);
- }
- }
-
- parseInitialData(data: Array<ServicePathMapItem>) {
- this.source = this.convertValuesToDropDownOptions(data);
- if (this.link.fromNode) {
- let srcCPOptions = this.findOptions(data, this.link.fromNode);
- if (!srcCPOptions) { return; }
- this.srcCP = this.convertValuesToDropDownOptions(srcCPOptions);
- if (this.link.fromCP) {
- this.target = this.convertValuesToDropDownOptions(data);
- if (this.link.toNode) {
- let targetCPOptions = this.findOptions(data, this.link.toNode);
- if (!targetCPOptions) { return; }
- this.targetCP = this.convertValuesToDropDownOptions(targetCPOptions);
- }
- }
- }
- }
-
- private findOptions(items: Array<ServicePathMapItem>, nodeOrCPId: string) {
- let item = _.find(items, (dataItem) => nodeOrCPId === dataItem.id);
- if (item && item.data && item.data.options) {
- return item.data.options;
- }
- console.warn('no option was found to match selection of Node/CP with id:' + nodeOrCPId);
- return null;
- }
-
- private convertValuesToDropDownOptions(values: Array<ServicePathMapItem>): Array<DropdownValue> {
- let result:Array<DropdownValue> = [];
- for (let i = 0; i < values.length ; i++) {
- result[result.length] = new DropdownValue(values[i].id, values[i].data.name);
- }
- return result.sort((a, b) => a.label.localeCompare(b.label));
- }
-
- onSourceSelected(id) {
- if (id) {
- let srcCPOptions = this.findOptions(this.data, id);
- this.srcCP = this.convertValuesToDropDownOptions(srcCPOptions);
- this.link.fromCP = '';
- this.link.toNode = '';
- this.link.toCP = '';
- this.target = [];
- this.targetCP = [];
- }
- }
-
- onSrcCPSelected (id) {
- if (id) {
- let srcCPOptions = this.findOptions(this.data, this.link.fromNode);
- let srcCPData = srcCPOptions.find(option => id === option.id).data;
- this.target = this.convertValuesToDropDownOptions(this.data);
- this.link.fromCPOriginId = srcCPData.ownerId;
- this.link.toNode = '';
- this.link.toCP = '';
- this.targetCP = [];
- }
-
- }
-
- onTargetSelected(id) {
- if (id) {
- let targetCPOptions = this.findOptions(this.data, id);
- this.targetCP = this.convertValuesToDropDownOptions(targetCPOptions);
- this.link.toCP = '';
- }
-
- }
-
- onTargetCPSelected(id) {
- if (id) {
- let targetCPOptions = this.findOptions(this.data, this.link.toNode);
- let targetCPDataObj = targetCPOptions.find(option => id === option.id).data;
- this.link.toCPOriginId = targetCPDataObj.ownerId;
- }
- }
-}
diff --git a/catalog-ui/src/app/ng2/pages/service-path-creator/link-row/link.model.ts b/catalog-ui/src/app/ng2/pages/service-path-creator/link-row/link.model.ts
deleted file mode 100644
index 80128eb42e..0000000000
--- a/catalog-ui/src/app/ng2/pages/service-path-creator/link-row/link.model.ts
+++ /dev/null
@@ -1,36 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 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.
- * ============LICENSE_END=========================================================
- */
-'use strict';
-import {ForwardingPathLink} from "app/models/forwarding-path-link";
-
-export class Link extends ForwardingPathLink {
- public canEdit:boolean = false;
- public canRemove:boolean = false;
- public isFirst:boolean = false;
-
- constructor(link: ForwardingPathLink, canEdit: boolean, canRemove: boolean, isFirst: boolean) {
- super(link.fromNode,link.fromCP, link.toNode, link.toCP, link.fromCPOriginId, link.toCPOriginId);
- this.canEdit = canEdit;
- this.canRemove = canRemove;
- this.isFirst = isFirst;
- }
-}
-
-
diff --git a/catalog-ui/src/app/ng2/pages/service-path-creator/service-path-creator.component.html b/catalog-ui/src/app/ng2/pages/service-path-creator/service-path-creator.component.html
deleted file mode 100644
index cc14b4961f..0000000000
--- a/catalog-ui/src/app/ng2/pages/service-path-creator/service-path-creator.component.html
+++ /dev/null
@@ -1,56 +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 class="service-path-creator">
- <form class="w-sdc-form">
- <div class="i-sdc-form-item" >
- <label class="i-sdc-form-label required">Flow Name</label>
- <input type="text" data-tests-id="pathName" name="pathName" [(ngModel)]="forwardingPath.name" [attr.maxLength]="200" />
- </div>
-
- <div class="side-by-side">
- <div class="i-sdc-form-item" >
- <label class="i-sdc-form-label">Protocol</label>
- <input type="text" data-tests-id="pathProtocol" name="protocol" [(ngModel)]="forwardingPath.protocol" [attr.maxLength]="200" />
- </div>
- <div class="i-sdc-form-item" >
- <label class="i-sdc-form-label">Destination Port Numbers</label>
- <input type="text" data-tests-id="pathPortNumbers" name="portNumbers" [(ngModel)]="forwardingPath.destinationPortNumber" pattern="[0-9,]*" />
- </div>
- </div>
-
- <div class="separator-buttons">
- <span class="based-on-title">Based On</span>
- <a (click)="addRow()" [ngClass]="{'disabled':!isExtendAllowed()}" data-tests-id="extendPathlnk">Extend Flow</a>
- </div>
-
- <div class="generic-table">
- <div class="header-row">
- <div class="cell header-cell" *ngFor="let header of headers">
- {{header}}
- </div>
- </div>
- <div *ngIf="links && links.length === 0" class="no-row-text" >
- There is no data to display
- </div>
- <div>
- <link-row *ngFor="let link of links" [data]="linksMap" [link]="link" [removeRow]="removeRow" class="data-row" ></link-row>
- </div>
- </div>
-
-
- </form>
-</div> \ No newline at end of file
diff --git a/catalog-ui/src/app/ng2/pages/service-path-creator/service-path-creator.component.less b/catalog-ui/src/app/ng2/pages/service-path-creator/service-path-creator.component.less
deleted file mode 100644
index 5c9e53e229..0000000000
--- a/catalog-ui/src/app/ng2/pages/service-path-creator/service-path-creator.component.less
+++ /dev/null
@@ -1,45 +0,0 @@
-@import './../../../../assets/styles/variables.less';
-.service-path-creator {
- font-family: @font-opensans-regular;
- .separator-buttons {
- margin: 10px 0;
- display: flex;
- justify-content: space-between;
- }
- .i-sdc-form-label {
- font-size: 12px;
- }
- .w-sdc-form .i-sdc-form-item {
- margin-bottom: 15px;
- }
-
- .side-by-side {
- display: flex;
- .i-sdc-form-item {
- flex-basis: 100%;
- &:first-child {
- margin-right: 10px;
- }
- }
- }
-
- .generic-table {
- max-height: 233px;
- .header-row .header-cell {
- &:last-child {
- padding: 0;
- }
- }
- /deep/ .cell {
- &:last-child {
- min-width: 30px;
- }
- }
- }
-
- .based-on-title {
- text-transform: uppercase;
- font-size: 18px;
- font-family: @font-opensans-regular;
- }
-} \ No newline at end of file
diff --git a/catalog-ui/src/app/ng2/pages/service-path-creator/service-path-creator.component.ts b/catalog-ui/src/app/ng2/pages/service-path-creator/service-path-creator.component.ts
deleted file mode 100644
index bffb1c5e7e..0000000000
--- a/catalog-ui/src/app/ng2/pages/service-path-creator/service-path-creator.component.ts
+++ /dev/null
@@ -1,147 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 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.
- * ============LICENSE_END=========================================================
- */
-
-import * as _ from "lodash";
-import { Component, ElementRef, forwardRef, Inject } from '@angular/core';
-import {Link} from './link-row/link.model';
-import {ForwardingPath} from 'app/models/forwarding-path';
-import {ServiceServiceNg2} from "app/ng2/services/component-services/service.service";
-import {ForwardingPathLink} from "app/models/forwarding-path-link";
-import {ServicePathMapItem} from "app/models/graph/nodes-and-links-map";
-
-@Component({
- selector: 'service-path-creator',
- templateUrl: './service-path-creator.component.html',
- styleUrls:['./service-path-creator.component.less'],
- providers: [ServiceServiceNg2]
-})
-
-export class ServicePathCreatorComponent {
-
- linksMap:Array<ServicePathMapItem>;
- links:Array<Link> = [];
- input:any;
- headers: Array<string> = [];
- removeRow: Function;
- forwardingPath:ForwardingPath;
- //isExtendAllowed:boolean = false;
-
- constructor(private serviceService: ServiceServiceNg2) {
- this.forwardingPath = new ForwardingPath();
- this.links = [new Link(new ForwardingPathLink('', '', '', '', '', ''), true, false, true)];
- this.headers = ['Source', 'Source Connection Point', 'Target', 'Target Connection Point', ' '];
- this.removeRow = () => {
- if (this.links.length === 1) {
- return;
- }
- this.links.splice(this.links.length-1, 1);
- this.enableCurrentRow();
- };
- }
-
- ngOnInit() {
- this.serviceService.getNodesAndLinksMap(this.input.service).subscribe((res:any) => {
- this.linksMap = res;
- });
- this.processExistingPath();
-
- }
-
- private processExistingPath() {
- if (this.input.pathId) {
- let forwardingPath = <ForwardingPath>{...this.input.service.forwardingPaths[this.input.pathId]};
- this.forwardingPath.name = forwardingPath.name;
- this.forwardingPath.destinationPortNumber = forwardingPath.destinationPortNumber;
- this.forwardingPath.protocol = forwardingPath.protocol;
- this.forwardingPath.uniqueId = forwardingPath.uniqueId;
- this.links = [];
- _.forEach(forwardingPath.pathElements.listToscaDataDefinition, (link:ForwardingPathLink) => {
- this.links[this.links.length] = new Link(link, false, false, false);
- });
- this.links[this.links.length - 1].canEdit = true;
- this.links[this.links.length - 1].canRemove = true;
- this.links[0].isFirst = true;
- }
- }
-
- isExtendAllowed():boolean {
- if (this.links[this.links.length-1].toCP) {
- return true;
- }
- return false;
- }
-
- enableCurrentRow() {
- this.links[this.links.length-1].canEdit = true;
- if (this.links.length !== 1) {
- this.links[this.links.length-1].canRemove = true;
- }
- }
-
- addRow() {
- this.disableRows();
- this.links[this.links.length] = new Link(
- new ForwardingPathLink(this.links[this.links.length-1].toNode,
- this.links[this.links.length-1].toCP,
- '',
- '',
- this.links[this.links.length-1].toCPOriginId,
- ''
- ),
- true,
- true,
- false
- );
- }
-
- disableRows() {
- for (let i = 0 ; i < this.links.length ; i++) {
- this.links[i].canEdit = false;
- this.links[i].canRemove = false;
- }
- }
-
- createPathLinksObject() {
- for (let i = 0 ; i < this.links.length ; i++) {
- let link = this.links[i];
- this.forwardingPath.addPathLink(link.fromNode, link.fromCP, link.toNode, link.toCP, link.fromCPOriginId, link.toCPOriginId);
- }
- }
-
- createServicePathData() {
- this.createPathLinksObject();
- return this.forwardingPath;
- }
-
- checkFormValidForSubmit():boolean {
- if (this.forwardingPath.name && this.isPathValid() ) {
- return true;
- }
- return false;
- }
-
- isPathValid():boolean {
- let lastLink = this.links[this.links.length -1] ;
- if (lastLink.toNode && lastLink.toCP && lastLink.fromNode && lastLink.fromCP) {
- return true;
- }
- return false;
- }
-} \ No newline at end of file
diff --git a/catalog-ui/src/app/ng2/pages/service-path-creator/service-path-creator.module.ts b/catalog-ui/src/app/ng2/pages/service-path-creator/service-path-creator.module.ts
deleted file mode 100644
index 78005317a2..0000000000
--- a/catalog-ui/src/app/ng2/pages/service-path-creator/service-path-creator.module.ts
+++ /dev/null
@@ -1,25 +0,0 @@
-import { NgModule } from "@angular/core";
-import {CommonModule} from "@angular/common";
-import {ServicePathCreatorComponent} from "./service-path-creator.component";
-import {FormsModule} from "@angular/forms";
-import {FormElementsModule} from "app/ng2/components/ui/form-components/form-elements.module";
-import {UiElementsModule} from "app/ng2/components/ui/ui-elements.module";
-import {LinkRowComponent} from './link-row/link-row.component'
-@NgModule({
- declarations: [
- ServicePathCreatorComponent,
- LinkRowComponent
- ],
- imports: [CommonModule,
- FormsModule,
- FormElementsModule,
- UiElementsModule
- ],
- exports: [],
- entryComponents: [
- ServicePathCreatorComponent
- ],
- providers: []
-})
-export class ServicePathCreatorModule {
-} \ No newline at end of file