sources template changes 96/79896/1
authorSwapnali Shadanan Pode <sp00501638@techmahindra.com>
Thu, 7 Mar 2019 10:41:38 +0000 (16:11 +0530)
committerSwapnali Shadanan Pode <sp00501638@techmahindra.com>
Thu, 7 Mar 2019 10:41:38 +0000 (16:11 +0530)
Change-Id: I394dbb4d538d57534b81d5a4884c1681f03d5577
Issue-ID: CCSDK-807
Signed-off-by: sp00501638 <sp00501638@techmahindra.com>
cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.html
cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.ts

index ee59b70..123594a 100644 (file)
@@ -28,7 +28,7 @@
                <mat-expansion-panel class="expansion-panel">
                        <mat-expansion-panel-header>
                                <mat-panel-title>
-                                       {{item}}
+                                       {{item.type}}
                                </mat-panel-title>
                        </mat-expansion-panel-header>
                        {{item}}
        <br><br>
     <div
       cdkDropList
-      [cdkDropListData]="done"
+      [cdkDropListData]="sourcesOptions"
       class="options-list"
       (cdkDropListDropped)="drop($event)">
-      <div class="options-box" *ngFor="let item of done | search : searchText" cdkDrag>{{item}}</div>
+      <div class="options-box" *ngFor="let item of sourcesOptions | search : searchText" cdkDrag>{{item.type}}</div>
     </div>
   </div>
 </div>
\ No newline at end of file
index 1490085..8c6d99c 100644 (file)
@@ -2,7 +2,7 @@
 * ============LICENSE_START=======================================================
 * ONAP : CDS
 * ================================================================================
-* Copyright 2019 TechMahindra
+* Copyright (C) 2019 TechMahindra
 *=================================================================================
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 */
 
 import { Component, OnInit } from '@angular/core';
-import {CdkDragDrop, moveItemInArray, transferArrayItem} from '@angular/cdk/drag-drop';
+import { CdkDragDrop, moveItemInArray, transferArrayItem } from '@angular/cdk/drag-drop';
+import { IResources } from 'src/app/common/core/store/models/resources.model';
+import { IResourcesState } from 'src/app/common/core/store/models/resourcesState.model';
+import { Observable } from 'rxjs';
+import { Store } from '@ngrx/store';
+import { IAppState } from '../../../../common/core/store/state/app.state';
+import { A11yModule } from '@angular/cdk/a11y';
+import { LoadResourcesSuccess } from 'src/app/common/core/store/actions/resources.action';
+import { ISourcesData } from 'src/app/common/core/store/models/sourcesData.model';
 
 @Component({
   selector: 'app-sources-template',
@@ -27,24 +35,31 @@ import {CdkDragDrop, moveItemInArray, transferArrayItem} from '@angular/cdk/drag
   styleUrls: ['./sources-template.component.scss']
 })
 export class SourcesTemplateComponent implements OnInit {
+    rdState: Observable<IResourcesState>;
+    resources: IResources;
+    todo = [];
+    sources:ISourcesData; 
+    sourcesOptions = [];
 
-  constructor() { }
+ constructor(private store: Store<IAppState>) {
+    this.rdState = this.store.select('resources');
+ }
 
-  ngOnInit() {
-  }
+ ngOnInit() {
+    this.rdState.subscribe(
+      resourcesdata => {
+        var resourcesState: IResourcesState = { resources: resourcesdata.resources, isLoadSuccess: resourcesdata.isLoadSuccess, isSaveSuccess: resourcesdata.isSaveSuccess, isUpdateSuccess: resourcesdata.isUpdateSuccess };
+        this.sources = resourcesState.resources.sources;
+        for (let key in this.sources) {
+          if (this.sources.hasOwnProperty(key)) {
+            this.sourcesOptions.push(this.sources[key]);             
+          }
+        }
+        console.log(this.sourcesOptions);
+    })
+ }
 
-    todo = [
-    'MDSAL'
-  ];
-    
-  done = [
-    'INPUT',
-    'DEFAULT',
-     'DB',
-     'NETBOX'   
-  ];
-
-  drop(event: CdkDragDrop<string[]>) {
+ drop(event: CdkDragDrop<string[]>) {
     if (event.previousContainer === event.container) {
       moveItemInArray(event.container.data, event.previousIndex, event.currentIndex);
     } else {