diff --git a/src/components/modals/SetFramesFromTaskTypePreviewsModal.vue b/src/components/modals/SetFramesFromTaskTypePreviewsModal.vue new file mode 100644 index 0000000000..3755884d65 --- /dev/null +++ b/src/components/modals/SetFramesFromTaskTypePreviewsModal.vue @@ -0,0 +1,119 @@ + + + + + diff --git a/src/components/pages/Shots.vue b/src/components/pages/Shots.vue index b090b848eb..73925436d6 100644 --- a/src/components/pages/Shots.vue +++ b/src/components/pages/Shots.vue @@ -45,6 +45,13 @@ icon="import-files" @click="showAddThumbnailsModal" /> + + + { this.loading.importing = false }) + }, + + async confirmSetFrames(taskTypeId) { + this.loading.getFrames = true + try { + await this.setNbFramesFromTaskTypePreviews({ + taskTypeId, + productionId: this.currentProduction.id, + episodeId: this.currentEpisode ? this.currentEpisode.id : null + }) + this.modals.isSetFramesDisplayed = false + } catch (err) { + console.error(err) + this.errors.getFrames = true + } finally { + this.loading.getFrames = false + } } }, diff --git a/src/components/widgets/ComboboxTaskType.vue b/src/components/widgets/ComboboxTaskType.vue index d616d6a9e4..e06efdb87d 100644 --- a/src/components/widgets/ComboboxTaskType.vue +++ b/src/components/widgets/ComboboxTaskType.vue @@ -80,6 +80,12 @@ export default { default: false, type: Boolean }, + placeholder: { + default: function () { + return this.$t('task_types.add_task_type_placeholder') + }, + type: String + }, openTop: { default: false, type: Boolean @@ -95,7 +101,7 @@ export default { if (this.value) { return this.taskTypeMap.get(this.value) } else if (this.addPlaceholder) { - return { name: '+ Task Type', color: '#E5E5E5', id: '' } + return { name: this.placeholder, color: '#E5E5E5', id: '' } } else { return this.taskTypeList[0] } diff --git a/src/locales/en.js b/src/locales/en.js index 2074d47aea..5ca262d9b9 100644 --- a/src/locales/en.js +++ b/src/locales/en.js @@ -1232,6 +1232,7 @@ export default { }, task_types: { + add_task_type_placeholder: '+ Task type', delete_text: 'Are you sure you want to remove {name} from your database?', delete_error: 'An error occurred while deleting this task type. There are probably data linked to it. Are you sure this task type has no task linked to it?', edit_title: 'Edit task type', @@ -1239,6 +1240,7 @@ export default { new_task_type: 'Add a task type', no_task_types: 'There is no task type for this entity type', number: 'task type | task types', + select_task_type: 'Select a task type...', title: 'Task Types', fields: { dedicated_to: 'For', @@ -1366,6 +1368,9 @@ export default { empty_list: 'There is no shot in the production. What about creating some?', empty_list_client: 'There is no shot in this production.', episodes: 'Episodes', + get_frames_from_previews: 'Set frame numbers from previews', + get_frames_from_previews_description: 'Select a task type to extract the frame numbers from the latest published movie previews.', + get_frames_from_previews_error: 'There was an error while extracting the frame numbers from the task type previews. Please contact our support team.', history: 'Shot values history', multiple_delete_error: 'An error occurred while deleting a shot. There is probably some data linked to a shot. Are you sure there is no task linked to a selected shot?', new_shot: 'Add a shot', diff --git a/src/store/api/shots.js b/src/store/api/shots.js index 8f04be7d47..0835dad0c1 100644 --- a/src/store/api/shots.js +++ b/src/store/api/shots.js @@ -191,5 +191,13 @@ export default { `/api/data/projects/${productionId}/quotas/` + `${taskTypeId}?detail=${detailLevel}&weighted=${weighted}` ) + }, + + setNbFramesFromTaskTypePreviews(taskTypeId, productionId, episodeId) { + let path = + `/api/actions/projects/${productionId}/task-types/` + + `${taskTypeId}/set-shot-nb-frames` + if (episodeId) path += `?episode_id=${episodeId}` + return client.ppost(path) } } diff --git a/src/store/modules/shots.js b/src/store/modules/shots.js index 46e0ad7fb8..389bdbb8e9 100644 --- a/src/store/modules/shots.js +++ b/src/store/modules/shots.js @@ -759,6 +759,21 @@ const actions = { } ) }) + }, + + async setNbFramesFromTaskTypePreviews( + { commit, rootGetters }, + { taskTypeId, productionId, episodeId } + ) { + const shotNbFrames = await shotsApi.setNbFramesFromTaskTypePreviews( + taskTypeId, + productionId, + episodeId + ) + shotNbFrames.forEach(shot => { + commit(UPDATE_SHOT, shot) + }) + return shotNbFrames } }