Source template component- store update 89/92389/1
authorArundathi Patil <arundpil@in.ibm.com>
Wed, 31 Jul 2019 17:05:17 +0000 (22:35 +0530)
committerArundathi Patil <arundpil@in.ibm.com>
Wed, 31 Jul 2019 17:05:23 +0000 (22:35 +0530)
Implemented code to store sourc list changes to store

Issue-ID: CCSDK-707
Change-Id: If1ff2cd4cf624473a8962bf921225c00ff161ef5
Signed-off-by: Arundathi Patil <arundpil@in.ibm.com>
cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/sources-template/sources-template.component.ts

index 3e8f4f8..1d41ae7 100644 (file)
@@ -28,7 +28,7 @@ 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 { SetResourcesState } from 'src/app/common/core/store/actions/resources.action';
 import { ISourcesData } from 'src/app/common/core/store/models/sourcesData.model';
 import { JsonEditorComponent, JsonEditorOptions } from 'ang-jsoneditor';
 import { ResourceEditService } from '../resource-edit.service';
@@ -171,6 +171,20 @@ export class SourcesTemplateComponent implements OnInit {
                         }
                      }
                   });
+                  let newsources= {};
+                  this.sourcesOptions.forEach(sourceItem=>{
+                     console
+                     newsources[sourceItem.name] = {};
+                     newsources[sourceItem.name] = sourceItem.data;
+                  });
+                  this.resources.definition.sources = newsources;
+                  let resourcesState = {
+                     resources: this.resources,
+                     isLoadSuccess: true,
+                     isUpdateSuccess:true,
+                     isSaveSuccess:true
+                  }  
+                  this.store.dispatch(new SetResourcesState(resourcesState));
             });
          }  
       });