Skip to content
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

JNG-5985 readonly by #475

Merged
merged 1 commit into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ export default function PlanetView(props: PlanetViewProps) {
}}
InputLabelProps={{ shrink: true }}
InputProps={{
readOnly: false || !isFormUpdateable(),
readOnly: actions?.isNameReadonly
? actions.isNameReadonly(data, editMode, isLoading)
: false || !isFormUpdateable(),
startAdornment: (
<InputAdornment position="start">
<MdiIcon path="brightness-1" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,9 @@ export default function ViewGalaxyForm(props: ViewGalaxyFormProps) {
}}
InputLabelProps={{ shrink: true }}
InputProps={{
readOnly: false || !isFormUpdateable(),
readOnly: actions?.isNameReadonly
? actions.isNameReadonly(data, editMode, isLoading)
: false || !isFormUpdateable(),
startAdornment: (
<InputAdornment position="start">
<MdiIcon path="atom-variant" />
Expand Down Expand Up @@ -198,7 +200,9 @@ export default function ViewGalaxyForm(props: ViewGalaxyFormProps) {
}}
InputLabelProps={{ shrink: true }}
InputProps={{
readOnly: false || !isFormUpdateable(),
readOnly: actions?.isConstellationReadonly
? actions.isConstellationReadonly(data, editMode, isLoading)
: false || !isFormUpdateable(),
startAdornment: (
<InputAdornment position="start">
<MdiIcon path="star" />
Expand Down Expand Up @@ -268,7 +272,9 @@ export default function ViewGalaxyForm(props: ViewGalaxyFormProps) {
}}
InputLabelProps={{ shrink: true }}
InputProps={{
readOnly: false || !isFormUpdateable(),
readOnly: actions?.isMagnitudeReadonly
? actions.isMagnitudeReadonly(data, editMode, isLoading)
: false || !isFormUpdateable(),
startAdornment: (
<InputAdornment position="start">
<MdiIcon path="star-outline" />
Expand Down Expand Up @@ -302,7 +308,9 @@ export default function ViewGalaxyForm(props: ViewGalaxyFormProps) {
}}
InputLabelProps={{ shrink: true }}
InputProps={{
readOnly: false || !isFormUpdateable(),
readOnly: actions?.isOriginOfNameReadonly
? actions.isOriginOfNameReadonly(data, editMode, isLoading)
: false || !isFormUpdateable(),
startAdornment: (
<InputAdornment position="start">
<MdiIcon path="weather-night" />
Expand Down Expand Up @@ -359,7 +367,11 @@ export default function ViewGalaxyForm(props: ViewGalaxyFormProps) {
views={['year', 'month', 'day', 'hours', 'minutes', 'seconds']}
label={t('View.Galaxy.Form.discovered', { defaultValue: 'Discovered' }) as string}
value={data.discovered ?? null}
readOnly={false || !isFormUpdateable()}
readOnly={
actions?.isDiscoveredReadonly
? actions.isDiscoveredReadonly(data, editMode, isLoading)
: false || !isFormUpdateable()
}
disabled={
actions?.isDiscoveredDisabled ? actions.isDiscoveredDisabled(data, editMode, isLoading) : isLoading
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,9 @@ export default function ViewGalaxyView(props: ViewGalaxyViewProps) {
}}
InputLabelProps={{ shrink: true }}
InputProps={{
readOnly: false || !isFormUpdateable(),
readOnly: actions?.isNameReadonly
? actions.isNameReadonly(data, editMode, isLoading)
: false || !isFormUpdateable(),
startAdornment: (
<InputAdornment position="start">
<MdiIcon path="atom-variant" />
Expand Down Expand Up @@ -330,7 +332,9 @@ export default function ViewGalaxyView(props: ViewGalaxyViewProps) {
}}
InputLabelProps={{ shrink: true }}
InputProps={{
readOnly: false || !isFormUpdateable(),
readOnly: actions?.isConstellationReadonly
? actions.isConstellationReadonly(data, editMode, isLoading)
: false || !isFormUpdateable(),
startAdornment: (
<InputAdornment position="start">
<MdiIcon path="star-settings-outline" />
Expand Down Expand Up @@ -374,7 +378,9 @@ export default function ViewGalaxyView(props: ViewGalaxyViewProps) {
}}
InputLabelProps={{ shrink: true }}
InputProps={{
readOnly: false || !isFormUpdateable(),
readOnly: actions?.isMagnitudeReadonly
? actions.isMagnitudeReadonly(data, editMode, isLoading)
: false || !isFormUpdateable(),
startAdornment: (
<InputAdornment position="start">
<MdiIcon path="decagram-outline" />
Expand Down Expand Up @@ -452,7 +458,9 @@ export default function ViewGalaxyView(props: ViewGalaxyViewProps) {
}}
InputLabelProps={{ shrink: true }}
InputProps={{
readOnly: false || !isFormUpdateable(),
readOnly: actions?.isOriginOfNameReadonly
? actions.isOriginOfNameReadonly(data, editMode, isLoading)
: false || !isFormUpdateable(),
startAdornment: (
<InputAdornment position="start">
<MdiIcon path="weather-night" />
Expand Down Expand Up @@ -551,7 +559,11 @@ export default function ViewGalaxyView(props: ViewGalaxyViewProps) {
views={['year', 'month', 'day', 'hours', 'minutes', 'seconds']}
label={t('View.Galaxy.View.discovered', { defaultValue: 'Discovered' }) as string}
value={data.discovered ?? null}
readOnly={false || !isFormUpdateable()}
readOnly={
actions?.isDiscoveredReadonly
? actions.isDiscoveredReadonly(data, editMode, isLoading)
: false || !isFormUpdateable()
}
disabled={
actions?.isDiscoveredDisabled
? actions.isDiscoveredDisabled(data, editMode, isLoading)
Expand Down Expand Up @@ -654,7 +666,9 @@ export default function ViewGalaxyView(props: ViewGalaxyViewProps) {
}}
InputLabelProps={{ shrink: true }}
InputProps={{
readOnly: true || !isFormUpdateable(),
readOnly: actions?.isDarkMatterReadonly
? actions.isDarkMatterReadonly(data, editMode, isLoading)
: true || !isFormUpdateable(),
noherczeg marked this conversation as resolved.
Show resolved Hide resolved
startAdornment: (
<InputAdornment position="start">
<MdiIcon path="chart-bubble" />
Expand Down Expand Up @@ -701,7 +715,9 @@ export default function ViewGalaxyView(props: ViewGalaxyViewProps) {
}}
InputLabelProps={{ shrink: true }}
InputProps={{
readOnly: true || !isFormUpdateable(),
readOnly: actions?.isIntergalacticDustReadonly
? actions.isIntergalacticDustReadonly(data, editMode, isLoading)
: true || !isFormUpdateable(),
noherczeg marked this conversation as resolved.
Show resolved Hide resolved
startAdornment: (
<InputAdornment position="start">
<MdiIcon path="scatter-plot-outline" />
Expand Down Expand Up @@ -748,7 +764,9 @@ export default function ViewGalaxyView(props: ViewGalaxyViewProps) {
}}
InputLabelProps={{ shrink: true }}
InputProps={{
readOnly: true || !isFormUpdateable(),
readOnly: actions?.isInterstellarMediumReadonly
? actions.isInterstellarMediumReadonly(data, editMode, isLoading)
: true || !isFormUpdateable(),
noherczeg marked this conversation as resolved.
Show resolved Hide resolved
startAdornment: (
<InputAdornment position="start">
<MdiIcon path="scatter-plot" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export function {{ componentName link }}(props: {{ componentName link }}Props) {
icon={<MdiIcon path="{{ link.icon.iconName }}" />}
{{/ if }}
disabled={actions?.is{{ firstToUpper link.relationType.name }}Disabled ? actions.is{{ firstToUpper link.relationType.name }}Disabled(ownerData, editMode, isLoading) : disabled}
readOnly={readOnly}
readOnly={actions?.is{{ firstToUpper link.relationType.name }}Readonly ? actions.is{{ firstToUpper link.relationType.name }}Readonly(ownerData, editMode, isLoading) : readOnly}
editMode={editMode}
{{# unless link.isEager }}
isEager={false}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export interface {{ componentName link }}ActionDefinitions {
{{/ if }}
is{{ firstToUpper link.relationType.name }}Required?: ({{{ inputModifierParams container false }}}) => boolean;
is{{ firstToUpper link.relationType.name }}Disabled?: ({{{ inputModifierParams container true }}}) => boolean;
is{{ firstToUpper link.relationType.name }}Readonly?: ({{{ inputModifierParams container true }}}) => boolean;
get{{ firstToUpper link.relationType.name }}Mask?: () => string;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
{{# each (getInputsForContainer container) as |input| }}
is{{ firstToUpper input.attributeType.name }}Required?: ({{{ inputModifierParams container false }}}) => boolean;
is{{ firstToUpper input.attributeType.name }}Disabled?: ({{{ inputModifierParams container true }}}) => boolean;
is{{ firstToUpper input.attributeType.name }}Readonly?: ({{{ inputModifierParams container true }}}) => boolean;
{{/ each}}
{{# each (getElementsWithHiddenBy container) as |ve| }}
is{{ safeName ve }}Hidden?: ({{{ inputModifierParams container false }}}) => boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
attributeName="{{ child.attributeType.name }}"
attributePath="{{ attributePath child.attributeType }}"
disabled={actions?.is{{ firstToUpper child.attributeType.name }}Disabled ? actions.is{{ firstToUpper child.attributeType.name }}Disabled(data, editMode, isLoading) : ({{# if child.enabledBy }}!data.{{ child.enabledBy.name }} ||{{/ if }} isLoading)}
readonly={ {{ boolValue child.attributeType.isReadOnly }} || !isFormUpdateable() }
readonly={actions?.is{{ firstToUpper child.attributeType.name }}Readonly ? actions.is{{ firstToUpper child.attributeType.name }}Readonly(data, editMode, isLoading) : ({{ boolValue child.attributeType.isReadOnly }} || !isFormUpdateable())}
{{# unless child.attributeType.isReadOnly }}
deleteCallback={ async () => {
storeDiff('{{ child.attributeType.name }}', null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
views={['year', 'month', 'day']}
label={ t('{{ getTranslationKeyForVisualElement child }}', { defaultValue: '{{ child.label }}' }) as string }
value={ data.{{ child.attributeType.name }} ?? null }
readOnly={ {{ boolValue child.attributeType.isReadOnly }} || !isFormUpdateable() }
readOnly={actions?.is{{ firstToUpper child.attributeType.name }}Readonly ? actions.is{{ firstToUpper child.attributeType.name }}Readonly(data, editMode, isLoading) : ({{ boolValue child.attributeType.isReadOnly }} || !isFormUpdateable())}
disabled={actions?.is{{ firstToUpper child.attributeType.name }}Disabled ? actions.is{{ firstToUpper child.attributeType.name }}Disabled(data, editMode, isLoading) : ({{# if child.enabledBy }}!data.{{ child.enabledBy.name }} ||{{/ if }} isLoading)}
onChange={ (newValue?: Date | null) => {
storeDiff('{{ child.attributeType.name }}', newValue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
views={['year', 'month', 'day', 'hours', 'minutes', 'seconds']}
label={ t('{{ getTranslationKeyForVisualElement child }}', { defaultValue: '{{ child.label }}' }) as string }
value={ data.{{ child.attributeType.name }} ?? null }
readOnly={ {{ boolValue child.attributeType.isReadOnly }} || !isFormUpdateable() }
readOnly={actions?.is{{ firstToUpper child.attributeType.name }}Readonly ? actions.is{{ firstToUpper child.attributeType.name }}Readonly(data, editMode, isLoading) : ({{ boolValue child.attributeType.isReadOnly }} || !isFormUpdateable())}
disabled={actions?.is{{ firstToUpper child.attributeType.name }}Disabled ? actions.is{{ firstToUpper child.attributeType.name }}Disabled(data, editMode, isLoading) : ({{# if child.enabledBy }}!data.{{ child.enabledBy.name }} ||{{/ if }} isLoading)}
onChange={ (newValue: Date | null) => {
storeDiff('{{ child.attributeType.name }}', newValue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
} }
InputLabelProps={ { shrink: true } }
InputProps={ {
readOnly: {{ boolValue child.attributeType.isReadOnly }} || !isFormUpdateable(),
readOnly: actions?.is{{ firstToUpper child.attributeType.name }}Readonly ? actions.is{{ firstToUpper child.attributeType.name }}Readonly(data, editMode, isLoading) : ({{ boolValue child.attributeType.isReadOnly }} || !isFormUpdateable()),
{{# if child.icon }}
startAdornment: (
<InputAdornment position="start">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
} }
InputLabelProps={ { shrink: true } }
InputProps={ {
readOnly: {{ boolValue child.attributeType.isReadOnly }} || !isFormUpdateable(),
readOnly: actions?.is{{ firstToUpper child.attributeType.name }}Readonly ? actions.is{{ firstToUpper child.attributeType.name }}Readonly(data, editMode, isLoading) : ({{ boolValue child.attributeType.isReadOnly }} || !isFormUpdateable()),
{{# if child.icon }}
startAdornment: (
<InputAdornment position="start">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
} }
InputLabelProps={ { shrink: true } }
InputProps={ {
readOnly: {{ boolValue child.attributeType.isReadOnly }} || !isFormUpdateable(),
readOnly: actions?.is{{ firstToUpper child.attributeType.name }}Readonly ? actions.is{{ firstToUpper child.attributeType.name }}Readonly(data, editMode, isLoading) : ({{ boolValue child.attributeType.isReadOnly }} || !isFormUpdateable()),
{{# if child.icon }}
startAdornment: (
<InputAdornment position="start">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
{{# if child.icon }}
icon={<MdiIcon path="{{ child.icon.iconName }}" />}
{{/ if }}
readOnly={ {{ boolValue child.attributeType.isReadOnly }} || !isFormUpdateable() }
readOnly={actions?.is{{ firstToUpper child.attributeType.name }}Readonly ? actions.is{{ firstToUpper child.attributeType.name }}Readonly(data, editMode, isLoading) : ({{ boolValue child.attributeType.isReadOnly }} || !isFormUpdateable())}
editMode={editMode}
{{# if child.onBlur }}
onBlur={ () => {
Expand Down Expand Up @@ -77,7 +77,7 @@
} }
InputLabelProps={ { shrink: true } }
InputProps={ {
readOnly: {{ boolValue child.attributeType.isReadOnly }} || !isFormUpdateable(),
readOnly: actions?.is{{ firstToUpper child.attributeType.name }}Readonly ? actions.is{{ firstToUpper child.attributeType.name }}Readonly(data, editMode, isLoading) : ({{ boolValue child.attributeType.isReadOnly }} || !isFormUpdateable()),
noherczeg marked this conversation as resolved.
Show resolved Hide resolved
{{# if child.icon }}
startAdornment: (
<InputAdornment position="start">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
views={['hours', 'minutes', 'seconds']}
label={ t('{{ getTranslationKeyForVisualElement child }}', { defaultValue: '{{ child.label }}' }) as string }
value={ data.{{ child.attributeType.name }} ?? null }
readOnly={ {{ boolValue child.attributeType.isReadOnly }} || !isFormUpdateable() }
readOnly={actions?.is{{ firstToUpper child.attributeType.name }}Readonly ? actions.is{{ firstToUpper child.attributeType.name }}Readonly(data, editMode, isLoading) : ({{ boolValue child.attributeType.isReadOnly }} || !isFormUpdateable())}
disabled={actions?.is{{ firstToUpper child.attributeType.name }}Disabled ? actions.is{{ firstToUpper child.attributeType.name }}Disabled(data, editMode, isLoading) : ({{# if child.enabledBy }}!data.{{ child.enabledBy.name }} ||{{/ if }} isLoading)}
{{# if child.onBlur }}
onBlur={ () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
{{/ if }}
} }
disabled={actions?.is{{ firstToUpper child.attributeType.name }}Disabled ? actions.is{{ firstToUpper child.attributeType.name }}Disabled(data, editMode, isLoading) : ({{# if child.enabledBy }}!data.{{ child.enabledBy.name }} || {{/ if }}isLoading)}
readOnly={ {{ boolValue child.attributeType.isReadOnly }} || !isFormUpdateable() }
readOnly={actions?.is{{ firstToUpper child.attributeType.name }}Readonly ? actions.is{{ firstToUpper child.attributeType.name }}Readonly(data, editMode, isLoading) : ({{ boolValue child.attributeType.isReadOnly }} || !isFormUpdateable())}
/>
{{# if child.customImplementation }}
</ComponentProxy>
Expand Down
Loading