Merge "CDS Api reference add index, template, first APIs"
[ccsdk/cds.git] / cds-ui / designer-client / src / app / modules / feature-modules / packages / designer / source-view / source-view.component.ts
index e70d98d..ae4d09d 100644 (file)
@@ -10,23 +10,37 @@ import { SourceViewService } from './source-view.service';
 @Component({
     selector: 'app-designer-source-view',
     templateUrl: './source-view.component.html',
-    styleUrls: ['./source-view.component.css']
+    // styleUrls: ['./source-view.component.css']
+    styleUrls: ['../designer.component.css']
 })
 export class DesignerSourceViewComponent implements OnInit, OnDestroy {
 
     content = '';
     lang = 'json';
-    private controllerSideBar: boolean;
-    private ngUnsubscribe = new Subject();
+    controllerSideBar: boolean;
+    ngUnsubscribe = new Subject();
     viewedPackage: BluePrintDetailModel = new BluePrintDetailModel();
+    public customActionName = '';
+    cl = 'editBar';
+    packageId: string;
 
-    constructor(private store: DesignerStore,
-                private packageCreationUtils: PackageCreationUtils,
-                private router: Router,
-                private route: ActivatedRoute,
-                private sourceViewService: SourceViewService) {
+    constructor(
+        private store: DesignerStore,
+        private packageCreationUtils: PackageCreationUtils,
+        private router: Router,
+        private route: ActivatedRoute,
+        private sourceViewService: SourceViewService) {
         this.controllerSideBar = true;
     }
+    _toggleSidebar1() {
+        this.controllerSideBar = !this.controllerSideBar;
+        if (this.controllerSideBar === false) {
+            this.cl = 'editBar2';
+        }
+        if (this.controllerSideBar === true) {
+            this.cl = 'editBar';
+        }
+    }
 
     ngOnInit() {
         this.store.state$.subscribe(
@@ -42,13 +56,17 @@ export class DesignerSourceViewComponent implements OnInit, OnDestroy {
                     this.viewedPackage = bluePrintDetailModels[0];
                 }
             });
+
+        this.route.paramMap.subscribe(res => {
+            this.packageId = res.get('id');
+        });
     }
 
     convertAndOpenInDesingerView(id) {
         // TODO validate json against scheme
         console.log('convertAndOpenInDesingerView ...', this.content);
         this.store.saveSourceContent(this.content);
-        this.router.navigate(['/packages/designer', id]);
+        this.router.navigate(['/packages/designer', this.packageId, { actionName: this.customActionName }]);
     }
 
     ngOnDestroy() {