From d7d6ba274216c0bff3af7c3b4511b6e2cee57ad9 Mon Sep 17 00:00:00 2001 From: David Butenhof Date: Sat, 24 Jun 2023 07:55:47 -0400 Subject: [PATCH] Rough changes to the Javascript With these changes, it's possible to navigate down the directory hierarchy. Navigating backwards on the "breadcrumb" line (still) doesn't quite work, but I now believe that my URI change in the API hasn't made anything worse than it was before. --- dashboard/src/actions/tableOfContentActions.js | 5 ++++- dashboard/src/modules/components/TableOfContent/index.jsx | 4 ++-- dashboard/src/reducers/tableOfContentReducer.js | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/dashboard/src/actions/tableOfContentActions.js b/dashboard/src/actions/tableOfContentActions.js index 6136de32e6..f3e4c86362 100644 --- a/dashboard/src/actions/tableOfContentActions.js +++ b/dashboard/src/actions/tableOfContentActions.js @@ -1,6 +1,8 @@ import * as TYPES from "./types"; import API from "../utils/axiosInstance"; import { uriTemplate } from "../utils/helper"; +import { showToast } from "./toastActions"; +import { DANGER } from "assets/constants/toastConstants"; export const fetchTOC = (param, parent, callForSubData) => async (dispatch, getState) => { @@ -18,7 +20,8 @@ export const fetchTOC = }); } } catch (error) { - return error; + const msg = error.response?.data?.message; + dispatch(showToast(DANGER, msg ? msg : `Error response: ERROR_MSG`)); } }; diff --git a/dashboard/src/modules/components/TableOfContent/index.jsx b/dashboard/src/modules/components/TableOfContent/index.jsx index ed61ae05e2..0d5ee7345c 100644 --- a/dashboard/src/modules/components/TableOfContent/index.jsx +++ b/dashboard/src/modules/components/TableOfContent/index.jsx @@ -195,7 +195,7 @@ const TableOfContent = () => { ? initialBreadcrumb(breadCrumbLabels) : appGroupingBreadcrumb(false, breadCrumbLabels) ); - const dirPath = param.concat(`${firstHierarchyLevel ? "" : "/"}`, data); + const dirPath = param.concat(firstHierarchyLevel ? "" : "/", data); setParam(dirPath); setIsLoading(true); getSubFolderData(dirPath); @@ -288,7 +288,7 @@ const TableOfContent = () => { } > - {data} + {data.name} ); })} diff --git a/dashboard/src/reducers/tableOfContentReducer.js b/dashboard/src/reducers/tableOfContentReducer.js index 75b4482c7f..0346568470 100644 --- a/dashboard/src/reducers/tableOfContentReducer.js +++ b/dashboard/src/reducers/tableOfContentReducer.js @@ -36,7 +36,7 @@ const TableOfContentReducer = (state = initialState, action = {}) => { stack: [...state.stack, payload], searchSpace: payload.files, tableData: payload.files, - currData: payload, + contentData: payload, isLoading: false, };