Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
dashboard
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AURA
dashboard
Commits
78226917
Commit
78226917
authored
5 years ago
by
jackie / Andrea Ida Malkah Klaura
Browse files
Options
Downloads
Patches
Plain Diff
FIX: check for valid type & category in add show modal
parent
46dfc62d
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/components/ShowManagerModalSuperuser.vue
+39
-18
39 additions, 18 deletions
src/components/ShowManagerModalSuperuser.vue
with
39 additions
and
18 deletions
src/components/ShowManagerModalSuperuser.vue
+
39
−
18
View file @
78226917
...
...
@@ -59,7 +59,7 @@
</div>
</b-col>
</b-row>
<b-row>
<b-col
cols=
"3"
>
Funding category:
...
...
@@ -165,33 +165,54 @@ export default {
},
methods
:
{
// create a new show and POST it to the steering API
// new shows have to at least contain a name, a slug and a short-description.
// also a valide show type and funding category have to be choosen.
// for all other categories we can use an empty array and let the user fill
// it out through the existing show manager modals, after the show is created
addShow
(
event
)
{
// prevent the modal from closing automatically on click
event
.
preventDefault
()
// only try to add a new show if name and short description are filled out
if
(
this
.
newShow
.
name
.
trim
()
===
''
||
this
.
newShow
.
short_description
.
trim
()
===
''
)
{
// TODO: make this nicer UI-wise (red text annotations next to input fields instead of simple alert)
alert
(
'
Please provide at least a title and a short description for this show.
'
)
}
else
{
// as the slug is a computed property we to assign it to the new show's slug variable
this
.
newShow
.
slug
=
this
.
temporarySlug
let
uri
=
process
.
env
.
VUE_APP_API_STEERING_SHOWS
axios
.
post
(
uri
,
this
.
newShow
,
{
withCredentials
:
true
,
headers
:
{
'
Authorization
'
:
'
Bearer
'
+
this
.
$parent
.
$parent
.
user
.
access_token
}
}).
then
(
response
=>
{
// everything was fine, we can close the modal now
this
.
$refs
.
modalAddShow
.
hide
()
this
.
$parent
.
loadAndSwitch
(
response
.
data
.
id
)
}).
catch
(
error
=>
{
this
.
$log
.
error
(
error
.
response
.
status
+
'
'
+
error
.
response
.
statusText
)
this
.
$log
.
error
(
error
.
response
)
alert
(
'
Error: could not add new show. See console for details.
'
)
// and we leave the modal open, so no call to its .hide function here
})
return
}
// also the type and funding category have to be set
if
(
this
.
types
.
findIndex
(
type
=>
type
.
id
===
this
.
newShow
.
type
)
===
-
1
)
{
// TODO: make this nicer UI-wise (red text annotations next to input fields instead of simple alert)
alert
(
'
Please choose a type for this show.
'
)
return
}
if
(
this
.
fundingcategories
.
findIndex
(
cat
=>
cat
.
id
===
this
.
newShow
.
fundingcategory
)
===
-
1
)
{
// TODO: make this nicer UI-wise (red text annotations next to input fields instead of simple alert)
alert
(
'
Please choose a funding category for this show.
'
)
return
}
// as the slug is a computed property we have to assign it to the new show's slug property
this
.
newShow
.
slug
=
this
.
temporarySlug
// ready to go, let's POST this new show
let
uri
=
process
.
env
.
VUE_APP_API_STEERING_SHOWS
axios
.
post
(
uri
,
this
.
newShow
,
{
withCredentials
:
true
,
headers
:
{
'
Authorization
'
:
'
Bearer
'
+
this
.
$parent
.
$parent
.
user
.
access_token
}
}).
then
(
response
=>
{
// everything was fine, we can close the modal now
this
.
$refs
.
modalAddShow
.
hide
()
this
.
$parent
.
loadAndSwitch
(
response
.
data
.
id
)
}).
catch
(
error
=>
{
this
.
$log
.
error
(
error
.
response
.
status
+
'
'
+
error
.
response
.
statusText
)
this
.
$log
.
error
(
error
.
response
)
alert
(
'
Error: could not add new show. See console for details.
'
)
// and we leave the modal open, so no call to its .hide function here
})
},
// delete a show by sending a DELETE to the steering API
deleteShow
(
event
)
{
// prevent the modal from closing automatically on click
event
.
preventDefault
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment