Skip to content

Commit

Permalink
Added visualization API service to frontend (#1675)
Browse files Browse the repository at this point in the history
  • Loading branch information
ajchili authored and k8s-ci-robot committed Jul 25, 2019
1 parent 2355451 commit a4813ff
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions frontend/src/lib/Apis.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
9 changes: 9 additions & 0 deletions frontend/src/lib/Apis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit a4813ff

Please sign in to comment.