From a4813fffb8778efb6b445e402180391c55c82e41 Mon Sep 17 00:00:00 2001 From: Kirin Patel Date: Thu, 25 Jul 2019 18:10:05 +0000 Subject: [PATCH] Added visualization API service to frontend (#1675) --- frontend/src/lib/Apis.test.ts | 4 ++++ frontend/src/lib/Apis.ts | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/frontend/src/lib/Apis.test.ts b/frontend/src/lib/Apis.test.ts index b20c48e5c54..d43e9b25695 100644 --- a/frontend/src/lib/Apis.test.ts +++ b/frontend/src/lib/Apis.test.ts @@ -40,6 +40,10 @@ describe('Apis', () => { it('hosts a singleton runServiceApi', () => { expect(Apis.runServiceApi).toBe(Apis.runServiceApi); }); + + it('hosts a singleton visualizationServiceApi', () => { + expect(Apis.visualizationServiceApi).toBe(Apis.visualizationServiceApi); + }); it('getPodLogs', async () => { const spy = fetchSpy('http://some/address'); diff --git a/frontend/src/lib/Apis.ts b/frontend/src/lib/Apis.ts index e300ce46258..7e43908ca74 100644 --- a/frontend/src/lib/Apis.ts +++ b/frontend/src/lib/Apis.ts @@ -18,6 +18,7 @@ import { JobServiceApi } from '../apis/job'; import { RunServiceApi } from '../apis/run'; import { PipelineServiceApi, ApiPipeline } from '../apis/pipeline'; import { StoragePath } from './WorkflowParser'; +import { VisualizationServiceApi } from '../apis/visualization'; const v1beta1Prefix = 'apis/v1beta1'; @@ -79,6 +80,13 @@ export class Apis { return this._runServiceApi; } + public static get visualizationServiceApi(): VisualizationServiceApi { + if (!this._visualizationServiceApi) { + this._visualizationServiceApi = new VisualizationServiceApi({ basePath: this.basePath }); + } + return this._visualizationServiceApi; + } + /** * Retrieve various information about the build. */ @@ -158,6 +166,7 @@ export class Apis { private static _jobServiceApi?: JobServiceApi; private static _pipelineServiceApi?: PipelineServiceApi; private static _runServiceApi?: RunServiceApi; + private static _visualizationServiceApi?: VisualizationServiceApi; /** * This function will call this._fetch() and parse the resulting JSON into an object of type T.