1. Timer auf 60 Minuten und 10 Minuten vorher eine Warnung

11. Continue statt Review Dataset (im Step 3)
12. keywords auf default 'uncontrolled' einfrieren
14. Lizenzen mit Links versehen
19. Timezone: 'timezone' => 'Europe/Vienna'
20. angefangen mit RDR -> TETHYS Unbenennungen
21. translated validation ausgebessert
22. dataset als Typescript Instanz
This commit is contained in:
Arno Kaimbacher 2019-11-21 18:43:56 +01:00
parent 300c8a13a9
commit 4b8f2a63d8
45 changed files with 1729 additions and 826 deletions

View file

@ -0,0 +1,144 @@
import { Component, Vue, Watch } from 'vue-property-decorator';
//outside of the component:
function initialState() {
return {
type: "",
state: "",
rights: null,
project_id: "",
creating_corporation: "GBA Repository",
language: "",
embargo_date: "",
belongs_to_bibliography: 0,
title_main: {
value: "",
language: ""
},
abstract_main: {
value: "",
language: ""
},
// geolocation: {
// xmin: "",
// ymin: "",
// xmax: "",
// ymax: ""
// },
coverage: {
xmin: "",
ymin: "",
xmax: "",
ymax: "",
elevation_min: "",
elevation_max: "",
elevation_absolut: "",
depth_min: "",
depth_max: "",
depth_absolut: "",
time_min: "",
time_max: "",
time_absolut: ""
},
checkedAuthors: [],
checkedLicenses: [], // [],
files: [],
keywords: [],
references: [],
titles: [],
descriptions: [],
checkedContributors: [],
// checkedSubmitters: [],
persons: [],
contributors: []
// submitters: []
};
}
// const dataset = new Vue({
@Component
export default class Dataset extends Vue {
// data: function() {
// return initialState();
// }
initialState = {};
type= "";
state= "";
rights= null;
project_id= "";
creating_corporation= "TETHYS Repository";
language= "";
embargo_date= "";
belongs_to_bibliography= 0;
title_main= {
value: "",
language: ""
};
abstract_main= {
value: "",
language: ""
};
// geolocation: {
// xmin: "",
// ymin: "",
// xmax: "",
// ymax: ""
// },
coverage= {
xmin: "",
ymin: "",
xmax: "",
ymax: "",
elevation_min: "",
elevation_max: "",
elevation_absolut: "",
depth_min: "",
depth_max: "",
depth_absolut: "",
time_min: "",
time_max: "",
time_absolut: ""
};
checkedAuthors= [];
checkedLicenses= [];
files= [];
keywords= [];
references= [];
titles= [];
descriptions= [];
checkedContributors= [];
// checkedSubmitters: [],
persons= [];
contributors= [];
// submitters: []
created () {
this.initialState = Object.assign({}, this);
// let json = JSON.stringify(this.$data);
// this.reset = () => {
// Object.assign(this.$data, JSON.parse(json));
// };
// this.reset(json);
}
@Watch('language')
onLanguageChanged(val) {
this.title_main.language = val;
this.abstract_main.language = val;
}
reset() {
// Object.assign(this.$data, initialState());
Object.assign(this.$data, this.initialState);
}
}
// export default dataset;

View file

@ -1,87 +0,0 @@
// <script>
import Vue from "vue";
//outside of the component:
function initialState() {
return {
type: "",
state: "",
rights: null,
project_id: "",
creating_corporation: "GBA Repository",
language: "",
embargo_date: "",
belongs_to_bibliography: 0,
title_main: {
value: "",
language: ""
},
abstract_main: {
value: "",
language: ""
},
// geolocation: {
// xmin: "",
// ymin: "",
// xmax: "",
// ymax: ""
// },
coverage: {
xmin: "",
ymin: "",
xmax: "",
ymax: "",
elevation_min: "",
elevation_max: "",
elevation_absolut: "",
depth_min: "",
depth_max: "",
depth_absolut: "",
time_min: "",
time_max: "",
time_absolut: ""
},
checkedAuthors: [],
checkedLicenses: [], // [],
files: [],
keywords: [],
references: [],
titles: [],
descriptions: [],
checkedContributors: [],
// checkedSubmitters: [],
persons: [],
contributors: []
// submitters: []
};
}
const dataset = new Vue({
data: function() {
return initialState();
},
created: function() {
// let json = JSON.stringify(this.$data);
// this.reset = () => {
// Object.assign(this.$data, JSON.parse(json));
// };
// this.reset(json);
},
watch: {
language(val) {
this.title_main.language = val;
this.abstract_main.language = val;
}
},
methods: {
reset() {
Object.assign(this.$data, initialState());
}
}
});
export default dataset;
//export { dataset };
</script>

