Commit 61e91f95 authored by Jerome Chauveau's avatar Jerome Chauveau
Browse files

vignette temporaire d'image pendant post traitement.

parent d02fda3d
Loading
Loading
Loading
Loading
+29 −3
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@
        @click="select()"
      >
        <v-img
          v-if="isImageResourceTile()"
          v-if="isImageResourceTile() && iconLoaded"
          height="120"
          :src="resource.urls.m"
        />
@@ -67,7 +67,8 @@ export default {

  data() {
    return {
      titleLimit: 25
      titleLimit: 25,
      iconLoaded : true,
    }
  },

@@ -97,6 +98,14 @@ export default {
    ...mapGetters(["isPickerMode", "currentResource"])
  },


  beforeMount() {
    if(this.isImageResourceTile()){
      this.iconLoaded = false;
      this.fetchTileImage();
    }
  },

  methods: {
    select() {
      this.$emit('resource-selected', this.resource)
@@ -127,8 +136,25 @@ export default {
        id: this.resource.id,
        title: this.resource.title,
        type: 'resource'}));
    },

    async fetchTileImage(){
      let maxTrials = 10;
      const sleep = (ms) => new Promise((r) => setTimeout(r, ms));//test
      for(let trials = 0; trials < maxTrials; trials++){
        console.info('try to fetch img, trial ' + trials);
        let r = await fetch(this.resource.urls.m);
        if(r.ok) {
          this.iconLoaded = true;
          return;
        }
        else
          await(sleep(2000));
      }

      this.iconLoaded = false;

    },

  }
}
+0 −1
Original line number Diff line number Diff line
@@ -766,7 +766,6 @@ export default {

    reloadCurrentCollection() {
      this.$store.commit('emptyResources');
      console.log("mptified");
      this.loadCollectionById(this.currentCollection.id);
    },