Skip to content

Commit 97f9ee8

Browse files
committed
Added simple error handling to SQL query editor
1 parent d6cf46b commit 97f9ee8

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

public/visifile_drivers/all_system_components/appSqliteEditorComponent.js

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ use_db("todo")
4040
pane_sql_queryResults: [],
4141
pane_sql_query: "",
4242
pane_sql_tabulator: null,
43+
pane_sql_message: null
4344
}
4445
},
4546
template: `<div style='background-color:white; ' >
@@ -361,6 +362,14 @@ use_db("todo")
361362
v-on:click="pane_sql_executeQuery()" >Run</button>
362363
</div>
363364
365+
<div style="width: 78% ;border: 1px solid blue;display: inline-block;height:300px;vertical-align: top;padding: 10px;"
366+
v-if='pane_sql_message && (selectedTab=="sql")'>
367+
<div style="height: 300px;display: inline-block; width:100%;color: red">
368+
{{ pane_sql_message }}
369+
</div>
370+
</div>
371+
372+
364373
<div style="width: 78% ;border: 1px solid blue;display: inline-block;height:300px;vertical-align: top;"
365374
v-if='pane_sql_queryResults && (pane_sql_queryResults.length > 0) && (selectedTab=="sql")'>
366375
<div id="pane_sql_db_editor_grid_view_parent" style="height: 300px;display: inline-block; width:100%;">
@@ -374,6 +383,8 @@ use_db("todo")
374383
</div>
375384
</div>
376385
386+
387+
377388
378389
<pre v-if='$DEBUGUI == "true"' style="margin-top: 500px;border: solid 1px blue;padding: 5px;">
379390
--------------------------------------------------------------------
@@ -1390,20 +1401,25 @@ use_db("todo")
13901401
// SQL Pane
13911402
pane_sql_executeQuery: async function ( ) {
13921403
let mm = this
1404+
mm.pane_sql_message = null
13931405
let codeId = await mm.getCurrentCommitId()
13941406
let baseComponentId = yz.helpers.getValueOfCodeString(mm.text,"base_component_id")
13951407
let results = await sqlRx( codeId , baseComponentId , mm.pane_sql_query )
1396-
mm.pane_sql_queryResults = results
13971408
if (mm.pane_sql_tabulator != null) {
13981409
mm.pane_sql_tabulator = null
13991410
let parentEl = document.getElementById("pane_sql_db_editor_grid_view_parent")
14001411
if (parentEl) {
14011412
parentEl.innerHTML = '';
14021413
}
14031414
}
1415+
if (typeof(results) == "undefined") {
1416+
mm.pane_sql_message = "An error occurred"
1417+
} else {
1418+
mm.pane_sql_queryResults = results
14041419

1405-
if (mm.pane_sql_queryResults.length > 0) {
1406-
await mm.pane_sql_drawTabulatorGrid()
1420+
if (mm.pane_sql_queryResults.length > 0) {
1421+
await mm.pane_sql_drawTabulatorGrid()
1422+
}
14071423
}
14081424
},
14091425
pane_sql_drawTabulatorGrid: async function ( ) {

0 commit comments

Comments
 (0)