Commit d84d698d authored by Anton's avatar Anton

Replace all model property occurrences of uuid with _uuid

parent 95691431
......@@ -7,7 +7,7 @@
q-item-separator
template(v-for="(cell, index) in cells", :key="cell.uuid")
template(v-for="(cell, index) in cells", :key="cell._uuid")
template(v-if="index > 0")
q-item-separator
......@@ -257,13 +257,12 @@
}
},
async updateCellContent (value, cell, path) {
const destUuid = cell.uuid
const destUuid = cell._uuid
if (destUuid) {
const annotations = await this.$store.dispatch('annotations/find', { 'uuid': destUuid })
const a = annotations.items.shift()
const annotation = await this.$store.dispatch('annotations/get', destUuid)
cell[path] = value
a.body.value = JSON.stringify(cell)
await this.$store.dispatch('annotations/patch', [destUuid, { body: a.body, target: a.target }])
annotation.body.value = JSON.stringify(cell)
await this.$store.dispatch('annotations/patch', [destUuid, { body: annotation.body, target: annotation.target }])
}
}
}
......
......@@ -10,7 +10,7 @@
cell(:cell="cell", display="display")
q-page-sticky(position="top-right", :offset="[18, 18]", v-if="$store.state.auth.user")
q-btn(round, color="primary", small, @click="$router.push(`/mosys/grids/${$route.params.id}/annotate`)")
q-btn(round, color="primary", small, @click="$router.push(`/mosys/grids/${$route.params.uuid}/annotate`)")
q-icon(name="edit")
style-tag(v-if="styles || stylesheetUrl", :styles="styles", :url="stylesheetUrl")
......@@ -60,7 +60,7 @@
}
},
async mounted () {
await this.loadGrid(this.$route.params.id)
await this.loadGrid(this.$route.params.uuid)
},
methods: {
onScroll () {
......@@ -111,7 +111,7 @@
this.cells = this.annotations.map(annotation => {
try {
const cell = JSON.parse(annotation.body.value)
cell.uuid = annotation.uuid
cell._uuid = annotation._uuid
cell.id = annotation.id
cell.styleClass = annotation.target ? annotation.target.styleClass : undefined
return cell
......@@ -136,7 +136,7 @@
catch (e) {
console.debug('Failed to parse grid metadata annotation body', e)
}
if (metadata) this.gridMetadata = Object.assign(metadata, { uuid: annotation.uuid })
if (metadata) this.gridMetadata = Object.assign(metadata, { _uuid: annotation._uuid })
}
else {
this.gridMetadata = {
......@@ -152,7 +152,7 @@
{ dispatch } = this.$store,
annotation = this.getGridCellAnnotation(cell)
if (cell.uuid) await dispatch('annotations/patch', [cell.uuid, annotation])
if (cell._uuid) await dispatch('annotations/patch', [cell._uuid, annotation])
else await dispatch('annotations/post', annotation)
},
async updateGridMetadataStore () {
......@@ -160,7 +160,7 @@
{ dispatch } = this.$store,
mapAnnotation = this.getGridMetadataAnnotation(this.grid.id, this.gridMetadata)
if (this.gridMetadata.uuid) await dispatch('annotations/patch', [this.gridMetadata.uuid, mapAnnotation])
if (this.gridMetadata._uuid) await dispatch('annotations/patch', [this.gridMetadata._uuid, mapAnnotation])
else await dispatch('annotations/post', mapAnnotation)
this.updateGridDimensions()
......
......@@ -23,7 +23,7 @@
template(v-for="(cell, index) in cells")
.cell-item(
v-if="cellUIStates[cell.uuid] && !cellUIStates[cell.uuid].beingDragged",
v-if="cellUIStates[cell._uuid] && !cellUIStates[cell._uuid].beingDragged",
draggable="true",
@dragstart="event => {handleCellDragStart(event, cell)}",
@dragend="event => {handleCellDragEnd(event, cell)}",
......@@ -31,7 +31,7 @@
:style="getCellStyle(cell)",
:title="cell.title",
@click.prevent="event => {handleCellClick(event, cell)}",
:class="{selected: cellUIStates[cell.uuid] ? cellUIStates[cell.uuid].selected : false}",
:class="{selected: cellUIStates[cell._uuid] ? cellUIStates[cell._uuid].selected : false}",
:key="`cell-${index}`")
cell(:cell="cell", preview)
div.cell-item-resize-handle(
......@@ -66,7 +66,7 @@
div.fixed-top-right(style="right:18px; top:68px", v-if="!$store.state.mosys.showSources")
q-btn(round, color="primary", small, @click="handleGridButtonClickEdit", style="margin-right: 0.5em")
q-icon(name="add")
q-btn(round, color="primary", small, @click="$router.push(`/mosys/grids/${$route.params.id}`)")
q-btn(round, color="primary", small, @click="$router.push(`/mosys/grids/${$route.params.uuid}`)")
q-icon(name="remove red eye")
</template>
......@@ -191,7 +191,7 @@
},
handleCellResizerDragStart (event, cell) {
event.dataTransfer.setDragImage(nullImage, 0, 0)
this.cellUIStates[cell.uuid].beingResized = true
this.cellUIStates[cell._uuid].beingResized = true
let tmpCell = this.getTmpCell(cell)
this.tmpCells.push(tmpCell)
},
......@@ -199,16 +199,16 @@
let position = this.getGridPositionForEvent(event)
cell.width = Math.max(1, 1 + position.x - cell.x)
cell.height = Math.max(1, 1 + position.y - cell.y)
this.cellUIStates[cell.uuid].beingResized = false
this.cellUIStates[cell._uuid].beingResized = false
this.tmpCells = []
this.updateCellStore(cell)
},
handleCellClick (event, cell) {
this.cellUIStates[cell.uuid].selected = !this.cellUIStates[cell.uuid].selected
this.cellUIStates[cell._uuid].selected = !this.cellUIStates[cell._uuid].selected
this.updateSelectedCells()
},
handleCellDragStart (event, cell) {
if (this.cellUIStates[cell.uuid].beingResized) {
if (this.cellUIStates[cell._uuid].beingResized) {
}
else {
event.dataTransfer.setData('text/plain', JSON.stringify(cell))
......@@ -219,14 +219,14 @@
x: (event.clientX - elContainerBoundingBox.x) - (elBoundingBox.x - elContainerBoundingBox.x),
y: (event.clientY - elContainerBoundingBox.y) - (elBoundingBox.y - elContainerBoundingBox.y)
}
this.cellUIStates[cell.uuid].draggingOffset = offset
this.cellUIStates[cell.uuid].beginDragged = true
this.cellUIStates[cell._uuid].draggingOffset = offset
this.cellUIStates[cell._uuid].beginDragged = true
}
let tmpCell = this.getTmpCell(cell)
this.tmpCells.push(tmpCell)
},
handleCellDragEnd (event, cell) {
this.cellUIStates[cell.uuid].beingDragged = false
this.cellUIStates[cell._uuid].beingDragged = false
},
// handleCellContextMenuClick () {
// },
......@@ -235,10 +235,10 @@
// // this.$store.commit('mosys/setSourcesTab', 'tab-default-cells')
// },
async handleCellContextMenuDelete (event, cell) {
this.cellUIStates[cell.uuid].selected = false
this.cellUIStates[cell._uuid].selected = false
this.updateSelectedCells()
this.cells = this.cells.filter(c => c !== cell)
await this.$store.dispatch('annotations/delete', cell.uuid)
await this.$store.dispatch('annotations/delete', cell._uuid)
this.fetchCellAnnotations()
},
handleCellContextMenu (event) {
......@@ -260,7 +260,7 @@
else if (styleClass.indexOf('.') === 0) styleClass = styleClass.substr(1)
}
cell.styleClass = styleClass
this.$store.dispatch('annotations/patch', [cell.uuid, { target: { styleClass: styleClass || null } }])
this.$store.dispatch('annotations/patch', [cell._uuid, { target: { styleClass: styleClass || null } }])
}
catch (e) { /* dialog canceled */ }
},
......@@ -283,7 +283,7 @@
position = this.getGridPositionForEvent(event)
}
else {
offset = this.cellUIStates[cell.uuid].draggingOffset
offset = this.cellUIStates[cell._uuid].draggingOffset
position = this.getGridPositionForEvent(event, offset)
}
let tmpCell = this.tmpCells[0]
......@@ -309,10 +309,10 @@
let cellDropped = event.dataTransfer.getData('text/plain')
if (cellDropped) {
cellDropped = JSON.parse(cellDropped)
let cell = this.cells.find(c => c.uuid === cellDropped.uuid)
let cell = this.cells.find(c => c._uuid === cellDropped._uuid)
let offset, position
if (cell) {
offset = this.cellUIStates[cell.uuid].draggingOffset
offset = this.cellUIStates[cell._uuid].draggingOffset
position = this.getGridPositionForEvent(event, offset)
}
else {
......@@ -349,7 +349,7 @@
if (cell.x >= position.x) {
cell.x += 1
let annotation = this.getGridCellAnnotation(cell)
await this.$store.dispatch('annotations/patch', [cell.uuid, annotation])
await this.$store.dispatch('annotations/patch', [cell._uuid, annotation])
await this.fetchCellAnnotations()
}
}
......@@ -363,7 +363,7 @@
if (cell.x > position.x) {
cell.x -= 1
let annotation = this.getGridCellAnnotation(cell)
await this.$store.dispatch('annotations/patch', [cell.uuid, annotation])
await this.$store.dispatch('annotations/patch', [cell._uuid, annotation])
await this.fetchCellAnnotations()
}
}
......@@ -377,7 +377,7 @@
if (cell.y >= position.y) {
cell.y += 1
let annotation = this.getGridCellAnnotation(cell)
await this.$store.dispatch('annotations/patch', [cell.uuid, annotation])
await this.$store.dispatch('annotations/patch', [cell._uuid, annotation])
await this.fetchCellAnnotations()
}
}
......@@ -391,7 +391,7 @@
if (cell.y > position.y) {
cell.y -= 1
let annotation = this.getGridCellAnnotation(cell)
await this.$store.dispatch('annotations/patch', [cell.uuid, annotation])
await this.$store.dispatch('annotations/patch', [cell._uuid, annotation])
await this.fetchCellAnnotations()
}
}
......@@ -407,14 +407,14 @@
let selectedCells = Object.keys(this.cellUIStates).filter(k => {
return _this.cellUIStates[k].selected
}).map(k => {
return _this.cells.find(c => c.uuid === k)
return _this.cells.find(c => c._uuid === k)
})
this.$store.commit('mosys/setSelectedCells', selectedCells)
},
updateCellUIStates () {
let newCellUIStates = {}
this.cells.map(c => {
newCellUIStates[c.uuid] = {
newCellUIStates[c._uuid] = {
selected: false,
beingResized: false,
cell: c
......@@ -425,7 +425,7 @@
},
getTmpCell (cell, type = 'UIFeedback') {
return {
srcUuid: cell.uuid,
srcUuid: cell._uuid,
type: type,
x: cell.x,
y: cell.y,
......@@ -509,7 +509,7 @@
this.cells = result.items.map(annotation => {
let cell = JSON.parse(annotation.body.value)
if (cell) {
cell.uuid = annotation.uuid
cell._uuid = annotation._uuid
cell.id = annotation.id
cell.styleClass = annotation.target ? annotation.target.styleClass : undefined
cell.author = annotation.author
......@@ -528,7 +528,7 @@
let annotation = result.items.shift()
if (annotation) {
let metadata = JSON.parse(annotation.body.value)
metadata.uuid = annotation.uuid
metadata._uuid = annotation._uuid
if (metadata) {
this.gridMetadata = metadata
}
......@@ -574,8 +574,8 @@
},
async updateCellStore (cell) {
let annotation = this.getGridCellAnnotation(cell)
if (cell.uuid) {
await this.$store.dispatch('annotations/patch', [cell.uuid, annotation])
if (cell._uuid) {
await this.$store.dispatch('annotations/patch', [cell._uuid, annotation])
}
else {
await this.$store.dispatch('annotations/post', annotation)
......@@ -585,8 +585,8 @@
async updateGridMetadataStore () {
let mapAnnotation = this.getGridMetadataAnnotation(this.grid.id, this.gridMetadata)
if (this.gridMetadata.uuid) {
await this.$store.dispatch('annotations/patch', [this.gridMetadata.uuid, mapAnnotation])
if (this.gridMetadata._uuid) {
await this.$store.dispatch('annotations/patch', [this.gridMetadata._uuid, mapAnnotation])
}
await this.$store.dispatch('annotations/post', mapAnnotation)
this.updateGridDimensions()
......
......@@ -40,7 +40,7 @@
@dragstart.native="event => {handleItemDragStart(event, entry.annotation, 'Annotation-List')}",
name="comment", style="font-size: 1.8rem")
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}}
// timelines list
template(v-else)
......@@ -110,14 +110,14 @@
},
handleItemDragStart (event, item, type = 'Video') {
let videoCell = {
uuid: null,
_uuid: null,
type: type,
x: 1,
y: 1,
width: 1,
height: 1,
content: type === 'Video' ? item.body.source.id : item.uuid,
sourceUuid: item.uuid
content: type === 'Video' ? item.body.source.id : item._uuid,
sourceUuid: item._uuid
}
event.dataTransfer.setData('text/plain', JSON.stringify(videoCell))
}
......
......@@ -204,14 +204,13 @@ export default {
return index === this.inputIndex
},
async fetchAnnotations () {
const result = await this.$store.dispatch('annotations/find', { uuid: this.videoUuid })
const videoAnnotation = result.items.shift()
const videoAnnotation = await this.$store.dispatch('annotations/get', this.videoUuid)
if (videoAnnotation) {
this.video = videoAnnotation
this.contextTime = this.videoTime
const query = {
type: constants.MAP_TYPE_TIMELINE,
uuid: videoAnnotation.target.uuid
id: videoAnnotation.target.id
}
const mapResult = await this.$store.dispatch('maps/find', query)
const map = mapResult.items.shift()
......
......@@ -91,7 +91,7 @@
this.$root.$on('annotation-trigger', (annotation, annotationGlobalTime) => {
if (!_this.video) return
if (_this.video.target && annotation.target.id === _this.video.target.id) {
console.debug('CellVideo: received annotation-trigger', annotation.uuid, annotationGlobalTime.toISO())
console.debug('CellVideo: received annotation-trigger', annotation.id, annotationGlobalTime.toISO())
_this.setPlayerTimeFromDateTime(annotationGlobalTime)
}
})
......
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