Skip to content

Commit c2072e6

Browse files
authored
Corrections from running the dashboard
* Controller name check and Date picker * Changed fetchControllers method * Removed return in fetchDataList * Main layout changes * Updated Search Component * Replaced the term controllers
1 parent 4227406 commit c2072e6

File tree

28 files changed

+406
-315
lines changed

28 files changed

+406
-315
lines changed

dashboard/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
"classnames": "^2.3.1",
1616
"crypto-js": "^4.1.1",
1717
"js-cookie": "^3.0.1",
18+
"babel-jest": "^27.5.1",
19+
"gulp": "^4.0.2",
20+
"jest": "^27.5.1",
1821
"less-watch-compiler": "^1.16.3",
1922
"patternfly": "^3.9.0",
2023
"react": "^17.0.2",

dashboard/src/App.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import './App.css';
55
import * as APP_ROUTES from "./utils/routeConstants";
66
import AuthComponent from './modules/components/AuthComponent';
77
import '@patternfly/patternfly/patternfly.css';
8-
import { TableWithFavorite } from 'modules/components/TableComponent';
8+
import MainLayout from 'modules/containers/MainLayout';
99

1010
function App() {
1111
useEffect(() => {
@@ -17,7 +17,7 @@ function App() {
1717
<div className="App">
1818
<BrowserRouter>
1919
<Routes>
20-
<Route path="/" element={<TableWithFavorite />} />
20+
<Route path="/" element={<MainLayout />} />
2121
<Route path={APP_ROUTES.AUTH} element={<AuthComponent />} />
2222
<Route path={APP_ROUTES.AUTH_LOGIN} element={<AuthComponent />} />
2323
<Route path={APP_ROUTES.AUTH_SIGNUP} element={<AuthComponent />} />
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import * as TYPES from "./types";
2+
import API from "../utils/api";
3+
4+
export const fetchPublicDatasets = () => async (dispatch) => {
5+
try {
6+
dispatch({ type: TYPES.LOADING });
7+
const response = await API.get(
8+
"api/v1/datasets/list?metadata=dataset.created&access=public"
9+
);
10+
if (response.status === 200 && response.data) {
11+
dispatch({
12+
type: "GET_PUBLIC_DATASETS",
13+
payload: response?.data,
14+
});
15+
}
16+
dispatch({ type: TYPES.COMPLETED });
17+
} catch (error) {
18+
return error;
19+
}
20+
};
21+
22+
export const getFavoritedDatasets = () => async (dispatch) => {
23+
let fav_datasets = [];
24+
let fav_datasets_text = localStorage.getItem("favorite_datasets");
25+
fav_datasets = fav_datasets_text ? JSON.parse(fav_datasets_text) : [];
26+
dispatch({
27+
type: TYPES.FAVORITED_DATASETS,
28+
payload: [...fav_datasets],
29+
});
30+
};
31+
32+
export const updateFavoriteRepoNames = (favorites) => async (dispatch) => {
33+
dispatch({
34+
type: TYPES.FAVORITED_DATASETS,
35+
payload: [...favorites],
36+
});
37+
};
38+
39+
export const updateTblData = (data) => async (dispatch) => {
40+
dispatch({
41+
type: TYPES.UPDATE_PUBLIC_DATASETS,
42+
payload: [...data],
43+
});
44+
};

dashboard/src/actions/fetchPublicDatasets.js

Lines changed: 0 additions & 22 deletions
This file was deleted.

dashboard/src/actions/types.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,8 @@ export const SET_SIGNUP_BUTTON = "SET_SIGNUP_BUTTON";
1616
/* NAVBAR OPEN/CLOSE */
1717
export const NAVBAR_OPEN="NAVBAR_OPEN";
1818
export const NAVBAR_CLOSE="NAVBAR_CLOSE";
19+
20+
/* PUBLIC DATASETS */
21+
export const GET_PUBLIC_DATASETS = "GET_PUBLIC_DATASETS";
22+
export const FAVORITED_DATASETS = "GET_FAVORITE_DATASETS";
23+
export const UPDATE_PUBLIC_DATASETS = "UPDATE_PUBLIC_DATASETS";

dashboard/src/modules/components/AlertComponent/index.css

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,16 @@
1-
import { Alert, AlertActionCloseButton } from "@patternfly/react-core";
2-
import { useNavigate } from "react-router-dom";
3-
import "./index.css";
1+
import { Alert } from "@patternfly/react-core";
42
import React from "react";
5-
import { AUTH_LOGIN } from "utils/routeConstants";
63

7-
function LoginAlertMessage() {
8-
const navigate = useNavigate();
4+
5+
const AlertMessage = ( message ) => {
96
return (
107
<Alert
118
className="alertNotification"
129
variant="info"
1310
isInline
14-
actionClose={
15-
<AlertActionCloseButton
16-
onClose={() =>
17-
(document.querySelector(".alertNotification").style.display =
18-
"none")
19-
}
20-
/>
21-
}
22-
title={[
23-
'Want to see your own data?',
24-
<a className="alertHelpText" onClick={() => navigate(`/${AUTH_LOGIN}`)}>
25-
Login to your account
26-
</a>,
27-
]}
28-
></Alert>
11+
title={ message }
12+
/>
2913
);
30-
}
14+
};
3115

32-
export default LoginAlertMessage;
16+
export default AlertMessage;

dashboard/src/modules/components/BreadCrumbComponent/index.jsx

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,16 @@ import React from "react";
44
function PathBreadCrumb({ pathList }) {
55
return (
66
<Breadcrumb>
7-
{pathList.map((value, index) => {
8-
if (index === pathList.length - 1)
9-
return (
10-
<BreadcrumbItem key={index} to="#" isActive>
11-
{value}
12-
</BreadcrumbItem>
13-
);
14-
else
15-
return (
16-
<BreadcrumbItem key={index} to="#">
17-
{value}
18-
</BreadcrumbItem>
19-
);
7+
{pathList.map((path, index) => {
8+
return (
9+
<BreadcrumbItem
10+
key={index}
11+
to={path.link}
12+
isActive={index === pathList.length - 1 ? true : false}
13+
>
14+
{path.name}
15+
</BreadcrumbItem>
16+
);
2017
})}
2118
</Breadcrumb>
2219
);

dashboard/src/modules/components/DatePickerComponent/index.jsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,18 @@ import {
66
isValidDate,
77
Button,
88
} from "@patternfly/react-core";
9-
import "./index.css";
9+
import "./index.less";
1010
import { filterData } from "utils/filterDataset";
11-
import { dateFromUTCString } from "utils/constructDate";
12-
import { bumpToDate } from "utils/bumpDate";
13-
import { getTodayMidnightUTCDate } from "utils/getMidnightUTCDate";
11+
import {
12+
bumpToDate,
13+
dateFromUTCString,
14+
getTodayMidnightUTCDate,
15+
} from "utils/dateFunctions";
1416

1517
function DatePickerWidget({
1618
dataArray,
1719
setPublicData,
18-
controllerName,
20+
datasetName,
1921
setDateRange,
2022
}) {
2123
const [fromDate, setFromDate] = useState({});
@@ -42,7 +44,7 @@ function DatePickerWidget({
4244
};
4345

4446
const filterByDate = () => {
45-
setPublicData(filterData(dataArray, fromDate, toDate, controllerName));
47+
setPublicData(filterData(dataArray, fromDate, toDate, datasetName));
4648
setDateRange(fromDate, toDate);
4749
};
4850
return (

0 commit comments

Comments
 (0)