Skip to content

Commit

Permalink
Merge branch 'release/0.13.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Mulholland committed Mar 28, 2018
2 parents 0594893 + c470881 commit 7dd4737
Show file tree
Hide file tree
Showing 140 changed files with 3,421 additions and 2,680 deletions.
3 changes: 1 addition & 2 deletions .cucumberproignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# ignore this features and don't display them in cucumber pro
# ignore this features and doesn't display them in cucumber pro
test/features/backlog
test/features/version_2
test/features/drafts
11 changes: 1 addition & 10 deletions .electron-vue/webpack.main.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@ const webpack = require('webpack')
const BabiliWebpackPlugin = require('babili-webpack-plugin')
const FixDefaultImportPlugin = require('webpack-fix-default-import-plugin')

let yargsParsed = require('yargs-parser').detailed(process.argv.slice(2), {
alias: {
filename: ['f']
},
configuration: {
'dot-notation': false
}
})
let mainConfig = {
entry: {
main: path.join(__dirname, '../src/main/index.js')
Expand Down Expand Up @@ -64,8 +56,7 @@ let mainConfig = {
},
plugins: [
new webpack.NoEmitOnErrorsPlugin(),
new FixDefaultImportPlugin(),
new webpack.DefinePlugin({clFilename: JSON.stringify(yargsParsed.argv.filename)})
new FixDefaultImportPlugin()
],
target: 'electron-main'
}
Expand Down
12 changes: 12 additions & 0 deletions .electron-vue/webpack.renderer.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,18 @@ let rendererConfig = {
? path.resolve(__dirname, '../node_modules')
: false
}),
new HtmlWebpackPlugin({
filename: 'errors.html',
template: path.resolve(__dirname, '../src/errors.ejs'),
minify: {
collapseWhitespace: true,
removeAttributeQuotes: true,
removeComments: true
},
nodeModules: process.env.NODE_ENV !== 'production'
? path.resolve(__dirname, '../node_modules')
: false
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoEmitOnErrorsPlugin(),
new FixDefaultImportPlugin()
Expand Down
14 changes: 6 additions & 8 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,17 @@ The best way to contribute financially to this project is to [join the ODI Austr

## Contribute Ideas and Feature Requests

Your idea for a feature addition may already exist on our [issues backlog](https://github.com/ODIQueensland/data-curator/issues) or [feature backlog](https://github.com/ODIQueensland/data-curator/tree/master/test/features/backlog). If the gist of your idea isn't there:
- [add an issue](https://github.com/ODIQueensland/data-curator/issues) - we'll label it with `f:feature-request`
- to discuss your idea privately, [contact us](https://theodi.org.au/contact/)
Your idea for a feature addition may already exist on our [issues backlog](https://github.com/ODIQueensland/data-curator/issues) or [feature backlog](https://github.com/ODIQueensland/data-curator/tree/master/test/features/backlog). If a similar idea is in the backlog, please join the conversation.

If a similar idea is in the backlog, please join the conversation.
If the gist of your idea isn't there:
- [request a feature](https://github.com/ODIQueensland/data-curator/issues/new?template=feature-request.md&labels=f:Feature-request&milestone=6&assignee=Stephen-Gates)
- to discuss your idea privately, [contact us](https://theodi.org.au/contact/).

## Contribute Issues

If you encounter a problem, please [add an issue](https://github.com/ODIQueensland/data-curator/issues). Make sure it hasn't already be reported.
If you encounter a problem, please [add an issue](https://github.com/ODIQueensland/data-curator/issues/new?template=bug.md&labels=problem:Bug&assignee=Stephen-Gates). Make sure it isn't [already reported](https://github.com/ODIQueensland/data-curator/issues).

In order for us to best respond to the issue, we need as much information about the issue as you can provide. Please fill in as many sections as apply from our issue ticket template to provide us with as much detail as possible. Provide a descriptive name for your issue.

If you're [able](https://help.github.com/articles/applying-labels-to-issues-and-pull-requests/) to, [select a label](https://github.com/theodi/toolbox/wiki/Labels-In-Use-Across-the-ODI-Toolbox) for your issue. We've adopted the ODI's approach to labelling issues. We may add or change labels on your issue to help us manage the issue backlog.
In order for us to best respond to the issue, we need as much information about the issue as you can provide. Please provide a descriptive name for your issue and provide us with as much detail as possible.

## Contribute Documentation

Expand Down
11 changes: 3 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![Appveyor Build status](https://ci.appveyor.com/api/projects/status/fahwo5shvb6jl9ux/?svg=true)](https://ci.appveyor.com/project/ODIQueensland/data-curator)

:sparkles: [Download Data Curator](https://github.com/ODIQueensland/data-curator/releases/latest) for Windows or macOS.
:bulb:[Request a new feature](https://github.com/ODIQueensland/data-curator/issues/new?template=feature-request.md&labels=f:Feature-request&milestone=6&assignee=Stephen-Gates) :beetle: [Report a bug](https://github.com/ODIQueensland/data-curator/issues/new?template=bug.md&labels=problem:Bug) :rocket: [View our plans](https://github.com/ODIQueensland/data-curator/milestones?direction=asc&sort=due_date&state=open)
:bulb:[Request a new feature](https://github.com/ODIQueensland/data-curator/issues/new?template=feature-request.md&labels=f:Feature-request&milestone=6&assignee=Stephen-Gates) :beetle: [Report a bug](https://github.com/ODIQueensland/data-curator/issues/new?template=bug.md&labels=problem:Bug&assignee=Stephen-Gates) :rocket: [View our plans](https://github.com/ODIQueensland/data-curator/milestones?direction=asc&sort=due_date&state=open)

# Data Curator

Expand Down Expand Up @@ -37,7 +37,7 @@ Using data from any of these sources, you can:

- automatically create a [schema](http://frictionlessdata.io/specs/table-schema/) that describes the data fields
- refine the schema to include extra [data validation rules](http://frictionlessdata.io/specs/table-schema/#constraints)
- describe the [provenance](https://relishapp.com/odi-australia/data-curator/docs/tools/set-provenance-information) of your data
- describe the provenance of your data
- save data as a valid CSV file in various [CSV dialects](http://frictionlessdata.io/specs/csv-dialect/)

The schema enables you to:
Expand Down Expand Up @@ -158,8 +158,7 @@ We have adopted [Standard JS](https://standardjs.com) as our JavaScript coding s
Acceptance tests for [Data Curator](https://github.com/ODIQueensland/data-curator/blob/master/README.md) are:

- written using the [Gherkin language](https://cucumber.io/docs/reference#gherkin) ([learn more](https://media.pragprog.com/titles/hwcuc/gherkin.pdf)) and stored [on GitHub](https://github.com/ODIQueensland/data-curator/tree/master/test/features)
- [shared](https://relishapp.com/odi-australia/data-curator/docs) using [Relish](https://relishapp.com) (which will be replaced by Cucumber Pro)
- [shared privately](https://app.cucumber.pro/projects/data-curator/documents/branch/develop) using the [Cucumber Pro](https://cucumber.io/pro) beta
- [shared](https://app.cucumber.pro/projects/data-curator/documents/branch/develop) using the [Cucumber Pro](https://cucumber.io/pro) beta.
- arranged in folders like the application menu structure
- integrated with:

Expand All @@ -173,10 +172,6 @@ Acceptance tests for [Data Curator](https://github.com/ODIQueensland/data-curato
- [Chai](http://chaijs.com)
- [Spectron-fake-dialog](https://github.com/joe-re/spectron-fake-dialog)

To push the acceptance tests (.feature and .md files) to Relish:

`relish push odi-australia/data-curator path /your-local-path/data-curator/test/features`

Acceptance tests are automatically added to Cucumber Pro via a GitHub webhook.

### Unit tests
Expand Down
15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "DataCurator",
"version": "0.12.0",
"version": "0.13.0",
"author": " <[email protected]>",
"description": "Data Curator is a simple desktop CSV editor to help describe, validate and share usable open data",
"license": "MIT",
Expand Down Expand Up @@ -78,9 +78,9 @@
},
"dependencies": {
"archiver": "^2.1.1",
"autosize": "^4.0.0",
"autosize": "^4.0.1",
"bootstrap": "3.3.7",
"components-font-awesome": "^4.7.0",
"components-font-awesome": "^5.0.6",
"csv": "^2.0.0",
"datapackage": "^1.0.5",
"escape-regexp": "^0.0.1",
Expand All @@ -93,7 +93,7 @@
"moment": "^2.21.0",
"pikaday": "^1.6.1",
"request": "^2.81.0",
"rxjs": "^5.5.2",
"rxjs": "^5.5.8",
"slug": "^0.9.1",
"sortablejs": "^1.6.0",
"spectron-fake-dialog": "^0.0.1",
Expand All @@ -106,6 +106,7 @@
"vue-async-computed": "^3.3.1",
"vue-directive-tooltip": "^1.4.1",
"vue-electron": "^1.0.6",
"vue-good-table": "^1.20.3",
"vue-router": "^3.0.1",
"vue-rx": "^5.0.0",
"vue-template-compiler": "^2.5.2",
Expand Down Expand Up @@ -136,10 +137,10 @@
"cucumber": "^4.0.0",
"cucumber-html-reporter": "^4.0.2",
"del": "^3.0.0",
"devtron": "^1.1.0",
"devtron": "^1.4.0",
"electron": "^1.8.2",
"electron-builder": "^19.27.2",
"electron-debug": "~1.4.0",
"electron-debug": "^1.5.0",
"electron-devtools-installer": "^2.0.1",
"eslint": "^4.18.2",
"eslint-config-standard": "^10.2.1",
Expand Down Expand Up @@ -172,7 +173,7 @@
"node-loader": "^0.6.0",
"nyc": "^11.4.1",
"require-dir": "^0.3.0",
"sinon": "^4.4.2",
"sinon": "^4.4.9",
"sinon-chai": "^2.14.0",
"sinon-test": "^2.1.3",
"spectron": "^3.7.1",
Expand Down
22 changes: 22 additions & 0 deletions src/errors.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Data Curator - Errors</title>
<% if (htmlWebpackPlugin.options.nodeModules) { %>
<!-- Add `node_modules/` to global paths so `require` works properly in development -->
<script>
require('module').globalPaths.push('<%= htmlWebpackPlugin.options.nodeModules.replace(/\\/g, '\\\\') %>')
</script>
<% } %>
</head>
<body>
<div id="errors" ></div>
<!-- Set `__static` path to static files in production -->
<script>
if (process.env.NODE_ENV !== 'development') window.__static = require('path').join(__dirname, '/static').replace(/\\/g, '\\\\')
</script>

<!-- webpack builds are automatically injected -->
</body>
</html>
2 changes: 1 addition & 1 deletion src/keyboardhelp.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html>
<head>
<meta charset="utf-8">
<title>Data Curator</title>
<title>Data Curator - Keyboard Help</title>
<% if (htmlWebpackPlugin.options.nodeModules) { %>
<!-- Add `node_modules/` to global paths so `require` works properly in development -->
<script>
Expand Down
5 changes: 5 additions & 0 deletions src/main/errors.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import {focusOrNewSecondaryWindow} from './windows'

export function showErrors() {
let browserWindow = focusOrNewSecondaryWindow('errors', {width: 760, height: 400})
}
39 changes: 15 additions & 24 deletions src/main/excel.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {BrowserWindow, ipcMain as ipc, dialog as Dialog} from 'electron'
import {ipcMain as ipc, dialog as Dialog} from 'electron'
import XLSX from 'xlsx'
import {createWindowTabWithData} from './utils'
import {createWindowTabWithData, focusOrNewSecondaryWindow} from './windows'
import {getSubMenuFromMenu} from './menu.js'

export function importExcel() {
Dialog.showOpenDialog({
Expand All @@ -17,36 +18,26 @@ export function importExcel() {
var first_sheet_name = workbook.SheetNames[0]
var worksheet = workbook.Sheets[first_sheet_name]

let popup
if (process.env.BABEL_ENV !== 'test') {
popup = new BrowserWindow({width: 300, height: 150, nodeIntegration: false})
} else {
popup = new BrowserWindow({width: 300, height: 150})
}
const winURL = process.env.NODE_ENV === 'development'
? `http://localhost:9080/openexcel.html`
: `file://${__dirname}/openexcel.html`
popup.loadURL(winURL)
popup.setMenu(null)
popup.webContents.on('did-finish-load', function() {
popup.webContents.send('loadSheets', workbook.SheetNames)
let shortcutsSubMenu = getSubMenuFromMenu('File', 'Open Excel Sheet...')
shortcutsSubMenu.enabled = false
let browserWindow = focusOrNewSecondaryWindow('openexcel', {width: 300, height: 150})
browserWindow.on('closed', function () {
shortcutsSubMenu.enabled = true
})
browserWindow.webContents.on('did-finish-load', function() {
browserWindow.webContents.send('loadSheets', workbook.SheetNames)
ipc.once('worksheetCanceled', function() {
if (popup) {
popup.close()
if (browserWindow) {
browserWindow.close()
}
})
ipc.once('worksheetSelected', function(e, sheet_name) {
let data = XLSX.utils.sheet_to_csv(workbook.Sheets[sheet_name])
if (popup) {
popup.close()
if (browserWindow) {
browserWindow.close()
}
createWindowTabWithData(data)
})
})
popup.on('closed', function(e) {
if (popup) {
popup = null
}
})
})
}
45 changes: 17 additions & 28 deletions src/main/file.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {dialog as Dialog, BrowserWindow, ipcMain as ipc} from 'electron'
import Fs from 'fs'
import {enableSave, createWindowTabWithFormattedDataFile} from './utils'
import {enableSave, createWindowTabWithFormattedDataFile, focusMainWindow} from './windows'
import _ from 'lodash'
let path = require('path')

Expand All @@ -20,12 +20,12 @@ let path = require('path')
// }

// function saveAsCustom() {
// let currentWindow = BrowserWindow.getFocusedWindow()
// let currentWindow = focusMainWindow()
// let dialog
// if (process.env.BABEL_ENV !== 'test') {
// dialog = new BrowserWindow({width: 200, height: 400, nodeIntegration: false})
// } else {
// if (process.env.BABEL_ENV === 'test' || process.env.NODE_ENV === 'development') {
// dialog = new BrowserWindow({width: 200, height: 400})
// } else {
// dialog = new BrowserWindow({width: 200, height: 400, nodeIntegration: false})
// }
// dialog.setMenu(null)
// dialog.once('closed', function() {
Expand All @@ -40,10 +40,8 @@ let path = require('path')
// dialog.loadURL(`http://localhost:9080/#/customformat`)
// }

function saveFileAs(format, currentWindow) {
if (!currentWindow) {
currentWindow = BrowserWindow.getFocusedWindow()
}
export function saveFileAs(format) {
let currentWindow = focusMainWindow()
Dialog.showSaveDialog({
filters: format.filters,
defaultPath: global.tab.activeTitle
Expand Down Expand Up @@ -77,18 +75,18 @@ function savedFilenameExists(filename) {
return length - filtered.length > threshold
}

function saveFile() {
let currentWindow = BrowserWindow.getFocusedWindow()
export function saveFile() {
let currentWindow = focusMainWindow()
currentWindow.webContents.send('saveData', currentWindow.format, global.tab.activeFilename)
}

// function openCustom() {
// // var window = BrowserWindow.getFocusedWindow()
// // var window = focusMainWindow()
// let dialog
// if (process.env.BABEL_ENV !== 'test') {
// dialog = new BrowserWindow({width: 200, height: 400, nodeIntegration: false})
// } else {
// if (process.env.BABEL_ENV === 'test' || process.env.NODE_ENV === 'development') {
// dialog = new BrowserWindow({width: 200, height: 400})
// } else {
// dialog = new BrowserWindow({width: 200, height: 400, nodeIntegration: false})
// }
// dialog.setMenu(null)
// dialog.once('closed', function() {
Expand All @@ -104,7 +102,7 @@ function saveFile() {
// }

export function importDataPackage() {
let window = BrowserWindow.getFocusedWindow()
let window = focusMainWindow()
Dialog.showOpenDialog({
filters: [
{
Expand All @@ -121,7 +119,7 @@ export function importDataPackage() {
})
}

function openFile(format) {
export function openFile(format) {
Dialog.showOpenDialog({
filters: format.filters
}, function(filenames) {
Expand All @@ -139,7 +137,7 @@ ipc.on('openFileIntoTab', (event, arg1, arg2) => {
readFile(arg1, arg2)
})

function readFile(filename, format) {
export function readFile(filename, format) {
if (openedFilenameExists(filename)) {
showAlreadyOpenedFileDialog()
return
Expand All @@ -156,7 +154,7 @@ function readFile(filename, format) {

// TODO: consider toggle global var and use with debounce to check when last dialog triggered so don't get too many dialogs for multiple file opens
function showAlreadyOpenedFileDialog() {
Dialog.showMessageBox(BrowserWindow.getFocusedWindow(), {
Dialog.showMessageBox(focusMainWindow(), {
type: 'warning',
// title is not displayed on screen on macOS
title: 'File not opened',
Expand All @@ -169,12 +167,3 @@ function showAlreadyOpenedFileDialog() {
function openedFilenameExists(filename) {
return _.indexOf(global.tab.filenames, filename) > -1
}

export {
openFile,
// openCustom,
readFile,
saveFileAs,
// saveAsCustom,
saveFile
}
Loading

0 comments on commit 7dd4737

Please sign in to comment.