diff options
author | 2020-05-14 18:13:14 +0530 | |
---|---|---|
committer | 2020-05-14 14:39:59 +0000 | |
commit | 8edf6f6c1ce26923439f3474f54904d05d076714 (patch) | |
tree | 39887c03c4a69b2c8ddfde7576bcf6b57d9eece4 /cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/source-view | |
parent | ae362a76b5bef17db5c7c747b01b504f8ca2a66d (diff) |
Designer > Breadcrumb
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>
Diffstat (limited to 'cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/source-view')
3 files changed, 45 insertions, 6 deletions
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/source-view/source-view.component.html b/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/source-view/source-view.component.html index 2a558517c..05f6eeb5a 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/source-view/source-view.component.html +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/source-view/source-view.component.html @@ -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> diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/source-view/source-view.component.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/source-view/source-view.component.ts index 34194e42f..e70d98d04 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/source-view/source-view.component.ts +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/source-view/source-view.component.ts @@ -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 index 000000000..758952221 --- /dev/null +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/source-view/source-view.service.ts @@ -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); + } + +} |