Commit 3451e4f8 authored by christianrhansen's avatar christianrhansen

Merge remote-tracking branch 'origin/mosys-maintenance-update---mosys' into...

Merge remote-tracking branch 'origin/mosys-maintenance-update---mosys' into mosys-maintenance-update---mosys
parents e51427ce 1aa69071
Pipeline #59876 passed with stage
in 1 minute and 24 seconds
......@@ -30,10 +30,12 @@
Cell,
StyleTag
},
props: ['gridUuid'],
props: {
gridUuid: String,
locked: { type: Boolean, default: false }
},
data () {
return {
locked: false,
data: {},
grid: undefined,
annotations: [],
......@@ -45,8 +47,7 @@
},
computed: {
...mapGetters({
isMobile: 'globalSettings/getIsMobile',
scrollPositionCache: 'mosys/getScrollPositionCache'
isMobile: 'globalSettings/getIsMobile'
}),
queryPositionX () {
if (this.$route.query.x) return parseInt(this.$route.query.x)
......@@ -61,19 +62,30 @@
await this.loadGrid(val)
},
queryPositionX (val) {
if (typeof val === 'number') this.scrollToGridCoordinates(val)
if (typeof val === 'number') return this.scrollToGridCoordinates(val)
},
globalTime (val) {
if (typeof val === 'string') this.broadcastDateTime(DateTime.fromISO(val, { setZone: true }))
}
},
async mounted () {
await this.loadGrid(this.$route.params.uuid)
this.$el.scrollLeft = this.scrollPositionCache
this.$q.loading.show()
try {
await this.loadGrid(this.$route.params.uuid)
}
catch (err) {
this.$handleError(this, err, 'errors.load_grid_failed')
}
this.$q.loading.hide()
},
methods: {
onScroll () {
onScroll (val) {
if (this.$route.query.x) this.$router.push({ query: {} })
if (!this.locked) {
if (val && this.data && this.data.grid) {
this.$store.commit('mosys/setScrollConfig', [this.data.grid.id, val.originalTarget.scrollLeft])
}
}
},
async loadGrid (uuid) {
this.data = await this.$store.dispatch('mosys/getGrid', uuid)
......@@ -92,10 +104,16 @@
this.styles = [this.data.grid.stylesheet.value]
}
}
this.updateGridDimensions()
await this.updateGridDimensions()
if (this.$route.query.x) this.scrollToGridCoordinates(parseInt(this.$route.query.x))
else this.scrollToGridCoordinates(0)
if (this.$route.query.x) await this.scrollToGridCoordinates(parseInt(this.$route.query.x))
else {
if (this.$store.state.mosys && this.$store.state.mosys.currentScrollConfig.id === this.data.grid.id) {
this.$refs.gridContainer.scrollTo(this.$store.state.mosys.currentScrollConfig.offset, 0)
await this.$nextTick()
}
else await this.scrollToGridCoordinates(0)
}
if (this.$route.query.datetime) this.broadcastDateTime(this.$route.query.datetime)
},
scrollToGridCoordinates (x = 0, y = 0) {
......@@ -103,6 +121,7 @@
Math.round(x * this.gridDimensions.full.cell.width),
Math.round(y * this.gridDimensions.full.cell.height)
)
return this.$nextTick()
},
broadcastDateTime (datetime) {
if (typeof datetime === 'string') datetime = DateTime.fromISO(datetime)
......@@ -167,6 +186,7 @@
}
}
*/
return this.$nextTick()
},
getAnnotationStyle (annotation) {
const parsed = annotation.target.selector._value
......
<template lang="pug">
div.cell-grid-container.bg-dark(style="overflow-y: hidden; scroll-behavior: smooth;")
div.cell-grid-container.bg-dark.scroll(style="overflow-y: hidden; scroll-behavior: smooth;" @scroll="onScroll")
q-window-resize-observable(@resize="updateGridDimensions")
//----- modal for existing cell editing
......@@ -292,7 +291,6 @@
// isMobile: 'globalSettings/getIsMobile',
// editingCells: 'mosys/getEditingCells',
showEditingCells: 'mosys/getShowEditingCells',
scrollPositionCache: 'mosys/getScrollPositionCache',
editGrid: 'mosys/getEditGrid'
}),
countColumns () {
......@@ -370,25 +368,27 @@
}
},
async mounted () {
this.data = await this.$store.dispatch('mosys/getGrid', this.gridUuid)
if (this.data && this.data.grid) {
try {
this.$q.loading.show()
try {
this.data = await this.$store.dispatch('mosys/getGrid', this.gridUuid)
if (this.data && this.data.grid) {
const acl = await this.$store.dispatch('acl/isAllowed',
{ id: this.data.grid.id, permission: 'get' })
this.mayEdit = !!(acl || {}).get
}
catch (err) {
this.$handleError(err)
}
}
if (this.mayEdit) this.$store.commit('mosys/setMayEdit', true)
else this.$store.commit('mosys/setMayEdit', false)
if (this.mayEdit) this.$store.commit('mosys/setMayEdit', true)
else this.$store.commit('mosys/setMayEdit', false)
this.updateGridDimensions()
this.resetScrollPosition()
this.updateAnnotationUIStates()
document.addEventListener('keydown', this.keyHandler)
await this.updateGridDimensions()
await this.updateAnnotationUIStates()
await this.resetScrollPosition()
document.addEventListener('keydown', this.keyHandler)
}
catch (err) {
this.$handleError(this, err, 'errors.load_grid_failed')
}
this.$q.loading.hide()
},
watch: {
cachedNewCell (obj) {
......@@ -402,54 +402,17 @@
editCellModal (val) {
if (!val) this.modal = false
},
/*
'pannedCell': {
handler: function (cursor) {
let
pannedCell = this.pannedCell,
gridRows = this.data.configuration.rows,
gridColumns = this.data.configuration.columns,
cellTop = pannedCell.y - pannedCell.offset.y - 1,
cellBottom = (pannedCell.y - pannedCell.offset.y) + pannedCell.h - 1,
cellLeft = pannedCell.x - pannedCell.offset.y - 1,
cellRight = (pannedCell.x - pannedCell.offset.x) + pannedCell.w - 1
let x
if (cellRight > gridColumns) x = gridColumns - pannedCell.w + 1
else if (cellLeft < 0) x = 0
else x = cursor.x - pannedCell.offset.x
let y
if (cellBottom > gridRows) y = gridRows - pannedCell.h + 1
else if (cellTop < 0) y = 0
else y = cursor.y - pannedCell.offset.y
if (pannedCell) {
this.setCellPosition(pannedCell.annotation, x, y)
}
},
deep: true
},
*/
/*
annotations () {
this.updateAnnotationUIStates()
},
*/
gridMetadata () {
this.updateGridDimensions()
},
async gridUuid () {
this.data = await this.$store.dispatch('mosys/getGrid', this.gridUuid)
},
showEditingCells (val) {
if (val === false) {
this.cellHandler.hidden = true
this.updateAnnotationUIStates()
return this.updateAnnotationUIStates()
}
},
tabsAreOpen () {
this.resetScrollPosition()
return this.resetScrollPosition()
}
},
beforeDestroy () {
......@@ -457,6 +420,11 @@
document.removeEventListener('mousemove', this.mouseMoveListener)
},
methods: {
onScroll (val) {
if (val && this.data && this.data.grid) {
this.$store.commit('mosys/setScrollConfig', [this.data.grid.id, val.originalTarget.scrollLeft])
}
},
toggleAxis () {
this.editingGrid.axis = !this.editingGrid.axis
},
......@@ -833,7 +801,6 @@
this.annotationUIStates[annotation._uuid].editing = !this.annotationUIStates[annotation._uuid].editing
// this.updateEditingCells()
this.$root.$emit('mosys_saveScrollPosition')
}
// set temp cell position
......@@ -1000,6 +967,7 @@
this.annotationUIStates = newAnnotationUIStates
// this.updateSelectedCells()
// this.updateEditingCells()
return this.$nextTick()
},
//
......@@ -1031,7 +999,7 @@
console.debug('Created new cell annotation', annotation ? annotation.toObject() : undefined)
await this.$store.dispatch('acl/clone', { source: annotation.id, target: cell.id })
this.data.annotations.push(annotation)
this.updateAnnotationUIStates()
await this.updateAnnotationUIStates()
}
this.$store.commit('mosys/setSourceCellInput', undefined)
this.clearHandler('temp cell')
......@@ -1112,7 +1080,7 @@
}
this.data.configuration.columns++
await this.$store.dispatch('mosys/updateGridMetadataStore', [this.data.grid, this.data.configuration])
this.updateGridDimensions()
return this.updateGridDimensions()
},
async handleGridContextMenuDeleteColumn (pos) {
let position
......@@ -1131,7 +1099,7 @@
}
this.data.configuration.columns = Math.max(1, this.data.configuration.columns - 1)
await this.$store.dispatch('mosys/updateGridMetadataStore', [this.data.grid, this.data.configuration])
this.updateGridDimensions()
return this.updateGridDimensions()
},
async handleGridContextMenuInsertRowAbove (pos) {
let position
......@@ -1150,7 +1118,7 @@
}
this.data.configuration.rows++
await this.$store.dispatch('mosys/updateGridMetadataStore', [this.data.grid, this.data.configuration])
this.updateGridDimensions()
return this.updateGridDimensions()
},
async handleGridContextMenuDeleteRow (pos) {
let position
......@@ -1169,7 +1137,7 @@
}
this.data.configuration.rows = Math.max(1, this.data.configuration.rows - 1)
await this.$store.dispatch('mosys/updateGridMetadataStore', [this.data.grid, this.data.configuration])
this.updateGridDimensions()
return this.updateGridDimensions()
},
//
......@@ -1246,6 +1214,7 @@
}
}
}
return this.$nextTick()
},
getCellStyle (obj) {
if (!obj) return {}
......@@ -1299,7 +1268,11 @@
else return {}
},
resetScrollPosition () {
this.$el.scrollLeft = this.scrollPositionCache
if (this.$store.state.mosys.currentScrollConfig.id === this.data.grid.id) {
this.$el.scroll(this.$store.state.mosys.currentScrollConfig.offset, 0)
}
else this.$el.scroll(0, 0)
return this.$nextTick()
}
}
}
......
......@@ -53,18 +53,33 @@
if (this.video) {
this.videoTime = DateTime.fromMillis(this.video.target.selector._valueMillis)
this.contextTime = this.videoTime
if (!this.display) {
try {
const meta = await this.$store.dispatch('metadata/getLocal', this.video)
this.$emit('onMetadata', meta)
}
catch (err) {
console.error('Unable to fetch metadata for media:', err.message)
}
}
}
}
else {
const videoUrl = this.cell ? this.cell.source._value.content : undefined
if (!videoUrl) return
this.fauxMedia()
if (!this.display) {
try {
const meta = await this.$store.dispatch('metadata/get', this.video)
this.$emit('onMetadata', meta)
}
catch (e) {
console.error('Unable to fetch metadata for media')
catch (err) {
console.error('Unable to fetch metadata for fauxMedia', err.message)
}
}
}
else {
this.fauxMedia()
}
if (this.display) {
if (!this.cell.source.start) this.showPlayer = true
else {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment