Designer > Breadcrumb 80/107680/3
authorRupinder <rupinsi1@in.ibm.com>
Thu, 14 May 2020 12:43:14 +0000 (18:13 +0530)
committerRupinderjeet Singh <rupinsi1@in.ibm.com>
Thu, 14 May 2020 14:39:59 +0000 (14:39 +0000)
1. Change Package name to current package name
2. Make package name link open to package view

Issue-ID: CCSDK-2247
Change-Id: Ica060beff9a0785d80c69cf971623dd45ebe75fe
Signed-off-by: Rupinder <rupinsi1@in.ibm.com>
cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/configuration-dashboard.component.html
cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/configuration-dashboard.component.ts
cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/designer.component.html
cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/designer.component.ts
cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/designer.service.ts
cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/source-view/source-view.component.html
cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/source-view/source-view.component.ts
cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/source-view/source-view.service.ts [new file with mode: 0644]
cds-ui/designer-client/src/app/modules/feature-modules/packages/packages.routing.module.ts

index 9e1c9b7..4042c88 100644 (file)
@@ -8,7 +8,7 @@
                     <ul class="breadcrumb-header">
                         <li><a routerLink="/packages">CBA Packages</a></li>
                         <i class="fa fa-angle-right ml-2 mr-2"></i>
-                        <li>Package Name</li>
+                        <li>{{viewedPackage.artifactName}}</li> 
                     </ul>
                 </h2>
                 <div class="col">
                                                             <div class="form-group text-center">
                                                                 <input type="text" class="form-control customAction"
                                                                     placeholder="Type Action Name" autofocus>
-                                                                <button type="button" class="btn submit">Start</button>
+                                                                <button type="button" (click)="goToDesignerMode(viewedPackage.id)" class="btn submit">Start</button>
                                                             </div>
 
                                                         </div>
                                                                 <div class="row">
                                                                     <div class="col text-center">
                                                                         <p class="selectedActions">0 selected</p>
-                                                                        <button type="button"
+                                                                        <button type="button" (click)="goToDesignerMode(viewedPackage.id)"
                                                                             class="btn submit">Start</button>
                                                                     </div>
                                                                 </div>
index 6de76f9..0578b10 100644 (file)
@@ -206,7 +206,7 @@ export class ConfigurationDashboardComponent implements OnInit {
         this.router.navigate(['/packages']);
     }
 
-    goToDesignerMode() {
-        this.router.navigate(['/packages/designer']);
-    }
+    goToDesignerMode(id) {
+        this.router.navigate(['/packages/designer', id]);
+     }
 }
index 6e072b1..3e3528c 100644 (file)
@@ -10,7 +10,7 @@
                     </li>
                     <i class="fa fa-angle-right ml-2 mr-2"></i>
                     <li class="breadcrumb-item">
-                        <a href="#">Package Name</a>
+                        <a href="/package/{{viewedPackage.id}}">{{viewedPackage.artifactName}}</a>
                         <button type="button" class="btn package-info-btn" data-toggle="modal"
                             data-target="#exampleModalLong">
                             <i class="icon-info" aria-hidden="true"></i>
 <div class="source-button editBar">
     <div class="btn-group viewBtns" role="group">
         <button type="button" class="btn btn-secondary topologySource active">Designer</button>
-        <button [routerLink]="['/designer/source']" type="button"
+        <button [routerLink]="['/designer/source', viewedPackage.id]" type="button"
             class="btn btn-secondary topologyView">Scripting</button>
     </div>
 </div>
index 5adce7e..fa3a99b 100644 (file)
@@ -3,6 +3,8 @@
 ===================================================================
 Copyright (C) 2019 Orange. All rights reserved.
 ===================================================================
+Modification Copyright (c) 2020 IBM
+===================================================================
 
 Unless otherwise specified, all software contained herein is licensed
 under the Apache License, Version 2.0 (the License);
@@ -34,6 +36,9 @@ import { FunctionsStore } from './functions.store';
 import { Subject } from 'rxjs';
 import { takeUntil } from 'rxjs/operators';
 import { distinctUntilChanged } from 'rxjs/operators';
