aboutsummaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app/shared/server
diff options
context:
space:
mode:
authorIttay Stern <ittay.stern@att.com>2018-08-29 17:01:32 +0300
committerIttay Stern <ittay.stern@att.com>2019-02-18 18:35:30 +0200
commit6f900cc45d7dd7f97430812b86b5c1d1693c8ae3 (patch)
tree936005c364dc5a7264d6304d4777c3d83494db22 /vid-webpack-master/src/app/shared/server
parent67d99f816cc583643c35193197594cf78d8ce60a (diff)
merge from ecomp a88f0072 - Modern UI
Issue-ID: VID-378 Change-Id: Ibcb23dd27f550cf32ce2fe0239f0f496ae014ff6 Signed-off-by: Ittay Stern <ittay.stern@att.com>
Diffstat (limited to 'vid-webpack-master/src/app/shared/server')
-rw-r--r--vid-webpack-master/src/app/shared/server/healthStatusService/health-status.service.spec.ts60
-rw-r--r--vid-webpack-master/src/app/shared/server/healthStatusService/health-status.service.ts6
-rw-r--r--vid-webpack-master/src/app/shared/server/serviceInfo/AuditStatus.model.ts4
-rw-r--r--vid-webpack-master/src/app/shared/server/serviceInfo/serviceInfo.model.ts6
-rw-r--r--vid-webpack-master/src/app/shared/server/serviceInfo/serviceInfo.service.spec.ts77
-rw-r--r--vid-webpack-master/src/app/shared/server/serviceInfo/serviceInfo.service.ts49
6 files changed, 102 insertions, 100 deletions
diff --git a/vid-webpack-master/src/app/shared/server/healthStatusService/health-status.service.spec.ts b/vid-webpack-master/src/app/shared/server/healthStatusService/health-status.service.spec.ts
deleted file mode 100644
index 36f6349e2..000000000
--- a/vid-webpack-master/src/app/shared/server/healthStatusService/health-status.service.spec.ts
+++ /dev/null
@@ -1,60 +0,0 @@
-import {TestBed, inject, getTestBed} from '@angular/core/testing';
-
-import { HealthStatusService } from './health-status.service';
-import {Constants} from "../../utils/constants";
-import {HttpClientTestingModule, HttpTestingController} from "@angular/common/http/testing";
-import {ExternalComponentStatus} from "../../models/externalComponentStatus";
-
-describe('HealthStatusService', () => {
-
- let injector;
- let service: HealthStatusService;
- let httpMock: HttpTestingController;
-
- beforeEach(() => {
- TestBed.configureTestingModule({
- imports: [HttpClientTestingModule],
- providers: [HealthStatusService]
- });
-
- injector = getTestBed();
- service = injector.get(HealthStatusService);
- httpMock = injector.get(HttpTestingController);
- });
-
- describe('#getProbe', () =>{
- it('when call probe, there is http GET with right url', () => {
-
- service.getProbe().subscribe((result: Array<ExternalComponentStatus>)=>{
- expect(result[0].component).toEqual("AAI");
- expect(result[0].available).toBeTruthy();
- expect(result[0].metadata).toEqual({ myKey: 'myValue' });
-
- expect(result[1].component).toEqual("MSO");
- expect(result[1].available).toBeFalsy();
- expect(result[1].metadata).toEqual({otherKey: 123});
- });
-
- const req = httpMock.expectOne(Constants.Path.SERVICES_PROBE_PATH);
- expect(req.request.method).toEqual('GET');
- req.flush([
- {
- "component": "AAI",
- "available": true,
- "metadata": {
- "myKey": "myValue"
- }
- },
- {
- "component": "MSO",
- "available": false,
- "metadata": {
- "otherKey": 123
- }
- },
- ]);
- });
-
- });
-
-});
diff --git a/vid-webpack-master/src/app/shared/server/healthStatusService/health-status.service.ts b/vid-webpack-master/src/app/shared/server/healthStatusService/health-status.service.ts
index 4305ab97e..71e32f1d4 100644
--- a/vid-webpack-master/src/app/shared/server/healthStatusService/health-status.service.ts
+++ b/vid-webpack-master/src/app/shared/server/healthStatusService/health-status.service.ts
@@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';
import {HttpClient} from "@angular/common/http";
-import {Observable} from "rxjs/Observable";
+import {Observable} from "rxjs";
import {Constants} from "../../utils/constants";
import {ExternalComponentStatus} from "../../models/externalComponentStatus";
@@ -10,8 +10,8 @@ export class HealthStatusService {
constructor(private _http: HttpClient) {
}
- getProbe(): Observable<Array<ExternalComponentStatus>> {
+ getProbe(): Observable<ExternalComponentStatus[]> {
let pathQuery = Constants.Path.SERVICES_PROBE_PATH;
- return this._http.get<Array<ExternalComponentStatus>>(pathQuery).map(res => res);
+ return this._http.get<ExternalComponentStatus[]>(pathQuery).map(res => res);
}
}
diff --git a/vid-webpack-master/src/app/shared/server/serviceInfo/AuditStatus.model.ts b/vid-webpack-master/src/app/shared/server/serviceInfo/AuditStatus.model.ts
index 0b4c70f9d..a0920a902 100644
--- a/vid-webpack-master/src/app/shared/server/serviceInfo/AuditStatus.model.ts
+++ b/vid-webpack-master/src/app/shared/server/serviceInfo/AuditStatus.model.ts
@@ -6,5 +6,7 @@ export class AuditStatus{
jobStatus :string;
source: string;
requestId: string;
- additionalInfo :any
+ additionalInfo :any;
+ instanceName: string;
+ instanceType : string;
}
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 0b4695930..a507e073e 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,4 +1,5 @@
import {ServiceStatus} from '../../../instantiationStatus/instantiationStatus.component.service';
+import {ServiceAction} from "../../models/serviceInstanceActions";
export class ServiceInfoModel {
id: number;
@@ -9,6 +10,8 @@ export class ServiceInfoModel {
numRow: number;
uuid: string;
userId: string;
+ requestId: string;
+ aLaCarte: boolean;
jobStatus: string;
pause: boolean;
owningEntityId: string;
@@ -22,6 +25,7 @@ export class ServiceInfoModel {
regionName: string;
serviceType: string;
subscriberName: string;
+ subscriberId: string;
serviceInstanceId: string;
serviceInstanceName: string;
serviceModelId: string;
@@ -30,6 +34,8 @@ export class ServiceInfoModel {
templateId: string;
auditUserId: string;
jobId: string;
+ action: ServiceAction;
+ isRetryEnabled: boolean;
}
export class ServiceInfoUiModel extends ServiceInfoModel{
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 78c1b5ab9..147434b1a 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
@@ -9,59 +9,75 @@ describe('Service Info Service', () => {
let service: ServiceInfoService;
let httpMock: HttpTestingController;
- beforeEach(() => {
+ beforeAll(done => (async () => {
TestBed.configureTestingModule({
imports: [HttpClientTestingModule],
providers: [ServiceInfoService]
});
+ await TestBed.compileComponents();
+
injector = getTestBed();
service = injector.get(ServiceInfoService);
httpMock = injector.get(HttpTestingController);
- });
- describe('#getServicesJobInfo', () => {
- it('should return an Observable<ServiceInfoModel[]>', () => {
- const dummyServiceInfo: ServiceInfoModel[] = generateServiceInfoData();
+ })().then(done).catch(done.fail));
- service.getServicesJobInfo(true).subscribe((serviceInfo:Array<ServiceInfoModel>) => {
- expect(serviceInfo).toEqual(dummyServiceInfo);
- });
- });
+ describe('#getMacroJobAuditStatus', ()=> {
+ test('should return Observable<Object[]>', ()=>{
+ let job: ServiceInfoModel = new ServiceInfoModel();
+ job.jobId = '111';
+ service.getJobAuditStatus(job).subscribe();
+ const req = httpMock.expectOne(Constants.Path.SERVICES_JOB_INFO_PATH + Constants.Path.SERVICES_JOB_AUDIT_PATH + '/' + job.jobId + '?source=VID');
+ const req2 = httpMock.expectOne(Constants.Path.SERVICES_JOB_INFO_PATH + Constants.Path.SERVICES_JOB_AUDIT_PATH + '/' + job.jobId + '?source=MSO');
+ expect(req.request.method).toBe('GET');
+ expect(req2.request.method).toBe('GET');
+ });
});
- describe('#deleteJob', () =>{
- it('delete job', () => {
- const jobId : string = "1111";
-
- service.deleteJob(jobId).subscribe();
+ describe('#getALaCarteJobAuditStatus Without params', ()=> {
+ test('should return Observable<Object[]>', ()=>{
+ let job: ServiceInfoModel = new ServiceInfoModel();
+ job.aLaCarte = true;
+ job.jobId = '111';
- const req = httpMock.expectOne(Constants.Path.SERVICES_JOB_INFO_PATH + '/job/' + jobId);
- expect(req.request.method).toEqual('DELETE');
+ service.getJobAuditStatus(job).subscribe();
+ const req = httpMock.expectOne(Constants.Path.SERVICES_JOB_INFO_PATH + Constants.Path.SERVICES_JOB_AUDIT_PATH + '/' + job.jobId + '?source=VID');
+ const req2 = httpMock.expectOne(Constants.Path.SERVICES_JOB_INFO_PATH + Constants.Path.SERVICES_JOB_AUDIT_PATH + '/' + job.jobId + '/mso');
+ expect(req.request.method).toEqual('GET');
+ expect(req2.request.method).toEqual('GET');
});
});
- describe('#hideJob', () =>{
- it('when call hide job, there is http POST with right url', () => {
- const jobId : string = "3";
+ describe('#getALaCarteJobAuditStatus With ServiceInstanceId', ()=> {
+ test('should return Observable<Object[]>', ()=>{
+ let job: ServiceInfoModel = new ServiceInfoModel();
+ job.aLaCarte = true;
+ job.jobId = '111';
+ job.serviceInstanceId = '222';
- service.hideJob(jobId).subscribe();
+ service.getJobAuditStatus(job).subscribe();
+ const req = httpMock.expectOne(Constants.Path.SERVICES_JOB_INFO_PATH + Constants.Path.SERVICES_JOB_AUDIT_PATH + '/' + job.jobId + '?source=VID');
+ const req2 = httpMock.expectOne(Constants.Path.SERVICES_JOB_INFO_PATH + Constants.Path.SERVICES_JOB_AUDIT_PATH + '/' + job.jobId + '/mso?serviceInstanceId=' + job.serviceInstanceId);
- const req = httpMock.expectOne(Constants.Path.SERVICES_JOB_INFO_PATH + '/hide/' + jobId);
- expect(req.request.method).toEqual('POST');
+ expect(req.request.method).toEqual('GET');
+ expect(req2.request.method).toEqual('GET');
});
});
- describe('#getJobAuditStatus', ()=> {
- it('should return Observable<Object[]>', ()=>{
- const jobId : string = '111';
+ describe('#getALaCarteJobAuditStatus With RequestId', ()=> {
+ test('should return Observable<Object[]>', ()=>{
+ let job: ServiceInfoModel = new ServiceInfoModel();
+ job.aLaCarte = true;
+ job.jobId = '111';
+ job.requestId = '333';
- service.getJobAuditStatus(jobId).subscribe();
- const req = httpMock.expectOne(Constants.Path.SERVICES_JOB_INFO_PATH + Constants.Path.SERVICES_JOB_AUDIT_PATH + '/' + jobId + '?source=VID');
- const req2 = httpMock.expectOne(Constants.Path.SERVICES_JOB_INFO_PATH + Constants.Path.SERVICES_JOB_AUDIT_PATH + '/' + jobId + '?source=MSO');
+ service.getJobAuditStatus(job).subscribe();
+ const req = httpMock.expectOne(Constants.Path.SERVICES_JOB_INFO_PATH + Constants.Path.SERVICES_JOB_AUDIT_PATH + '/' + job.jobId + '?source=VID');
+ const req2 = httpMock.expectOne(Constants.Path.SERVICES_JOB_INFO_PATH + Constants.Path.SERVICES_JOB_AUDIT_PATH + '/' + job.jobId + '/mso?requestId=' + job.requestId);
expect(req.request.method).toEqual('GET');
expect(req2.request.method).toEqual('GET');
@@ -73,6 +89,7 @@ describe('Service Info Service', () => {
[{
"created": 1519956533000,
"modified": 1521727738000,
+ "action": "INSTANTIATE",
"createdId": null,
"modifiedId": null,
"rowNum": null,
@@ -105,6 +122,7 @@ describe('Service Info Service', () => {
{
"created": 1519956533000,
"modified": 1521727738000,
+ "action": "INSTANTIATE",
"createdId": null,
"modifiedId": null,
"rowNum": null,
@@ -137,6 +155,7 @@ describe('Service Info Service', () => {
{
"created": 1519956533000,
"modified": 1521727738000,
+ "action": "INSTANTIATE",
"createdId": null,
"modifiedId": null,
"rowNum": null,
@@ -169,6 +188,7 @@ describe('Service Info Service', () => {
{
"created": 1519956533000,
"modified": 1521727738000,
+ "action": "INSTANTIATE",
"createdId": null,
"modifiedId": null,
"rowNum": null,
@@ -201,6 +221,7 @@ describe('Service Info Service', () => {
{
"created": 1519956533000,
"modified": 1521727738000,
+ "action": "INSTANTIATE",
"createdId": null,
"modifiedId": null,
"rowNum": null,
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 e0057bb4d..fe6ebc7ee 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
@@ -1,19 +1,23 @@
import {Injectable} from '@angular/core';
-import {Observable} from 'rxjs/Observable';
+import {Observable} from 'rxjs';
import {ServiceInfoModel} from './serviceInfo.model';
-import {HttpClient} from '@angular/common/http';
-import 'rxjs/add/operator/map'
+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';
+import {AuditStatus} from "./AuditStatus.model";
@Injectable()
export class ServiceInfoService {
constructor(private _http: HttpClient) {
}
- getServicesJobInfo(filterByUser : boolean): Observable<ServiceInfoModel[]> {
+ getServicesJobInfo(filterByUser : boolean, showSpinner: boolean = true): Observable<ServiceInfoModel[]> {
let pathQuery = Constants.Path.SERVICES_JOB_INFO_PATH;
- return this._http.get<ServiceInfoModel[]>(pathQuery).map(res => res );
+ let headers = new HttpHeaders({'x-show-spinner': showSpinner.toString()});
+ return this._http.get<ServiceInfoModel[]>(pathQuery, { headers: headers }).map(res => res );
}
deleteJob(jobId: string): Observable<any> {
@@ -26,13 +30,42 @@ export class ServiceInfoService {
return this._http.post<any>(pathQuery, null).map(res => res);
}
- getJobAuditStatus(jobId : string) : Observable<Object[]>{
- let pathQueryVID = Constants.Path.SERVICES_JOB_INFO_PATH + Constants.Path.SERVICES_JOB_AUDIT_PATH + '/' + jobId + '?source=VID';
- let pathQueryMSO = Constants.Path.SERVICES_JOB_INFO_PATH + Constants.Path.SERVICES_JOB_AUDIT_PATH + '/' + jobId + '?source=MSO';
+ getJobAuditStatus(jobData: ServiceInfoModel) : Observable<Object[]>{
+ let pathQueryBySource: string = Constants.Path.SERVICES_JOB_INFO_PATH + Constants.Path.SERVICES_JOB_AUDIT_PATH + '/' + jobData.jobId + '?source=';
+ let pathQueryVID: string = pathQueryBySource + 'VID';
+ let pathQueryMSO: string;
+
+ // just call it
+ if(jobData.aLaCarte) {
+ let requestParams: string[] = [];
+ pathQueryMSO = Constants.Path.SERVICES_JOB_INFO_PATH + Constants.Path.SERVICES_JOB_AUDIT_PATH + '/' + jobData.jobId + '/mso';
+ if (!_.isEmpty(jobData.requestId)) {
+ requestParams[requestParams.length] = 'requestId=' + jobData.requestId;
+ }
+ if (!_.isEmpty(jobData.serviceInstanceId)) {
+ requestParams[requestParams.length] = 'serviceInstanceId=' + jobData.serviceInstanceId;
+ }
+ if (requestParams.length > 0) {
+ pathQueryMSO += '?' + requestParams.join('&');
+ }
+ }
+ else {
+ pathQueryMSO = pathQueryBySource + 'MSO';
+ }
+
let vidObs = this._http.get(pathQueryVID);
let msoObs = this._http.get(pathQueryMSO);
return forkJoin([vidObs, msoObs]);
}
+ getInstanceAuditStatus(instanceId: string, type :string) : Observable<AuditStatus[]>{
+ let pathQuery: string = Constants.Path.SERVICES_JOB_INFO_PATH + Constants.Path.SERVICES_JOB_AUDIT_PATH + '/' + type + '/' + instanceId + '/mso';
+ return this._http.get<any>(pathQuery).map(res => res);
+ }
+
+ getAuditStatusForRetry(trackById: string) : Observable<AuditStatus>{
+ let pathQuery: string = Constants.Path.AUDIT_STATUS_FOR_RETRY_PATH + '/' + trackById ;
+ return this._http.get<any>(pathQuery).map(res => res);
+ }
}