Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

feat(imaging): create basic imaging module #2250

Merged
merged 15 commits into from
Aug 5, 2020

Conversation

AlexTan331
Copy link
Contributor

@AlexTan331 AlexTan331 commented Jul 23, 2020

Fixes #2242

Changes proposed in this pull request:

  • add permissions to create new imaging and view all imagings
  • add ability to request a new imaging
  • add ability to view all requested imagings
  • add imaging tabs to sidebar for "New Imaging Request" and "Imaging Requests"
  • add imaging tab to quick add button in the navbar for "New Imaging Request"
  • add imaging unit tests

No new dependency added

Side note:

  • no ability to view a single imaging request/edit imaging request/update imaging request in this issue

@gitpod-io
Copy link

gitpod-io bot commented Jul 23, 2020

@AlexTan331 AlexTan331 marked this pull request as draft July 23, 2020 22:35
@matteovivona matteovivona added this to In progress in Version 2.0 via automation Jul 24, 2020
@vercel
Copy link

vercel bot commented Jul 24, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/hospitalrun/hospitalrun-frontend/82kmapk97
✅ Preview: https://hospitalrun-frontend-git-fork-alextan331-imaging.hospitalrun.vercel.app

@matteovivona matteovivona added the in progress indicates that issue/pull request is currently being worked on label Jul 24, 2020
@matteovivona matteovivona added this to the v2.0 milestone Jul 24, 2020
@AlexTan331 AlexTan331 marked this pull request as ready for review July 28, 2020 14:41
@AlexTan331 AlexTan331 changed the title WIP: feat(imaging): create basic imaging module feat(imaging): create basic imaging module Jul 28, 2020
@matteovivona matteovivona added the 🚀enhancement an issue/pull request that adds a feature to the application label Jul 30, 2020
@@ -53,6 +54,7 @@ const HospitalRun = () => {
<Route path="/labs" component={Labs} />
<Route path="/incidents" component={Incidents} />
<Route path="/settings" component={Settings} />
<Route path="/imagings" component={Imagings} />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's just go with /imaging for the route name

Comment on lines +48 to +50
useEffect(() => {
setSearchFilter('all' as ImagingFilter)
}, [])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this useEffect needed? it seems like it might not be since we initialize the state to be all

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method is to display all the imaging with any status (requested, canceled, and completed). And this method can be used for searching imaging with specific status in the future.

label: t('imagings.imaging.requestedBy'),
key: 'requestedBy',
formatter: (row) => extractUsername(row.requestedBy),
}, // need to be formated later
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

by the comment, there appears like there may be some work left? if not, remove comment.

Comment on lines 25 to 40
const store = mockStore({
title: '',
user: { permissions: [Permissions.ViewImagings, Permissions.RequestLab] },
imagings: { imagings: [] },
} as any)
titleSpy = jest.spyOn(titleUtil, 'default')
jest.spyOn(ImagingRepository, 'findAll').mockResolvedValue([])
await act(async () => {
await mount(
<Provider store={store}>
<Router history={createMemoryHistory()}>
<ViewImagings />
</Router>
</Provider>,
)
})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lately, we have been putting this kind of setup in a setup function. I think we should continue this pattern since it makes it easy to make sure each test is not dependent on a previous test.

Each describe can share the setup function. i.e. one setup function for the whole test suite.

Comment on lines 54 to 61
wrapper = mount(
<Provider store={store}>
<Router history={history}>
<NewImagingRequest />
</Router>
</Provider>,
)
})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can use a setup function here as well.

It would like something like:

const setup = () => {
	const store = mockStore({ title: '', imaging: { status: 'loading', error: {} } } as any)
      history.push('/imagings/new')

      wrapper = mount(
        <Provider store={store}>
          <Router history={history}>
            <NewImagingRequest />
          </Router>
        </Provider>,
      )

	return { wrapper: wrapper as ReactWrapper, history, store }
}

This will eliminate the need for global variables in this file.

@jackcmeyer
Copy link
Member

@AlexTan331 this is awesome work! let me know if you have any questions about getting the tests passing or any of the code review feedback.

@jackcmeyer jackcmeyer merged commit f256129 into HospitalRun:master Aug 5, 2020
Version 2.0 automation moved this from In progress to Done Aug 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🚀enhancement an issue/pull request that adds a feature to the application in progress indicates that issue/pull request is currently being worked on
Projects
Version 2.0
  
Done
Development

Successfully merging this pull request may close these issues.

Create basic imaging module
3 participants