summaryrefslogtreecommitdiffstats
path: root/cds-ui/client
diff options
context:
space:
mode:
Diffstat (limited to 'cds-ui/client')
-rw-r--r--cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.html6
-rw-r--r--cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.ts49
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 @@
<mat-expansion-panel class="expansion-panel">
<mat-expansion-panel-header>
<mat-panel-title>
- {{item}}
+ {{item.type}}
</mat-panel-title>
</mat-expansion-panel-header>
{{item}}
@@ -47,10 +47,10 @@
<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
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 {