diff options
author | Jacob Schatz <jschatz1@gmail.com> | 2017-04-08 07:18:37 +0300 |
---|---|---|
committer | Luke "Jared" Bennett <lbennett@gitlab.com> | 2017-04-10 16:56:43 +0300 |
commit | ef07200cd0f059a2e0493779263aa526a2ade2e3 (patch) | |
tree | 0d3e727d510998b7af7e45648ef72cfb14161878 /app/assets/javascripts/blob | |
parent | acea881bb012cce0b59f3d5874a630b16d0caaef (diff) |
Get initial sql values back from file which is database
Diffstat (limited to 'app/assets/javascripts/blob')
-rw-r--r-- | app/assets/javascripts/blob/balsamiq/index.js | 27 | ||||
-rw-r--r-- | app/assets/javascripts/blob/balsamiq_viewer.js | 5 |
2 files changed, 32 insertions, 0 deletions
diff --git a/app/assets/javascripts/blob/balsamiq/index.js b/app/assets/javascripts/blob/balsamiq/index.js new file mode 100644 index 00000000000..04201366897 --- /dev/null +++ b/app/assets/javascripts/blob/balsamiq/index.js @@ -0,0 +1,27 @@ +import Vue from 'vue'; +import sqljs from 'sql.js'; + +export default class BalsamiqViewer { + constructor(el) { + this.el = el; + this.loadSqlFile(); + } + + + + loadSqlFile() { + var xhr = new XMLHttpRequest(); + console.log(this.el) + xhr.open('GET', this.el.dataset.endpoint, true); + xhr.responseType = 'arraybuffer'; + + xhr.onload = function(e) { + var uInt8Array = new Uint8Array(this.response); + var db = new SQL.Database(uInt8Array); + var contents = db.exec("SELECT * FROM thumbnails"); + console.log(contents) + // contents is now [{columns:['col1','col2',...], values:[[first row], [second row], ...]}] + }; + xhr.send(); + } +}
\ No newline at end of file diff --git a/app/assets/javascripts/blob/balsamiq_viewer.js b/app/assets/javascripts/blob/balsamiq_viewer.js new file mode 100644 index 00000000000..b1493398099 --- /dev/null +++ b/app/assets/javascripts/blob/balsamiq_viewer.js @@ -0,0 +1,5 @@ +import BalsamiqViewer from './balsamiq'; + +document.addEventListener('DOMContentLoaded', () => { + new BalsamiqViewer(document.getElementById('js-balsamiq-viewer')); +});
\ No newline at end of file |