+import { BluePrintDetailModel } from '../model/BluePrint.detail.model';
+import { ActivatedRoute } from '@angular/router';
+import { DesignerService } from './designer.service';
 
 
 @Component({
@@ -46,6 +51,7 @@ export class DesignerComponent implements OnInit, OnDestroy {
 
   private controllerSideBar: boolean;
   private attributesSideBar: boolean;
+  viewedPackage: BluePrintDetailModel = new BluePrintDetailModel();
 
   boardGraph: joint.dia.Graph;
   boardPaper: joint.dia.Paper;
@@ -58,7 +64,9 @@ export class DesignerComponent implements OnInit, OnDestroy {
   constructor(private designerStore: DesignerStore,
               private functionStore: FunctionsStore,
               private graphUtil: GraphUtil,
-              private graphGenerator: GraphGenerator) {
+              private graphGenerator: GraphGenerator,
+              private route: ActivatedRoute,
+              private designerService: DesignerService) {
     this.controllerSideBar = true;
     this.attributesSideBar = false;
 
@@ -88,6 +96,14 @@ export class DesignerComponent implements OnInit, OnDestroy {
     this.initializePalette();
     this.stencilPaperEventListeners();
 
+    const id = this.route.snapshot.paramMap.get('id');
+    this.designerService.getPagedPackages(id).subscribe(
+      (bluePrintDetailModels) => {
+        if (bluePrintDetailModels) {
+          this.viewedPackage = bluePrintDetailModels[0];
+        }
+      });
+
     /**
      * the code to retrieve from server is commented
      */
index aa3a6a6..771c44b 100644 (file)
@@ -3,6 +3,8 @@
 ===================================================================
 Copyright (C) 2019 Orange. All rights reserved.
 ===================================================================
+Modification Copyright (c) 2020 IBM
+===================================================================
 
 Unless otherwise specified, all software contained herein is licensed
 under the Apache License, Version 2.0 (the License);
@@ -22,8 +24,9 @@ limitations under the License.
 import {Injectable} from '@angular/core';
 import {Observable} from 'rxjs';
 import {ApiService} from '../../../../common/core/services/api.typed.service';
-import {ResourceDictionaryURLs} from '../../../../common/constants/app-constants';
+import {ResourceDictionaryURLs, BlueprintURLs} from '../../../../common/constants/app-constants';
 import {ModelType} from './model/ModelType.model';
+import { BluePrintDetailModel } from '../model/BluePrint.detail.model';
 
 
 @Injectable({
@@ -31,11 +34,20 @@ import {ModelType} from './model/ModelType.model';
 })
 export class DesignerService {
 
-    constructor(private api: ApiService<ModelType>) {
+    constructor(private api: ApiService<ModelType>,
+                private api2: ApiService<BluePrintDetailModel>) {
     }
 
     getFunctions(modelDefinitionType: string): Observable<ModelType[]> {
         return this.api.get(ResourceDictionaryURLs.getResourceDictionary + '/' + modelDefinitionType);
     }
 
+    private getBluePrintModel(id: string): Observable<BluePrintDetailModel> {
+        return this.api2.getOne(BlueprintURLs.getOneBlueprint + '/' + id);
+    }
+
+    getPagedPackages(id: string) {
+        return this.getBluePrintModel(id);
+    }
+
 }
index 2a55851..05f6eeb 100644 (file)
@@ -8,7 +8,7 @@
                         <a href="#">CBA Packages</a>
                     </li>
                     <li class="breadcrumb-item">
-                        <a href="#">Package Name</a>
+                        <a href="/package/{{viewedPackage.id}}">{{viewedPackage.artifactName}}</a>
                     </li>
                     <li class="breadcrumb-item active" aria-current="page">
                         <p class="mb-0">Topology View</p>
@@ -56,7 +56,7 @@
 </header>
 <div class="source-button editBar">
     <div class="btn-group viewBtns" role="group">
-        <button (click)="convertAndOpenInDesingerView()" type="button" class="btn btn-secondary topologySource">Designer</button>
+        <button (click)="convertAndOpenInDesingerView(viewedPackage.id)" type="button" class="btn btn-secondary topologySource">Designer</button>
         <button type="button"
             class="btn btn-secondary topologyView active">Scripting</button>
     </div>
index 34194e4..e70d98d 100644 (file)
@@ -1,8 +1,11 @@
 import { Component, OnInit, OnDestroy } from '@angular/core';
 import { DesignerStore } from '../designer.store';
 import { PackageCreationUtils } from '../../package-creation/package-creation.utils';
-import { RouterLink, Router } from '@angular/router';
+import { RouterLink, Router, ActivatedRoute } from '@angular/router';
 import { Subject } from 'rxjs';
+import { BluePrintDetailModel } from '../../model/BluePrint.detail.model';
+import { viewClassName } from '@angular/compiler';
+import { SourceViewService } from './source-view.service';
 
 @Component({
     selector: 'app-designer-source-view',
@@ -15,10 +18,13 @@ export class DesignerSourceViewComponent implements OnInit, OnDestroy {
     lang = 'json';
     private controllerSideBar: boolean;
     private ngUnsubscribe = new Subject();
+    viewedPackage: BluePrintDetailModel = new BluePrintDetailModel();
 
     constructor(private store: DesignerStore,
                 private packageCreationUtils: PackageCreationUtils,
-                private router: Router) {
+                private router: Router,
+                private route: ActivatedRoute,
+                private sourceViewService: SourceViewService) {
         this.controllerSideBar = true;
     }
 
@@ -29,13 +35,20 @@ export class DesignerSourceViewComponent implements OnInit, OnDestroy {
                 this.content = this.packageCreationUtils.transformToJson(state.template);
             });
 
+        const id = this.route.snapshot.paramMap.get('id');
+        this.sourceViewService.getPagedPackages(id).subscribe(
+            (bluePrintDetailModels) => {
+                if (bluePrintDetailModels) {
+                    this.viewedPackage = bluePrintDetailModels[0];
+                }
+            });
     }
 
-    convertAndOpenInDesingerView() {
+    convertAndOpenInDesingerView(id) {
         // TODO validate json against scheme
         console.log('convertAndOpenInDesingerView ...', this.content);
         this.store.saveSourceContent(this.content);
-        this.router.navigateByUrl('/packages/designer');
+        this.router.navigate(['/packages/designer', id]);
     }
 
     ngOnDestroy() {
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/source-view/source-view.service.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/source-view/source-view.service.ts
new file mode 100644 (file)
index 0000000..7589522
--- /dev/null
@@ -0,0 +1,26 @@
+import {Injectable} from '@angular/core';
+import {Observable} from 'rxjs';
+import { ApiService } from 'src/app/common/core/services/api.typed.service';
+import { BluePrintDetailModel } from '../../model/BluePrint.detail.model';
+import { ModelType } from '../model/ModelType.model';
+import { ResourceDictionaryURLs, BlueprintURLs } from 'src/app/common/constants/app-constants';
+
+
+
+@Injectable({
+    providedIn: 'root'
+})
+export class SourceViewService {
+
+    constructor(private api1: ApiService<BluePrintDetailModel>) {
+    }
+
+
+    private getBluePrintModel(id: string): Observable<BluePrintDetailModel> {
+        return this.api1.getOne(BlueprintURLs.getOneBlueprint + '/' + id);
+    }
+    getPagedPackages(id: string) {
+        return this.getBluePrintModel(id);
+    }
+
+}
index ad06cf1..f357bc1 100644 (file)
@@ -12,10 +12,10 @@ const routes: Routes = [
         path: '',
         component: PackagesDashboardComponent
     },
-    {path: 'designer', component: DesignerComponent},
-    { path: 'designer/source', component: DesignerSourceViewComponent },
+    {path: 'designer/:id', component: DesignerComponent},
+    {path: 'designer/source/:id', component: DesignerSourceViewComponent},
     {path: 'package/:id', component: ConfigurationDashboardComponent},
-    {path: 'createPackage', component: PackageCreationComponent},
+    {path: 'createPackage', component: PackageCreationComponent}
 ];
 
 @NgModule({