From 7e06008a45d6767919fccdffb6d95e591a78a680 Mon Sep 17 00:00:00 2001 From: Swapnali Shadanan Pode Date: Thu, 7 Mar 2019 16:11:38 +0530 Subject: sources template changes Change-Id: I394dbb4d538d57534b81d5a4884c1681f03d5577 Issue-ID: CCSDK-807 Signed-off-by: sp00501638 --- .../sources-template.component.html | 6 +-- .../sources-template/sources-template.component.ts | 49 ++++++++++++++-------- 2 files changed, 35 insertions(+), 20 deletions(-) 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 index ee59b70b3..123594a50 100644 --- 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 @@ -28,7 +28,7 @@ - {{item}} + {{item.type}} {{item}} @@ -47,10 +47,10 @@

-
{{item}}
+
{{item.type}}
\ 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.ts b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.ts index 149008518..8c6d99ca7 100644 --- 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 @@ -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. @@ -19,7 +19,15 @@ */ 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; + resources: IResources; + todo = []; + sources:ISourcesData; + sourcesOptions = []; - constructor() { } + constructor(private store: Store) { + 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) { + drop(event: CdkDragDrop) { if (event.previousContainer === event.container) { moveItemInArray(event.container.data, event.previousIndex, event.currentIndex); } else { -- cgit 1.2.3-korg