Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Rex Dri
Rex Dri
Commits
cf0fd2d2
Commit
cf0fd2d2
authored
Sep 13, 2018
by
Florent Chehab
Browse files
Detecting when a save was moderated
parent
9e940bf1
Pipeline
#27297
passed with stages
in 2 minutes and 41 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
frontend/src/components/university/modules/editors/Editor.js
View file @
cf0fd2d2
...
...
@@ -39,6 +39,7 @@ class Editor extends MyComponent {
open
:
false
,
},
lastSave
:
this
.
props
.
lastSave
,
lastUpdateTime
:
this
.
props
.
lastUpdateTime
,
}
formIsValid
()
{
...
...
@@ -144,11 +145,22 @@ class Editor extends MyComponent {
if
(
this
.
state
.
lastSave
<
this
.
props
.
lastSave
)
{
//saving data was successfull
this
.
setState
({
lastSave
:
this
.
props
.
lastSave
});
// We check if data was moderated
let
message
=
"
Les données ont été enregistrées avec succès !
"
;
let
lastUpdateTime
=
this
.
state
.
lastUpdateTime
;
const
newUpdateTime
=
this
.
props
.
lastUpdateTime
;
if
(
lastUpdateTime
==
newUpdateTime
)
{
message
=
"
Les données ont été enregistrées et sont en attentes de modération.
"
;
}
else
{
lastUpdateTime
=
newUpdateTime
;
}
this
.
setState
({
lastSave
:
this
.
props
.
lastSave
,
lastUpdateTime
});
this
.
setState
({
notification
:
{
open
:
true
,
message
:
"
Les données ont été enregistrées avec succès !
"
,
message
,
success
:
true
,
duration
:
5000
,
preventClickAway
:
false
...
...
@@ -268,6 +280,7 @@ Editor.propTypes = {
clearSaveError
:
PropTypes
.
func
.
isRequired
,
savingHasError
:
PropTypes
.
object
.
isRequired
,
saveData
:
PropTypes
.
func
.
isRequired
,
lastUpdateTime
:
PropTypes
.
string
,
};
Editor
.
defaultProps
=
{
...
...
frontend/src/components/university/modules/editors/UniversitySemestersDatesEditor.js
View file @
cf0fd2d2
...
...
@@ -25,7 +25,7 @@ const styles = theme => ({
class
UniversitySemestersDatesEditor
extends
Editor
{
renderEditor
()
{
const
{
modelData
}
=
this
.
props
;
...
...
@@ -75,9 +75,16 @@ UniversitySemestersDatesEditor.propTypes = {
const
mapStateToProps
=
(
state
)
=>
{
let
lastUpdateTime
=
null
;
const
tmp
=
state
.
universitiesSemestersDatesEl
.
fetched
;
if
(
tmp
.
fetchedAt
)
{
lastUpdateTime
=
tmp
.
data
.
updated_on
;
}
return
{
savingHasError
:
state
.
universitiesSemestersDatesEl
.
savingHasError
,
lastSave
:
state
.
universitiesSemestersDatesEl
.
fetched
.
fetchedAt
,
lastUpdateTime
,
};
};
...
...
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