diff options
Diffstat (limited to 'cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.ts')
-rw-r--r-- | cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.ts | 49 |
1 files changed, 32 insertions, 17 deletions
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<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 { |