View file

@ -0,0 +1,118 @@
import EasyTimer from 'easytimer';
import { Component, Vue, Prop, Watch } from 'vue-property-decorator';
@Component
export default class VueCountdown extends Vue {
// props: {
// seconds: Number,
// countdown: Boolean,
// message: String,
// date: String,
// units: Array,
// start: {
// type: Boolean,
// default: true
// }
// },
@Prop(Number)
seconds;
@Prop(Boolean)
countdown;
@Prop([String])
message;
@Prop([String])
date;
@Prop([Array])
units;
@Prop({ default: true, type: Boolean })
start: boolean;
// data () {
// return {
// timer: null,
// time: '',
// label: this.message ? this.message : 'Time\'s up!',
// timerUnits: this.units ? this.units : ['hours', 'minutes', 'seconds'],
// timerOptions: {}
// };
// },
warningSeconds: Number = this.seconds;
timer: EasyTimer = null;
time: string = '';
label: string = this.message ? this.message : 'Time\'s up!';
timerUnits = this.units ? this.units : ['hours', 'minutes', 'seconds'];
timerOptions = {
startValues: {},
// target: {},
countdown: true,
current_page: 0,
data: []
};
get parsedDate(): number {
if (!this.date) {
return 0;
}
return Date.parse(this.date);
}
created() {
this.timer = new EasyTimer();
const parsedDate = this.parsedDate;
const now = Date.now();
let seconds = this.seconds;
this.timerOptions.countdown = true;
// = {
// countdown: true
// };
if (!parsedDate && this.date) {
throw new Error('Please provide valid date');
}
if (now < parsedDate) {
seconds = (parsedDate - now) / 1000;
}
this.timerOptions.startValues = {
seconds: seconds
};
if (this.start) {
this.timer.start(this.timerOptions);
}
this.time = this.timer.getTimeValues().toString(this.timerUnits);
this.timer.addEventListener('secondsUpdated', this.onTimeChange.bind(this));
this.timer.addEventListener('targetAchieved', this.onTimeExpire.bind(this));
}
onTimeChange() {
this.warningSeconds = this.timer.getTotalTimeValues().seconds;
this.time = this.timer.getTimeValues().toString(this.timerUnits);
}
onTimeExpire() {
this.$emit('time-expire');
this.time = this.label;
}
@Watch('start')
onStartChanged(newValue) {
if (newValue) {
this.timer.start(this.timerOptions);
} else {
this.timer.stop();
}
}
}

View file

@ -0,0 +1,18 @@
<template>
<div v-show="warningSeconds <= 600" class="vue-countdown">
<div class="vue-countdown--time">
remaining time: {{ time }}
</div>
</div>
</template>
<script lang="ts">
import VueCountdown from "./VueCountdown";
export default VueCountdown;
</script>
<style scoped>
.vue-countdown--time {
color:red;
}
</style>

View file

