Skip to content
GitLab
Menu
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
6de7c109
Commit
6de7c109
authored
Aug 24, 2020
by
Richard Blechinger
Browse files
Add expandable schedule block to show manager
parent
736db302
Changes
7
Expand all
Show whitespace changes
Inline
Side-by-side
package-lock.json
View file @
6de7c109
This diff is collapsed.
Click to expand it.
src/components/ShowManager.vue
View file @
6de7c109
...
@@ -25,6 +25,8 @@
...
@@ -25,6 +25,8 @@
<!-- When all show data is loaded, here we display all the rest -->
<!-- When all show data is loaded, here we display all the rest -->
<div
v-else
>
<div
v-else
>
<show-schedules
/>
<!-- include the modals to edit show and timeslot entries from the modal compontents -->
<!-- include the modals to edit show and timeslot entries from the modal compontents -->
<show-timeslots
ref=
"timeslotsComponent"
/>
<show-timeslots
ref=
"timeslotsComponent"
/>
...
@@ -44,6 +46,7 @@
...
@@ -44,6 +46,7 @@
<
script
>
<
script
>
import
showJumbotron
from
'
./shows/Jumbotron.vue
'
import
showJumbotron
from
'
./shows/Jumbotron.vue
'
import
showTimeslots
from
'
./shows/Timeslots.vue
'
import
showTimeslots
from
'
./shows/Timeslots.vue
'
import
showSchedules
from
'
./shows/Schedules.vue
'
import
showMetaSimpleTypes
from
'
./shows/MetaSimpleTypes.vue
'
import
showMetaSimpleTypes
from
'
./shows/MetaSimpleTypes.vue
'
import
showMetaArrays
from
'
./shows/MetaArrays.vue
'
import
showMetaArrays
from
'
./shows/MetaArrays.vue
'
import
showMetaOwners
from
'
./shows/MetaOwners.vue
'
import
showMetaOwners
from
'
./shows/MetaOwners.vue
'
...
@@ -57,6 +60,7 @@ export default {
...
@@ -57,6 +60,7 @@ export default {
components
:
{
components
:
{
'
show-jumbotron
'
:
showJumbotron
,
'
show-jumbotron
'
:
showJumbotron
,
'
show-timeslots
'
:
showTimeslots
,
'
show-timeslots
'
:
showTimeslots
,
'
show-schedules
'
:
showSchedules
,
'
show-metaArrays
'
:
showMetaArrays
,
'
show-metaArrays
'
:
showMetaArrays
,
'
show-metaSimpleTypes
'
:
showMetaSimpleTypes
,
'
show-metaSimpleTypes
'
:
showMetaSimpleTypes
,
'
show-metaOwners
'
:
showMetaOwners
,
'
show-metaOwners
'
:
showMetaOwners
,
...
...
src/components/shows/Schedules.vue
0 → 100644
View file @
6de7c109
<
template
>
<div
:class=
"
{ 'show-schedules': true, 'expandable': isExpandable, 'collapsed': isExpandable
&&
collapsed }" @click="expand">
<table
class=
"table b-table table-striped border"
>
<thead>
<tr>
<th
class=
"top-header"
>
Schedules
</th>
<th
class=
"top-header text-right font-weight-normal"
>
{{
schedules
.
length
}}
schedules
</th>
</tr>
</thead>
<tbody>
<tr
v-for=
"schedule in schedules"
:key=
"schedule.id"
>
<td>
{{
renderRruleForSchedule
(
schedule
)
}}
</td>
<td
class=
"text-right"
>
{{
prettyHours
(
schedule
.
tstart
)
}}
-
{{
prettyHours
(
schedule
.
tend
)
}}
</td>
</tr>
</tbody>
</table>
<div
v-if=
"isExpandable"
class=
"collapser"
>
click to collapse
</div>
</div>
</
template
>
<
script
>
import
{
mapGetters
}
from
'
vuex
'
import
rrules
from
'
../../mixins/rrules
'
import
prettyDate
from
'
../../mixins/prettyDate
'
import
{
lowercaseFirst
,
uppercaseFirst
}
from
"
../../utilities
"
;
export
default
{
mixins
:
[
rrules
,
prettyDate
],
data
()
{
return
{
collapsed
:
true
}
},
computed
:
{
...
mapGetters
({
schedules
:
'
shows/schedules
'
,
selectedShow
:
'
shows/selectedShow
'
,
}),
isExpandable
()
{
return
this
.
schedules
.
length
>
2
}
},
created
()
{
this
.
getSchedules
()
},
methods
:
{
expand
()
{
this
.
collapsed
=
!
this
.
collapsed
},
getSchedules
()
{
this
.
$store
.
dispatch
(
'
shows/fetchSchedules
'
,
{
show
:
this
.
selectedShow
.
id
,
callback
:
console
.
log
})
},
renderRruleForSchedule
(
schedule
)
{
console
.
log
(
uppercaseFirst
(
this
.
rruleRender
(
schedule
.
rrule
)));
if
(
schedule
.
rrule
<
3
)
{
return
uppercaseFirst
(
this
.
rruleRender
(
schedule
.
rrule
))
}
const
rrule
=
uppercaseFirst
(
this
.
rruleRender
(
schedule
.
rrule
));
const
weekday
=
lowercaseFirst
(
this
.
prettyWeekday
(
schedule
.
byweekday
));
return
`
${
rrule
}
${
weekday
}
s`
}
},
}
</
script
>
<
style
scoped
>
.show-schedules
{
box-sizing
:
border-box
;
width
:
100%
;
margin-bottom
:
.5rem
;
position
:
relative
;
overflow-y
:
hidden
;
}
.show-schedules
:hover
{
cursor
:
pointer
;
}
.show-schedules.expandable
{
margin-bottom
:
1rem
;
}
.show-schedules.collapsed
{
height
:
10rem
;
}
.show-schedules.collapsed
::after
{
content
:
"click to expand"
;
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
background
:
linear-gradient
(
rgba
(
255
,
255
,
255
,
0
),
rgba
(
255
,
255
,
255
,
9
)
66%
);
height
:
4rem
;
width
:
100%
;
z-index
:
1
;
bottom
:
0
;
position
:
absolute
;
}
.show-schedules.collapsed
::after
,
.collapser
{
text-align
:
center
;
color
:
var
(
--info
);
}
.show-schedules
:hover:after
,
.show-schedules
:hover
.collapser
{
text-decoration
:
underline
;
}
</
style
>
src/mixins/prettyDate.js
View file @
6de7c109
...
@@ -65,6 +65,9 @@ export default {
...
@@ -65,6 +65,9 @@ export default {
dstring
+=
leadingZero
(
d
.
getHours
())
+
'
:
'
+
leadingZero
(
d
.
getMinutes
())
+
'
:
'
+
leadingZero
(
d
.
getSeconds
())
dstring
+=
leadingZero
(
d
.
getHours
())
+
'
:
'
+
leadingZero
(
d
.
getMinutes
())
+
'
:
'
+
leadingZero
(
d
.
getSeconds
())
return
dstring
return
dstring
},
},
prettyHours
(
hours
)
{
return
hours
.
replace
(
/:00$/
,
''
);
},
prettyDuration
:
function
(
start
,
end
)
{
prettyDuration
:
function
(
start
,
end
)
{
var
seconds
=
(
new
Date
(
end
).
getTime
()
-
new
Date
(
start
).
getTime
())
/
1000
var
seconds
=
(
new
Date
(
end
).
getTime
()
-
new
Date
(
start
).
getTime
())
/
1000
var
minutes
=
Math
.
floor
(
seconds
/
60
)
var
minutes
=
Math
.
floor
(
seconds
/
60
)
...
@@ -82,6 +85,9 @@ export default {
...
@@ -82,6 +85,9 @@ export default {
var
minutes
=
Math
.
floor
((
sec_total
-
(
hours
*
3600
))
/
60
)
var
minutes
=
Math
.
floor
((
sec_total
-
(
hours
*
3600
))
/
60
)
var
seconds
=
Math
.
floor
((
sec_total
-
(
hours
*
3600
)
-
(
minutes
*
60
))
*
10
)
/
10
var
seconds
=
Math
.
floor
((
sec_total
-
(
hours
*
3600
)
-
(
minutes
*
60
))
*
10
)
/
10
return
hours
+
'
:
'
+
leadingZero
(
minutes
)
+
'
:
'
+
leadingZero
(
seconds
)
return
hours
+
'
:
'
+
leadingZero
(
minutes
)
+
'
:
'
+
leadingZero
(
seconds
)
},
prettyWeekday
:
function
(
weekday
)
{
return
day
[
weekday
];
}
}
}
}
}
}
src/mixins/rrules.js
View file @
6de7c109
...
@@ -21,7 +21,8 @@ export default {
...
@@ -21,7 +21,8 @@ export default {
methods
:
{
methods
:
{
rruleRender
(
rrule
)
{
rruleRender
(
rrule
)
{
let
rule
=
this
.
rruleOptions
.
find
(
r
=>
r
.
value
===
rrule
)
let
rule
=
this
.
rruleOptions
.
find
(
r
=>
r
.
value
===
rrule
)
return
rule
.
text
return
rule
.
text
}
}
,
}
}
}
}
src/store/modules/shows.js
View file @
6de7c109
...
@@ -25,6 +25,7 @@ const cloneMinimalShowObject = function (show) {
...
@@ -25,6 +25,7 @@ const cloneMinimalShowObject = function (show) {
const
state
=
{
const
state
=
{
shows
:
[],
shows
:
[],
schedule
:
null
,
schedule
:
null
,
schedules
:
[],
scheduleTimeslots
:
[],
scheduleTimeslots
:
[],
timeslots
:
[],
timeslots
:
[],
notes
:
[],
notes
:
[],
...
@@ -60,6 +61,7 @@ const getters = {
...
@@ -60,6 +61,7 @@ const getters = {
shows
:
state
=>
state
.
shows
,
shows
:
state
=>
state
.
shows
,
selectedShow
:
state
=>
state
.
shows
[
state
.
selected
.
index
],
selectedShow
:
state
=>
state
.
shows
[
state
.
selected
.
index
],
schedule
:
state
=>
state
.
schedule
,
schedule
:
state
=>
state
.
schedule
,
schedules
:
state
=>
state
.
schedules
,
scheduleTimeslots
:
state
=>
state
.
scheduleTimeslots
,
scheduleTimeslots
:
state
=>
state
.
scheduleTimeslots
,
timeslots
:
state
=>
state
.
timeslots
,
timeslots
:
state
=>
state
.
timeslots
,
notes
:
state
=>
state
.
notes
,
notes
:
state
=>
state
.
notes
,
...
@@ -100,6 +102,7 @@ const mutations = {
...
@@ -100,6 +102,7 @@ const mutations = {
},
},
setSchedule
(
state
,
schedule
)
{
state
.
schedule
=
schedule
},
setSchedule
(
state
,
schedule
)
{
state
.
schedule
=
schedule
},
setSchedules
(
state
,
schedules
)
{
state
.
schedules
=
schedules
},
setScheduleTimeslots
(
state
,
slots
)
{
state
.
scheduleTimeslots
=
slots
},
setScheduleTimeslots
(
state
,
slots
)
{
state
.
scheduleTimeslots
=
slots
},
setTimeslots
(
state
,
slots
)
{
state
.
timeslots
=
slots
},
setTimeslots
(
state
,
slots
)
{
state
.
timeslots
=
slots
},
...
@@ -190,6 +193,23 @@ const actions = {
...
@@ -190,6 +193,23 @@ const actions = {
})
})
},
},
fetchSchedules
(
ctx
,
data
)
{
ctx
.
commit
(
'
loading
'
,
'
schedule
'
)
let
uri
=
process
.
env
.
VUE_APP_API_STEERING
+
'
shows/
'
+
data
.
show
+
'
/schedules/
'
axios
.
get
(
uri
,
{
withCredentials
:
true
,
headers
:
{
'
Authorization
'
:
'
Bearer
'
+
ctx
.
rootState
.
auth
.
user
.
access_token
}
}).
then
(
response
=>
{
ctx
.
commit
(
'
setSchedules
'
,
response
.
data
)
ctx
.
commit
(
'
finishLoading
'
,
'
schedule
'
)
if
(
data
&&
typeof
(
data
.
callback
)
===
'
function
'
)
{
data
.
callback
(
response
)
}
}).
catch
(
error
=>
{
handleApiError
(
this
,
error
,
'
could not load schedule
'
)
if
(
data
&&
typeof
(
data
.
callbackCancel
)
===
'
function
'
)
{
data
.
callbackCancel
()
}
})
},
fetchTimeslots
(
ctx
,
data
)
{
fetchTimeslots
(
ctx
,
data
)
{
if
(
data
.
schedule
!==
undefined
)
{
ctx
.
commit
(
'
loading
'
,
'
scheduleTimeslots
'
)
}
if
(
data
.
schedule
!==
undefined
)
{
ctx
.
commit
(
'
loading
'
,
'
scheduleTimeslots
'
)
}
else
{
ctx
.
commit
(
'
loading
'
,
'
timeslots
'
)
}
else
{
ctx
.
commit
(
'
loading
'
,
'
timeslots
'
)
}
...
...
src/utilities.js
0 → 100644
View file @
6de7c109
export
function
uppercaseFirst
(
string
=
""
)
{
return
string
.
charAt
(
0
).
toUpperCase
()
+
string
.
slice
(
1
);
}
export
function
lowercaseFirst
(
string
=
""
)
{
return
string
.
charAt
(
0
).
toLowerCase
()
+
string
.
slice
(
1
);
}
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