Commit e66cee67 authored by Anton's avatar Anton
Browse files

More fixes for cells and sources

parent f530419b
...@@ -165,7 +165,7 @@ ...@@ -165,7 +165,7 @@
await this.fetchData() await this.fetchData()
}, },
watch: { watch: {
cells () { annotations () {
this.updateAnnotationUIStates() this.updateAnnotationUIStates()
}, },
gridMetadata () { gridMetadata () {
...@@ -198,7 +198,6 @@ ...@@ -198,7 +198,6 @@
'body.type': 'Cell' 'body.type': 'Cell'
}) })
this.annotations = items this.annotations = items
this.updateAnnotationUIStates()
} }
}, },
async updateGridMetadataStore () { async updateGridMetadataStore () {
...@@ -307,6 +306,7 @@ ...@@ -307,6 +306,7 @@
target: this.grid.get2DArea([x, y], [1, 1]) target: this.grid.get2DArea([x, y], [1, 1])
}) })
this.annotations.push(annotation) this.annotations.push(annotation)
this.updateAnnotationUIStates()
} }
this.tmpObjects = [] this.tmpObjects = []
......
...@@ -25,8 +25,7 @@ ...@@ -25,8 +25,7 @@
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
const typeToIconName = { const typeToIconName = {
'image': 'photo', 'image': 'photo'
'video': 'local movies'
} }
export default { export default {
...@@ -78,13 +77,12 @@ ...@@ -78,13 +77,12 @@
}, },
handleItemDragStart (event, item) { handleItemDragStart (event, item) {
const resourceCell = { const resourceCell = {
uuid: null, data: {
type: this.getSimpleType(item.metaData['content-type'], true), content: `${process.env.STORAGE_HOST}/files/${this.bucketName}/${item.name}`,
x: 1, type: this.getSimpleType(item.metaData['content-type'], true)
y: 1, },
width: 1, config: {},
height: 1, component: 'CellImage'
content: `${process.env.STORAGE_HOST}/files/${this.bucketName}/${item.name}`
} }
event.dataTransfer.setData('text/plain', JSON.stringify(resourceCell)) event.dataTransfer.setData('text/plain', JSON.stringify(resourceCell))
} }
......
...@@ -33,11 +33,11 @@ ...@@ -33,11 +33,11 @@
q-item-side q-item-side
q-icon( q-icon(
draggable="true", draggable="true",
@dragstart.native="event => {handleItemDragStart(event, entry.annotation, 'Video')}", @dragstart.native="event => {handleItemDragStart(event, entry.annotation, 'CellVideo')}",
name="local movies", style="font-size: 1.8rem") name="local movies", style="font-size: 1.8rem")
q-icon( q-icon(
draggable="true", draggable="true",
@dragstart.native="event => {handleItemDragStart(event, entry.annotation, 'Annotation-List')}", @dragstart.native="event => {handleItemDragStart(event, entry.annotation, 'CellAnnotationList')}",
name="comment", style="font-size: 1.8rem") name="comment", style="font-size: 1.8rem")
q-item-main q-item-main
a(@click.prevent="event => {handleVideoItemClick(event, entry.annotation)}") {{entry.title || entry.annotation._uuid}} a(@click.prevent="event => {handleVideoItemClick(event, entry.annotation)}") {{entry.title || entry.annotation._uuid}}
...@@ -108,18 +108,17 @@ ...@@ -108,18 +108,17 @@
}, },
handleVideoItemClick () { handleVideoItemClick () {
}, },
handleItemDragStart (event, item, type = 'Video') { handleItemDragStart (event, item, component = 'CellVideo') {
let videoCell = { const resourceCell = {
_uuid: null, component,
type: type, config: {},
x: 1, data: {
y: 1, id: item.id,
width: 1, sourceUuid: item._uuid,
height: 1, content: component === 'CellVideo' ? item.body.source.id : item._uuid
content: type === 'Video' ? item.body.source.id : item._uuid,
sourceUuid: item._uuid
} }
event.dataTransfer.setData('text/plain', JSON.stringify(videoCell)) }
event.dataTransfer.setData('text/plain', JSON.stringify(resourceCell))
} }
} }
} }
......
...@@ -71,7 +71,6 @@ export default { ...@@ -71,7 +71,6 @@ export default {
props: ['cell', 'display', 'preview', 'visible'], props: ['cell', 'display', 'preview', 'visible'],
data () { data () {
return { return {
videoUuid: '',
video: {}, video: {},
videoTime: {}, videoTime: {},
videoMeta: {}, videoMeta: {},
...@@ -92,7 +91,6 @@ export default { ...@@ -92,7 +91,6 @@ export default {
} }
}, },
async mounted () { async mounted () {
this.videoUuid = this.cell.sourceUuid
const videoAnnotation = await this.$store.dispatch( const videoAnnotation = await this.$store.dispatch(
'annotations/get', 'annotations/get',
this.cell.sourceUuid this.cell.sourceUuid
...@@ -111,6 +109,9 @@ export default { ...@@ -111,6 +109,9 @@ export default {
this.$root.$on('grid-datetime', this.onGridDateTime) this.$root.$on('grid-datetime', this.onGridDateTime)
}, },
computed: { computed: {
videoUuid () {
return this.cell ? this.cell.id : undefined
},
currentIndex () { currentIndex () {
if (!this.annotations || !this.annotations.length) return if (!this.annotations || !this.annotations.length) return
......
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
}, },
async mounted () { async mounted () {
if (this.cell && this.cell.data.sourceUuid) { if (this.cell && this.cell.data.sourceUuid) {
this.video = await this.$store.dispatch('annotations/get', this.cell.data.sourceUuid) this.video = await this.$store.dispatch('annotations/get', this.cell.data.id)
if (this.video) { if (this.video) {
this.videoTime = DateTime.fromMillis(this.video.target.selector._valueMillis) this.videoTime = DateTime.fromMillis(this.video.target.selector._valueMillis)
this.contextTime = this.videoTime this.contextTime = this.videoTime
......
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