- bug fixes Testphase Januar 2020
This commit is contained in:
parent
d323e1d4bb
commit
a773fe2a1d
29 changed files with 1238 additions and 496 deletions
|
@ -1,7 +1,16 @@
|
|||
import { Component, Vue, Watch } from 'vue-property-decorator';
|
||||
import datetime from 'vuejs-datetimepicker';
|
||||
import messagesEN from './strings/messages/en.js';
|
||||
import VeeValidate from 'vee-validate';
|
||||
Vue.use(VeeValidate);
|
||||
// Vue.use(VeeValidate);
|
||||
Vue.use(VeeValidate, {
|
||||
// validity: true
|
||||
locale: 'en',
|
||||
useConstraintAttrs: true,
|
||||
dictionary: {
|
||||
en: { messages: messagesEN }
|
||||
}
|
||||
});
|
||||
import LocationsMap from './components/locations-map.vue';
|
||||
import Dataset from './components/Dataset';
|
||||
import PersonTable from './components/PersonTable.vue';
|
||||
|
@ -30,7 +39,7 @@ export default class EditDataset extends Vue {
|
|||
// language: '',
|
||||
// type: '',
|
||||
// project_id: '',
|
||||
// creating_corporation: 'TETHYS Repository',
|
||||
// creating_corporation: 'TETHYS RDR',
|
||||
// embargo_date: '',
|
||||
// coverage: {
|
||||
// xmin: "",
|
||||
|
@ -67,10 +76,37 @@ export default class EditDataset extends Vue {
|
|||
|
||||
get remainingTitleTypes() {
|
||||
// this.titleTypes.filter(e => e != 'Main');
|
||||
var filtered = Object.fromEntries(Object.entries(this.titleTypes).filter(([k,v]) => v != 'Main'));
|
||||
var filtered = Object.fromEntries(Object.entries(this.titleTypes).filter(([k, v]) => v != 'Main'));
|
||||
return filtered;
|
||||
}
|
||||
|
||||
get keywords_length() {
|
||||
return this.form.subjects.length;
|
||||
}
|
||||
|
||||
get files_length() {
|
||||
return this.form.files.length;
|
||||
}
|
||||
|
||||
get isElevationAbsolut() {
|
||||
return this.elevation == "absolut";
|
||||
}
|
||||
get isElevationRange() {
|
||||
return this.elevation == "range";
|
||||
}
|
||||
get isDepthAbsolut() {
|
||||
return this.depth == "absolut";
|
||||
}
|
||||
get isDepthRange() {
|
||||
return this.depth == "range";
|
||||
}
|
||||
get isTimeAbsolut() {
|
||||
return this.time == "absolut";
|
||||
}
|
||||
get isTimeRange() {
|
||||
return this.time == "range";
|
||||
}
|
||||
|
||||
beforeMount() {
|
||||
// this.form = window.Laravel.form;
|
||||
this.realMerge(this.form, window.Laravel.form);
|
||||
|
@ -83,12 +119,12 @@ export default class EditDataset extends Vue {
|
|||
this.referenceTypes = window.Laravel.referenceTypes;
|
||||
this.relationTypes = window.Laravel.relationTypes;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
created() {
|
||||
// add the required rule
|
||||
VeeValidate.Validator.extend('translatedLanguage', {
|
||||
// add the required rule
|
||||
VeeValidate.Validator.extend('translatedLanguage', {
|
||||
getMessage: field => 'The translated ' + field + ' must be in a language other than than the dataset language.',
|
||||
validate: (value, [mainLanguage, type]) => {
|
||||
if (type == "Translated") {
|
||||
|
@ -186,7 +222,7 @@ export default class EditDataset extends Vue {
|
|||
} else {
|
||||
this.time = "no_time";
|
||||
}
|
||||
|
||||
|
||||
if (this.form.coverage.elevation_absolut != null) {
|
||||
this.elevation = "absolut";
|
||||
} else if (this.form.coverage.elevation_min != null) {
|
||||
|
@ -194,7 +230,7 @@ export default class EditDataset extends Vue {
|
|||
} else {
|
||||
this.elevation = "no_elevation";
|
||||
}
|
||||
|
||||
|
||||
if (this.form.coverage.depth_absolut != null) {
|
||||
this.depth = "absolut";
|
||||
} else if (this.form.coverage.depth_min != null) {
|
||||
|
@ -204,6 +240,58 @@ export default class EditDataset extends Vue {
|
|||
}
|
||||
}
|
||||
|
||||
@Watch('elevation')
|
||||
onElevationChanged(val, oldVal) {
|
||||
if (val == "absolut") {
|
||||
//formData.append('coverage[elevation_absolut]', this.dataset.coverage.elevation_absolut);
|
||||
this.form.coverage.elevation_min = null;
|
||||
this.form.coverage.elevation_max = null;
|
||||
}
|
||||
else if (val == "range") {
|
||||
this.form.coverage.elevation_absolut = null;
|
||||
} else {
|
||||
this.form.coverage.elevation_min = null;
|
||||
this.form.coverage.elevation_max = null;
|
||||
this.form.coverage.elevation_absolut = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Watch('depth')
|
||||
onDepthChanged(val, oldVal) {
|
||||
if (val == "absolut") {
|
||||
this.form.coverage.depth_min = null;
|
||||
this.form.coverage.depth_max = null;
|
||||
}
|
||||
else if (val == "range") {
|
||||
this.form.coverage.depth_absolut = null;
|
||||
} else {
|
||||
this.form.coverage.depth_min = null;
|
||||
this.form.coverage.depth_max = null;
|
||||
this.form.coverage.depth_absolut = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Watch('time')
|
||||
onTimeChanged(val, oldVal) {
|
||||
if (val == "absolut") {
|
||||
this.form.coverage.time_min = null;
|
||||
this.form.coverage.time_max = null;
|
||||
this.$refs.minTimeDatepicker.clearDate();
|
||||
this.$refs.maxTimeDatepicker.clearDate();
|
||||
}
|
||||
else if (val == "range") {
|
||||
this.form.coverage.time_absolut = null;
|
||||
this.$refs.absoluteTimeDatepicker.clearDate();
|
||||
} else {
|
||||
this.form.coverage.time_min = null;
|
||||
this.form.coverage.time_max = null;
|
||||
this.form.coverage.time_absolut = null;
|
||||
this.$refs.minTimeDatepicker.clearDate();
|
||||
this.$refs.maxTimeDatepicker.clearDate();
|
||||
this.$refs.absoluteTimeDatepicker.clearDate();
|
||||
}
|
||||
}
|
||||
|
||||
onSubmit() {
|
||||
// var dataform = new FormData();
|
||||
// var dataform = document.getElementById('submitEditForm');
|
||||
|
@ -230,7 +318,7 @@ export default class EditDataset extends Vue {
|
|||
this.submitted = true;
|
||||
this.$validator.validate().then(result => {
|
||||
if (result) {
|
||||
// console.log('From Submitted!');
|
||||
// console.log('From Submitted!');
|
||||
document.getElementById("submitEditForm").submit();
|
||||
return;
|
||||
}
|
||||
|
@ -299,7 +387,7 @@ export default class EditDataset extends Vue {
|
|||
//if (this.persons.includes(person) == false) {
|
||||
if (this.form.authors.filter(e => e.id === person.id).length > 0) {
|
||||
this.$toast.error("person is already defined as author");
|
||||
} else if (this.form.contributors.filter(e => e.id === person.id).length > 0) {
|
||||
} else if (this.form.contributors.filter(e => e.id === person.id).length > 0) {
|
||||
this.$toast.error("person is already defined as contributor");
|
||||
}
|
||||
else {
|
||||
|
@ -308,7 +396,7 @@ export default class EditDataset extends Vue {
|
|||
// this.dataset.checkedAuthors.push(person.id);
|
||||
this.$toast.success("person has been successfully added as author");
|
||||
}
|
||||
|
||||
|
||||
// else if (this.dataset.contributors.filter(e => e.id === person.id).length > 0) {
|
||||
// this.$toast.error("person is already defined as contributor");
|
||||
// }
|
||||
|
@ -324,7 +412,17 @@ export default class EditDataset extends Vue {
|
|||
*/
|
||||
for (var i = 0; i < uploadedFiles.length; i++) {
|
||||
let fileName = uploadedFiles[i].name.replace(/\.[^/.]+$/, '');
|
||||
let uploadeFile = { file: uploadedFiles[i], label: fileName, sort_order: 0 };
|
||||
console.log(uploadedFiles[i]);
|
||||
var file = {
|
||||
'lastModified': uploadedFiles[i].lastModified,
|
||||
// 'lastModifiedDate': uploadedFiles[i].lastModifiedDate,
|
||||
'name': uploadedFiles[i].name,
|
||||
'size': uploadedFiles[i].size,
|
||||
'type': uploadedFiles[i].type,
|
||||
'webkitRelativePath': uploadedFiles[i].value,
|
||||
}
|
||||
console.log(file);
|
||||
let uploadeFile = { file: JSON.stringify(file), label: fileName, sort_order: 0 };
|
||||
//this.dataset.files.push(uploadedFiles[i]);
|
||||
this.form.files.push(uploadeFile);
|
||||
}
|
||||
|
@ -337,7 +435,7 @@ export default class EditDataset extends Vue {
|
|||
/*
|
||||
Removes a select file the user has uploaded
|
||||
*/
|
||||
removeFile(key) {
|
||||
removeFile(key) {
|
||||
this.form.files.splice(key, 1);
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ function initialState() {
|
|||
rights: null,
|
||||
project_id: "",
|
||||
|
||||
creating_corporation: "GBA Repository",
|
||||
creating_corporation: "TETHYS RDR",
|
||||
language: "",
|
||||
embargo_date: "",
|
||||
belongs_to_bibliography: 0,
|
||||
|
@ -70,7 +70,7 @@ export default class Dataset extends Vue {
|
|||
rights = null;
|
||||
project_id = "";
|
||||
|
||||
creating_corporation = "TETHYS Repository";
|
||||
creating_corporation = "TETHYS RDR";
|
||||
language = "";
|
||||
embargo_date = "";
|
||||
belongs_to_bibliography = 0;
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
v-model="geolocation.x_min"
|
||||
data-vv-scope="step-2"
|
||||
id="xmin"
|
||||
v-validate="'decimal'"
|
||||
v-validate="'decimal|required'"
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
@ -27,7 +27,7 @@
|
|||
v-model="geolocation.y_min"
|
||||
data-vv-scope="step-2"
|
||||
id="ymin"
|
||||
v-validate="'decimal'"
|
||||
v-validate="'decimal|required'"
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
@ -40,7 +40,7 @@
|
|||
v-model="geolocation.x_max"
|
||||
data-vv-scope="step-2"
|
||||
id="xmax"
|
||||
v-validate="'decimal'"
|
||||
v-validate="'decimal|required'"
|
||||
/>
|
||||
</div>
|
||||
|
||||
|
@ -53,7 +53,7 @@
|
|||
v-model="geolocation.y_max"
|
||||
data-vv-scope="step-2"
|
||||
id="ymax"
|
||||
v-validate="'decimal'"
|
||||
v-validate="'decimal|required'"
|
||||
/>
|
||||
</div>
|
||||
<input type="button" v-if="validBoundingBox" v-on:click="zoomTo" value="validate coordinates" />
|
||||
|
|
|
@ -152,6 +152,9 @@ const app = new Vue({
|
|||
keywords_length() {
|
||||
return this.dataset.subjects.length;
|
||||
},
|
||||
files_length() {
|
||||
return this.dataset.files.length;
|
||||
},
|
||||
isInitial() {
|
||||
return this.currentStatus === STATUS_INITIAL;
|
||||
},
|
||||
|
@ -578,10 +581,15 @@ const app = new Vue({
|
|||
}
|
||||
return true;
|
||||
},
|
||||
submit(status) {
|
||||
submit(scope) {
|
||||
// alert('Submit to blah and show blah and etc.');
|
||||
// save it
|
||||
this.save(status);
|
||||
// this.save(status);
|
||||
this.$validator.validateAll(scope).then((result) => {
|
||||
if (result) {
|
||||
this.save("inprogress");
|
||||
}
|
||||
});
|
||||
},
|
||||
handleTimeExpire() {
|
||||
window.location = '/login';
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
const messages={
|
||||
min_value: (field, num) => field +' cannot be empty! ' + num + ' items are required.',
|
||||
min_value: (field, num) => field
|
||||
+' cannot be empty! '
|
||||
+ num
|
||||
+ (num==1 ? ' item' : ' items')
|
||||
+ (num==1 ? ' is' : ' are')
|
||||
+ ' required.',
|
||||
};
|
||||
export default messages;
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue