diff --git a/application/views/metadata_editor/fields/vue-field-date.js b/application/views/metadata_editor/fields/vue-field-date.js index e12c92bf..1315aa7a 100644 --- a/application/views/metadata_editor/fields/vue-field-date.js +++ b/application/views/metadata_editor/fields/vue-field-date.js @@ -8,6 +8,13 @@ Vue.component('editor-date-field', { } }, methods:{ + isFieldReadOnly() { + if (!this.$store.getters.getUserHasEditAccess) { + return true; + } + + return this.field.is_readonly; + }, momentDateISO(date) { return moment(date).toISOString(); }, @@ -60,12 +67,13 @@ Vue.component('editor-date-field', { prepend-inner-icon="mdi-calendar" :hint="'Date format: YYYY-MM-DD - ' + value" persistent-hint - :disabled="field.is_readonly" + :disabled="isFieldReadOnly" > diff --git a/application/views/metadata_editor/vue-external-resources-component.js b/application/views/metadata_editor/vue-external-resources-component.js index df095811..feba995c 100644 --- a/application/views/metadata_editor/vue-external-resources-component.js +++ b/application/views/metadata_editor/vue-external-resources-component.js @@ -36,6 +36,7 @@ const VueExternalResources = Vue.component('external-resources', { }) .catch(function(response){ vm.errors=response; + alert("Failed: " + vm.erorrMessageToText(response)); }); }, importResource:function(){ @@ -56,8 +57,20 @@ const VueExternalResources = Vue.component('external-resources', { }) .catch(function(response){ vm.errors=response; + alert("Failed: " + vm.erorrMessageToText(response)); }); }, + erorrMessageToText: function(error){ + let error_text = ''; + if (error.response.data.errors) { + for (let key in error.response.data.errors) { + error_text += error.response.data.errors[key] + '\n'; + } + } else { + error_text = error.response.data.message; + } + return error_text; + }, }, computed: { ExternalResources() @@ -69,7 +82,10 @@ const VueExternalResources = Vue.component('external-resources', { }, ProjectID(){ return this.$store.state.project_id; - } + }, + isProjectEditable(){ + return this.$store.getters.getUserHasEditAccess; + } }, template: `
diff --git a/application/views/metadata_editor/vue-external-resources-edit-component.js b/application/views/metadata_editor/vue-external-resources-edit-component.js index 3ebe58e4..2c7a453b 100644 --- a/application/views/metadata_editor/vue-external-resources-edit-component.js +++ b/application/views/metadata_editor/vue-external-resources-edit-component.js @@ -228,8 +228,10 @@ const VueExternalResourcesEdit= Vue.component('external-resources-edit', { } }, computed: { - ExternalResources() - { + isProjectEditable(){ + return this.$store.getters.getUserHasEditAccess; + }, + ExternalResources(){ return this.$store.state.external_resources; }, ActiveResourceIndex(){ @@ -239,18 +241,9 @@ const VueExternalResourcesEdit= Vue.component('external-resources-edit', { }, Resource(){ - //return this.ExternalResources[this.ActiveResourceIndex]; - return this.$store.state.external_resources.find(resource => { return resource.id == this.ActiveResourceIndex }); - - return this.$store.state.external_resources.forEach((resource, index) => { - if (resource.id==this.ActiveResourceIndex){ - console.log(":resource",resource, this.ActiveResourceIndex); - return this.ExternalResources[index]; - } - }); }, ResourceAttachmentType() { @@ -271,7 +264,6 @@ const VueExternalResourcesEdit= Vue.component('external-resources-edit', { template: `
- {{is_dirty}}
@@ -419,8 +411,7 @@ const VueExternalResourcesEdit= Vue.component('external-resources-edit', {
- - Save + Save Cancel diff --git a/application/views/metadata_editor/vue-form-input-component.js b/application/views/metadata_editor/vue-form-input-component.js index bb0aa946..2bd4aa0b 100644 --- a/application/views/metadata_editor/vue-form-input-component.js +++ b/application/views/metadata_editor/vue-form-input-component.js @@ -6,6 +6,13 @@ Vue.component("form-input", { }, mounted: function () {}, computed: { + isFieldReadOnly() { + if (!this.$store.getters.getUserHasEditAccess) { + return true; + } + + return this.field.is_readonly; + }, local: { get: function () { return this.value; @@ -139,7 +146,7 @@ Vue.component("form-input", { >
-
+
@@ -174,7 +181,7 @@ Vue.component("form-input", { {{field.help_text}} @@ -206,7 +213,7 @@ Vue.component("form-input", { {{field.enum_store_column}} - {{local}}
@@ -261,7 +268,7 @@ Vue.component("form-input", { dense clearable background-color="#FFFFFF" - :disabled="field.is_readonly" + :disabled="isFieldReadOnly" > {{local}}
diff --git a/application/views/metadata_editor/vue-summary-component.js b/application/views/metadata_editor/vue-summary-component.js index be37e8e6..b9c086db 100644 --- a/application/views/metadata_editor/vue-summary-component.js +++ b/application/views/metadata_editor/vue-summary-component.js @@ -18,6 +18,9 @@ Vue.component('summary-component', { this.getProjectDiskUsage(); }, computed: { + isProjectEditable(){ + return this.$store.getters.getUserHasEditAccess; + }, ProjectID(){ return this.$store.state.project_id; }, @@ -151,11 +154,11 @@ Vue.component('summary-component', {
mdi-alpha-t-box {{$t("template")}}
- mdi-checkbox-multiple-marked-circleDefaults + mdi-checkbox-multiple-marked-circleDefaults
- + {{ProjectTemplate.name}} - {{ProjectTemplate.version}}
diff --git a/application/views/metadata_editor/vue-table-grid-component.js b/application/views/metadata_editor/vue-table-grid-component.js index ed9f0381..4d022097 100644 --- a/application/views/metadata_editor/vue-table-grid-component.js +++ b/application/views/metadata_editor/vue-table-grid-component.js @@ -41,10 +41,15 @@ Vue.component('table-grid-component', { } return keys; }, - isReadOnly(){ + isFieldReadOnly() { + if (!this.$store.getters.getUserHasEditAccess) { + return true; + } + if (this.field && this.field.is_readonly){ return this.field.is_readonly; } + return false; } }, @@ -240,7 +245,7 @@ Vue.component('table-grid-component', { - +