Skip to content

Commit

Permalink
Parameter edits should be in a custom parameter route
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdjohnson committed Nov 23, 2024
1 parent cfc1aa3 commit a0c979c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/components/listItem/BaseListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { NavButtonDiv } from '~/components/NavButton'

export type BaseListItemType<T> = {
id: string
to?: string
label: string
data: T

Expand Down Expand Up @@ -37,7 +38,7 @@ const BaseListItem = observer(
return (
<NavButtonDiv
key={item.id}
to={item.id}
to={item.to || item.id}
onClick={e => onClick?.(item, index, e)}
className={twMerge(
'rounded-md bg-base-200 p-1 first-of-type:mt-0',
Expand Down
1 change: 1 addition & 0 deletions src/containers/SettingSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { NavButton } from '~/components/NavButton'

export type SettingSectionItem<T> = {
id: string
to?: string
label: string
subLabels?: string | string[]
data: T
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ const ConnectionDataParameterSection = ({ subControl }: { subControl: unknown })
isJson: false,
})

navigate('newField')
navigate('parameter/newField')
}

const removeParameterByIndex = (index: number) => {
Expand All @@ -301,7 +301,8 @@ const ConnectionDataParameterSection = ({ subControl }: { subControl: unknown })
const parameterToSectionItem = (
parameter: ConnectionParameterModel,
): SettingSectionItem<ConnectionParameterModel> => ({
id: parameter.field || '',
id: parameter.field,
to: 'parameter/' + parameter.field,
label: parameter.field,
subLabels: parameter.helpText && [parameter.helpText],
data: parameter,
Expand Down
2 changes: 1 addition & 1 deletion src/features/settings/settingRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export const settingRoutesByName: Record<SettingPanelOptionsType, SettingPanelTy
<Route path="empty_panel" element={<NewConnectionPanel />} />

<Route path="edit/:id" element={<ConnectionPanel />}>
<Route path=":parameterId" element={<ParameterForm />} />
<Route path="parameter/:parameterId" element={<ParameterForm />} />
</Route>

<Route path=":id" element={<ConnectionModelPanel />}>
Expand Down

0 comments on commit a0c979c

Please sign in to comment.