Skip to content
Snippets Groups Projects
Verified Commit ef07200c authored by Jacob Schatz's avatar Jacob Schatz Committed by Luke "Jared" Bennett
Browse files

Get initial sql values back from file which is database

parent acea881b
No related branches found
No related tags found
No related merge requests found
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
import BalsamiqViewer from './balsamiq';
document.addEventListener('DOMContentLoaded', () => {
new BalsamiqViewer(document.getElementById('js-balsamiq-viewer'));
});
\ No newline at end of file
import renderBalsamiq from './balsamiq';
document.addEventListener('DOMContentLoaded', renderBalsamiq);
\ No newline at end of file
Loading
Loading
@@ -15,6 +15,10 @@ var DEV_SERVER_LIVERELOAD = process.env.DEV_SERVER_LIVERELOAD !== 'false';
var WEBPACK_REPORT = process.env.WEBPACK_REPORT;
 
var config = {
// because sqljs requires fs.
node: {
fs: "empty"
},
context: path.join(ROOT_PATH, 'app/assets/javascripts'),
entry: {
common: './commons/index.js',
Loading
Loading
@@ -118,6 +122,7 @@ var config = {
'merge_conflicts',
'notebook_viewer',
'pdf_viewer',
'balsamiq_viewer',
'vue_pipelines',
],
minChunks: function(module, count) {
Loading
Loading
Loading
Loading
@@ -35,6 +35,7 @@
"raphael": "^2.2.7",
"raw-loader": "^0.5.1",
"select2": "3.5.2-browserify",
"sql.js": "^0.4.0",
"stats-webpack-plugin": "^0.4.3",
"three": "^0.84.0",
"three-orbit-controls": "^82.1.0",
Loading
Loading
Loading
Loading
@@ -4154,6 +4154,10 @@ sprintf-js@~1.0.2:
version "1.0.3"
resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c"
 
sql.js@^0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/sql.js/-/sql.js-0.4.0.tgz#23be9635520eb0ff43a741e7e830397266e88445"
sshpk@^1.7.0:
version "1.10.2"
resolved "https://registry.yarnpkg.com/sshpk/-/sshpk-1.10.2.tgz#d5a804ce22695515638e798dbe23273de070a5fa"
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment