55 MatchLabels ,
66 Selector ,
77} from '@console/dynamic-plugin-sdk/src' ;
8- import { RouteModel } from '@console/internal/models' ;
98import { k8sGet } from '@console/internal/module/k8s' ;
109import { ALL_NAMESPACES_KEY } from '@console/shared/src/constants' ;
1110import { consoleProxyFetch , consoleProxyFetchJSON } from '@console/shared/src/utils/proxy' ;
@@ -205,22 +204,7 @@ export const clearCache = () => {
205204} ;
206205const InFlightStore : { [ key : string ] : boolean } = { } ;
207206
208- // const getTRUrlPrefix = (): string => URL_PREFIX;
209-
210207export const getTRURLHost = async ( ) => {
211- const tektonResult = await k8sGet ( TektonResultModel , 'result' ) ;
212- const targetNamespace = tektonResult ?. spec ?. targetNamespace ;
213- const route = await k8sGet ( RouteModel , 'tekton-results-api-service' , targetNamespace ) ;
214- return route ?. spec . host ;
215- } ;
216-
217- export const createTektonResultsUrl = async (
218- namespace : string ,
219- dataType ?: DataType ,
220- filter ?: string ,
221- options ?: TektonResultsOptions ,
222- nextPageToken ?: string ,
223- ) : Promise < string > => {
224208 const tektonResult = await k8sGet ( TektonResultModel , 'result' ) ;
225209 const targetNamespace = tektonResult ?. spec ?. targetNamespace ;
226210 const serverPort = tektonResult ?. spec ?. server_port ?? '8080' ;
@@ -233,6 +217,17 @@ export const createTektonResultsUrl = async (
233217 } else {
234218 tektonResultsAPI = `tekton-results-api-service.openshift-pipelines.svc.cluster.local:${ serverPort } ` ;
235219 }
220+ return tektonResultsAPI ;
221+ } ;
222+
223+ export const createTektonResultsUrl = async (
224+ namespace : string ,
225+ dataType ?: DataType ,
226+ filter ?: string ,
227+ options ?: TektonResultsOptions ,
228+ nextPageToken ?: string ,
229+ ) : Promise < string > => {
230+ const tektonResultsAPI = await getTRURLHost ( ) ;
236231 const namespaceToSearch = namespace && namespace !== ALL_NAMESPACES_KEY ? namespace : '-' ;
237232 const url = `https://${ tektonResultsAPI } /apis/results.tekton.dev/v1alpha2/parents/${ namespaceToSearch } /results/-/records?${ new URLSearchParams (
238233 {
0 commit comments