Skip to content

Commit 174087f

Browse files
committed
Implement new video download functionality with progress indication and cancellation option,
The download feature now informs users the status of the process as well as progress bar with cancel button.
1 parent 56310b1 commit 174087f

File tree

5 files changed

+330
-83
lines changed

5 files changed

+330
-83
lines changed

assets/css/opencast.scss

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -723,6 +723,13 @@ h2.oc--loadingbar, .oc--loadingbar-title {
723723
}
724724
}
725725

726+
&.oc--minimal-progress {
727+
height: 3px !important;
728+
.oc--progress-bar {
729+
height: 3px !important;
730+
}
731+
}
732+
726733
margin: 5px 0;
727734
}
728735

@@ -911,6 +918,113 @@ div.oc--dialog-possibilities {
911918
display: block;
912919
}
913920

921+
/* * * * * * * * * * * */
922+
/* DOWNLOAD VIDEOS */
923+
/* * * * * * * * * * * */
924+
925+
.oc--download-list-container {
926+
display: flex;
927+
flex-direction: column;
928+
height: 100%;
929+
.oc--download-list {
930+
flex-grow: 1;
931+
}
932+
.oc--download-messages {
933+
flex-shrink: 0;
934+
}
935+
936+
.oc--download-item {
937+
position: relative;
938+
display: flex;
939+
flex-direction: column;
940+
justify-content: start;
941+
align-items: stretch;
942+
padding: 5px 0px;
943+
944+
button.button {
945+
margin: 0px !important;
946+
}
947+
948+
.oc--download-btn-container {
949+
position: relative;
950+
display: flex;
951+
flex-direction: row;
952+
justify-content: space-between;
953+
align-items: center;
954+
width: 100%;
955+
956+
.oc--download-btn {
957+
flex-grow: 1;
958+
position: relative;
959+
}
960+
961+
.oc--download-cancel {
962+
margin-left: 5px;
963+
flex-shrink: 0;
964+
display: flex;
965+
justify-content: center;
966+
align-items: center;
967+
968+
&.active {
969+
cursor: pointer;
970+
}
971+
972+
&.inactive {
973+
cursor: default;
974+
}
975+
}
976+
}
977+
978+
.oc--download-info-container {
979+
display: flex;
980+
flex-direction: row;
981+
justify-content: start;
982+
align-items: center;
983+
.oc--download-info-status {
984+
flex: 1;
985+
margin-left: 5px;
986+
font-size: 0.8em;
987+
}
988+
}
989+
990+
.oc--download-spinner-container {
991+
z-index: 999;
992+
position: absolute;
993+
top: 50%;
994+
translate: 0 -50%;
995+
left: 2px;
996+
margin-right: 5px;
997+
flex-shrink: 0;
998+
display: flex;
999+
justify-content: center;
1000+
align-items: center;
1001+
width: 24px;
1002+
height: 24px;
1003+
1004+
.oc--spinner {
1005+
transform: scale(0.5);
1006+
}
1007+
.oc--spinner:after {
1008+
content: " ";
1009+
display: block;
1010+
width: 24px;
1011+
height: 24px;
1012+
border-radius: 50%;
1013+
border: 6px solid;
1014+
border-color: #28497c transparent #28497c transparent;
1015+
animation: oc-spinner 1.2s linear infinite;
1016+
}
1017+
@keyframes oc-spinner {
1018+
0% {
1019+
transform: rotate(0deg);
1020+
}
1021+
100% {
1022+
transform: rotate(360deg);
1023+
}
1024+
}
1025+
}
1026+
}
1027+
}
9141028

9151029
/* * * * * * * * * * * * * * * * * * */
9161030
/* U P L O A D E L E M E N T S */

vueapp/app.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ window.addEventListener("DOMContentLoaded", function() {
4545
}, function (error) {
4646
store.dispatch('axiosStop');
4747

48+
// This makes it possible to cancel requests, but we at the moment we don't want to handle it here.
49+
if (axios.isCancel(error)) {
50+
return Promise.reject(error);
51+
}
52+
4853
if (error.response.data !== undefined) {
4954
store.dispatch('addMessage', error.response);
5055
}

vueapp/components/ProgressBar.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
2-
<div class="oc--progress">
2+
<div class="oc--progress" :class="{'oc--minimal-progress': minimal === true}">
33
<div class="oc--progress-bar" :style="`width: ` + progress + `%`">
4-
<span>
4+
<span v-if="minimal !== true">
55
{{ progress }}%
66
</span>
77
</div>
@@ -12,6 +12,6 @@
1212
export default {
1313
name: 'ProgressBar',
1414
15-
props: ['progress']
15+
props: ['progress', 'minimal']
1616
}
1717
</script>

0 commit comments

Comments
 (0)