diff --git a/lib/www/client/source/src/views/Calendar.vue b/lib/www/client/source/src/views/Calendar.vue index 1694f09..2de8f0f 100644 --- a/lib/www/client/source/src/views/Calendar.vue +++ b/lib/www/client/source/src/views/Calendar.vue @@ -37,7 +37,65 @@ {{ $refs.calendar.title }} + + + ({{downloadableItemCount}} log entries) + + + + + + + Seis+JSON + + JSON + YAML + CSV + + + + i.category ?? "General"))]; }, + calendarDates () { + // The this.items.length reference is only needed to force recalculation + // of this computed property, as this.$refs is not reactive. + // https://github.com/vuejs/vue/issues/3842 + if (this.items.length && this.$refs.calendar) { + return { + start: this.$refs.calendar.renderProps.start.date, + end: this.$refs.calendar.renderProps.end.date + } + } + }, + + downloadableItemCount () { + return this.events.filter(i => i.tstamp.substr(0, 10) >= this.calendarDates?.start && + i.tstamp.substr(0, 10) <= this.calendarDates?.end).length; + }, + ...mapGetters(['sequencesLoading', 'sequences', 'events']) }, @@ -298,6 +373,18 @@ export default { }; }, + downloadUrl (qry) { + if (this.calendarDates) { + const url = new URL(`/api/project/${this.$route.params.project}/event`, document.location.href); + for (const key in qry) { + url.searchParams.set(key, qry[key]); + } + url.searchParams.set("date0", this.calendarDates.start); + url.searchParams.set("date1", this.calendarDates.end); + return url.toString(); + } + }, + ...mapActions(["api"])