Commit 052783b4 authored by anton's avatar anton

Wrap cells/get calls in object checks

parent 2729a8d3
Pipeline #55245 passed with stage
in 5 minutes and 37 seconds
......@@ -71,7 +71,9 @@
},
methods: {
async getCell () {
this.cell = await this.$store.dispatch('cells/get', this.annotation.body.source.id)
if (this.annotation) {
this.cell = await this.$store.dispatch('cells/get', this.annotation.body.source.id)
}
},
onScroll () {
const
......
......@@ -372,10 +372,12 @@
async getCells (annotations) {
this.cells = []
for (let i = 0; i < annotations.length; i++) {
let c = await this.$store.dispatch('cells/get', annotations[i].body.source.id)
c.configuration.value = Object.assign({}, c.configuration._value, { path: 'content' })
this.cells.push(c)
this.cellSourceValues[c.id] = c.source._value
if (annotations[i]) {
let c = await this.$store.dispatch('cells/get', annotations[i].body.source.id)
c.configuration.value = Object.assign({}, c.configuration._value, {path: 'content'})
this.cells.push(c)
this.cellSourceValues[c.id] = c.source._value
}
}
},
async handleItemChanged (value, cell, path) {
......
......@@ -742,26 +742,28 @@
}
},
async copyCell (event, annotation) {
this.$store.commit('mosys/setEditingCells', '')
if (annotation) {
this.$store.commit('mosys/setEditingCells', '')
this.$q.notify({
message: 'Copied.',
color: 'dark',
textColor: 'white',
position: 'bottom-right'
})
this.$q.notify({
message: 'Copied.',
color: 'dark',
textColor: 'white',
position: 'bottom-right'
})
const _cell = await this.$store.dispatch('cells/get', annotation.body.source.id)
const resourceCell = {
source: {
value: { content: '' }
},
configuration: {
value: {},
component: _cell.configuration._value.component
const _cell = await this.$store.dispatch('cells/get', annotation.body.source.id)
const resourceCell = {
source: {
value: { content: '' }
},
configuration: {
value: {},
component: _cell.configuration._value.component
}
}
this.$store.commit('mosys/cacheNewCell', resourceCell)
}
this.$store.commit('mosys/cacheNewCell', resourceCell)
},
addCell () {
if (this.cachedNewCell) {
......@@ -851,10 +853,12 @@
})
},
async getCellType (annotation) {
let
cell = await this.$store.dispatch('cells/get', annotation.body.source.id),
cellType = cell.configuration._value.component
this.selectedCell.type = cellType.substr(4, cellType.length - 4)
if (annotation) {
let
cell = await this.$store.dispatch('cells/get', annotation.body.source.id),
cellType = cell.configuration._value.component
this.selectedCell.type = cellType.substr(4, cellType.length - 4)
}
},
async setCellPosition (annotation, x, y) {
// this.$el.scrollLeft = this.$el.scrollLeft + (this.gridDimensions.full.cell.width * _x)
......
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