From 22db795f81203ef7f510466104e894ee215f2d56 Mon Sep 17 00:00:00 2001 From: "Christian R. Garcia" Date: Tue, 30 Jul 2024 11:55:45 -0700 Subject: [PATCH] Proper model and dataset formatting in breadcrumbs for ml-hub --- .../ui/Breadcrumbs/breadcrumbsFromPathname.ts | 28 ++++++++++++++++++- .../PodsLoadingText/PodsLoadingText.tsx | 20 ++++++------- 2 files changed, 37 insertions(+), 11 deletions(-) diff --git a/packages/tapisui-common/src/ui/Breadcrumbs/breadcrumbsFromPathname.ts b/packages/tapisui-common/src/ui/Breadcrumbs/breadcrumbsFromPathname.ts index 7be7cfce4..c33ae3a1d 100644 --- a/packages/tapisui-common/src/ui/Breadcrumbs/breadcrumbsFromPathname.ts +++ b/packages/tapisui-common/src/ui/Breadcrumbs/breadcrumbsFromPathname.ts @@ -9,7 +9,33 @@ const breadcrumbsFromPathname = (pathname: string) => { console.log(image); items.push({ to: normalize('/pods/'), text: 'pods' }); items.push({ to: normalize('/pods/images/'), text: 'images' }); - items.push({ to: normalize(`/pods/images/${image}/`), text: image }); + if (image) { + items.push({ to: normalize(`/pods/images/${image}/`), text: image }); + } + } else if (pathname.startsWith('/ml-hub/datasets/')) { + // special case for ml-hub/datasets + const dataset = pathname.replace('/ml-hub/datasets/', ''); + console.log(dataset); + items.push({ to: normalize('/ml-hub/'), text: 'ml-hub' }); + items.push({ to: normalize('/ml-hub/datasets/'), text: 'datasets' }); + if (dataset) { + items.push({ + to: normalize(`/ml-hub/datasets/${dataset}/`), + text: dataset, + }); + } + } else if (pathname.startsWith('/ml-hub/models/')) { + // special case for ml-hub/models + const model = pathname.replace('/ml-hub/models/', ''); + console.log(model); + items.push({ to: normalize('/ml-hub/'), text: 'ml-hub' }); + items.push({ to: normalize('/ml-hub/models/'), text: 'models' }); + if (model) { + items.push({ + to: normalize(`/ml-hub/models/${model}/`), + text: model, + }); + } } else { // Original logic const pathParts = pathname.split('/'); diff --git a/src/app/Pods/_components/PodsLoadingText/PodsLoadingText.tsx b/src/app/Pods/_components/PodsLoadingText/PodsLoadingText.tsx index f2a6e34e8..d81b81a5e 100644 --- a/src/app/Pods/_components/PodsLoadingText/PodsLoadingText.tsx +++ b/src/app/Pods/_components/PodsLoadingText/PodsLoadingText.tsx @@ -5,19 +5,19 @@ const PodsLoadingText = ( intervalDuration = 333 ) => { const [loadingText, setLoadingText] = useState(initialText); - useEffect(() => { - let loadingState = 0; - const loadingStates = ['loading...', 'loading', 'loading.', 'loading..']; + // useEffect(() => { + // let loadingState = 0; + // const loadingStates = ['loading...', 'loading', 'loading.', 'loading..']; - const interval = setInterval(() => { - setLoadingText(loadingStates[loadingState]); - loadingState = (loadingState + 1) % loadingStates.length; - }, intervalDuration); + // const interval = setInterval(() => { + // setLoadingText(loadingStates[loadingState]); + // loadingState = (loadingState + 1) % loadingStates.length; + // }, intervalDuration); - return () => clearInterval(interval); - }, [intervalDuration]); + // return () => clearInterval(interval); + // }, [intervalDuration]); - return loadingText; + return initialText; // "oadingText; }; export default PodsLoadingText;