Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SSHOC
sshoc-marketplace-frontend
Commits
927ac48a
Commit
927ac48a
authored
Apr 14, 2021
by
Stefan Probst
Browse files
fix: adjust to objectid=>persistentId change, pass dto to workflow edit form
parent
fa3ebff7
Pipeline
#188014
failed with stage
in 13 seconds
Changes
7
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
src/api/sshoc/helpers.ts
View file @
927ac48a
...
...
@@ -74,28 +74,32 @@ export function convertToInitialFormValues(
}
}),
/**
*
`persistentId` => `objectId`
*
Only ids needed.
*/
relatedItems
:
item
.
relatedItems
?.
map
((
relation
)
=>
{
return
{
...
relation
,
objectId
:
relation
.
persistentId
,
id
:
relation
.
id
,
persistentId
:
relation
.
persistentId
,
relation
:
relation
.
relation
&&
{
code
:
relation
.
relation
.
code
},
}
}),
/**
* Only ids needed. Also, fields are non-null.
*/
externalIds
:
item
.
externalIds
?.
map
((
id
)
=>
{
return
{
serviceIdentifier
:
id
.
identifierService
?.
code
??
''
,
identifier
:
id
.
identifier
??
''
,
const
identifierService
=
{
code
:
id
.
identifierService
?.
code
}
const
identifier
=
id
.
identifier
!
const
externalId
=
{
identifier
,
serviceIdentifier
:
identifierService
,
}
return
externalId
}),
/**
* Only id needed.
*/
source
:
{
id
:
item
.
source
?
.
id
,
source
:
item
.
source
&&
{
id
:
item
.
source
.
id
,
},
sourceItemId
:
item
.
sourceItemId
,
}
...
...
src/api/sshoc/index.ts
View file @
927ac48a
This diff is collapsed.
Click to expand it.
src/components/item/ActorsFormSection/ActorsFormSection.tsx
View file @
927ac48a
...
...
@@ -263,7 +263,7 @@ function CreateActorForm(props: CreateActorFormProps) {
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
id
!=
null
&&
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
id
.
serviceIdentifier
!=
null
&&
id
.
serviceIdentifier
?.
code
!=
null
&&
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
id
.
identifier
==
null
)
{
...
...
@@ -285,13 +285,13 @@ function CreateActorForm(props: CreateActorFormProps) {
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
id
.
identifier
!=
null
&&
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
id
.
serviceIdentifier
==
null
id
.
serviceIdentifier
?.
code
==
null
)
{
if
(
errors
.
externalIds
===
undefined
)
{
errors
.
externalIds
=
[]
}
errors
.
externalIds
[
index
]
=
{
serviceIdentifier
:
'
Please select an ID service.
'
,
serviceIdentifier
:
{
code
:
'
Please select an ID service.
'
}
,
}
}
})
...
...
src/components/item/MainFormSection/MainFormSection.tsx
View file @
927ac48a
...
...
@@ -88,7 +88,7 @@ export function MainFormSection(props: MainFormSectionProps): JSX.Element {
}
>
<
ExternalIdServiceSelect
name
=
{
`
${
name
}
.serviceIdentifier`
}
name
=
{
`
${
name
}
.serviceIdentifier
.code
`
}
label
=
"ID Service"
/>
<
FormTextField
...
...
src/components/item/RelatedItemsFormSection/RelatedItemsFormSection.tsx
View file @
927ac48a
...
...
@@ -46,7 +46,7 @@ export function RelatedItemsFormSection(
label
=
{
'
Relation type
'
}
/>
<
RelatedItemComboBox
name
=
{
`
${
name
}
.
objec
tId`
}
name
=
{
`
${
name
}
.
persisten
tId`
}
label
=
{
'
Item
'
}
initialValues
=
{
props
.
initialValues
}
index
=
{
index
}
...
...
src/components/item/WorkflowEditForm/WorkflowEditForm.tsx
View file @
927ac48a
...
...
@@ -440,7 +440,11 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
</
div
>
)
:
null
}
</
div
>
<
Page
onSetPage
=
{
onSetPage
}
prefix
=
{
state
.
prefix
}
/>
<
Page
onSetPage
=
{
onSetPage
}
prefix
=
{
state
.
prefix
}
item
=
{
props
.
item
}
/>
<
div
className
=
"flex items-center justify-end space-x-6"
>
<
Button
onPress
=
{
onCancel
}
variant
=
"link"
>
Cancel
...
...
@@ -523,15 +527,16 @@ export function ItemForm(props: ItemFormProps<ItemFormValues>): JSX.Element {
interface
FormPageProps
{
onSetPage
:
(
page
:
PageKey
,
prefix
?:
string
,
onReset
?:
()
=>
void
)
=>
void
prefix
?:
string
item
?:
WorkflowDto
}
function
WorkflowPage
()
{
function
WorkflowPage
(
props
:
FormPageProps
)
{
return
(
<
Fragment
>
<
MainFormSection
/>
<
ActorsFormSection
/>
<
PropertiesFormSection
/>
<
RelatedItemsFormSection
/>
<
ActorsFormSection
initialValues
=
{
props
.
item
}
/>
<
PropertiesFormSection
initialValues
=
{
props
.
item
}
/>
<
RelatedItemsFormSection
initialValues
=
{
props
.
item
}
/>
<
SourceFormSection
/>
</
Fragment
>
)
...
...
src/lib/sshoc/validateCommonFormFields.ts
View file @
927ac48a
...
...
@@ -170,13 +170,13 @@ export function validateCommonFormFields<
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
item
!=
null
&&
item
.
relation
!==
undefined
&&
item
.
objec
tId
===
undefined
item
.
persisten
tId
===
undefined
)
{
if
(
errors
.
relatedItems
===
undefined
)
{
/* @ts-expect-error Untyped empty array. */
errors
.
relatedItems
=
[]
}
errors
.
relatedItems
[
index
]
=
{
objec
tId
:
'
Please select an item.
'
}
errors
.
relatedItems
[
index
]
=
{
persisten
tId
:
'
Please select an item.
'
}
}
})
}
...
...
@@ -187,7 +187,7 @@ export function validateCommonFormFields<
if
(
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
item
!=
null
&&
item
.
objec
tId
!==
undefined
&&
item
.
persisten
tId
!==
undefined
&&
item
.
relation
===
undefined
)
{
if
(
errors
.
relatedItems
===
undefined
)
{
...
...
@@ -207,7 +207,7 @@ export function validateCommonFormFields<
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
id
!=
null
&&
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
id
.
serviceIdentifier
!=
null
&&
id
.
serviceIdentifier
?.
code
!=
null
&&
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
id
.
identifier
==
null
)
{
...
...
@@ -230,14 +230,14 @@ export function validateCommonFormFields<
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
id
.
identifier
!=
null
&&
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
id
.
serviceIdentifier
==
null
id
.
serviceIdentifier
?.
code
==
null
)
{
if
(
errors
.
externalIds
===
undefined
)
{
/* @ts-expect-error Untyped empty array. */
errors
.
externalIds
=
[]
}
errors
.
externalIds
[
index
]
=
{
serviceIdentifier
:
'
Please select an ID service.
'
,
serviceIdentifier
:
{
code
:
'
Please select an ID service.
'
}
,
}
}
})
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment