Commit 83310593 authored by Anton's avatar Anton

Add start and duration to CellEditor for Video and AnnotationList

parent a1826765
......@@ -7,12 +7,12 @@
q-item-separator
template(v-for="(cell, index) in cells")
template(v-for="(cell, index) in cells", :key="cell.uuid")
template(v-if="index > 0")
q-item-separator
q-item(v-if="cell.type in itemSpecs", v-for="spec in itemSpecs[cell.type]")
q-item(v-if="cell.type in itemSpecs", v-for="spec in itemSpecs[cell.type]", :key="`${spec.type}-${spec.path}`")
q-field(
:icon="typeToIconName[cell.type]",
:helper="spec.help",
......@@ -74,8 +74,7 @@
errorMessage: 'Needs to be a valid URL',
value: '',
path: 'content'
}
/*
},
{
inputType: 'number',
type: 'Video',
......@@ -95,7 +94,7 @@
errorMessage: 'Needs to be a valid number',
value: 0,
path: 'duration'
} */],
}],
'Image': [{
inputType: 'url',
type: 'Image',
......@@ -135,11 +134,10 @@
errorMessage: '',
value: '',
path: 'content'
}
/*
},
{
inputType: 'number',
type: 'Video',
type: 'Annotation-List',
label: 'Start',
help: 'Filter from video start point (seconds)',
error: false,
......@@ -149,46 +147,41 @@
},
{
inputType: 'number',
type: 'Video',
type: 'Annotation-List',
label: 'Duration',
help: 'Filter duration (seconds)',
error: false,
errorMessage: 'Needs to be a valid number',
value: 0,
path: 'duration'
} */]
}]
}
}
},
// mounted () {
// console.log(this.$props.cells)
// },
mounted () {
console.debug(this.cells)
},
methods: {
handleItemChanged (value, cell, path) {
async handleItemChanged (value, cell, path) {
if (cell.inputType !== 'url') {
this.updateCellContent(value, cell, path)
await this.updateCellContent(value, cell, path)
}
else {
cell.error = !(/^http[s]?:\/\/.+/.test(value))
if (!cell.error) {
this.updateCellContent(value, cell, path)
await this.updateCellContent(value, cell, path)
}
}
},
updateCellContent (value, cell, path) {
const _this = this
// can't remember why the extra sourceUuid is needed …
// maybe if this is an annotation made in piecemaker (video),
// that is wrapped into a cell-annotation
const destUuid = cell.sourceUuid || cell.uuid
async updateCellContent (value, cell, path) {
const destUuid = cell.uuid
if (destUuid) {
this.$store.dispatch('annotations/find', { 'uuid': destUuid })
.then(annotations => {
const a = annotations.items.shift()
cell[path] = value
a.body.value = JSON.stringify(cell)
_this.$store.dispatch('annotations/patch', [destUuid, { body: a.body, target: a.target }])
})
console.debug('change', value, cell, path)
const annotations = await this.$store.dispatch('annotations/find', { 'uuid': destUuid })
const a = annotations.items.shift()
cell[path] = value
a.body.value = JSON.stringify(cell)
await this.$store.dispatch('annotations/patch', [destUuid, { body: a.body, target: a.target }])
}
}
}
......
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