Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
AURA
dashboard
Commits
60981067
Commit
60981067
authored
Oct 25, 2019
by
jackie / Andrea Ida Malkah Klaura
Browse files
implements future timeslot deletion for
#30
parent
35c3005a
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/components/EmissionManagerModalEdit.vue
View file @
60981067
...
...
@@ -120,6 +120,29 @@
>
</div>
</b-modal>
<b-modal
ref=
"modalEmissionManagerDeleteTimeslots"
title=
"Deleting timeslots"
size=
"lg"
centered
hide-footer
no-close-on-esc
no-close-on-backdrop
>
<div
align=
"center"
>
<img
src=
"../assets/radio.gif"
alt=
"loading schedule data"
>
<b-progress
:value=
"deletion.count"
:max=
"deletion.amount"
variant=
"info"
animated
/>
</div>
</b-modal>
</div>
</
template
>
...
...
@@ -141,6 +164,10 @@ export default {
modal
:
false
,
schedule
:
false
,
scheduleTimeslots
:
false
,
},
deletion
:
{
amount
:
0
,
count
:
0
,
}
}
},
...
...
@@ -177,9 +204,47 @@ export default {
})
},
deleteAllFutureTimeslots
(
scheduleId
,
timeslotId
)
{
this
.
$log
.
debug
(
scheduleId
,
timeslotId
)
this
.
notYetImplemented
()
deleteAllFutureTimeslots
(
scheduleId
)
{
let
startDate
=
new
Date
(
this
.
timeslot
.
start
)
let
toDelete
=
[]
for
(
let
slot
of
this
.
scheduleTimeslots
)
{
if
(
new
Date
(
slot
.
start
)
>=
startDate
)
{
toDelete
.
push
(
slot
.
id
)
}
}
if
(
toDelete
.
length
===
this
.
scheduleTimeslots
.
length
)
{
this
.
$log
.
debug
(
'
deleting full schedule
'
)
this
.
deleteFullSchedule
(
scheduleId
)
}
else
{
this
.
deletion
.
amount
=
toDelete
.
length
this
.
deletion
.
count
=
0
this
.
$refs
.
modalEmissionManagerDeleteTimeslots
.
show
()
let
uri
=
process
.
env
.
VUE_APP_API_STEERING
+
'
shows/
'
+
this
.
show
.
id
+
'
/schedules/
'
+
scheduleId
+
'
/
'
for
(
let
i
in
toDelete
)
{
this
.
$log
.
debug
(
'
Deleting timeslot
'
,
toDelete
[
i
])
axios
.
delete
(
uri
+
'
timeslots/
'
+
toDelete
[
i
]
+
'
/
'
,
{
withCredentials
:
true
,
headers
:
{
'
Authorization
'
:
'
Bearer
'
+
this
.
$parent
.
$parent
.
user
.
access_token
}
}).
then
(()
=>
{
this
.
deletion
.
count
++
this
.
$log
.
debug
(
'
deleted
'
+
this
.
deletion
.
count
+
'
timeslots
'
)
if
(
this
.
deletion
.
count
===
this
.
deletion
.
amount
)
{
this
.
$parent
.
renderView
(
null
)
this
.
$refs
.
modalEmissionManagerDeleteTimeslots
.
hide
()
this
.
$refs
.
modalEmissionManagerEdit
.
hide
()
}
}).
catch
(
error
=>
{
this
.
$log
.
error
(
error
.
response
.
status
+
'
'
+
error
.
response
.
statusText
)
this
.
$log
.
error
(
error
.
response
)
alert
(
'
Error: could not delete full timeslot. See console for details.
'
)
})
}
}
},
loadSchedule
(
id
)
{
...
...
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