Display encode and transcript status (#23919)
* Have separate column for transcript and encode status * Display error message sent from VEM PROD-1432
This commit is contained in:
@@ -248,7 +248,8 @@ class VideosHandlerTestCase(VideoUploadTestMixin, CourseTestCase):
|
||||
'status',
|
||||
'course_video_image_url',
|
||||
'transcripts',
|
||||
'transcription_status'
|
||||
'transcription_status',
|
||||
'error_description'
|
||||
])
|
||||
)
|
||||
dateutil.parser.parse(response_video['created'])
|
||||
@@ -264,6 +265,7 @@ class VideosHandlerTestCase(VideoUploadTestMixin, CourseTestCase):
|
||||
[
|
||||
'edx_video_id', 'client_video_id', 'created', 'duration',
|
||||
'status', 'course_video_image_url', 'transcripts', 'transcription_status',
|
||||
'error_description'
|
||||
],
|
||||
[
|
||||
{
|
||||
@@ -280,6 +282,7 @@ class VideosHandlerTestCase(VideoUploadTestMixin, CourseTestCase):
|
||||
[
|
||||
'edx_video_id', 'client_video_id', 'created', 'duration',
|
||||
'status', 'course_video_image_url', 'transcripts', 'transcription_status',
|
||||
'error_description'
|
||||
],
|
||||
[
|
||||
{
|
||||
@@ -721,25 +724,19 @@ class VideosHandlerTestCase(VideoUploadTestMixin, CourseTestCase):
|
||||
status = convert_video_status(video)
|
||||
self.assertEqual(status, StatusDisplayStrings.get('youtube_duplicate'))
|
||||
|
||||
# `transcript_ready` should be converted to `file_complete`
|
||||
video['status'] = 'transcript_ready'
|
||||
status = convert_video_status(video)
|
||||
self.assertEqual(status, StatusDisplayStrings.get('file_complete'))
|
||||
|
||||
# The encode status should be converted to `file_complete` if video encodes are complete
|
||||
# The "encode status" should be converted to `file_complete` if video encodes are complete
|
||||
video['status'] = 'transcription_in_progress'
|
||||
status = convert_video_status(video, is_video_encodes_ready=True)
|
||||
self.assertEqual(status, StatusDisplayStrings.get('file_complete'))
|
||||
|
||||
# The encode status should be converted to `file_complete` if video encodes are complete
|
||||
video['status'] = 'partial_failure'
|
||||
status = convert_video_status(video, is_video_encodes_ready=True)
|
||||
self.assertEqual(status, StatusDisplayStrings.get('file_complete'))
|
||||
# If encoding is not complete return the status as it is
|
||||
video['status'] = 's3_upload_failed'
|
||||
status = convert_video_status(video)
|
||||
self.assertEqual(status, StatusDisplayStrings.get('s3_upload_failed'))
|
||||
|
||||
# for all other status, there should not be any conversion
|
||||
statuses = list(StatusDisplayStrings._STATUS_MAP.keys()) # pylint: disable=protected-access
|
||||
statuses.remove('invalid_token')
|
||||
statuses.remove('transcript_ready')
|
||||
for status in statuses:
|
||||
video['status'] = status
|
||||
new_status = convert_video_status(video)
|
||||
|
||||
@@ -531,7 +531,7 @@ def convert_video_status(video, is_video_encodes_ready=False):
|
||||
])
|
||||
elif video['status'] == 'invalid_token':
|
||||
status = StatusDisplayStrings.get('youtube_duplicate')
|
||||
elif is_video_encodes_ready or video['status'] == 'transcript_ready':
|
||||
elif is_video_encodes_ready:
|
||||
status = StatusDisplayStrings.get('file_complete')
|
||||
else:
|
||||
status = StatusDisplayStrings.get(video['status'])
|
||||
@@ -553,26 +553,19 @@ def _get_videos(course, pagination_conf=None):
|
||||
|
||||
# This is required to see if edx video pipeline is enabled while converting the video status.
|
||||
course_video_upload_token = course.video_upload_pipeline.get('course_video_upload_token')
|
||||
# TODO: add 'transcript_ready' when we have moved to VEM to keep transcript and encode status separate
|
||||
transcription_statuses = ['partial_failure', 'transcription_in_progress']
|
||||
transcription_statuses = ['transcription_in_progress', 'transcript_ready', 'partial_failure', 'transcript_failed']
|
||||
|
||||
# convert VAL's status to studio's Video Upload feature status.
|
||||
for video in videos:
|
||||
# If we are using "new video workflow" and status is `transcription_in_progress` then video encodes are ready.
|
||||
# If we are using "new video workflow" and status is in `transcription_statuses` then video encodes are ready.
|
||||
# This is because Transcription starts once all the encodes are complete except for YT, but according to
|
||||
# "new video workflow" YT is disabled as well as deprecated. So, Its precise to say that the Transcription
|
||||
# starts once all the encodings are complete *for the new video workflow*.
|
||||
# If the video status is 'partial_failure', it means during the transcription flow, some transcription jobs
|
||||
# failed. As mentioned, transcript jobs start only when the encodes have finished
|
||||
is_video_encodes_ready = not course_video_upload_token and (video['status'] in transcription_statuses)
|
||||
# Update with transcript languages
|
||||
video['transcripts'] = get_available_transcript_languages(video_id=video['edx_video_id'])
|
||||
# Transcription status should only be visible if 3rd party transcripts are pending.
|
||||
# TODO: change logic to separate transcript status from video status
|
||||
video['transcription_status'] = (
|
||||
StatusDisplayStrings.get(video['status'])
|
||||
if not video['transcripts'] and is_video_encodes_ready else
|
||||
''
|
||||
StatusDisplayStrings.get(video['status']) if is_video_encodes_ready else ''
|
||||
)
|
||||
# Convert the video status.
|
||||
video['status'] = convert_video_status(video, is_video_encodes_ready)
|
||||
@@ -595,6 +588,7 @@ def _get_index_videos(course, pagination_conf=None):
|
||||
attrs = [
|
||||
'edx_video_id', 'client_video_id', 'created', 'duration',
|
||||
'status', 'courses', 'transcripts', 'transcription_status',
|
||||
'error_description'
|
||||
]
|
||||
|
||||
def _get_values(video):
|
||||
|
||||
@@ -58,7 +58,7 @@ define(
|
||||
it('should render status correctly', function() {
|
||||
var testStatus = 'Test Status';
|
||||
var $el = render({status: testStatus});
|
||||
expect($el.find('.status-col').text()).toEqual(testStatus);
|
||||
expect($el.find('.video-status').text()).toEqual(testStatus);
|
||||
});
|
||||
|
||||
it('should render remove button correctly', function() {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
define(
|
||||
['underscore', 'gettext', 'js/utils/date_utils', 'js/views/baseview', 'common/js/components/views/feedback_prompt',
|
||||
'common/js/components/views/feedback_notification', 'js/views/video_thumbnail', 'js/views/video_transcripts',
|
||||
'common/js/components/utils/view_utils', 'edx-ui-toolkit/js/utils/html-utils',
|
||||
'js/views/video_status', 'common/js/components/utils/view_utils', 'edx-ui-toolkit/js/utils/html-utils',
|
||||
'text!templates/previous-video-upload.underscore'],
|
||||
function(_, gettext, DateUtils, BaseView, PromptView, NotificationView, VideoThumbnailView, VideoTranscriptsView,
|
||||
ViewUtils, HtmlUtils, previousVideoUploadTemplate) {
|
||||
VideoStatusView, ViewUtils, HtmlUtils, previousVideoUploadTemplate) {
|
||||
'use strict';
|
||||
|
||||
var PreviousVideoUploadView = BaseView.extend({
|
||||
@@ -34,10 +34,17 @@ define(
|
||||
edxVideoID: this.model.get('edx_video_id'),
|
||||
clientVideoID: this.model.get('client_video_id'),
|
||||
transcriptionStatus: this.model.get('transcription_status'),
|
||||
errorDescription: this.model.get('error_description'),
|
||||
transcriptAvailableLanguages: options.transcriptAvailableLanguages,
|
||||
videoSupportedFileFormats: options.videoSupportedFileFormats,
|
||||
videoTranscriptSettings: options.videoTranscriptSettings
|
||||
});
|
||||
|
||||
this.VideoStatusView = new VideoStatusView({
|
||||
status: this.model.get('status'),
|
||||
showError: !this.model.get('transcription_status'),
|
||||
errorDescription: this.model.get('error_description')
|
||||
});
|
||||
},
|
||||
|
||||
render: function() {
|
||||
@@ -57,6 +64,7 @@ define(
|
||||
this.videoThumbnailView.setElement(this.$('.thumbnail-col')).render();
|
||||
}
|
||||
this.videoTranscriptsView.setElement(this.$('.transcripts-col')).render();
|
||||
this.VideoStatusView.setElement(this.$('.status-col')).render();
|
||||
return this;
|
||||
},
|
||||
|
||||
|
||||
37
cms/static/js/views/video_status.js
Normal file
37
cms/static/js/views/video_status.js
Normal file
@@ -0,0 +1,37 @@
|
||||
define(
|
||||
[
|
||||
'js/views/baseview', 'edx-ui-toolkit/js/utils/html-utils', 'text!templates/video-status.underscore'
|
||||
],
|
||||
function(BaseView, HtmlUtils, videoStatusTemplate) {
|
||||
'use strict';
|
||||
|
||||
var VideoStatusView = BaseView.extend({
|
||||
tagName: 'div',
|
||||
|
||||
initialize: function(options) {
|
||||
this.status = options.status;
|
||||
this.showError = options.showError;
|
||||
this.errorDescription = options.errorDescription;
|
||||
this.template = HtmlUtils.template(videoStatusTemplate);
|
||||
},
|
||||
|
||||
/*
|
||||
Renders status view.
|
||||
*/
|
||||
render: function() {
|
||||
HtmlUtils.setHtml(
|
||||
this.$el,
|
||||
this.template({
|
||||
status: this.status,
|
||||
show_error: this.showError,
|
||||
error_description: this.errorDescription
|
||||
})
|
||||
);
|
||||
|
||||
return this;
|
||||
}
|
||||
});
|
||||
|
||||
return VideoStatusView;
|
||||
}
|
||||
);
|
||||
@@ -23,6 +23,7 @@ define(
|
||||
this.edxVideoID = options.edxVideoID;
|
||||
this.clientVideoID = options.clientVideoID;
|
||||
this.transcriptionStatus = options.transcriptionStatus;
|
||||
this.errorDescription = options.errorDescription;
|
||||
this.transcriptAvailableLanguages = options.transcriptAvailableLanguages;
|
||||
this.videoSupportedFileFormats = options.videoSupportedFileFormats;
|
||||
this.videoTranscriptSettings = options.videoTranscriptSettings;
|
||||
@@ -338,6 +339,7 @@ define(
|
||||
this.$el,
|
||||
this.template({
|
||||
transcripts: this.transcripts,
|
||||
error_description: this.errorDescription,
|
||||
transcription_status: this.transcriptionStatus,
|
||||
transcriptAvailableLanguages: this.transcriptAvailableLanguages,
|
||||
edxVideoID: this.edxVideoID,
|
||||
|
||||
@@ -87,7 +87,7 @@
|
||||
@extend %t-strong;
|
||||
}
|
||||
|
||||
.status-col {
|
||||
.video-status {
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,10 @@
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.message-error {
|
||||
color: $red;
|
||||
}
|
||||
|
||||
.video-transcripts-wrapper {
|
||||
display: block;
|
||||
|
||||
@@ -486,7 +490,7 @@
|
||||
}
|
||||
|
||||
.name-col {
|
||||
width: 25%;
|
||||
width: 23%;
|
||||
}
|
||||
|
||||
.transcripts-col {
|
||||
@@ -500,7 +504,7 @@
|
||||
|
||||
.date-col,
|
||||
.status-col {
|
||||
width: 10%;
|
||||
width: 15%;
|
||||
}
|
||||
|
||||
.actions-col {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<div class="video-col date-col"><%- created %></div>
|
||||
<div class="video-col video-id-col"><%- edx_video_id %></div>
|
||||
<div class="video-col transcripts-col"></div>
|
||||
<div class="video-col status-col"><%- status %></div>
|
||||
<div class="video-col status-col"></div>
|
||||
<div class="video-col actions-col">
|
||||
<ul class="actions-list">
|
||||
<li class="action-item action-remove">
|
||||
|
||||
5
cms/templates/js/video-status.underscore
Normal file
5
cms/templates/js/video-status.underscore
Normal file
@@ -0,0 +1,5 @@
|
||||
<span class='video-status'><%- status %></span>
|
||||
<% if (show_error && error_description) { %>
|
||||
</br>
|
||||
<span class='message-error'><%- error_description %></span>
|
||||
<% }%>
|
||||
@@ -1,4 +1,14 @@
|
||||
<div class='video-transcripts-header'>
|
||||
<% if (transcription_status) { %>
|
||||
<span class='transcripts-empty-text'><%- transcription_status %></span>
|
||||
<% if (error_description) { %>
|
||||
</br>
|
||||
<span class='message-error'><%- error_description %></span>
|
||||
<% }%>
|
||||
<% } else { %>
|
||||
<span class='transcripts-empty-text'><%- gettext('No transcript uploaded.') %></span>
|
||||
<% }%>
|
||||
</br>
|
||||
<% if (transcripts.length) { %>
|
||||
<button class="button-link toggle-show-transcripts-button">
|
||||
<strong>
|
||||
@@ -8,10 +18,6 @@
|
||||
</span>
|
||||
</strong>
|
||||
</button>
|
||||
<% } else if (transcription_status) { %>
|
||||
<span class='transcripts-empty-text'><%- transcription_status %></span>
|
||||
<% } else { %>
|
||||
<span class='transcripts-empty-text'><%- gettext('No transcript uploaded.') %></span>
|
||||
<% }%>
|
||||
<div class='video-transcripts-wrapper'>
|
||||
<% _.each(transcripts, function(transcriptLanguageCode){ %>
|
||||
|
||||
Reference in New Issue
Block a user