Skip to content

Commit

Permalink
Dashboard TOC view (distributed-system-analysis#3511)
Browse files Browse the repository at this point in the history
* PBENCH-1217

Fix the TOC page and add a download link for regular files
  • Loading branch information
MVarshini authored Aug 8, 2023
1 parent b4ef1dd commit a549c24
Show file tree
Hide file tree
Showing 8 changed files with 248 additions and 254 deletions.
60 changes: 27 additions & 33 deletions dashboard/src/actions/tableOfContentActions.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
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";
import { showToast } from "./toastActions";
import { uriTemplate } from "../utils/helper";

export const fetchTOC =
(param, parent, callForSubData) => async (dispatch, getState) => {
(param, dataUri, callForSubData) => async (dispatch, getState) => {
try {
dispatch({ type: TYPES.LOADING });
const endpoints = getState().apiEndpoint.endpoints;
const parent = dataUri?.split("contents/").pop();
const uri = uriTemplate(endpoints, "datasets_contents", {
dataset: param,
target: parent,
Expand All @@ -23,39 +26,30 @@ export const fetchTOC =
const msg = error.response?.data?.message;
dispatch(showToast(DANGER, msg ?? `Error response: ${error}`));
}
dispatch({ type: TYPES.COMPLETED });
};

export const updateTableData = (data) => {
return {
type: TYPES.UPDATE_TABLE_DATA,
payload: data,
};
};
export const updateTableData = (data) => ({
type: TYPES.UPDATE_TABLE_DATA,
payload: data,
});

export const updateSearchSpace = (data) => {
return {
type: TYPES.UPDATE_SEARCH_SPACE,
payload: data,
};
};
export const updateContentData = (data) => ({
type: TYPES.UPDATE_CONTENT_DATA,
payload: data,
});

export const updateStack = (length) => {
return {
type: TYPES.UPDATE_STACK,
payload: length,
};
};
export const updateSearchSpace = (data) => ({
type: TYPES.UPDATE_SEARCH_SPACE,
payload: data,
});

export const updateCurrData = (data) => {
return {
type: TYPES.UPDATE_CURR_DATA,
payload: data,
};
};
export const updateStack = (length) => ({
type: TYPES.UPDATE_STACK,
payload: length,
});

export const updateTOCLoader = (data) => {
return {
type: TYPES.UPDATE_TOC_LOADING,
payload: data,
};
};
export const updateCurrData = (data) => ({
type: TYPES.UPDATE_CURR_DATA,
payload: data,
});
2 changes: 1 addition & 1 deletion dashboard/src/actions/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const UPDATE_TABLE_DATA = "UPDATE_TABLE_DATA";
export const UPDATE_SEARCH_SPACE = "UPDATE_SEARCH_SPACE";
export const UPDATE_STACK = "UPDATE_STACK";
export const UPDATE_CURR_DATA = "UPDATE_CURR_DATA";
export const UPDATE_TOC_LOADING = "UPDATE_TOC_LOADING";
export const UPDATE_CONTENT_DATA = "UPDATE_CONTENT_DATA";

/* SIDEBAR */
export const SET_ACTIVE_MENU_ITEM = "SET_ACTIVE_MENU_ITEM";
Expand Down
1 change: 0 additions & 1 deletion dashboard/src/assets/constants/navigationConstants.js

This file was deleted.

5 changes: 2 additions & 3 deletions dashboard/src/modules/components/TableComponent/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import * as APP_ROUTES from "utils/routeConstants";
import * as CONSTANTS from "assets/constants/browsingPageConstants";

import { EmptyTable, Heading, LoginHint, SearchBox } from "./common-components";
import { HOME, TOC } from "utils/routeConstants";
import {
InnerScrollContainer,
OuterScrollContainer,
Expand All @@ -27,7 +28,6 @@ import { DATASET_UPLOADED } from "assets/constants/overviewConstants";
import DatePickerWidget from "../DatePickerComponent";
import PathBreadCrumb from "../BreadCrumbComponent";
import { RenderPagination } from "../OverviewComponent/common-component";
import { TOC } from "assets/constants/navigationConstants";
import TablePagination from "../PaginationComponent";
import { useKeycloak } from "@react-keycloak/web";
import { useNavigate } from "react-router";
Expand All @@ -52,7 +52,6 @@ const TableWithFavorite = () => {
const [page, setPage] = useState(CONSTANTS.START_PAGE_NUMBER);

const navigate = useNavigate();

const dispatch = useDispatch();

useEffect(() => {
Expand Down Expand Up @@ -209,7 +208,7 @@ const TableWithFavorite = () => {
<Td
dataLabel={columnNames.name}
onClick={() =>
navigate(`${TOC}/${repo?.resource_id}`)
navigate(`/${HOME}${TOC}/${repo?.resource_id}`)
}
>
{repo?.name}
Expand Down
Loading

0 comments on commit a549c24

Please sign in to comment.