Commit 69a474ea authored by Jerome Chauveau's avatar Jerome Chauveau
Browse files

Treeview : pas de chargement de collection sur expand d'un noeud + tests de...

Treeview : pas de chargement de collection sur expand d'un noeud + tests de simplification de synchro
parent 26a5709e
Loading
Loading
Loading
Loading
+20 −5
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@
    </v-toolbar>

    <v-treeview
        ref="collectionTreeView"
        dense
        :items="collectionsTree"
        :load-children="collectionClicked"
@@ -59,9 +60,21 @@ export default {
  watch: {

    currentCollection(){
        //console.log(this.openNodes);
        // if(this.active.length === 0 || this.active[0].id !== this.currentCollection.id){
        //   let a = this.$store.getters.collectionsTreeNodeById(this.currentCollection.id);
        //   this.active = [a];
        //   this.openNodes = this.openNodes.concat([a]).map((e)=>this.$store.getters.collectionsTreeNodeById(e.id));
        //
        //   console.log(this.active);
        // }
        if (this.highlightedNode && this.highlightedNode.id !== this.currentCollection.id) {
          document.querySelectorAll('.v-treeview-node--active')
              .forEach((elt) => elt.classList.remove('v-treeview-node--active'))//desactive current active

        }


          /*if (this.currentCollection.id === this.currentRootCollectionId) {//home clicked
            this.highlightedNode = null;
            document.querySelectorAll('.v-treeview-node--active')
@@ -79,7 +92,7 @@ export default {
            catch (e) {
            }
          }*/
        }
     //   }

    }
  },
@@ -90,7 +103,7 @@ export default {
      //   return;
      // }
      await this.fetchCollectionTree(c.id);
      this.$emit('tree-collection-selected', c.id);
      //this.$emit('tree-collection-selected', c.id);
    },

    async activeItemChanged(values) {
@@ -98,15 +111,17 @@ export default {
        this.highlightedNode = values[0];
        this.$emit('tree-collection-selected', values[0].id)
      }
      else{
        console.log("VALUES != 1", values.length, 'inactive!')
      }
    },

    loadHome() {
      this.$emit('tree-collection-selected', this.currentRootCollectionId);
    },

    onOpen(items) {
      this.openIds = items;
      console.log(this.openIds)
    },

    ...mapActions(["fetchCollectionTree", "fetchCollections"])

  }
+4 −1
Original line number Diff line number Diff line
@@ -98,7 +98,10 @@ export default new Vuex.Store({
        sortOptions: state => state.sortOptions,
        currentStats: state => state.currentStats,
        filter: state => state.filter,
        multiSelectActionAddons: state => state.multiSelectActionAddons
        multiSelectActionAddons: state => state.multiSelectActionAddons,
        // collectionsTreeNodeById: (state) => (id) => {
        //     return findItem(id,state.collectionsTree)
        // }
    },
    mutations: {