Commit 72bd5e80 authored by Stefan Probst's avatar Stefan Probst
Browse files

fix: remove source form section

parent 378b9ca1
...@@ -9,7 +9,6 @@ import { DateFormSection } from '@/components/item/DateFormSection/DateFormSecti ...@@ -9,7 +9,6 @@ import { DateFormSection } from '@/components/item/DateFormSection/DateFormSecti
import { MainFormSection } from '@/components/item/MainFormSection/MainFormSection' import { MainFormSection } from '@/components/item/MainFormSection/MainFormSection'
import { PropertiesFormSection } from '@/components/item/PropertiesFormSection/PropertiesFormSection' import { PropertiesFormSection } from '@/components/item/PropertiesFormSection/PropertiesFormSection'
import { RelatedItemsFormSection } from '@/components/item/RelatedItemsFormSection/RelatedItemsFormSection' import { RelatedItemsFormSection } from '@/components/item/RelatedItemsFormSection/RelatedItemsFormSection'
import { SourceFormSection } from '@/components/item/SourceFormSection/SourceFormSection'
import { Button } from '@/elements/Button/Button' import { Button } from '@/elements/Button/Button'
import { useToast } from '@/elements/Toast/useToast' import { useToast } from '@/elements/Toast/useToast'
import { sanitizeFormValues } from '@/lib/sshoc/sanitizeFormValues' import { sanitizeFormValues } from '@/lib/sshoc/sanitizeFormValues'
...@@ -152,7 +151,6 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element { ...@@ -152,7 +151,6 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
<ActorsFormSection /> <ActorsFormSection />
<PropertiesFormSection /> <PropertiesFormSection />
<RelatedItemsFormSection /> <RelatedItemsFormSection />
<SourceFormSection />
<div className="flex items-center justify-end space-x-6"> <div className="flex items-center justify-end space-x-6">
<Button onPress={onCancel} variant="link"> <Button onPress={onCancel} variant="link">
Cancel Cancel
......
...@@ -9,7 +9,6 @@ import { DateFormSection } from '@/components/item/DateFormSection/DateFormSecti ...@@ -9,7 +9,6 @@ import { DateFormSection } from '@/components/item/DateFormSection/DateFormSecti
import { MainFormSection } from '@/components/item/MainFormSection/MainFormSection' import { MainFormSection } from '@/components/item/MainFormSection/MainFormSection'
import { PropertiesFormSection } from '@/components/item/PropertiesFormSection/PropertiesFormSection' import { PropertiesFormSection } from '@/components/item/PropertiesFormSection/PropertiesFormSection'
import { RelatedItemsFormSection } from '@/components/item/RelatedItemsFormSection/RelatedItemsFormSection' import { RelatedItemsFormSection } from '@/components/item/RelatedItemsFormSection/RelatedItemsFormSection'
import { SourceFormSection } from '@/components/item/SourceFormSection/SourceFormSection'
import { Button } from '@/elements/Button/Button' import { Button } from '@/elements/Button/Button'
import { useToast } from '@/elements/Toast/useToast' import { useToast } from '@/elements/Toast/useToast'
import { sanitizeFormValues } from '@/lib/sshoc/sanitizeFormValues' import { sanitizeFormValues } from '@/lib/sshoc/sanitizeFormValues'
...@@ -154,7 +153,6 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element { ...@@ -154,7 +153,6 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
<ActorsFormSection initialValues={props.item} /> <ActorsFormSection initialValues={props.item} />
<PropertiesFormSection initialValues={props.item} /> <PropertiesFormSection initialValues={props.item} />
<RelatedItemsFormSection initialValues={props.item} /> <RelatedItemsFormSection initialValues={props.item} />
<SourceFormSection initialValues={props.item} />
<div className="flex items-center justify-end space-x-6"> <div className="flex items-center justify-end space-x-6">
<Button onPress={onCancel} variant="link"> <Button onPress={onCancel} variant="link">
Cancel Cancel
......
...@@ -9,7 +9,6 @@ import { DateFormSection } from '@/components/item/DateFormSection/DateFormSecti ...@@ -9,7 +9,6 @@ import { DateFormSection } from '@/components/item/DateFormSection/DateFormSecti
import { MainFormSection } from '@/components/item/MainFormSection/MainFormSection' import { MainFormSection } from '@/components/item/MainFormSection/MainFormSection'
import { PropertiesFormSection } from '@/components/item/PropertiesFormSection/PropertiesFormSection' import { PropertiesFormSection } from '@/components/item/PropertiesFormSection/PropertiesFormSection'
import { RelatedItemsFormSection } from '@/components/item/RelatedItemsFormSection/RelatedItemsFormSection' import { RelatedItemsFormSection } from '@/components/item/RelatedItemsFormSection/RelatedItemsFormSection'
import { SourceFormSection } from '@/components/item/SourceFormSection/SourceFormSection'
import { Button } from '@/elements/Button/Button' import { Button } from '@/elements/Button/Button'
import { useToast } from '@/elements/Toast/useToast' import { useToast } from '@/elements/Toast/useToast'
import { sanitizeFormValues } from '@/lib/sshoc/sanitizeFormValues' import { sanitizeFormValues } from '@/lib/sshoc/sanitizeFormValues'
...@@ -151,7 +150,6 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element { ...@@ -151,7 +150,6 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
<ActorsFormSection /> <ActorsFormSection />
<PropertiesFormSection /> <PropertiesFormSection />
<RelatedItemsFormSection /> <RelatedItemsFormSection />
<SourceFormSection />
<div className="flex items-center justify-end space-x-6"> <div className="flex items-center justify-end space-x-6">
<Button onPress={onCancel} variant="link"> <Button onPress={onCancel} variant="link">
Cancel Cancel
......
...@@ -9,7 +9,6 @@ import { DateFormSection } from '@/components/item/DateFormSection/DateFormSecti ...@@ -9,7 +9,6 @@ import { DateFormSection } from '@/components/item/DateFormSection/DateFormSecti
import { MainFormSection } from '@/components/item/MainFormSection/MainFormSection' import { MainFormSection } from '@/components/item/MainFormSection/MainFormSection'
import { PropertiesFormSection } from '@/components/item/PropertiesFormSection/PropertiesFormSection' import { PropertiesFormSection } from '@/components/item/PropertiesFormSection/PropertiesFormSection'
import { RelatedItemsFormSection } from '@/components/item/RelatedItemsFormSection/RelatedItemsFormSection' import { RelatedItemsFormSection } from '@/components/item/RelatedItemsFormSection/RelatedItemsFormSection'
import { SourceFormSection } from '@/components/item/SourceFormSection/SourceFormSection'
import { Button } from '@/elements/Button/Button' import { Button } from '@/elements/Button/Button'
import { useToast } from '@/elements/Toast/useToast' import { useToast } from '@/elements/Toast/useToast'
import { sanitizeFormValues } from '@/lib/sshoc/sanitizeFormValues' import { sanitizeFormValues } from '@/lib/sshoc/sanitizeFormValues'
...@@ -154,7 +153,6 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element { ...@@ -154,7 +153,6 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
<ActorsFormSection initialValues={props.item} /> <ActorsFormSection initialValues={props.item} />
<PropertiesFormSection initialValues={props.item} /> <PropertiesFormSection initialValues={props.item} />
<RelatedItemsFormSection initialValues={props.item} /> <RelatedItemsFormSection initialValues={props.item} />
<SourceFormSection initialValues={props.item} />
<div className="flex items-center justify-end space-x-6"> <div className="flex items-center justify-end space-x-6">
<Button onPress={onCancel} variant="link"> <Button onPress={onCancel} variant="link">
Cancel Cancel
......
import { useState } from 'react'
import { useGetSources } from '@/api/sshoc'
import { useDebouncedState } from '@/lib/hooks/useDebouncedState'
import { FormComboBox } from '@/modules/form/components/FormComboBox/FormComboBox'
import { FormSection } from '@/modules/form/components/FormSection/FormSection'
import { FormTextField } from '@/modules/form/components/FormTextField/FormTextField'
export interface SoureFormSectionProps {
initialValues?: any
prefix?: string
}
/**
* Form section for item source.
*/
export function SourceFormSection(props: SoureFormSectionProps): JSX.Element {
const prefix = props.prefix ?? ''
return (
<FormSection title={'Source'}>
<div className="flex space-x-4">
<SourceComboBox
name={`${prefix}source.id`}
label={'Source'}
initialValues={props.initialValues}
/>
<FormTextField
name={`${prefix}sourceItemId`}
label={'Source ID'}
variant="form"
style={{ flex: 1 }}
/>
</div>
</FormSection>
)
}
interface SourceSelectProps {
name: string
label: string
initialValues?: any
}
/**
* Source.
*/
function SourceComboBox(props: SourceSelectProps): JSX.Element {
const initialLabel = props.initialValues?.source?.label ?? ''
const [searchTerm, setSearchTerm] = useState(initialLabel)
const debouncedSearchTerm = useDebouncedState(searchTerm, 150)
const sources = useGetSources(
{ q: debouncedSearchTerm },
{
// enabled: debouncedSearchTerm.length > 2,
keepPreviousData: true,
},
)
return (
<FormComboBox
name={props.name}
label={props.label}
items={sources.data?.sources ?? []}
onInputChange={setSearchTerm}
isLoading={sources.isLoading}
variant="form"
>
{(item) => <FormComboBox.Item>{item.label}</FormComboBox.Item>}
</FormComboBox>
)
}
...@@ -8,7 +8,6 @@ import { ActorsFormSection } from '@/components/item/ActorsFormSection/ActorsFor ...@@ -8,7 +8,6 @@ import { ActorsFormSection } from '@/components/item/ActorsFormSection/ActorsFor
import { MainFormSection } from '@/components/item/MainFormSection/MainFormSection' import { MainFormSection } from '@/components/item/MainFormSection/MainFormSection'
import { PropertiesFormSection } from '@/components/item/PropertiesFormSection/PropertiesFormSection' import { PropertiesFormSection } from '@/components/item/PropertiesFormSection/PropertiesFormSection'
import { RelatedItemsFormSection } from '@/components/item/RelatedItemsFormSection/RelatedItemsFormSection' import { RelatedItemsFormSection } from '@/components/item/RelatedItemsFormSection/RelatedItemsFormSection'
import { SourceFormSection } from '@/components/item/SourceFormSection/SourceFormSection'
import { Button } from '@/elements/Button/Button' import { Button } from '@/elements/Button/Button'
import { useToast } from '@/elements/Toast/useToast' import { useToast } from '@/elements/Toast/useToast'
import { sanitizeFormValues } from '@/lib/sshoc/sanitizeFormValues' import { sanitizeFormValues } from '@/lib/sshoc/sanitizeFormValues'
...@@ -147,7 +146,6 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element { ...@@ -147,7 +146,6 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
<ActorsFormSection /> <ActorsFormSection />
<PropertiesFormSection /> <PropertiesFormSection />
<RelatedItemsFormSection /> <RelatedItemsFormSection />
<SourceFormSection />
<div className="flex items-center justify-end space-x-6"> <div className="flex items-center justify-end space-x-6">
<Button onPress={onCancel} variant="link"> <Button onPress={onCancel} variant="link">
Cancel Cancel
......
...@@ -8,7 +8,6 @@ import { ActorsFormSection } from '@/components/item/ActorsFormSection/ActorsFor ...@@ -8,7 +8,6 @@ import { ActorsFormSection } from '@/components/item/ActorsFormSection/ActorsFor
import { MainFormSection } from '@/components/item/MainFormSection/MainFormSection' import { MainFormSection } from '@/components/item/MainFormSection/MainFormSection'
import { PropertiesFormSection } from '@/components/item/PropertiesFormSection/PropertiesFormSection' import { PropertiesFormSection } from '@/components/item/PropertiesFormSection/PropertiesFormSection'
import { RelatedItemsFormSection } from '@/components/item/RelatedItemsFormSection/RelatedItemsFormSection' import { RelatedItemsFormSection } from '@/components/item/RelatedItemsFormSection/RelatedItemsFormSection'
import { SourceFormSection } from '@/components/item/SourceFormSection/SourceFormSection'
import { Button } from '@/elements/Button/Button' import { Button } from '@/elements/Button/Button'
import { useToast } from '@/elements/Toast/useToast' import { useToast } from '@/elements/Toast/useToast'
import { sanitizeFormValues } from '@/lib/sshoc/sanitizeFormValues' import { sanitizeFormValues } from '@/lib/sshoc/sanitizeFormValues'
...@@ -150,7 +149,6 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element { ...@@ -150,7 +149,6 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
<ActorsFormSection initialValues={props.item} /> <ActorsFormSection initialValues={props.item} />
<PropertiesFormSection initialValues={props.item} /> <PropertiesFormSection initialValues={props.item} />
<RelatedItemsFormSection initialValues={props.item} /> <RelatedItemsFormSection initialValues={props.item} />
<SourceFormSection initialValues={props.item} />
<div className="flex items-center justify-end space-x-6"> <div className="flex items-center justify-end space-x-6">
<Button onPress={onCancel} variant="link"> <Button onPress={onCancel} variant="link">
Cancel Cancel
......
...@@ -8,7 +8,6 @@ import { ActorsFormSection } from '@/components/item/ActorsFormSection/ActorsFor ...@@ -8,7 +8,6 @@ import { ActorsFormSection } from '@/components/item/ActorsFormSection/ActorsFor
import { MainFormSection } from '@/components/item/MainFormSection/MainFormSection' import { MainFormSection } from '@/components/item/MainFormSection/MainFormSection'
import { PropertiesFormSection } from '@/components/item/PropertiesFormSection/PropertiesFormSection' import { PropertiesFormSection } from '@/components/item/PropertiesFormSection/PropertiesFormSection'
import { RelatedItemsFormSection } from '@/components/item/RelatedItemsFormSection/RelatedItemsFormSection' import { RelatedItemsFormSection } from '@/components/item/RelatedItemsFormSection/RelatedItemsFormSection'
import { SourceFormSection } from '@/components/item/SourceFormSection/SourceFormSection'
import { Button } from '@/elements/Button/Button' import { Button } from '@/elements/Button/Button'
import { useToast } from '@/elements/Toast/useToast' import { useToast } from '@/elements/Toast/useToast'
import { sanitizeFormValues } from '@/lib/sshoc/sanitizeFormValues' import { sanitizeFormValues } from '@/lib/sshoc/sanitizeFormValues'
...@@ -147,7 +146,6 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element { ...@@ -147,7 +146,6 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
<ActorsFormSection /> <ActorsFormSection />
<PropertiesFormSection /> <PropertiesFormSection />
<RelatedItemsFormSection /> <RelatedItemsFormSection />
<SourceFormSection />
<div className="flex items-center justify-end space-x-6"> <div className="flex items-center justify-end space-x-6">
<Button onPress={onCancel} variant="link"> <Button onPress={onCancel} variant="link">
Cancel Cancel
......
...@@ -8,7 +8,6 @@ import { ActorsFormSection } from '@/components/item/ActorsFormSection/ActorsFor ...@@ -8,7 +8,6 @@ import { ActorsFormSection } from '@/components/item/ActorsFormSection/ActorsFor
import { MainFormSection } from '@/components/item/MainFormSection/MainFormSection' import { MainFormSection } from '@/components/item/MainFormSection/MainFormSection'
import { PropertiesFormSection } from '@/components/item/PropertiesFormSection/PropertiesFormSection' import { PropertiesFormSection } from '@/components/item/PropertiesFormSection/PropertiesFormSection'
import { RelatedItemsFormSection } from '@/components/item/RelatedItemsFormSection/RelatedItemsFormSection' import { RelatedItemsFormSection } from '@/components/item/RelatedItemsFormSection/RelatedItemsFormSection'
import { SourceFormSection } from '@/components/item/SourceFormSection/SourceFormSection'
import { Button } from '@/elements/Button/Button' import { Button } from '@/elements/Button/Button'
import { useToast } from '@/elements/Toast/useToast' import { useToast } from '@/elements/Toast/useToast'
import { sanitizeFormValues } from '@/lib/sshoc/sanitizeFormValues' import { sanitizeFormValues } from '@/lib/sshoc/sanitizeFormValues'
...@@ -150,7 +149,6 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element { ...@@ -150,7 +149,6 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
<ActorsFormSection initialValues={props.item} /> <ActorsFormSection initialValues={props.item} />
<PropertiesFormSection initialValues={props.item} /> <PropertiesFormSection initialValues={props.item} />
<RelatedItemsFormSection initialValues={props.item} /> <RelatedItemsFormSection initialValues={props.item} />
<SourceFormSection initialValues={props.item} />
<div className="flex items-center justify-end space-x-6"> <div className="flex items-center justify-end space-x-6">
<Button onPress={onCancel} variant="link"> <Button onPress={onCancel} variant="link">
Cancel Cancel
......
...@@ -20,7 +20,6 @@ import { ActorsFormSection } from '@/components/item/ActorsFormSection/ActorsFor ...@@ -20,7 +20,6 @@ import { ActorsFormSection } from '@/components/item/ActorsFormSection/ActorsFor
import { MainFormSection } from '@/components/item/MainFormSection/MainFormSection' import { MainFormSection } from '@/components/item/MainFormSection/MainFormSection'
import { PropertiesFormSection } from '@/components/item/PropertiesFormSection/PropertiesFormSection' import { PropertiesFormSection } from '@/components/item/PropertiesFormSection/PropertiesFormSection'
import { RelatedItemsFormSection } from '@/components/item/RelatedItemsFormSection/RelatedItemsFormSection' import { RelatedItemsFormSection } from '@/components/item/RelatedItemsFormSection/RelatedItemsFormSection'
import { SourceFormSection } from '@/components/item/SourceFormSection/SourceFormSection'
import { WorkflowStepsFormSection } from '@/components/item/WorkflowStepsFormSection/WorkflowStepsFormSection' import { WorkflowStepsFormSection } from '@/components/item/WorkflowStepsFormSection/WorkflowStepsFormSection'
import { Button } from '@/elements/Button/Button' import { Button } from '@/elements/Button/Button'
import { useToast } from '@/elements/Toast/useToast' import { useToast } from '@/elements/Toast/useToast'
...@@ -473,7 +472,6 @@ function WorkflowPage() { ...@@ -473,7 +472,6 @@ function WorkflowPage() {
<ActorsFormSection /> <ActorsFormSection />
<PropertiesFormSection /> <PropertiesFormSection />
<RelatedItemsFormSection /> <RelatedItemsFormSection />
<SourceFormSection />
</Fragment> </Fragment>
) )
} }
...@@ -495,7 +493,6 @@ function WorkflowStepPage(props: FormPageProps) { ...@@ -495,7 +493,6 @@ function WorkflowStepPage(props: FormPageProps) {
<ActorsFormSection prefix={prefix} /> <ActorsFormSection prefix={prefix} />
<PropertiesFormSection prefix={prefix} /> <PropertiesFormSection prefix={prefix} />
<RelatedItemsFormSection prefix={prefix} /> <RelatedItemsFormSection prefix={prefix} />
<SourceFormSection prefix={prefix} />
</Fragment> </Fragment>
) )
} }
......
...@@ -21,7 +21,6 @@ import { ActorsFormSection } from '@/components/item/ActorsFormSection/ActorsFor ...@@ -21,7 +21,6 @@ import { ActorsFormSection } from '@/components/item/ActorsFormSection/ActorsFor
import { MainFormSection } from '@/components/item/MainFormSection/MainFormSection' import { MainFormSection } from '@/components/item/MainFormSection/MainFormSection'
import { PropertiesFormSection } from '@/components/item/PropertiesFormSection/PropertiesFormSection' import { PropertiesFormSection } from '@/components/item/PropertiesFormSection/PropertiesFormSection'
import { RelatedItemsFormSection } from '@/components/item/RelatedItemsFormSection/RelatedItemsFormSection' import { RelatedItemsFormSection } from '@/components/item/RelatedItemsFormSection/RelatedItemsFormSection'
import { SourceFormSection } from '@/components/item/SourceFormSection/SourceFormSection'
import { WorkflowStepsFormSection } from '@/components/item/WorkflowStepsFormSection/WorkflowStepsFormSection' import { WorkflowStepsFormSection } from '@/components/item/WorkflowStepsFormSection/WorkflowStepsFormSection'
import { Button } from '@/elements/Button/Button' import { Button } from '@/elements/Button/Button'
import { useToast } from '@/elements/Toast/useToast' import { useToast } from '@/elements/Toast/useToast'
...@@ -537,7 +536,6 @@ function WorkflowPage(props: FormPageProps) { ...@@ -537,7 +536,6 @@ function WorkflowPage(props: FormPageProps) {
<ActorsFormSection initialValues={props.item} /> <ActorsFormSection initialValues={props.item} />
<PropertiesFormSection initialValues={props.item} /> <PropertiesFormSection initialValues={props.item} />
<RelatedItemsFormSection initialValues={props.item} /> <RelatedItemsFormSection initialValues={props.item} />
<SourceFormSection initialValues={props.item} />
</Fragment> </Fragment>
) )
} }
...@@ -562,7 +560,6 @@ function WorkflowStepPage(props: FormPageProps) { ...@@ -562,7 +560,6 @@ function WorkflowStepPage(props: FormPageProps) {
<ActorsFormSection prefix={prefix} initialValues={initialValues} /> <ActorsFormSection prefix={prefix} initialValues={initialValues} />
<PropertiesFormSection prefix={prefix} initialValues={initialValues} /> <PropertiesFormSection prefix={prefix} initialValues={initialValues} />
<RelatedItemsFormSection prefix={prefix} initialValues={initialValues} /> <RelatedItemsFormSection prefix={prefix} initialValues={initialValues} />
<SourceFormSection prefix={prefix} initialValues={initialValues} />
</Fragment> </Fragment>
) )
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment