Skip to content

Commit

Permalink
check if nodes exist
Browse files Browse the repository at this point in the history
Signed-off-by: Cleopatra Enjeck M <patrathewhiz@gmail.com>
  • Loading branch information
enjeck committed Feb 22, 2024
1 parent 741b424 commit 49bef8b
Showing 1 changed file with 27 additions and 22 deletions.
49 changes: 27 additions & 22 deletions src/pages/Context.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@

<h1> Context Tables</h1>
<div v-for="table in contextTables">

Check failure on line 9 in src/pages/Context.vue

View workflow job for this annotation

GitHub Actions / NPM lint

Elements in iteration expect to have 'v-bind:key' directives
<TableWrapper :table="table" :columns="tableData['columns' + table.id]"
:rows="tableData['rows' + table.id]" :view-setting="viewSetting"
@create-column="createColumn(false, table)"
<TableWrapper :table="table" :columns="tableData['columns' + table.id]" :rows="tableData['rows' + table.id]"
:view-setting="viewSetting" @create-column="createColumn(false, table)"
@import="openImportModal(table, false)" @download-csv="downloadCSV(table, false)" />
</div>

Expand Down Expand Up @@ -49,12 +48,14 @@ export default {
...mapState(['tables', 'contexts', 'activeContextId']),
tableData() {
const data = {}
for (const [key, node] of Object.entries(this.context.nodes)) {
if (node.node_type) {
const rowId = 'rows' + node.node_id
const colId = 'columns' + node.node_id
data[colId] = this.$store.state.data.columns[(node.node_id).toString()]
data[rowId] = this.$store.state.data.rows[(node.node_id).toString()]
if (this.context && this.context.nodes) {
for (const [key, node] of Object.entries(this.context.nodes)) {

Check failure on line 52 in src/pages/Context.vue

View workflow job for this annotation

GitHub Actions / NPM lint

'key' is assigned a value but never used
if (node.node_type) {
const rowId = 'rows' + node.node_id
const colId = 'columns' + node.node_id
data[colId] = this.$store.state.data.columns[(node.node_id).toString()]
data[rowId] = this.$store.state.data.rows[(node.node_id).toString()]
}
}
}
return data
Expand All @@ -67,7 +68,7 @@ export default {
},
},
async mounted() {
async mounted() {
await this.reload()
},
Expand All @@ -77,18 +78,22 @@ export default {
const index = this.contexts.findIndex(c => parseInt(c.id) === parseInt(this.activeContextId))
this.context = this.contexts[index]
for (const [key, node] of Object.entries(this.context.nodes)) {
if (node.node_type === 'table') {
const table = this.tables.find(table => table.id === node.node_id)
this.contextTables.push(table)
await this.$store.dispatch('loadColumnsFromBE', {
view: null,
tableId: node.node_id,
})
await this.$store.dispatch('loadRowsFromBE', {
viewId: null,
tableId: node.node_id,
})
console.log(this.contexts, this.activeContextId)

Check failure on line 81 in src/pages/Context.vue

View workflow job for this annotation

GitHub Actions / NPM lint

Unexpected console statement
console.log(this.context)

Check failure on line 82 in src/pages/Context.vue

View workflow job for this annotation

GitHub Actions / NPM lint

Unexpected console statement
if (this.context && this.context.nodes) {
for (const [key, node] of Object.entries(this.context.nodes)) {

Check failure on line 84 in src/pages/Context.vue

View workflow job for this annotation

GitHub Actions / NPM lint

'key' is assigned a value but never used
if (node.node_type === 'table') {
const table = this.tables.find(table => table.id === node.node_id)
this.contextTables.push(table)
await this.$store.dispatch('loadColumnsFromBE', {
view: null,
tableId: node.node_id,
})
await this.$store.dispatch('loadRowsFromBE', {
viewId: null,
tableId: node.node_id,
})
}
}
}
},
Expand Down

0 comments on commit 49bef8b

Please sign in to comment.