Commit d4a468b4 authored by Jerome Chauveau's avatar Jerome Chauveau
Browse files

ui de sélection d'une destination de restauration (corbeille)

parent e2a2af5b
Loading
Loading
Loading
Loading
+36 −2
Original line number Diff line number Diff line
@@ -17,18 +17,36 @@
        {{new Date(Date.parse(item.deleted_at)).toLocaleString()}}
      </template>
      <template v-slot:item.actions="{ item }">
        <v-btn text @click="restore(item)">
        <v-btn text @click="restoringItem=item">
          <v-icon>mdi-restore</v-icon>
        </v-btn>
      </template>
    </v-data-table>

    <v-dialog v-model="restoreDialog" width="500">
      <v-card v-if="restoringItem">
        <v-card-title>{{restoreTitle}}</v-card-title>
          <collection-tree-select :root="restoringItem.object_type==='collection'" :ancestors="[]"/>
          <v-card-actions>
            <v-btn color="secondary" @click="restoringItem=null">Annuler</v-btn>
            <v-btn color="primary" @click="restore">Restaurer</v-btn>
          </v-card-actions>
      </v-card>
    </v-dialog>

  </v-container>
</template>

<script>


import CollectionTreeSelect from "./widgets/CollectionTreeSelect";
export default {
  name: "JamaTrash",

  components : {
    CollectionTreeSelect
  },
  beforeMount(){
    this.$jamaClient.recycleBin(this.$store.getters.currentProjectId).then((res) => {
      res.map((item) => item.uuid = item.object_type + item.id);
@@ -36,6 +54,19 @@ export default {
    })
  },

  computed : {
    restoreDialog(){
      return this.restoringItem !== null;
    },


    restoreTitle(){
      return 'Restaurer la '
          + (this.restoringItem.object_type === 'collection' ? 'collection ' : 'ressource ')
          + this.restoringItem.label +' dans : '
    },
  },

  data(){
    return {
      headers : [
@@ -56,11 +87,14 @@ export default {
          text: '',
        }
      ],
      items: []}
      items: [],
      restoringItem : null
    }
  },

  methods:{
    restore(item){

     this.$jamaAlert("Fonctionnalité à venir. L'élément " + item.label +" ne sera pas restauré.")
    }
  }
+0 −52
Original line number Diff line number Diff line
@@ -640,58 +640,6 @@ class JamaClient {
        return this._rpc("add_tag_to_resource", [tag_uid, resource_id]);
    }
    

    // /**
    //  * Performs a complex search using terms such as 'contains', 'is', 'does_not_contain'.
    //  *
    //  * Multiple conditions can be added.
    //  *
    //  * Example input:
    //  *
    //  * ```
    //  * [
    //  *     {"property": "title", "term": "contains", "value": "cherbourg"},
    //  *     {"meta": 123, "term": "is", "value": "35mm"},
    //  *     {"exclude_meta": 145},
    //  *     {"tags": ["PAINTINGS", "PHOTOS"]}
    //  *     {"exclude_tags": ["DRAWINGS"]}
    //  * ]
    //  * ```
    //  *
    //  * Example output:
    //  *
    //  * ```
    //  * {
    //  *     "collections": [],
    //  *     "resources": [
    //  *         {
    //  *         "id": 1,
    //  *         "title": "Cherbourg by night",
    //  *         "original_name": "cherbourg_by_night.jpg",
    //  *         "type": "image/jpeg",
    //  *         "hash": "0dd93a59aeaccfb6d35b1ff5a49bde1196aa90dfef02892f9aa2ef4087d8738e",
    //  *         "metas": null,
    //  *         "urls": [],
    //  *         "tags": [],
    //  *         }
    //  *     ]
    //  * }
    //  * ```
    //  *
    //  * @param {Array} search_terms
    //  * @param {BigInteger} project_id
    //  * @param {Boolean} include_metas
    //  * @param {BigInteger} collection_id
    //  * @param {BigInteger} limit_from
    //  * @param {BigInteger} limit_to
    //  * @param {String} order_by
    //  * @returns {Object}
    //  */
    // async advancedSearch(search_terms, project_id, include_metas = false, collection_id = null, limit_from = 0, limit_to = 2000, order_by = "title") {
    //     return this._rpc("advanced_search", [search_terms, project_id, include_metas, collection_id, limit_from, limit_to, order_by]);
    // }


    /**
     * Return terms conditions to be used in advanced search.
     *
+0 −1
Original line number Diff line number Diff line
export default class VuetifyUtils {

    static prepareTreeViewCollections(cols, ancestors) {
        console.log(ancestors);
        let prepared = [];
        let ancestorsIds = VuetifyUtils.prepareTreeViewAncestorsIds(ancestors)||[];
        for(let i = 0 ; i < cols.length; i++) {