aboutsummaryrefslogtreecommitdiffstats
path: root/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.component.ts
diff options
context:
space:
mode:
authorArundathi Patil <arundpil@in.ibm.com>2019-04-22 15:15:27 +0530
committerIBM602-PC0F1E3C\Arundathi <arundpil@in.ibm.com>2019-04-22 15:15:37 +0530
commitb0e2477271cd21606fb18d02103694d020163ad2 (patch)
treef1603795734d137be0985b4a0a66175459f5d06c /cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.component.ts
parent82f1f0a6156b7ca4847041f4f9140e05a37c1891 (diff)
Resouce creation- save resouce to backend
Integrated UI with loopback to save the resource dictionary in backend for exsisting and uploaded resource templates Issue-ID: CCSDK-1217 Change-Id: I714a20344d6df278f891e303eebceff21b74c2af Signed-off-by: Arundathi Patil <arundpil@in.ibm.com>
Diffstat (limited to 'cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.component.ts')
-rw-r--r--cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.component.ts19
1 files changed, 15 insertions, 4 deletions
diff --git a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.component.ts b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.component.ts
index 55b80628d..77e901717 100644
--- a/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.component.ts
+++ b/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.component.ts
@@ -27,6 +27,7 @@ import { IAppState } from '../../../common/core/store/state/app.state';
import { JsonEditorComponent, JsonEditorOptions } from 'ang-jsoneditor';
import { Observable } from 'rxjs';
import { A11yModule } from '@angular/cdk/a11y';
+import { ResourceEditService } from './resource-edit.service';
@Component({
selector: 'app-resource-edit',
@@ -38,13 +39,13 @@ export class ResourceEditComponent implements OnInit {
resources:IResources;
data:IResources;
rdState: Observable<IResourcesState>;
- designerMode: boolean = true;
- editorMode: boolean = false;
+ designerMode: boolean = false;
+ editorMode: boolean = true;
viewText: string = "Open in Editor Mode";
@ViewChild(JsonEditorComponent) editor: JsonEditorComponent;
options = new JsonEditorOptions();
- constructor(private store: Store<IAppState>) {
+ constructor(private store: Store<IAppState>, private resourceEditService: ResourceEditService) {
this.rdState = this.store.select('resources');
this.options.mode = 'text';
this.options.modes = [ 'text', 'tree', 'view'];
@@ -92,5 +93,15 @@ export class ResourceEditComponent implements OnInit {
this.designerMode = true;
this.viewText = 'Open in Editor Mode'
}
- }
+ }
+
+ saveToBackend() {
+ this.resourceEditService.saveResource(this.data)
+ .subscribe(response=>{
+ window.alert("save success");
+ },
+ error=>{
+ window.alert('Error saving resources');
+ })
+ }
}