Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Genesys Website
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
35
Issues
35
List
Boards
Labels
Service Desk
Milestones
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Genesys PGR
Genesys Website
Commits
400b618a
Commit
400b618a
authored
Dec 04, 2019
by
Viacheslav Pavlov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New crop isn`t created
parent
7046ee3d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
20 deletions
+24
-20
src/crop/ui/EditPage.tsx
src/crop/ui/EditPage.tsx
+18
-16
src/crop/ui/c/CropForm.tsx
src/crop/ui/c/CropForm.tsx
+6
-4
No files found.
src/crop/ui/EditPage.tsx
View file @
400b618a
...
...
@@ -47,28 +47,30 @@ class CropEditPage extends React.Component<ICropEditPageProps, any> {
private
onSave
=
async
(
updatedCrop
:
any
)
=>
{
const
{
article
,
createArticle
,
updateArticle
,
saveCrop
,
navigateTo
,
shortName
}
=
this
.
props
;
const
{
article
:
editedArticle
}
=
updatedCrop
;
const
{
id
}
=
this
.
props
.
crop
;
const
id
=
this
.
props
.
crop
&&
this
.
props
.
crop
.
id
;
let
receivedArticle
:
Article
;
try
{
if
(
article
&&
!
_
.
isEqual
(
editedArticle
,
article
.
body
))
{
receivedArticle
=
await
updateArticle
({
...
article
,
...{
body
:
editedArticle
}
},
shortName
);
}
else
if
(
!
article
&&
editedArticle
)
{
const
article
=
new
Article
();
article
.
body
=
editedArticle
;
article
.
targetId
=
id
;
receivedArticle
=
await
createArticle
(
article
,
shortName
);
if
(
id
)
{
try
{
if
(
article
&&
!
_
.
isEqual
(
editedArticle
,
article
.
body
))
{
receivedArticle
=
await
updateArticle
({...
article
,
...{
body
:
editedArticle
}},
shortName
);
}
else
if
(
!
article
&&
editedArticle
)
{
const
article
=
new
Article
();
article
.
body
=
editedArticle
;
article
.
targetId
=
id
;
receivedArticle
=
await
createArticle
(
article
,
shortName
);
}
if
(
receivedArticle
)
{
this
.
setState
({
article
:
receivedArticle
});
}
}
catch
(
e
)
{
return
console
.
log
(
'
updating description error
'
,
e
);
}
if
(
receivedArticle
)
{
this
.
setState
({
article
:
receivedArticle
});
}
}
catch
(
e
)
{
return
console
.
log
(
'
updating description error
'
,
e
);
delete
updatedCrop
.
article
;
}
delete
updatedCrop
.
article
;
saveCrop
(
updatedCrop
)
.
then
(()
=>
navigateTo
(
`
/c/
${
updatedCrop
.
shortName
}
/edit
`
));
}
...
...
src/crop/ui/c/CropForm.tsx
View file @
400b618a
...
...
@@ -42,14 +42,16 @@ const CropForm = ({error, handleSubmit, initialValues, onDelete, cropNames, t, l
<
h4
>
{
t
(
'
crop.admin.c.cropForm.otherNames
'
)
}
</
h4
>
<
ItemsEditor
name
=
"otherNames"
itemLabel
=
{
t
(
'
crop.admin.c.cropForm.otherNames
'
)
}
addItem
=
{
onAddString
}
removeItem
=
{
onRemoveString
}
component
=
{
stringField
}
/>
</
div
>
<
div
className
=
"mt-15"
>
<
h4
>
{
t
(
'
crop.admin.c.cropForm.article
'
,
{
lang
})
}
</
h4
>
{
initialValues
.
id
&&
(
<
div
className
=
"mt-15"
>
<
h4
>
{
t
(
'
crop.admin.c.cropForm.article
'
,
{
lang
})
}
</
h4
>
<
Field
required
name
=
"article"
component
=
{
HtmlEditField
}
component
=
{
HtmlEditField
}
/>
</
div
>
</
div
>
)
}
<
div
>
{
error
&&
<
strong
>
{
error
}
</
strong
>
}
</
div
>
<
Divider
/>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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