aboutsummaryrefslogtreecommitdiffstats
path: root/cds-ui/client/src/app/feature-modules/resource-definition/resource-edit/resource-edit.component.ts
diff options
context:
space:
mode:
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');
+ })
+ }
}