From d0a3e90aa0c515dfa94cf648d339db58e285b4cb Mon Sep 17 00:00:00 2001 From: Eylon Malin Date: Mon, 2 Dec 2019 10:55:37 +0200 Subject: FE getServicesJobInfo can filter by serviceModelId Issue-ID: VID-724 Signed-off-by: Eylon Malin Change-Id: I3acff0f47810825d90b91dbeaaedcdd348c7d733 --- .../instantiationStatus.component.ts | 5 ++--- .../server/serviceInfo/serviceInfo.service.spec.ts | 19 +++++++++++++++++++ .../shared/server/serviceInfo/serviceInfo.service.ts | 7 +++---- vid-webpack-master/src/app/shared/utils/constants.ts | 1 + 4 files changed, 25 insertions(+), 7 deletions(-) (limited to 'vid-webpack-master/src') diff --git a/vid-webpack-master/src/app/instantiationStatus/instantiationStatus.component.ts b/vid-webpack-master/src/app/instantiationStatus/instantiationStatus.component.ts index f3f651960..efb1a5694 100644 --- a/vid-webpack-master/src/app/instantiationStatus/instantiationStatus.component.ts +++ b/vid-webpack-master/src/app/instantiationStatus/instantiationStatus.component.ts @@ -11,7 +11,6 @@ import {LogService} from '../shared/utils/log/log.service'; import {AppState} from "../shared/store/reducers"; import {NgRedux} from '@angular-redux/store'; import {JobStatus, ServiceAction} from "../shared/models/serviceInstanceActions"; -import {DrawingBoardModes} from "../drawingBoard/service-planning/drawing-board.modes"; export interface MenuAction{ name: string; @@ -115,7 +114,7 @@ export class InstantiationStatusComponent { refreshData(): void { this.dataIsReady = false; - this._serviceInfoService.getServicesJobInfo(true, this.lastUpdatedDate === null) + this._serviceInfoService.getServicesJobInfo(this.lastUpdatedDate === null) .subscribe((res: ServiceInfoModel[]) => { this._instantiationStatusComponentService.convertObjectToArray(res).subscribe((res) => { this._logService.info('refresh instantiation status table', res); @@ -144,7 +143,7 @@ export class InstantiationStatusComponent { this.refreshData(); }); } - + retryItem(item: ServiceInfoModel) : void { if (item.isRetryEnabled) { this._instantiationStatusComponentService.retry(item); diff --git a/vid-webpack-master/src/app/shared/server/serviceInfo/serviceInfo.service.spec.ts b/vid-webpack-master/src/app/shared/server/serviceInfo/serviceInfo.service.spec.ts index 147434b1a..0234ea514 100644 --- a/vid-webpack-master/src/app/shared/server/serviceInfo/serviceInfo.service.spec.ts +++ b/vid-webpack-master/src/app/shared/server/serviceInfo/serviceInfo.service.spec.ts @@ -37,6 +37,25 @@ describe('Service Info Service', () => { }); }); + describe('#getServicesJobInfo', ()=> { + test('should call without serviceModelId', ()=>{ + let job: ServiceInfoModel = new ServiceInfoModel(); + + service.getServicesJobInfo().subscribe(); + const req = httpMock.expectOne(Constants.Path.SERVICES_JOB_INFO_PATH); + + expect(req.request.method).toBe('GET'); + }); + + test('should call with serviceModelId', ()=>{ + let job: ServiceInfoModel = new ServiceInfoModel(); + + service.getServicesJobInfo(true, "123").subscribe(); + const req = httpMock.expectOne(`${Constants.Path.SERVICES_JOB_INFO_PATH}?${Constants.Path.SERVICE_MODEL_ID}=123`); + expect(req.request.method).toBe('GET'); + }); + }); + describe('#getALaCarteJobAuditStatus Without params', ()=> { test('should return Observable', ()=>{ let job: ServiceInfoModel = new ServiceInfoModel(); diff --git a/vid-webpack-master/src/app/shared/server/serviceInfo/serviceInfo.service.ts b/vid-webpack-master/src/app/shared/server/serviceInfo/serviceInfo.service.ts index fe6ebc7ee..388afdba0 100644 --- a/vid-webpack-master/src/app/shared/server/serviceInfo/serviceInfo.service.ts +++ b/vid-webpack-master/src/app/shared/server/serviceInfo/serviceInfo.service.ts @@ -2,8 +2,6 @@ import {Injectable} from '@angular/core'; import {Observable} from 'rxjs'; import {ServiceInfoModel} from './serviceInfo.model'; import {HttpClient, HttpHeaders} from '@angular/common/http'; -import { of } from 'rxjs'; -import { map } from 'rxjs/operators'; import {Constants} from '../../utils/constants'; import {forkJoin} from "rxjs/observable/forkJoin"; import * as _ from 'lodash'; @@ -14,10 +12,11 @@ export class ServiceInfoService { constructor(private _http: HttpClient) { } - getServicesJobInfo(filterByUser : boolean, showSpinner: boolean = true): Observable { + getServicesJobInfo(showSpinner: boolean = true, serviceModelId: string = null): Observable { let pathQuery = Constants.Path.SERVICES_JOB_INFO_PATH; let headers = new HttpHeaders({'x-show-spinner': showSpinner.toString()}); - return this._http.get(pathQuery, { headers: headers }).map(res => res ); + let params = serviceModelId ? {serviceModelId} : {}; + return this._http.get(pathQuery, { headers: headers, params }); } deleteJob(jobId: string): Observable { diff --git a/vid-webpack-master/src/app/shared/utils/constants.ts b/vid-webpack-master/src/app/shared/utils/constants.ts index 400a4d8dc..6172320a4 100644 --- a/vid-webpack-master/src/app/shared/utils/constants.ts +++ b/vid-webpack-master/src/app/shared/utils/constants.ts @@ -92,6 +92,7 @@ export module Constants { public static WELCOME_PATH = 'welcome.htm'; public static IS_PERMITTED_SUB_PATH = '&isPermitted='; public static SERVICES_JOB_INFO_PATH = '../../asyncInstantiation'; + public static SERVICE_MODEL_ID = 'serviceModelId'; public static SERVICES_RETRY_TOPOLOGY = '../../asyncInstantiation/bulkForRetry'; public static CONFIGURATION_PATH = '../../get_property/{name}/defaultvalue'; public static SERVICES_JOB_AUDIT_PATH = '/auditStatus'; -- cgit 1.2.3-korg