@ -31,8 +31,9 @@ import axios from 'axios';
import MyAutocomplete from './components/MyAutocomplete.vue';
import messagesEN from './strings/messages/en.js';
import VeeValidate from 'vee-validate';
import dataset from './components/Dataset';
import Dataset from './components/Dataset';
import LocationsMap from './components/LocationsMap.vue';
import VueCountdown from './components/vue-countdown';
import PersonTable from './components/PersonTable.vue';
import modal from './components/ShowModal.vue';
// import datetime from 'vuejs-datetimepicker';
@ -62,7 +63,7 @@ Vue.use(VeeValidate, {
const STATUS_INITIAL = 0, STATUS_SAVING = 1, STATUS_SUCCESS = 2, STATUS_FAILED = 3;
const app = new Vue({
el: '#app',
components: { MyAutocomplete, LocationsMap, modal, PersonTable },
components: { MyAutocomplete, LocationsMap,VueCountdown, modal, PersonTable },
data() {
return {
list: [
@ -90,35 +91,10 @@ const app = new Vue({
isModalVisible: false,
step: 0,
dataset: dataset,
dataset: new Dataset(),
elevation: "no_elevation",
depth: "no_depth",
time: "no_time",
// dataset: {
// type: '',
// state: '',
// rights: null,
// project_id: '',
// creating_corporation: "GBA",
// embargo_date: '',
// belongs_to_bibliography: 0,
// title_main: {
// value: '',
// language: ''
// },
// abstract_main: {
// value: '',
// language: ''
// },
// checkedAuthors: [],
// checkedLicenses: [],// [],
// files: [],
// references: [],
// checkedContributors: [],
// checkedSubmitters: [],
// }
time: "no_time"
}
},
created: function () {
@ -138,7 +114,7 @@ const app = new Vue({
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") {
if (type == "Translated") {
return value !== mainLanguage;
}
return true;
@ -355,7 +331,6 @@ const app = new Vue({
formData.append('descriptions[' + i + '][language]', description.language);
formData.append('descriptions[' + i + '][type]', description.type);
}
/*
Make the request to the POST /multiple-files URL
*/
@ -363,7 +338,9 @@ const app = new Vue({
formData,
{
headers: {
'Content-Type': 'multipart/form-data'
'Content-Type': 'multipart/form-data',
'X-CSRF-TOKEN' : document.querySelector('meta[name="csrf-token"]').getAttribute('content'),
'X-Requested-With': 'XMLHttpRequest',
}
})
.then((response) => {
@ -375,9 +352,9 @@ const app = new Vue({
_this.currentStatus = STATUS_SUCCESS;
_this.releaseLink = response.data.release;
_this.deleteLink = response.data.delete;
// if (response.data.redirect) {
// window.location = response.data.redirect;
// }
if (response.data.redirect) {
window.location = response.data.redirect;
}
})
.catch((error) => {
// this.loading = false;
@ -397,12 +374,18 @@ const app = new Vue({
var error = error.response.data.error;
_this.serrors.push(error.message);
}
//raundtrip to server was not possible
//roundtrip to server was not possible
if (error.message && error.message.includes('413')) {
console.log('The file you tried to upload is too large.')
// console.log('The file you tried to upload is too large.')
var error = 'The file you tried to upload is too large.';
_this.serrors.push(error);
}
else if(error.response && error.response.status == 419) {
// session timed out | not authenticated
// _this.serrors.push(error.response.data.message);
_this.serrors.push('This page has expired due to inactivity, please refresh and try again');
window.location = '/login';
}
if (error.message && error.message) {
_this.serrors.push( error.message);
}
@ -441,7 +424,7 @@ const app = new Vue({
adds a new Keyword
*/
addKeyword() {
let newKeyword = { value: '', type: '', language: this.dataset.language };
let newKeyword = { value: '', type: 'uncontrolled', language: this.dataset.language };
//this.dataset.files.push(uploadedFiles[i]);
this.dataset.keywords.push(newKeyword);
},
@ -572,6 +555,9 @@ const app = new Vue({
// alert('Submit to blah and show blah and etc.');
// save it
this.save(status);
},
handleTimeExpire() {
window.location = '/login';
}
}
});

View file

@ -1,4 +1,4 @@
import { Component, Vue, Prop, Provide } from 'vue-property-decorator';
import { Component, Vue } from 'vue-property-decorator';
import VsInput from './text-search/vs-input.vue';
import VsResults from './search-results/vs-results.vue';
import FacetList from './search-results/facet-list.vue';

View file

@ -32,7 +32,7 @@ export default {
var limit = "&rows=" + SOLR_CONFIG["limit"];
// var limit = solrConfig.limit;
var qfFields = "title^3 author^3 subject^2";
var qfFields = "title^3 author^2 subject^1";
var params = "fl=" + fields;
if (term == "*%3A*") {
params += "&defType=edismax&wt=json&indent=on"; //edismax

View file

@ -1,5 +1,5 @@
import Vue from "vue";
import { Component, Prop, Watch } from 'vue-property-decorator';
import { Component, Prop } from 'vue-property-decorator';
import debounce from 'lodash/debounce';
import rdrApi from '../search-results/dataservice';
@ -88,11 +88,6 @@ export default class VsInput extends Vue {
// this.loading = false;
// }
// reset() {
// this.display = "";
// this.items = [];
// this.showResults = false;
// }
/**
* Clear all values, results and errors
*/
@ -230,7 +225,7 @@ export default class VsInput extends Vue {
}
find(myarray, searchterm): string {
private find(myarray, searchterm): string {
for (var i = 0, len = myarray.length; i < len; i += 1) {
if (typeof (myarray[i]) === 'string' && myarray[i].toLowerCase().indexOf(searchterm) !== -1) {
// print or whatever
@ -240,7 +235,6 @@ export default class VsInput extends Vue {
return "";
}
/**
* Close the results list. If nothing was selected clear the search
*/
@ -256,8 +250,4 @@ export default class VsInput extends Vue {
//this.removeEventListener()
this.$emit('close');
}
}