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
nomad-lab
nomad-FAIR
Commits
21642e3e
Commit
21642e3e
authored
Nov 22, 2019
by
Markus Scheidgen
Browse files
Fixed problems with swagger validation of edit actions model.
parent
505f9eae
Pipeline
#64184
passed with stages
in 25 minutes and 38 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
gui/src/components/EditUserMetadataDialog.js
View file @
21642e3e
...
...
@@ -678,10 +678,24 @@ class EditUserMetadataDialogUnstyled extends React.Component {
const
{
query
,
api
}
=
this
.
props
const
{
actions
}
=
this
.
state
// remove null values to allow swagger validation
const
actionsCopy
=
{...
this
.
state
.
actions
}
Object
.
keys
(
actionsCopy
).
forEach
(
key
=>
{
if
(
Array
.
isArray
(
actionsCopy
[
key
]))
{
actionsCopy
[
key
]
=
actionsCopy
[
key
].
map
(
action
=>
{
const
actionCopy
=
{...
action
}
if
(
!
actionCopy
.
value
)
{
delete
actionCopy
.
value
}
return
actionCopy
})
}
})
const
editRequest
=
{
query
:
query
,
verify
:
verify
,
actions
:
actions
actions
:
actions
Copy
}
return
api
.
edit
(
editRequest
).
then
(
data
=>
{
...
...
@@ -689,8 +703,8 @@ class EditUserMetadataDialogUnstyled extends React.Component {
return
}
const
newActions
=
{...
this
.
state
.
actions
}
let
verified
=
true
const
newActions
=
{...
this
.
state
.
actions
}
if
(
data
.
actions
)
{
Object
.
keys
(
newActions
).
forEach
(
key
=>
{
if
(
Array
.
isArray
(
newActions
[
key
]))
{
...
...
nomad/app/api/repo.py
View file @
21642e3e
...
...
@@ -330,13 +330,8 @@ def repo_edit_action_field(quantity):
fields
.
Nested
(
repo_edit_action_model
,
skip_none
=
True
),
description
=
quantity
.
description
)
class
NullableString
(
fields
.
String
):
__schema_type__
=
[
'string'
,
'null'
]
__schema_example__
=
'nullable string'
repo_edit_action_model
=
api
.
model
(
'RepoEditAction'
,
{
'value'
:
Nullable
String
(
description
=
'The value/values that is set as a string.'
),
'value'
:
fields
.
String
(
description
=
'The value/values that is set as a string.'
),
'success'
:
fields
.
Boolean
(
description
=
'If this can/could be done. Only in API response.'
),
'message'
:
fields
.
String
(
descriptin
=
'A message that details the action result. Only in API response.'
)
})
...
...
@@ -458,13 +453,12 @@ class EditRepoCalcsResource(Resource):
action
[
'success'
]
=
True
action
[
'message'
]
=
None
action_value
=
action
.
get
(
'value'
)
action_value
=
action_value
if
action_value
is
None
else
action_value
.
strip
()
if
action_value
is
None
:
continue
action_value
=
action_value
.
strip
()
mongo_value
=
None
if
action_value
==
''
:
el
if
action_value
==
''
:
mongo_value
=
None
elif
flask_verify
==
datamodel
.
User
:
...
...
Write
Preview
Supports
Markdown
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