diff options
author | Sara Weiss <sara.weiss@intl.att.com> | 2019-12-12 13:45:32 +0200 |
---|---|---|
committer | Sara Weiss <sara.weiss@intl.att.com> | 2019-12-15 12:55:05 +0200 |
commit | d6c8504a8ec747b9397c84f2d1f81ab656e8e4a2 (patch) | |
tree | 0d7904b9d010f7c177ff886507198cc88c1583c3 /vid-webpack-master/src | |
parent | 1a6e6bfbf92bc704d4c4e7b2e3593183fd4d2862 (diff) |
Load template button in new template modal
Issue-ID: VID-724
Signed-off-by: Sara Weiss <sara.weiss@intl.att.com>
Change-Id: I3a3d6a10b364b61f6a7631b47107b7c4de601aaf
Diffstat (limited to 'vid-webpack-master/src')
7 files changed, 29 insertions, 15 deletions
diff --git a/vid-webpack-master/src/app/instantiationStatus/instantiationStatus.component.service.ts b/vid-webpack-master/src/app/instantiationStatus/instantiationStatus.component.service.ts index 4bfedd913..229beb443 100644 --- a/vid-webpack-master/src/app/instantiationStatus/instantiationStatus.component.service.ts +++ b/vid-webpack-master/src/app/instantiationStatus/instantiationStatus.component.service.ts @@ -13,6 +13,7 @@ import {Router, UrlTree} from "@angular/router"; import {of} from "rxjs"; import {MsoService} from "../shared/services/msoService/mso.service"; import {ServiceAction} from "../shared/models/serviceInstanceActions"; +import {InstantiationBase} from "../shared/models/serviceBase"; export let PENDING : string = "pending"; export let INPROGRESS : string = "in_progress"; @@ -112,21 +113,21 @@ export class InstantiationStatusComponentService { window.parent.location.assign('../../serviceModels.htm#/instantiate?' + query); } - navigateToNewViewEdit(item: ServiceInfoModel, mode: DrawingBoardModes): void{ + navigateToNewViewEdit(item: InstantiationBase, mode: DrawingBoardModes): void { this._store.dispatch(updateDrawingBoardStatus(mode)); const viewEditUrlTree:UrlTree = this.getNewViewEditUrlTree(item, mode); this._router.navigateByUrl(viewEditUrlTree); window.parent.location.assign(this.getViewEditUrl(viewEditUrlTree)); } - getNewViewEditUrlTree(item: ServiceInfoModel, mode: DrawingBoardModes): UrlTree { + getNewViewEditUrlTree(item: InstantiationBase, mode: DrawingBoardModes): UrlTree { return this._router.createUrlTree( ['/servicePlanning/' + mode], { queryParams: mode==DrawingBoardModes.RECREATE ? this.getRecreateQueryParams(item) : - this.getDefaultViewEditQueryParams(item) + this.getDefaultViewEditQueryParams(<ServiceInfoModel> item) }); } @@ -140,7 +141,7 @@ export class InstantiationStatusComponentService { }; } - private getRecreateQueryParams(item: ServiceInfoModel) { + private getRecreateQueryParams(item: InstantiationBase) { return { serviceModelId: item.serviceModelId, jobId: item.jobId diff --git a/vid-webpack-master/src/app/shared/components/genericFormPopup/instantiationTemplatesModal/instantiation.templates.modal.component.html b/vid-webpack-master/src/app/shared/components/genericFormPopup/instantiationTemplatesModal/instantiation.templates.modal.component.html index 19f641a56..86c46ab3b 100644 --- a/vid-webpack-master/src/app/shared/components/genericFormPopup/instantiationTemplatesModal/instantiation.templates.modal.component.html +++ b/vid-webpack-master/src/app/shared/components/genericFormPopup/instantiationTemplatesModal/instantiation.templates.modal.component.html @@ -50,8 +50,8 @@ <tbody> <tr class="member-table-row" *ngFor="let item of filterTableData | searchFilter: filterText ;" - (click)="selectedJobId = item.jobId" - [ngClass]="{'selected' : selectedJobId === item.jobId}" + (click)="selectedInstantiation = item" + [ngClass]="{'selected' : selectedInstantiation && selectedInstantiation.jobId === item.jobId}" [attr.data-tests-id]="'row-' + item.jobId"> <td> <div> @@ -148,7 +148,7 @@ </div> <div class="col-md-6" style="padding: 15px;padding-right: 35px;"> <button - [disabled]="selectedJobId === null" + [disabled]="selectedInstantiation && selectedInstantiation.jobId === null" [attr.data-tests-id]="'LoadTemplateButton'" type="button" class="btn btn-primary submit" (click)="loadTemplate()"><span>Load Template</span> diff --git a/vid-webpack-master/src/app/shared/components/genericFormPopup/instantiationTemplatesModal/instantiation.templates.modal.component.ts b/vid-webpack-master/src/app/shared/components/genericFormPopup/instantiationTemplatesModal/instantiation.templates.modal.component.ts index 4d89750f9..7b16b6677 100644 --- a/vid-webpack-master/src/app/shared/components/genericFormPopup/instantiationTemplatesModal/instantiation.templates.modal.component.ts +++ b/vid-webpack-master/src/app/shared/components/genericFormPopup/instantiationTemplatesModal/instantiation.templates.modal.component.ts @@ -5,6 +5,8 @@ import {ActivatedRoute} from "@angular/router"; import {ServiceInfoService} from "../../../server/serviceInfo/serviceInfo.service"; import {InstantiationTemplatesModalService} from "./instantiation.templates.modal.service"; import {InstantiationTemplatesRowModel} from "./instantiation.templates.row.model"; +import {DrawingBoardModes} from "../../../../drawingBoard/service-planning/drawing-board.modes"; +import {InstantiationStatusComponentService} from "../../../../instantiationStatus/instantiationStatus.component.service"; @Component({ selector: 'template-modal', @@ -14,7 +16,7 @@ import {InstantiationTemplatesRowModel} from "./instantiation.templates.row.mode export class InstantiationTemplatesModalComponent extends DialogComponent<string, boolean> implements OnInit, OnDestroy { - selectedJobId : string = null; + selectedInstantiation: InstantiationTemplatesRowModel = null; templateModalComponentService: InstantiationTemplatesModalService; originalTableData: InstantiationTemplatesRowModel[] = []; filterTableData : InstantiationTemplatesRowModel[] = []; @@ -24,6 +26,7 @@ export class InstantiationTemplatesModalComponent extends DialogComponent<string private _iframeService: IframeService, private _serviceInfoService: ServiceInfoService, private _templateModalComponentService: InstantiationTemplatesModalService, + private _instantiationStatusComponentService: InstantiationStatusComponentService, private _route: ActivatedRoute) { super(dialogService); this.templateModalComponentService = _templateModalComponentService; @@ -42,6 +45,7 @@ export class InstantiationTemplatesModalComponent extends DialogComponent<string } loadTemplate = () => { + this._instantiationStatusComponentService.navigateToNewViewEdit(this.selectedInstantiation, DrawingBoardModes.RECREATE) }; diff --git a/vid-webpack-master/src/app/shared/components/genericFormPopup/instantiationTemplatesModal/instantiation.templates.modal.service.ts b/vid-webpack-master/src/app/shared/components/genericFormPopup/instantiationTemplatesModal/instantiation.templates.modal.service.ts index 7126da36a..8377ccf42 100644 --- a/vid-webpack-master/src/app/shared/components/genericFormPopup/instantiationTemplatesModal/instantiation.templates.modal.service.ts +++ b/vid-webpack-master/src/app/shared/components/genericFormPopup/instantiationTemplatesModal/instantiation.templates.modal.service.ts @@ -3,6 +3,7 @@ import {InstantiationTemplatesRowModel} from "./instantiation.templates.row.mode @Injectable() export class InstantiationTemplatesModalService { + convertResponseToUI = (jobsResponse: any[]): InstantiationTemplatesRowModel[] => { let tableRows: InstantiationTemplatesRowModel[] = []; @@ -12,4 +13,5 @@ export class InstantiationTemplatesModalService { return tableRows; }; + } diff --git a/vid-webpack-master/src/app/shared/components/genericFormPopup/instantiationTemplatesModal/instantiation.templates.row.model.ts b/vid-webpack-master/src/app/shared/components/genericFormPopup/instantiationTemplatesModal/instantiation.templates.row.model.ts index 08982cc67..f4609ee35 100644 --- a/vid-webpack-master/src/app/shared/components/genericFormPopup/instantiationTemplatesModal/instantiation.templates.row.model.ts +++ b/vid-webpack-master/src/app/shared/components/genericFormPopup/instantiationTemplatesModal/instantiation.templates.row.model.ts @@ -1,8 +1,8 @@ import * as moment from 'moment'; import * as _ from 'lodash'; +import {InstantiationBase} from "../../../models/serviceBase"; -export class InstantiationTemplatesRowModel { - readonly jobId: string; +export class InstantiationTemplatesRowModel extends InstantiationBase{ readonly userId ?: string; readonly createDate ?: string; readonly instanceName ?: string; @@ -13,7 +13,7 @@ export class InstantiationTemplatesRowModel { readonly aicZone?: string; constructor(data) { - this.jobId = data.jobId; + super(data); this.userId = !_.isNil(data.created) ? data.userId : null; this.createDate = !_.isNil(data.created) ? moment(data.created).format("YYYY-MM-DD HH:mm:ss") : null; this.instanceName = this.getInstanceName(data.serviceInstanceName); @@ -22,7 +22,6 @@ export class InstantiationTemplatesRowModel { this.region = this.getRegion(data.regionId, data.owningEntityName); this.tenant = !_.isNil(data.tenantName) ? data.tenantName : null; this.aicZone = !_.isNil(data.aicZoneName) ? data.aicZoneName : null; - } diff --git a/vid-webpack-master/src/app/shared/models/serviceBase.ts b/vid-webpack-master/src/app/shared/models/serviceBase.ts new file mode 100644 index 000000000..b6dec0fbb --- /dev/null +++ b/vid-webpack-master/src/app/shared/models/serviceBase.ts @@ -0,0 +1,9 @@ +export class InstantiationBase { + readonly jobId: string; + readonly serviceModelId: string; + + constructor(data) { + this.jobId = data.jobId; + this.serviceModelId = data.serviceModelId; + } +} diff --git a/vid-webpack-master/src/app/shared/server/serviceInfo/serviceInfo.model.ts b/vid-webpack-master/src/app/shared/server/serviceInfo/serviceInfo.model.ts index a507e073e..fa26a61a6 100644 --- a/vid-webpack-master/src/app/shared/server/serviceInfo/serviceInfo.model.ts +++ b/vid-webpack-master/src/app/shared/server/serviceInfo/serviceInfo.model.ts @@ -1,7 +1,8 @@ import {ServiceStatus} from '../../../instantiationStatus/instantiationStatus.component.service'; import {ServiceAction} from "../../models/serviceInstanceActions"; +import {InstantiationBase} from "../../models/serviceBase"; -export class ServiceInfoModel { +export class ServiceInfoModel extends InstantiationBase{ id: number; created: Date; modified: Date; @@ -28,12 +29,10 @@ export class ServiceInfoModel { subscriberId: string; serviceInstanceId: string; serviceInstanceName: string; - serviceModelId: string; serviceModelName: string; serviceModelVersion: string; templateId: string; auditUserId: string; - jobId: string; action: ServiceAction; isRetryEnabled: boolean; } |