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

advanced_search n'est plus appelé, tri obligatoire sur les colonnes des data-tables

parent cd3f95f0
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@
          :headers="headers"
          :options.sync="options"
          :items="items"
          must-sort
          class="elevation-0"
      >
        <template v-slot:item="{ item }">
@@ -97,6 +98,7 @@ export default {
      {
        value: 'icono',
        text: '',
        sortable: false,
      },
      {
        value: 'title',
+5 −1
Original line number Diff line number Diff line
@@ -6,7 +6,9 @@
    <v-data-table
        :headers="headers"
        :items="items"
        item-key="uuid"
        :items-per-page="50"
        must-sort
    >
      <template v-slot:item.object_type="{ item }">
        <v-icon>{{item.object_type === 'collection' ? 'mdi-folder' : 'mdi-file'}}</v-icon>
@@ -29,7 +31,9 @@ export default {

  beforeMount(){
    this.$jamaClient.recycleBin(this.$store.getters.currentProjectId).then((res) => {
      this.items = res})
      res.map((item) => item.uuid = item.object_type + item.id);
      this.items = res
    })
  },

  data(){
+8 −3
Original line number Diff line number Diff line
@@ -376,8 +376,14 @@ export default {
    currentProjectId() {
      if(!this.currentProjectId)
        return;
      this.$store.dispatch('fetchStats').then(() => this.loadCollectionById(this.$store.getters.currentRootCollectionId))
      this.tagClient.setProjectId(this.currentProjectId)
      this.$store.dispatch('fetchStats').then(() => {
        if(this.$store.getters.currentStats.project_root_collection_id) {
            this.$store.commit('setCurrentRootCollectionId', this.$store.getters.currentStats.project_root_collection_id);
            this.loadCollectionById(this.$store.getters.currentRootCollectionId);
          }
        }
      )
      this.tagClient.setProjectId(this.currentProjectId);
    }
  },

@@ -457,7 +463,6 @@ export default {


    setProject(projectId) {
      console.log('set project id =>', projectId)
      this.$store.commit('setCurrentProjectId', projectId);
    },

+1 −1
Original line number Diff line number Diff line
@@ -181,7 +181,7 @@ export default {
      for (let i = 0; i < this.searchFilters.length; i++) {
        query.push(this.simplifyFilter(this.searchFilters[i]))
      }
      this.$jamaClient.advancedSearch(query, this.currentProjectId).then((response) => {
      this.$jamaClient.projectItems(query, this.currentProjectId).then((response) => {
        this.foundResources = response.resources;
        this.foundCollections = response.collections;
        this.loading = false;
+49 −49
Original line number Diff line number Diff line
@@ -641,55 +641,55 @@ class JamaClient {
    }


    /**
     * 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]);
    }
    // /**
    //  * 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]);
    // }


    /**