Skip to content

Commit 5a4096a

Browse files
committed
0.1.1-preview
- Update packages - Fix bug when file is removed - General housekeeping
1 parent 4f3efca commit 5a4096a

File tree

10 files changed

+237
-115
lines changed

10 files changed

+237
-115
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "augmentable-sql",
3-
"version": "0.1.0",
3+
"version": "0.1.1",
44
"description": "Augmentable SQL",
55
"main": "main/index.js",
66
"scripts": {
@@ -16,11 +16,11 @@
1616
"author": "Patrick DeVivo",
1717
"devDependencies": {
1818
"electron": "~1.7.8",
19-
"electron-builder": "^19.33.0",
19+
"electron-builder": "^19.34.1",
2020
"electron-devtools-installer": "^2.2.0"
2121
},
2222
"dependencies": {
23-
"alasql": "^0.4.2",
23+
"alasql": "^0.4.3",
2424
"electron-is-dev": "^0.3.0",
2525
"electron-remote": "^1.2.0",
2626
"md5-file": "^3.2.3",

ui/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
22
"name": "ui",
3-
"version": "0.1.0",
3+
"version": "0.1.1",
44
"private": true,
55
"dependencies": {
66
"@blueprintjs/core": "^1.30.0",
77
"@blueprintjs/table": "1.27.0",
88
"brace": "^0.10.0",
9-
"mobx": "^3.3.0",
9+
"mobx": "^3.3.1",
1010
"mobx-react": "^4.3.3",
1111
"normalize.css": "^7.0.0",
1212
"numbro": "^1.11.0",

ui/src/components/App.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import './styles.css';
88
import numbro from 'numbro';
99
import moment from 'moment';
1010
import MainStore from 'stores/MainStore';
11+
import _ from 'lodash';
1112

1213
import SQL from './SQL';
1314
import Controls from './Controls';
@@ -31,13 +32,15 @@ class App extends Component {
3132
MainStore.setFileHovering(false);
3233
}
3334
}
35+
pluralize(count, baseWord) {
36+
return count !== 1 ? `${baseWord}s` : baseWord;
37+
}
3438
render() {
3539
const {latestResults} = MainStore.toJS();
36-
console.log(latestResults)
3740
return (
3841
<div className="App">
3942
<nav id="title-bar">
40-
<span>{latestResults ? `${numbro(latestResults.itemCount).format()} rows. ${moment.duration(latestResults.executionTime).asSeconds()} seconds.` : 'Augmentable SQL'}</span>
43+
<span>{latestResults ? `${numbro(latestResults.itemCount).format()} ${this.pluralize(latestResults.itemCount, 'row')}. ${moment.duration(latestResults.executionTime).asSeconds()} seconds. Previewing ${_.size(latestResults.preview)} ${this.pluralize(_.size(latestResults.preview), 'row')}.` : 'Augmentable SQL'}</span>
4144
</nav>
4245

4346
<div id="contents">

ui/src/components/Controls.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class Controls extends Component {
3131
}
3232

3333
render() {
34-
const {currentSQL, files, fileHovering} = MainStore.toJS();
34+
const {currentSQL, files} = MainStore.toJS();
3535

3636
return (
3737
<div id="controls-container">

ui/src/components/FileList.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@ const path = window.require('path');
88
const {shell} = window.require('electron')
99

1010
class FileList extends Component {
11-
constructor(props) {
12-
super(props);
13-
}
14-
1511
render() {
1612
const {files} = MainStore.toJS();
1713
return (
@@ -28,7 +24,7 @@ class FileList extends Component {
2824
}}
2925
onClick={() => shell.showItemInFolder(file)}
3026
>
31-
<strong>${i}</strong> {path.basename(file)}
27+
<strong>${i+1}</strong> {path.basename(file)}
3228
</Tag>
3329
)
3430
})}

ui/src/components/Results.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {Table, Column, Cell, ColumnHeaderCell} from '@blueprintjs/table';
99
class Results extends Component {
1010

1111
render() {
12-
const {latestResults, currentSQL, queryError} = MainStore.toJS();
12+
const {latestResults, queryError} = MainStore.toJS();
1313
const columns = (latestResults && !_.isEmpty(latestResults.preview)) ? _.keys(latestResults.preview[0]) : [];
1414

1515
return (

ui/src/components/SQL.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import React, {Component} from 'react';
22
import {observer} from 'mobx-react';
3-
import _ from 'lodash';
43
import MainStore from 'stores/MainStore';
54
import AceEditor from 'react-ace';
65
import brace from 'brace';
@@ -22,7 +21,7 @@ class SQL extends Component {
2221
}
2322

2423
render() {
25-
const {files, currentSQL} = MainStore.toJS();
24+
const {currentSQL} = MainStore.toJS();
2625
return (
2726
<div id="sql-container" onKeyPress={this.onKeyPress}>
2827
<AceEditor

ui/src/stores/MainStore.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {extendObservable, observable, toJS} from 'mobx';
1+
import {extendObservable, toJS} from 'mobx';
22
import _ from 'lodash';
33
const {app} = window.require('electron').remote;
44

@@ -9,7 +9,7 @@ class MainStore {
99
sqlHistory: [],
1010
latestResults: undefined,
1111
queryError: null,
12-
files: observable.map(),
12+
files: [],
1313
fileHovering: false
1414
});
1515

@@ -27,7 +27,8 @@ class MainStore {
2727
const {currentSQL, files} = this.toJS();
2828
this.latestResults = null;
2929
this.queryError = null;
30-
window.worker.alasql(currentSQL, files, app.getPath('userData'))
30+
const fileMap = _.reduce(files, (accum, filePath, i) => ({...accum, [i+1]: filePath}), {});
31+
window.worker.alasql(currentSQL, fileMap, app.getPath('userData'))
3132
.then(res => {
3233
this.latestResults = res;
3334
console.log(res)
@@ -39,15 +40,13 @@ class MainStore {
3940
}
4041

4142
loadFile(filePath) {
42-
const fileCount = this.files.size;
4343
const alreadyLoaded = _.includes(this.files.values(), filePath)
4444
if (alreadyLoaded) return;
45-
this.files.set(`${fileCount + 1}`, filePath);
45+
this.files.push(filePath);
4646
}
4747

48-
removeFile(filePathKey) {
49-
const {files} = this.toJS();
50-
this.files.delete(filePathKey)
48+
removeFile(filePathIndex) {
49+
this.files.splice(filePathIndex, 1);
5150
}
5251

5352
toJS() {

ui/yarn.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4265,9 +4265,9 @@ mobx-react@^4.3.3:
42654265
dependencies:
42664266
hoist-non-react-statics "^2.3.1"
42674267

4268-
mobx@^3.3.0:
4269-
version "3.3.0"
4270-
resolved "https://registry.yarnpkg.com/mobx/-/mobx-3.3.0.tgz#1bc1dd7e78547065af04b49bdb7f2098cada47aa"
4268+
mobx@^3.3.1:
4269+
version "3.3.1"
4270+
resolved "https://registry.yarnpkg.com/mobx/-/mobx-3.3.1.tgz#c38fc1a287a0dda3f5d4b85efe1137fedd9dcdf0"
42714271

42724272
42734273
version "2.0.0"

0 commit comments

Comments
 (0)