-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add a reports navigation hidden behind a config
- Loading branch information
1 parent
53702a9
commit 6807f93
Showing
12 changed files
with
245 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
packages/esm-commons-lib/src/components/extension-conditional-renderer/side-nav-renderer.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import React from 'react'; | ||
import { useConfig } from '@openmrs/esm-framework'; | ||
|
||
export function ConditionalNavLinkRenderer({ children, conditionalConfigKey }) { | ||
const config = useConfig(); | ||
|
||
if (conditionalConfigKey) { | ||
return <>{config[conditionalConfigKey] ? children : null}</>; | ||
} | ||
return <>{children}</>; | ||
} | ||
|
||
export default ConditionalNavLinkRenderer; |
14 changes: 14 additions & 0 deletions
14
packages/esm-commons-lib/src/components/reports/reports-home.component.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import React from 'react'; | ||
import { OHRIWelcomeSection } from '@ohri/openmrs-esm-ohri-commons-lib'; | ||
import { Reports } from './reports'; | ||
|
||
const ReportsHomecomponent = () => { | ||
return ( | ||
<div> | ||
<OHRIWelcomeSection title="Reports" /> | ||
<Reports /> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ReportsHomecomponent; |
26 changes: 26 additions & 0 deletions
26
packages/esm-commons-lib/src/components/reports/reports-root.component.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import React from 'react'; | ||
import { SWRConfig } from 'swr'; | ||
import { BrowserRouter, Route, Routes } from 'react-router-dom'; | ||
import ReportsHome from './reports-home.component'; | ||
|
||
const swrConfiguration = { | ||
errorRetryCount: 3, | ||
}; | ||
|
||
const RootComponent: React.FC = () => { | ||
const reportsBasename = window.getOpenmrsSpaBase() + 'home/reports'; | ||
|
||
return ( | ||
<main> | ||
<SWRConfig value={swrConfiguration}> | ||
<BrowserRouter basename={reportsBasename}> | ||
<Routes> | ||
<Route path="/" element={<ReportsHome />} /> | ||
</Routes> | ||
</BrowserRouter> | ||
</SWRConfig> | ||
</main> | ||
); | ||
}; | ||
|
||
export default RootComponent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import React from 'react'; | ||
|
||
function Reports() { | ||
return <div>Reports view</div>; | ||
} | ||
|
||
export { Reports }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { Type } from '@openmrs/esm-framework'; | ||
|
||
export const configSchema = { | ||
showReports: { | ||
_type: Type.Boolean, | ||
_description: 'Show mamba reports', | ||
_default: false, | ||
}, | ||
}; | ||
|
||
export interface ConfigObject { | ||
showReports: boolean; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export const reportsDashboardMeta = { | ||
name: 'reports', | ||
slot: 'reports-dashboard-slot', | ||
config: { columns: 1, type: 'grid', dashboardTitle: 'Reports Home Page' }, | ||
title: 'Reports', | ||
isFolder: false, | ||
icon: null, | ||
layoutMode: 'anchored', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.