6
0
Эх сурвалжийг харах

fixed the ways copying from previous file works

Dimitri Korsch 3 жил өмнө
parent
commit
d7e7d70d77

+ 11 - 7
webui/src/components/media/paginated-media.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="paginated-media">
     <div class="media" ref="media">
-      <div v-for="(image, i) in images"
+      <div v-for="image in images"
            v-bind:key="image.path"
            class="image"
            @click="$emit('click', image)">
@@ -18,7 +18,9 @@
           <img alt="annotated" src="@/assets/icons/tag.svg">
         </div>
 
-        <div title="Copy results from previous file" v-if="inline && i != 0" class="media-control copy" @click="copyFrom(i, image)">
+        <div title="Copy results from previous file"
+             v-if="inline && elements.previous && elements.previous.has_annotations && current && current.identifier == image.identifier" class="media-control copy"
+             @click="copyFromPrev2Current">
           <img alt="copy" src="@/assets/icons/paper-airplane.svg">
         </div>
 
@@ -128,11 +130,13 @@ export default {
     deleteElement: function (element) {
       this.$root.socket.post(`/data/${element.identifier}/remove`, {remove: true});
     },
-    copyFrom: function (fromIdx, element) {
-      if (fromIdx === undefined || fromIdx === 0)
-        return;
-      let copy_from = this.images[fromIdx-1].identifier;
-      this.$root.socket.post(`/data/${element.identifier}/copy_results`, {copy_from});
+    copyFromPrev2Current: function () {
+      if (!this.elements.previous  || !this.current)
+        return
+
+      let copy_from = this.elements.previous.identifier;
+      let copy_to = this.current.identifier;
+      this.$root.socket.post(`/data/${copy_to}/copy_results`, {copy_from});
     },
     prevPage: function (callback) {
       if (this.page > 1)