-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
added new optional configurable organisation and state fields for ent… #1892
Closed
Closed
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
eb0eb9f
added new optional configurable oeganisation and state fields for ent…
3e5d613
updated organisation and state field logic
ARADDCC002 e5904d8
added a schema check for allowing empty strings for model organiation…
ARADDCC002 bcda977
added missing migration script from last commit!
ARADDCC002 9667013
fixed linting issue with CreateEntry component
ARADDCC002 a633fab
fixed backend build issue
ARADDCC002 2786e74
BAI-1608 add organisation and state to the python client
PE39806 15b2dee
Removed commented out section of migration script
ARADDCC002 a028a32
added dynamic zod schema adjustments for organisation and states
ARADDCC002 e40ecaa
merged main fixed conflicts
ARADDCC002 8b486d5
updated backend unit test mocked config
ARADDCC002 3ff8c76
updated some of the forms for entry state and organisation
ARADDCC002 d8a194f
fixed an issue where setting no state or organisation would cause val…
ARADDCC002 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Large diffs are not rendered by default.
Oops, something went wrong.
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,10 @@ | ||
import ModelModel from '../models/Model.js' | ||
|
||
export async function up() { | ||
await ModelModel.updateMany({ organisation: { $exists: false } }, { $set: { organisation: '' } }) | ||
await ModelModel.updateMany({ state: { $exists: false } }, { $set: { state: '' } }) | ||
} | ||
|
||
export async function down() { | ||
/* NOOP */ | ||
} |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { MenuItem, Select, SelectChangeEvent } from '@mui/material' | ||
import { useGetUiConfig } from 'actions/uiConfig' | ||
import { useMemo } from 'react' | ||
import LabelledInput from 'src/common/LabelledInput' | ||
import Loading from 'src/common/Loading' | ||
import MessageAlert from 'src/MessageAlert' | ||
|
||
const htmlId = 'entry-organisation-input' | ||
|
||
type EntryOrganisationInputProps = { | ||
value: string | ||
onChange: (value: string) => void | ||
} | ||
|
||
export default function EntryOrganisationInput({ value, onChange }: EntryOrganisationInputProps) { | ||
const { uiConfig, isUiConfigLoading, isUiConfigError } = useGetUiConfig() | ||
|
||
const handleChange = (event: SelectChangeEvent) => { | ||
onChange(event.target.value) | ||
} | ||
|
||
const organisationOptions = useMemo( | ||
() => | ||
uiConfig | ||
? [ | ||
<MenuItem value={''} key='unset'> | ||
<em>Unset</em> | ||
</MenuItem>, | ||
...uiConfig.modelDetails.organisations.map((organisationItem) => ( | ||
<MenuItem value={organisationItem} key={organisationItem}> | ||
{organisationItem} | ||
</MenuItem> | ||
)), | ||
] | ||
: [], | ||
[uiConfig], | ||
) | ||
|
||
if (isUiConfigError) { | ||
return <MessageAlert message={isUiConfigError.info.message} severity='error' /> | ||
} | ||
|
||
if (!uiConfig || isUiConfigLoading) { | ||
return <Loading /> | ||
} | ||
|
||
if (uiConfig.modelDetails.organisations.length === 0) { | ||
return <></> | ||
} | ||
|
||
return ( | ||
<LabelledInput fullWidth label='Organisation' htmlFor={htmlId}> | ||
<Select size='small' value={value} onChange={handleChange} id={htmlId}> | ||
{organisationOptions} | ||
</Select> | ||
</LabelledInput> | ||
) | ||
} |
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,58 @@ | ||
import { MenuItem, Select, SelectChangeEvent } from '@mui/material' | ||
import { useGetUiConfig } from 'actions/uiConfig' | ||
import { useMemo } from 'react' | ||
import LabelledInput from 'src/common/LabelledInput' | ||
import Loading from 'src/common/Loading' | ||
import MessageAlert from 'src/MessageAlert' | ||
|
||
const htmlId = 'entry-state-input' | ||
|
||
type EntryStateInputProps = { | ||
value: string | ||
onChange: (value: string) => void | ||
} | ||
|
||
export default function EntryStateInput({ value, onChange }: EntryStateInputProps) { | ||
const { uiConfig, isUiConfigLoading, isUiConfigError } = useGetUiConfig() | ||
|
||
const handleChange = (event: SelectChangeEvent) => { | ||
onChange(event.target.value) | ||
} | ||
|
||
const stateOptions = useMemo( | ||
() => | ||
uiConfig | ||
? [ | ||
<MenuItem value={''} key='unset'> | ||
<em>Unset</em> | ||
</MenuItem>, | ||
...uiConfig.modelDetails.states.map((stateItem) => ( | ||
<MenuItem value={stateItem} key={stateItem}> | ||
{stateItem} | ||
</MenuItem> | ||
)), | ||
] | ||
: [], | ||
[uiConfig], | ||
) | ||
|
||
if (isUiConfigError) { | ||
return <MessageAlert message={isUiConfigError.info.message} severity='error' /> | ||
} | ||
|
||
if (!uiConfig || isUiConfigLoading) { | ||
return <Loading /> | ||
} | ||
|
||
if (uiConfig.modelDetails.states.length === 0) { | ||
return <></> | ||
} | ||
|
||
return ( | ||
<LabelledInput fullWidth label='Model State' htmlFor={htmlId}> | ||
<Select size='small' value={value} onChange={handleChange} id={htmlId}> | ||
{stateOptions} | ||
</Select> | ||
</LabelledInput> | ||
) | ||
} |
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consistency- here you use the term 'unset' and for organisation you use 'no organisation'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My vote would be "None" for both