Adding new component sources-template 20/78820/1
authorSwapnali Shadanan Pode <sp00501638@techmahindra.com>
Wed, 20 Feb 2019 10:49:26 +0000 (16:19 +0530)
committerSwapnali Shadanan Pode <sp00501638@techmahindra.com>
Wed, 20 Feb 2019 10:49:26 +0000 (16:19 +0530)
Change-Id: Id522f18c36b8c91f46837559ecbbcab27ad76152
Issue-ID: CCSDK-804
Signed-off-by: sp00501638 <sp00501638@techmahindra.com>
cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.html [new file with mode: 0644]
cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.scss [new file with mode: 0644]
cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.spec.ts [new file with mode: 0644]
cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.ts [new file with mode: 0644]

diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.html b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.html
new file mode 100644 (file)
index 0000000..ee59b70
--- /dev/null
@@ -0,0 +1,56 @@
+<!--/*
+* ============LICENSE_START=======================================================
+* ONAP : CDS
+* ================================================================================
+* Copyright 2019 TechMahindra
+*=================================================================================
+* 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=========================================================
+*/-->
+<div cdkDropListGroup>
+  <div class="sources-container">
+       <div
+      cdkDropList
+      [cdkDropListData]="todo"
+      class="sources-list"
+      (cdkDropListDropped)="drop($event)">
+       <div class="sources-box" *ngFor="let item of todo" cdkDrag>
+               <mat-expansion-panel class="expansion-panel">
+                       <mat-expansion-panel-header>
+                               <mat-panel-title>
+                                       {{item}}
+                               </mat-panel-title>
+                       </mat-expansion-panel-header>
+                       {{item}}
+                        </mat-expansion-panel>
+       </div>
+    </div>
+  </div>
+
+  <div class="list-container">
+    <h3>Source Options</h3>
+       <mat-form-field>
+       <input [(ngModel)]="searchText" type="input" matInput placeholder="search sources">
+       <button matSuffix mat-icon-button><mat-icon>search</mat-icon></button>
+       <mat-hint>db,mdsal,input,default,..</mat-hint>
+       </mat-form-field>
+       <br><br>
+    <div
+      cdkDropList
+      [cdkDropListData]="done"
+      class="options-list"
+      (cdkDropListDropped)="drop($event)">
+      <div class="options-box" *ngFor="let item of done | search : searchText" cdkDrag>{{item}}</div>
+    </div>
+  </div>
+</div>
\ No newline at end of file
diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.scss b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.scss
new file mode 100644 (file)
index 0000000..a76b60a
--- /dev/null
@@ -0,0 +1,113 @@
+ /*\r
+* ============LICENSE_START=======================================================\r
+* ONAP : CDS\r
+* ================================================================================\r
+* Copyright 2019 TechMahindra\r
+*=================================================================================\r
+* Licensed under the Apache License, Version 2.0 (the "License");\r
+* you may not use this file except in compliance with the License.\r
+* You may obtain a copy of the License at\r
+*\r
+*     http://www.apache.org/licenses/LICENSE-2.0\r
+*\r
+* Unless required by applicable law or agreed to in writing, software\r
+* distributed under the License is distributed on an "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+* See the License for the specific language governing permissions and\r
+* limitations under the License.\r
+* ============LICENSE_END=========================================================\r
+*/\r
+.sources-container {\r
+  width: 900px;\r
+  max-width: 100%;\r
+  margin: 0 25px 25px 0;\r
+  display: inline-block;\r
+  vertical-align: top;\r
+ border-bottom: solid 1px #ccc; \r
+ border-radius: 4px;\r
+}\r
+.list-container {\r
+  min-width: 200px;\r
+  max-width: 100%;\r
+  margin: 0 25px 25px 0;\r
+  display: inline-block;\r
+  vertical-align: top;\r
+}\r
+.sources-list {\r
+  border: solid 1px #ccc;\r
+  width: 900px;\r
+  min-height: 30px;\r
+  background: white;\r
+  border-radius: 4px;\r
+  overflow: hidden;\r
+  display: block;\r
+  border-bottom: solid 1px #ccc;\r
+}\r
+.options-list {  \r
+  min-height: 30px;\r
+  border-radius: 4px;\r
+  overflow: hidden;\r
+  display: block;\r
+  width: 100%; \r
+}\r
+.sources-box {\r
+  //border-bottom: solid 1px #ccc;\r
+  color: rgba(0, 0, 0, 0.87);\r
+  display: flex;\r
+  flex-direction: row;\r
+  align-items: center;\r
+  justify-content: space-between;\r
+  box-sizing: border-box;\r
+  cursor: move;\r
+  background:white;\r
+  font-size: 14px;\r
+  min-height: 30px;\r
+  \r
+}\r
+.options-box {\r
+  border: solid 1px #ccc;\r
+  color: white;\r
+  display: flex;\r
+  flex-direction: row;\r
+  align-items: center;\r
+  justify-content: space-between;\r
+  box-sizing: border-box;\r
+  cursor: move;\r
+  background:gray;\r
+  font-size: 14px;\r
+  min-height: 30px;\r
+  width: 100px;\r
+ padding-left: 15px;\r
+}\r
+\r
+.cdk-drag-preview {\r
+  box-sizing: border-box;\r
+  border-radius: 4px;\r
+  box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2),\r
+              0 8px 10px 1px rgba(0, 0, 0, 0.14),\r
+              0 3px 14px 2px rgba(0, 0, 0, 0.12);\r
+}\r
+\r
+.cdk-drag-placeholder {\r
+  opacity: 0;\r
+}\r
+\r
+.cdk-drag-animating {\r
+  transition: transform 250ms cubic-bezier(0, 0, 0.2, 1);\r
+}\r
+\r
+.sources-box:last-child {\r
+  border: none;\r
+}\r
+\r
+.options-list.cdk-drop-list-dragging .options-box:not(.cdk-drag-placeholder) {\r
+  transition: transform 250ms cubic-bezier(0, 0, 0.2, 1);\r
+}\r
+.expansion-panel{\r
+  border: solid 0.5px #ededed;\r
+  background: white;\r
+  border-radius: 4px;\r
+  overflow: hidden;\r
+  display: block;\r
+  width: 100%;\r
+  }
\ No newline at end of file
diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.spec.ts b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.spec.ts
new file mode 100644 (file)
index 0000000..4a94fed
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+* ============LICENSE_START=======================================================
+* ONAP : CDS
+* ================================================================================
+* Copyright 2019 TechMahindra
+*=================================================================================
+* 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 { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { SourcesTemplateComponent } from './sources-template.component';
+
+describe('SourcesTemplateComponent', () => {
+  let component: SourcesTemplateComponent;
+  let fixture: ComponentFixture<SourcesTemplateComponent>;
+
+  beforeEach(async(() => {
+    TestBed.configureTestingModule({
+      declarations: [ SourcesTemplateComponent ]
+    })
+    .compileComponents();
+  }));
+
+  beforeEach(() => {
+    fixture = TestBed.createComponent(SourcesTemplateComponent);
+    component = fixture.componentInstance;
+    fixture.detectChanges();
+  });
+
+  it('should create', () => {
+    expect(component).toBeTruthy();
+  });
+});
diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.ts b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.ts
new file mode 100644 (file)
index 0000000..1490085
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+* ============LICENSE_START=======================================================
+* ONAP : CDS
+* ================================================================================
+* Copyright 2019 TechMahindra
+*=================================================================================
+* 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 { Component, OnInit } from '@angular/core';
+import {CdkDragDrop, moveItemInArray, transferArrayItem} from '@angular/cdk/drag-drop';
+
+@Component({
+  selector: 'app-sources-template',
+  templateUrl: './sources-template.component.html',
+  styleUrls: ['./sources-template.component.scss']
+})
+export class SourcesTemplateComponent implements OnInit {
+
+  constructor() { }
+
+  ngOnInit() {
+  }
+
+    todo = [
+    'MDSAL'
+  ];
+    
+  done = [
+    'INPUT',
+    'DEFAULT',
+     'DB',
+     'NETBOX'   
+  ];
+
+  drop(event: CdkDragDrop<string[]>) {
+    if (event.previousContainer === event.container) {
+      moveItemInArray(event.container.data, event.previousIndex, event.currentIndex);
+    } else {
+      transferArrayItem(event.previousContainer.data,
+                        event.container.data,
+                        event.previousIndex,
+                        event.currentIndex);
+    }
+  }    
+}