Commit 4f95529e 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 6bf20b6e 0be1f642
Pipeline #59620 passed with stage
in 1 minute and 24 seconds
......@@ -1247,22 +1247,26 @@
}
},
getCellStyle (obj) {
let x, y, w, h
if (!obj) return {}
let x = 0, y = 0, w = 0, h = 0
// ----- existing cell
if (obj.id) {
if (obj.id && obj.target && obj.target.selector) {
const parsed = obj.target.selector._value
x = parsed.xywh[0]
y = parsed.xywh[1]
w = parsed.xywh[2]
h = parsed.xywh[3]
if (Array.isArray(parsed.xywh) && parsed.xywh.length === 4) {
x = parsed.xywh[0]
y = parsed.xywh[1]
w = parsed.xywh[2]
h = parsed.xywh[3]
}
}
// ----- temp cell
else {
x = obj.x
y = obj.y
w = obj.width
h = obj.height
x = obj.x || x
y = obj.y || y
w = obj.width || w
h = obj.height || h
}
return {
'grid-column-start': x,
......
......@@ -4,7 +4,10 @@
//----------------------------------------------------------------------------------------------------- display mode
template(v-if="display")
template(v-if="video && video.body")
template(v-if="loading")
q-spinner.q-ma-sm.text-white
// strong Loading annotations
template(v-else-if="video && video.body")
//--------------------------------------------------------------------------------------------------------------
template(v-if="cell.displayType === 'tabs'")
.annotation-tabs-container.column
......@@ -56,8 +59,8 @@
@onDelete="fetchAnnotations")
template(v-else)
q-spinner.q-ma-sm.text-white
// strong Loading annotations
.q-pa-lg(v-if="error") {{ $t('errors.list_annotations_failed', error.message) }}
.q-pa-lg(v-else) {{ $t('errors.list_annotations_failed', $t('errors.unknown')) }}
//-------------------------------------------------------------------------------------------------------- edit mode
template(v-else)
......@@ -99,21 +102,27 @@ export default {
staging: process.env.IS_STAGING,
activeTabIdx: 0,
playerTime: 0.0,
lastSignal: Date.now()
lastSignal: Date.now(),
error: undefined,
loading: false
}
},
async mounted () {
this.video = await this.$store.dispatch('annotations/get', this.cell.source._value.id)
this.videoTime = DateTime.fromMillis(this.video.target.selector._valueMillis)
this.loading = true
try {
this.video = await this.$store.dispatch('annotations/get', this.cell.source._value.id)
this.videoTime = DateTime.fromMillis(this.video.target.selector._valueMillis)
const meta = await this.$store.dispatch('metadata/getLocal', this.video)
this.$emit('onMetadata', meta)
if (meta && meta.title) this.videoMeta = meta
await this.fetchAnnotations()
}
catch (e) {
console.error('Unable to fetch metadata for annotation')
catch (err) {
this.handleError(err)
}
await this.fetchAnnotations()
this.loading = false
this.$root.$on('video-time-changed', this.onMediaTimeChanged)
this.$root.$on('grid-datetime', this.onGridDateTime)
......@@ -183,12 +192,17 @@ export default {
}
}
}
const annotation = await this.$store.dispatch(
'annotations/post',
newAnnotation
)
console.debug('CellAnnotationList: post annotation', annotation)
await this.fetchAnnotations()
try {
const annotation = await this.$store.dispatch(
'annotations/post',
newAnnotation
)
console.debug('CellAnnotationList: post annotation', annotation)
await this.fetchAnnotations()
}
catch (err) {
this.handleError(err, 'errors.create_annotation_failed')
}
}
this.newAnnotationText = ''
},
......@@ -270,6 +284,16 @@ export default {
},
getMediaDate () {
return DateTime.fromMillis(this.video.target.selector._valueMillis)
},
handleError (err, message = undefined) {
if (message) {
this.$handleError(this, err)
}
else {
this.$captureException(err)
this.error = err.message
}
this.loading = false
}
}
}
......
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