Skip to content

Commit

Permalink
Merge branch 'release/0.5.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Mulholland committed Nov 15, 2017
2 parents b2ace33 + dad5290 commit cc4edff
Show file tree
Hide file tree
Showing 35 changed files with 577 additions and 147 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ Using Data Curator open data producers can:

Using data from any of these sources, you can:

- automatically create a [schema](http://specs.frictionlessdata.io/table-schema/) that describes the data fields
- refine the schema to include extra [data validation rules](http://specs.frictionlessdata.io/table-schema/#constraints)
- 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
- save data as a valid CSV file in various [CSV dialects](http://specs.frictionlessdata.io/csv-dialect/)
- save data as a valid CSV file in various [CSV dialects](http://frictionlessdata.io/specs/csv-dialect/)

The schema enables you to:

Expand Down
56 changes: 28 additions & 28 deletions help-tags.csv
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,31 @@ Close Tab,Tab,Close Data Tab
Close Panel,All Panels,Close Panel
Next,Property Panels,Next Property Panel
Previous,Property Panels,Previous Property Panel
Name,Column Property,"The <a href=""http://specs.frictionlessdata.io/table-schema/#name"">Name</a> of the column. Usually the value of the first row in the column."
Title,Column Property,"A human readable <a href=""http://specs.frictionlessdata.io/table-schema/#title"">Title</a> for the column."
Description,Column Property,"A <a href=""http://specs.frictionlessdata.io/table-schema/#description"">Description</a> of the column"
Type,Column Property,"Choose a <a href=""http://specs.frictionlessdata.io/table-schema/#types-and-formats"">Type</a> for the data in the column"
Format,Column Property,"Choose the <a href=""http://specs.frictionlessdata.io/table-schema/#types-and-formats"">Format</a> for the Type of data"
RDF Type,Column Property,"Set a <a href=""http://specs.frictionlessdata.io/table-schema/#rich-types"">RDF Type</a> to provide extra meaning to the Type"
Constraint,Column Property,"Set a <a href=""http://specs.frictionlessdata.io/table-schema/#constraints"">Constraint</a> to limit valid values"
Missing Value,Column Property,"Value(s) that indicate a <a href=""http://specs.frictionlessdata.io/table-schema/#missing-values"">Missing Value</a>. Separate values with a comma."
Name,Table Property,"The <a href=""http://specs.frictionlessdata.io/data-resource/#name"">Name</a>of the Table. Lower case, numbers, ""."", ""_"", ""-"" characters only"
Title,Table Property,"The <a href=""http://specs.frictionlessdata.io/data-resource/#optional-properties"">Title</a> or one sentence description for this Table"
Description,Table Property,"A <a href=""http://specs.frictionlessdata.io/data-resource/#optional-properties"">Description</a> for the Table"
Sources,Table Property,"The <a href=""http://specs.frictionlessdata.io/data-resource/#optional-properties"">Sources</a> for the data in this Table. Each Source MUST have a title and MAY have path and/or email address."
License,Table Property,"The Open <a href=""http://specs.frictionlessdata.io/data-resource/#optional-properties"">License</a> under which the Table is provided"
CSV Dialect,Table Property,"Select the <a href=""http://specs.frictionlessdata.io/tabular-data-resource/#csv-dialect"">CSV Dialect</a> for the Table"
Primary Key,Table Property,"Select the column(s) that are the <a href=""http://specs.frictionlessdata.io/table-schema/#primary-key"">Primary Key</a> that uniquely identifies each row in the table."
Foreign Key Table,Table Property,"Select the table to reference for the <a href=""http://specs.frictionlessdata.io/table-schema/#foreign-keys"">Foreign Key</a>"
Foreign Key Columns,Table Property,"Select the column(s) that make up the <a href=""http://specs.frictionlessdata.io/table-schema/#foreign-keys"">Foreign Key Table</a>"
Name,Data Package Property,"The <a href=""http://specs.frictionlessdata.io/data-package/#name"">Name</a> of the Data Package. Lower case, numbers, ""."", ""_"", ""-"" characters only"
Id,Data Package Property,"A globally unique identifier (<a href=""http://specs.frictionlessdata.io/data-package/#id"">Id</a>) e.g. a UUID or DOI"
License,Data Package Property,"The Open <a href=""http://specs.frictionlessdata.io/data-package/#licenses"">License</a> under which the Data Package is provided"
Title,Data Package Property,"A <a href=""http://specs.frictionlessdata.io/data-package/#title"">Title</a> or one sentence description for this Data Package"
Description,Data Package Property,"The first paragraph of the <a href=""http://specs.frictionlessdata.io/data-package/#description"">Description</a> should be usable as summary information for the package. Markdown formatting allowed."
Home Page,Data Package Property,"The <a href=""http://specs.frictionlessdata.io/data-package/#homepage"">Home Page</a>"
Version,Data Package Property,"The <a href=""http://specs.frictionlessdata.io/data-package/#version"">Version</a> of the data package. It should conform to the [Data Package Version Pattern](http://specs.frictionlessdata.io/patterns/#data-package-version)."
Sources,Data Package Property,"A list of <a href=""http://specs.frictionlessdata.io/data-package/#sources"">Sources</a> for this Data Package. Each Source MUST have a title and MAY have path and/or email address."
Contributors,Data Package Property,"A list of <a href=""http://specs.frictionlessdata.io/data-package/#contributors"">Contributors</a> (people or organisations) who contributed to this Data Package"
Keywords,Data Package Property,"A list of <a href=""http://specs.frictionlessdata.io/data-package/#keywords"">Keywords</a> to assist users searching for the package in catalogs"
Image URL,Data Package Property,"The URL of an <a href=""http://specs.frictionlessdata.io/data-package/#image"">Image</a> to use for this Data Package."
Name,Column Property,"The <a href=""http://frictionlessdata.io/specs/table-schema/#name"">Name</a> of the column. Usually the value of the first row in the column."
Title,Column Property,"A human readable <a href=""http://frictionlessdata.io/specs/table-schema/#title"">Title</a> for the column."
Description,Column Property,"A <a href=""http://frictionlessdata.io/specs/table-schema/#description"">Description</a> of the column"
Type,Column Property,"Choose a <a href=""http://frictionlessdata.io/specs/table-schema/#types-and-formats"">Type</a> for the data in the column"
Format,Column Property,"Choose the <a href=""http://frictionlessdata.io/specs/table-schema/#types-and-formats"">Format</a> for the Type of data"
RDF Type,Column Property,"Set a <a href=""http://frictionlessdata.io/specs/table-schema/#rich-types"">RDF Type</a> to provide extra meaning to the Type"
Constraint,Column Property,"Set a <a href=""http://frictionlessdata.io/specs/table-schema/#constraints"">Constraint</a> to limit valid values"
Missing Value,Column Property,"Value(s) that indicate a <a href=""http://frictionlessdata.io/specs/table-schema/#missing-values"">Missing Value</a>. Separate values with a comma."
Name,Table Property,"The <a href=""http://frictionlessdata.io/specs/data-resource/#name"">Name</a>of the Table. Lower case, numbers, ""."", ""_"", ""-"" characters only"
Title,Table Property,"The <a href=""http://frictionlessdata.io/specs/data-resource/#optional-properties"">Title</a> or one sentence description for this Table"
Description,Table Property,"A <a href=""http://frictionlessdata.io/specs/data-resource/#optional-properties"">Description</a> for the Table"
Sources,Table Property,"The <a href=""http://frictionlessdata.io/specs/data-resource/#optional-properties"">Sources</a> for the data in this Table. Each Source MUST have a title and MAY have path and/or email address."
License,Table Property,"The Open <a href=""http://frictionlessdata.io/specs/data-resource/#optional-properties"">License</a> under which the Table is provided"
CSV Dialect,Table Property,"Select the <a href=""http://frictionlessdata.io/specs/tabular-data-resource/#csv-dialect"">CSV Dialect</a> for the Table"
Primary Key,Table Property,"Select the column(s) that are the <a href=""http://frictionlessdata.io/specs/table-schema/#primary-key"">Primary Key</a> that uniquely identifies each row in the table."
Foreign Key Table,Table Property,"Select the table to reference for the <a href=""http://frictionlessdata.io/specs/table-schema/#foreign-keys"">Foreign Key</a>"
Foreign Key Columns,Table Property,"Select the column(s) that make up the <a href=""http://frictionlessdata.io/specs/table-schema/#foreign-keys"">Foreign Key Table</a>"
Name,Data Package Property,"The <a href=""http://frictionlessdata.io/specs/data-package/#name"">Name</a> of the Data Package. Lower case, numbers, ""."", ""_"", ""-"" characters only"
Id,Data Package Property,"A globally unique identifier (<a href=""http://frictionlessdata.io/specs/data-package/#id"">Id</a>) e.g. a UUID or DOI"
License,Data Package Property,"The Open <a href=""http://frictionlessdata.io/specs/data-package/#licenses"">License</a> under which the Data Package is provided"
Title,Data Package Property,"A <a href=""http://frictionlessdata.io/specs/data-package/#title"">Title</a> or one sentence description for this Data Package"
Description,Data Package Property,"The first paragraph of the <a href=""http://frictionlessdata.io/specs/data-package/#description"">Description</a> should be usable as summary information for the package. Markdown formatting allowed."
Home Page,Data Package Property,"The <a href=""http://frictionlessdata.io/specs/data-package/#homepage"">Home Page</a>"
Version,Data Package Property,"The <a href=""http://frictionlessdata.io/specs/data-package/#version"">Version</a> of the data package. It should conform to the [Data Package Version Pattern](http://frictionlessdata.io/specs/patterns/#data-package-version)."
Sources,Data Package Property,"A list of <a href=""http://frictionlessdata.io/specs/data-package/#sources"">Sources</a> for this Data Package. Each Source MUST have a title and MAY have path and/or email address."
Contributors,Data Package Property,"A list of <a href=""http://frictionlessdata.io/specs/data-package/#contributors"">Contributors</a> (people or organisations) who contributed to this Data Package"
Keywords,Data Package Property,"A list of <a href=""http://frictionlessdata.io/specs/data-package/#keywords"">Keywords</a> to assist users searching for the package in catalogs"
Image URL,Data Package Property,"The URL of an <a href=""http://frictionlessdata.io/specs/data-package/#image"">Image</a> to use for this Data Package."
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "DataCurator",
"version": "0.5.0",
"version": "0.5.1",
"author": " <matt@redboxresearchdata.com.au>",
"description": "Data Curator is a simple desktop CSV editor to help describe, validate and share usable open data",
"license": "MIT",
Expand Down Expand Up @@ -79,8 +79,8 @@
"bootstrap.native": "^2.0.17",
"components-font-awesome": "^4.7.0",
"datapackage": "^1.0.5",
"electron-prebuilt-compile": "^1.7.9",
"escape-regexp": "^0.0.1",
"etl": "^0.5.8",
"exports-loader": "^0.6.4",
"font-awesome": "^4.7.0",
"handsontable": "^0.34.5",
Expand All @@ -101,6 +101,7 @@
"svgo": "^1.0.0",
"tableschema": "^1.4.1",
"temp": "^0.8.3",
"unzipper": "^0.8.11",
"vee-validate": "^2.0.0-rc.18",
"vue": "^2.5.2",
"vue-async-computed": "^3.3.1",
Expand Down Expand Up @@ -132,10 +133,10 @@
"css-loader": "^0.28.4",
"del": "^3.0.0",
"devtron": "^1.1.0",
"electron": "^1.7.5",
"electron-builder": "^19.27.2",
"electron-debug": "^1.1.0",
"electron-devtools-installer": "^2.0.1",
"electron-prebuilt-compile": "^1.7.9",
"eslint": "^4.10.0",
"eslint-config-standard": "^10.2.1",
"eslint-friendly-formatter": "^3.0.0",
Expand Down
64 changes: 37 additions & 27 deletions src/main/file.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {dialog as Dialog, BrowserWindow} from 'electron'
import {dialog as Dialog, BrowserWindow, ipcMain as ipc} from 'electron'
import Fs from 'fs'
import {enableSave, createWindowTabWithFormattedDataFile} from './utils'
let path = require('path')
Expand Down Expand Up @@ -114,37 +114,47 @@ function openFile(format) {
Dialog.showOpenDialog({
filters: format.filters
}, function(filenames) {
readFile(filenames, format)
if (filenames === undefined || filenames.length === 0) {
return
}
readFile(filenames[0], format)
})
}

function openedFilenameExists(filename) {
return _.indexOf(global.tab.filenames, filename) > -1
}
ipc.on('openFileIntoTab', (event, arg) => {
readFile(arg)
})

function readFile(filenames, format) {
if (filenames !== undefined) {
let filename = filenames[0]
if (openedFilenameExists(filename)) {
Dialog.showMessageBox(BrowserWindow.getFocusedWindow(), {
type: 'warning',
// title is not displayed on screen on macOS
title: 'File not opened',
message: `The file was not opened.
You selected a file name that is already used in this Data Package.
A file may only be opened once.`
})
return
}
Fs.readFile(filename, 'utf-8', function(err, data) {
if (err) {
console.log(err.stack)
} else {
createWindowTabWithFormattedDataFile(data, format, filename)
// enableSave()
}
})
function readFile(filename, format) {
if (openedFilenameExists(filename)) {
showAlreadyOpenedFileDialog()
return
}
Fs.readFile(filename, 'utf-8', function(err, data) {
if (err) {
console.log(err.stack)
} else {
createWindowTabWithFormattedDataFile(data, format, filename)
// enableSave()
}
})
}

// 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() {
console.log('showing dialog...')
Dialog.showMessageBox(BrowserWindow.getFocusedWindow(), {
type: 'warning',
// title is not displayed on screen on macOS
title: 'File not opened',
message: `The file was not opened.
You selected a file name that is already used in this Data Package.
A file may only be opened once.`
})
}

function openedFilenameExists(filename) {
return _.indexOf(global.tab.filenames, filename) > -1
}

export {
Expand Down
2 changes: 1 addition & 1 deletion src/main/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const template = [
}, {
label: 'Open Data Package...',
// turned off for Beta release
enabled: false,
enabled: true,
click() {
importDataPackage()
}
Expand Down
26 changes: 21 additions & 5 deletions src/renderer/components/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,10 @@ export default {
'pushTabTitle',
'pushTabObject',
'destroyHotTab',
'destroyTabObject'
'destroyTabObject',
'resetPackagePropertiesToObject',
'resetTablePropertiesToObject',
'resetColumnPropertiesToObject'
]),
closeMessages: function() {
for (let el of ['main-bottom-panel', 'main-middle-panel']) {
Expand Down Expand Up @@ -348,8 +351,21 @@ export default {
console.log(err)
}
},
importDataPackage: function(filename) {
unzipFile(filename)
storeResetCallback(allProperties) {
console.log('all properties are:')
console.log(allProperties)
this.resetPackagePropertiesToObject(allProperties.package)
this.resetTablePropertiesToObject(allProperties.tables)
this.resetColumnPropertiesToObject(allProperties.columns)
},
importDataPackage: async function(filename) {
let message = await unzipFile(filename, this.storeResetCallback)
console.log(`message is...`)
console.log(message)
this.messagesTitle = message ? 'Import Data Package Error' : 'Import Data Package Success'
this.messages = message || 'All Properties have been imported.'
this.messagesType = 'feedback'
this.reportFeedback()
},
exportPackageFeedback: function() {
this.messagesTitle = 'Export package success'
Expand Down Expand Up @@ -678,8 +694,8 @@ export default {
vueGuessProperties()
})
const vueImportDataPackage = this.importDataPackage
ipc.on('importDataPackage', function(event, filename) {
vueImportDataPackage(filename)
ipc.on('importDataPackage', function(event, arg) {
vueImportDataPackage(arg[0])
})
const vueValidateTable = this.validateTable
ipc.on('validateTable', function(event, arg) {
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/data-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require('jquery-csv/src/jquery.csv.js')
export function loadDataIntoHot(hot, data, format) {
let arrays
// if no format specified, default to csv
if (typeof format === 'undefined') {
if (typeof format === 'undefined' || !format) {
arrays = $.csv.toArrays(data)
} else {
arrays = $.csv.toArrays(data, format.options)
Expand Down
3 changes: 2 additions & 1 deletion src/renderer/exportPackage.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import fs from 'fs-extra'
import path from 'path'
import archiver from 'archiver'
import {remote} from 'electron'
import tabStore from '@/store/modules/tabs.js'
Expand Down Expand Up @@ -58,7 +59,7 @@ function zipJson(archive, json) {

function zipResources(archive) {
for (let filename of tabStore.getters.getTabFilenames(tabStore.state)) {
let name = extractNameFromFile(filename)
let name = path.basename(filename)
archive.append(fs.createReadStream(filename), { name: name, prefix: 'data' })
}
}
Expand Down
Loading

0 comments on commit cc4edff

Please sign in to comment.