From 7aad250001234202ee4ee99c50814809fd8cf8f0 Mon Sep 17 00:00:00 2001 From: Yaacov Zamir Date: Sun, 6 Mar 2022 21:58:38 +0200 Subject: [PATCH] try to get static git pages urls (#82) --- bridge/dynamic-plugin-sdk-mocks/useK8sWatchResource.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bridge/dynamic-plugin-sdk-mocks/useK8sWatchResource.ts b/bridge/dynamic-plugin-sdk-mocks/useK8sWatchResource.ts index b324e00..09977da 100644 --- a/bridge/dynamic-plugin-sdk-mocks/useK8sWatchResource.ts +++ b/bridge/dynamic-plugin-sdk-mocks/useK8sWatchResource.ts @@ -8,12 +8,11 @@ const getResourceURL = (props: WatchK8sResource): string => { return; } - const baseURL ='/api/kubernetes/apis/' + group + '/' + version; const namespaceURL = namespaced ? '/namespaces/' + (namespace.toString() || 'default') : ''; const resourceKind = kind.toLowerCase() + 's'; const resourceName = name ? name.toString() : ''; - const url = baseURL + namespaceURL + '/' + resourceKind + (resourceName ? '/' + resourceName : ''); + const url = 'apis/' + group + '/' + version + namespaceURL + '/' + resourceKind + (resourceName ? '/' + resourceName : ''); return url; }; @@ -26,7 +25,10 @@ export const useK8sWatchResource = (); React.useEffect(() => { - const url = getResourceURL(props); + const baseURL = window.location.hostname.includes('kubevirt-ui.github.io') ? + '/kubevirt-components/api/kubernetes/' : + '/api/kubernetes/'; + const url = baseURL + getResourceURL(props); fetch(url) .then(response => response.json())