1 import {Injectable} from "@angular/core";
2 import {InstantiationTemplatesRowModel} from "./instantiation.templates.row.model";
3 import {Router} from "@angular/router";
4 import * as _ from 'lodash';
7 export class InstantiationTemplatesModalService {
8 constructor(private _router : Router){
11 convertResponseToUI = (jobsResponse: any[]): InstantiationTemplatesRowModel[] => {
12 let tableRows: InstantiationTemplatesRowModel[] = [];
14 jobsResponse.forEach((job) => {
15 tableRows.push(new InstantiationTemplatesRowModel(job));
22 filterByUserId = (userId: string, originalTableData: InstantiationTemplatesRowModel[]): InstantiationTemplatesRowModel[] => {
23 if (!_.isNil(originalTableData)) {
24 return originalTableData.filter((item: InstantiationTemplatesRowModel) => {
25 return item.userId === userId;
32 navigateToNewServiceModal(serviceModelId: string) {
33 this._router.navigate(['/servicePopup'], { queryParams: { serviceModelId: serviceModelId, isCreate:true, isInstantiationTemplateExists : true}, queryParamsHandling: 'merge' });