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

Merge branch 'md/oai-flag' into 'master'

add OAI-PMH checkbox to collection view

See merge request certic/vue-jama!8
parents 544966d1 4b2ded1a
Loading
Loading
Loading
Loading
+20 −2
Original line number Diff line number Diff line
@@ -38,6 +38,13 @@
                {{ $t('collection.recursive-remove') }}
              </v-list-item-title>
            </v-list-item>
            <v-list-item>
              <v-checkbox v-model="is_oai_record" @change="toggleOAIRecord">
                <template v-slot:label>
                  <span class="caption" style="color:black">{{ $t('collection.is_oai') }}</span>
                </template>
              </v-checkbox>
            </v-list-item>
          </v-list>
        </v-menu>

@@ -144,6 +151,7 @@ export default {
  data() {
    return {
      published: this.collection.public_access,
      is_oai_record: this.collection.is_oai_record
    }
  },

@@ -193,6 +201,14 @@ export default {
      }
    },

    toggleOAIRecord(){
      if(this.is_oai_record){
        this.$jamaClient.setIsOaiRecord(true).then(() => console.log('collection is now an OAI-PMH record'))
      }else{
        this.$jamaClient.setIsOaiRecord(false).then(() => console.log('collection is no more an OAI-PMH record'))
      }
    },

    tagAdded(tag) {
      this.collection.tags.push(tag);
    },
@@ -216,7 +232,8 @@ export default {
    "collection": {
      "remove": "Delete collection",
      "recursive-remove": "Delete",
      "rename": "Rename collection"
      "rename": "Rename collection",
      "is_oai": "Collection is an OAI-PMH record"
    },
    "collections": "collections",
    "resources": "resources"
@@ -226,7 +243,8 @@ export default {
    "collection": {
      "remove": "Supprimer la collection",
      "recursive-remove": "Supprimer la collection",
      "rename": "Renommer la collection"
      "rename": "Renommer la collection",
      "is_oai": "La collection est un enregistrement OAI-PMH"
    },
    "collections": "collections",
    "resources": "ressources"
+41 −11
Original line number Diff line number Diff line
@@ -392,8 +392,6 @@ class JamaClient {
        } else return false
    }



    /**
     * Add access to the RPC API for the given user name with the given API key.
     * A new user will be created if none is available with given user name.
@@ -437,7 +435,7 @@ class JamaClient {
     *
     * @param {String} title
     * @param {BigInteger} parent_id
     * @returns {Any}
     * @returns {Object}
     */
    async addCollection(title, parent_id = null) {
        return this._rpc("add_collection", [title, parent_id]);
@@ -830,7 +828,7 @@ class JamaClient {
     * ```
     *
     * @param {BigInteger} collection_id
     * @returns {Any}
     * @returns {Object}
     */
    async collection(collection_id = null) {
        return this._rpc("collection", [collection_id]);
@@ -957,7 +955,7 @@ class JamaClient {
     * ```
     *
     * @param {BigInteger} metadata_id
     * @returns {Any}
     * @returns {Object}
     */
    async metadata(metadata_id) {
        return this._rpc("metadata", [metadata_id]);
@@ -1196,6 +1194,30 @@ class JamaClient {
    }


    /**
     * Replace a file by another using two existing resources.
     *
     * The two resources are expected to be of File type. Then the
     * following operations are performed:
     *
     * - metas from the "ExifTool" set are removed from the destination resource instance
     * - metas from the "ExifTool" set are transfered from the source resource instance to the destination resource instance
     * - the destination resource instance gets the file hash from the source resource instance
     * - the source resource instance is deleted
     * - the destination resource instance is saved
     *
     * Such that all title/metas/tags/collections of the destination resource instance are untouched,
     * excluding exif metas that are transfered from the source.
     *
     * @param {BigInteger} from_resource_id
     * @param {BigInteger} to_resource_id
     * @returns {Boolean}
     */
    async replaceFile(from_resource_id, to_resource_id) {
        return this._rpc("replace_file", [from_resource_id, to_resource_id]);
    }


    /**
     * Get a resource given its id.
     *
@@ -1215,7 +1237,7 @@ class JamaClient {
     * ```
     *
     * @param {BigInteger} resource_id
     * @returns {Any}
     * @returns {Object}
     */
    async resource(resource_id) {
        return this._rpc("resource", [resource_id]);
@@ -1259,6 +1281,19 @@ class JamaClient {
    }


    /**
     * Set/unset the collection as a OAI-PMH record. The creation date
     * will be used in OAI-PMH requests.
     *
     * @param {BigInteger} collection_id
     * @param {Boolean} is_oai_record
     * @returns {Boolean}
     */
    async setIsOaiRecord(collection_id, is_oai_record = true) {
        return this._rpc("set_is_oai_record", [collection_id, is_oai_record]);
    }


    /**
     * Choose a Resource that is the best representation of a collection.
     * Typical use case: set a miniature for a collection.
@@ -1428,11 +1463,6 @@ class JamaClient {
    async uploadInfos(sha256_hash) {
        return this._rpc("upload_infos", [sha256_hash]);
    }





}

export {JamaClient, upload_events}