diff --git a/src/components/Element/Classifications/Classification.vue b/src/components/Element/Classifications/Classification.vue index 99b40825d8808c20f91a32a3b93feec9a223d002..4304db94c22752df5a3b7f71f43f0fe690749ead 100644 --- a/src/components/Element/Classifications/Classification.vue +++ b/src/components/Element/Classifications/Classification.vue @@ -20,7 +20,7 @@ <span :disabled="disabled || loading || null" class="tag button" - :class="{ 'is-loading': loading, 'is-danger': rejected, 'icon-trash has-text-danger': !classification.worker_version, 'is-delete': classification.worker_version }" + :class="{ 'is-loading': loading, 'is-danger': rejected, 'icon-trash has-text-danger': isManual, 'is-delete': !isManual }" v-on:click="reject" ></span> </div> @@ -76,6 +76,9 @@ export default { }, rejected () { return this.classification.state === CLASSIFICATION_STATES.rejected + }, + isManual () { + return !this.classification.worker_version || !this.classification.worker_run } }, methods: { diff --git a/src/components/Element/DetailsPanel.vue b/src/components/Element/DetailsPanel.vue index b00a7099b15578f0c59516df7862838cd2bc14ad..612d5dc1a3299b2de879edcd828fcda67cee4e43 100644 --- a/src/components/Element/DetailsPanel.vue +++ b/src/components/Element/DetailsPanel.vue @@ -145,7 +145,7 @@ export default { return this.selectedNewClassification && this.element && this.element.classifications && - this.element.classifications.find(c => (c.ml_class.id === this.selectedNewClassification && !c.worker_version)) + this.element.classifications.find(c => (c.ml_class.id === this.selectedNewClassification && !c.worker_version && !c.worker_run)) }, canCreateClassification () { return this.element && this.selectedNewClassification && !this.manualClassificationExists && !this.isSavingNewClassification diff --git a/src/components/Element/Transcription/Actions.vue b/src/components/Element/Transcription/Actions.vue index 741caaf45c41a89e51c22571d0a649a96fc69aeb..9a312b9f8ad2b912f1628baeb6395a74f8a61147 100644 --- a/src/components/Element/Transcription/Actions.vue +++ b/src/components/Element/Transcription/Actions.vue @@ -3,7 +3,7 @@ <ConfidenceTag :value="transcription.confidence" v-if="Number.isFinite(transcription.confidence)" /> <div class="tags has-addons mb-0"> <span - v-if="transcription.worker_version_id" + v-if="transcription.worker_version_id || transcription.worker_run" class="tag button px-1 icon-copy has-text-primary" :class="{ 'is-loading': loading }" :disabled="!canCopy || loading || null" @@ -88,7 +88,7 @@ export default { }, canEdit () { // Only allow editing a transcription without a worker version on a writable corpus - if (!this.corpus || !this.canWrite(this.corpus) || this.transcription.worker_version_id) return false + if (!this.corpus || !this.canWrite(this.corpus) || this.transcription.worker_version_id || this.transcription.worker_run) return false /* * Only allow transcriptions without entities. * We do not call the entity list actions here as this is already done in DetailsPanel and doing so here @@ -106,7 +106,10 @@ export default { * and worker transcriptions on corpora with admin access */ canDelete () { - return this.corpus && this.canWrite(this.corpus) && (!this.transcription.worker_version_id || this.canAdmin(this.corpus)) + return this.corpus && this.canWrite(this.corpus) && ( + (!this.transcription.worker_version_id && !this.transcription.worker_run) || + this.canAdmin(this.corpus) + ) } }, methods: { @@ -122,8 +125,8 @@ export default { this.notify({ type: 'error', text: 'A write right on the project is required to delete a transcription' }) return } - if (this.transcription.worker_version_id && !this.canAdmin(this.corpus)) { - this.notify({ type: 'error', text: 'An admin right on the project is required to delete a transcription with a worker version' }) + if ((this.transcription.worker_version_id || this.transcription.worker_run) && !this.canAdmin(this.corpus)) { + this.notify({ type: 'error', text: 'An admin right on the project is required to delete a transcription with a worker version or worker run' }) return } try { diff --git a/src/components/Element/Transcription/EditionForm.vue b/src/components/Element/Transcription/EditionForm.vue index 26233a6634c0f0df220d10273e9ed68b76f41ffc..d08faab376d17a518f2943075fe73a1aa1ad1db4 100644 --- a/src/components/Element/Transcription/EditionForm.vue +++ b/src/components/Element/Transcription/EditionForm.vue @@ -95,8 +95,8 @@ export default { transcription: { type: Object, required: true, - // Cannot edit a transcription with a worker version - validator: transcription => transcription?.text && transcription?.orientation && !transcription.worker_version_id + // Cannot edit a transcription with a worker version or worker run + validator: transcription => transcription?.text && transcription?.orientation && !transcription.worker_version_id && !transcription.worker_run } }, data: () => ({ diff --git a/src/components/MLClassSelect.vue b/src/components/MLClassSelect.vue index ca4c87624b326f097b47532dba6feb00b730146c..b7d781be2a69ae20b0a78c3e24078da72c1cc95b 100644 --- a/src/components/MLClassSelect.vue +++ b/src/components/MLClassSelect.vue @@ -48,7 +48,7 @@ export default { * Remove from the suggested ML classes any class already used in a manual classification * to prevent duplicate classification creation. */ - const manualCls = this.classifications.filter(cls => !cls.worker_version).map(cls => cls.ml_class.id || cls.ml_class) + const manualCls = this.classifications.filter(cls => !cls.worker_version && !cls.worker_run).map(cls => cls.ml_class.id || cls.ml_class) if (manualCls) results = results.filter(m => !manualCls.includes(m.id)) } // Process ML classes to turn them into { id: display_name } suggestions