CEC-3944 Static dashboard (#301)
* CEC-3944 Static dashboard * Unit test
This commit is contained in:
26
src/services/staticDashboards.js
Normal file
26
src/services/staticDashboards.js
Normal file
@@ -0,0 +1,26 @@
|
||||
const STATIC_DASHBOARDS_URL = process.env.REACT_APP_STATIC_DASHBOARDS_URL;
|
||||
|
||||
const INVALID_DASHBOARD = {
|
||||
label: "Invalid Dashboard",
|
||||
error: "Invalid Dashboard"
|
||||
}
|
||||
|
||||
export const StaticDashboardList = [
|
||||
{
|
||||
label: "Vehicle Paths",
|
||||
url: `${STATIC_DASHBOARDS_URL}/paths.html`
|
||||
}
|
||||
];
|
||||
|
||||
export const getStaticDashboard = (index) => {
|
||||
if (index < 0 || index >= StaticDashboardList.length) return INVALID_DASHBOARD;
|
||||
return StaticDashboardList[index];
|
||||
};
|
||||
|
||||
export const getStaticDashboardSubmenu = (role) => {
|
||||
return StaticDashboardList.map((item, index) => ({
|
||||
label: item.label,
|
||||
to: `/dashboards/${index}`,
|
||||
rolesPerProvider: role,
|
||||
}));
|
||||
}
|
||||
Reference in New Issue
Block a user