Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output vendor interface #59

Merged
merged 34 commits into from
Jul 20, 2020
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
035ef38
WIP define interface by creating json output
baruchiro Jun 10, 2020
89e8c64
init Json output
baruchiro Jun 11, 2020
070a40c
export outputs vendors
baruchiro Jun 11, 2020
75a0131
WIP
baruchiro Jun 14, 2020
c361c25
Create form-field based on properties
baruchiro Jun 26, 2020
bfe3ee9
Merge branch 'unifyRepos' into outputVendorInterface
baruchiro Jun 26, 2020
30e3286
Back to ncp
baruchiro Jun 26, 2020
2640879
Fix merge
baruchiro Jun 26, 2020
2806a68
git mv -f .\src\store\modules\config.js .\src\store\modules\Config.js
baruchiro Jun 26, 2020
96441d0
Exporter from config **NOT READY**
baruchiro Jun 28, 2020
e5b4403
Persist state
baruchiro Jun 29, 2020
a3889d5
WIP
baruchiro Jul 1, 2020
a3f79e5
remove test eslint
baruchiro Jul 1, 2020
fc051fc
Promise not resolved
baruchiro Jul 14, 2020
4a84e53
Update lint
baruchiro Jul 14, 2020
880439d
Remove comment
baruchiro Jul 14, 2020
6c086ee
Merge branch 'workaround' into outputVendorInterface
baruchiro Jul 14, 2020
931bb77
rename, save only if changed
baruchiro Jul 14, 2020
9935bb8
Test with pseudo interface
baruchiro Jul 14, 2020
36e7e48
Add index.js to GoogleSheets and YNAB
baruchiro Jul 14, 2020
db790e1
Revert "Add index.js to GoogleSheets and YNAB"
baruchiro Jul 15, 2020
8c1e049
Remove App.vue
baruchiro Jul 15, 2020
4a85c2f
Get input vendors from configManager
baruchiro Jul 15, 2020
14ab3cd
Register FormField globally
baruchiro Jul 15, 2020
879d0de
TODOs
baruchiro Jul 15, 2020
b3a02d8
Remove debugger
brafdlog Jul 17, 2020
c95f9f5
Remove comment
baruchiro Jul 17, 2020
9c4956b
Add default importer status
brafdlog Jul 17, 2020
bf2ddd8
Use the library's scraper and map importer parameter names
brafdlog Jul 17, 2020
355352a
Merge branch 'addTypescript2' into outputVendorInterface
brafdlog Jul 17, 2020
758c4b7
Fix output vendor active check
brafdlog Jul 17, 2020
2c4b2b1
remove debugging code
brafdlog Jul 17, 2020
edffee7
Merge branch 'outputVendorInterfaceWithTS' into outputVendorInterface
brafdlog Jul 19, 2020
2e01412
Merge branch 'unifyRepos' into outputVendorInterface
brafdlog Jul 19, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ module.exports = {
'comma-dangle': 'off',
'no-await-in-loop': 'off',
'import/prefer-default-export': 'off',
'no-unused-vars': ['error', { args: 'after-used', argsIgnorePattern: '^_' }]
'no-unused-vars': ['error', { args: 'after-used', argsIgnorePattern: '^_|h' }],
'arrow-body-style': 'off',
},

overrides: [
Expand Down
8 changes: 3 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"build": "vue-cli-service electron:build",
"postinstall": "electron-builder install-app-deps",
"postuninstall": "electron-builder install-app-deps",
"prepare": "cp -n src/originalBudgetTrackingApp/categoryCalculationScript-example.js src/originalBudgetTrackingApp/categoryCalculationScript.js || true",
"prepare": "ncp src/originalBudgetTrackingApp/categoryCalculationScript-example.js src/originalBudgetTrackingApp/categoryCalculationScript.js || true",
"lint": "eslint --ext .js,.vue -f ./node_modules/eslint-friendly-formatter src",
"lint:fix": "yarn lint --fix",
"test": "yarn unit && yarn e2e",
Expand Down Expand Up @@ -78,7 +78,9 @@
"jest": "^26.0.1",
"jest-circus": "^26.0.1",
"jest-config": "^26.0.1",
"jest-each": "^26.0.1",
"jest-environment-jsdom": "^26.0.1",
"ncp": "^2.0.0",
"prettier": "^2.0.5",
"replace-in-file": "5.0.2",
"sass": "^1.26.3",
Expand All @@ -90,9 +92,5 @@
"vue-template-compiler": "^2.6.11",
"vuetify-loader": "^1.4.4"
},
"resolutions": {
"deepmerge": "^4.0.0",
"electron-builder": "^22.0.0"
},
"snyk": true
}
14 changes: 0 additions & 14 deletions src/App.vue

This file was deleted.

13 changes: 13 additions & 0 deletions src/Splash.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<template>
<div>splash</div>
</template>

<script>
export default {
name: 'Splash'
};
</script>

<style>

</style>
10 changes: 6 additions & 4 deletions src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { app, BrowserWindow } from 'electron';
import { createProtocol, installVueDevtools } from 'vue-cli-plugin-electron-builder/lib';
import CreateLogger from './logger';
import { initializeReporter } from './modules/reporting';
import './store';
// import './store';

initializeReporter();

Expand All @@ -16,7 +16,6 @@ let mainWindow;
global.logger = CreateLogger(app);
const { logger } = global;


function createWindow() {
// Create the browser window.
mainWindow = new BrowserWindow({
Expand All @@ -28,14 +27,17 @@ function createWindow() {
},
});

// Workaround from https://github.com/electron/electron/issues/19554
const loadURL = (url) => setTimeout(() => mainWindow.loadURL(url), 100);

if (process.env.WEBPACK_DEV_SERVER_URL) {
// Load the url of the dev server if in development mode
mainWindow.loadURL(process.env.WEBPACK_DEV_SERVER_URL);
loadURL(process.env.WEBPACK_DEV_SERVER_URL);
if (!process.env.IS_TEST) mainWindow.webContents.openDevTools();
} else {
createProtocol('app');
// Load the index.html when not in development
mainWindow.loadURL('app://./index.html');
loadURL('app://./index.html');
}
mainWindow.on('closed', () => {
mainWindow = null;
Expand Down
1 change: 0 additions & 1 deletion src/components/MainPage/DataTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ const detailes = properties.map((prop) => ({

const tableFooterHeight = 59;


export default {
name: 'DataTable',
data() {
Expand Down
83 changes: 11 additions & 72 deletions src/components/MainPage/Exporters.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,89 +5,28 @@
Exporters
</v-toolbar-title>
</v-toolbar>
<v-expansion-panels>
<v-expansion-panel
v-for="comp in exportersComponents"
:key="comp.name"
:name="comp.name"
>
<v-expansion-panel-header disable-icon-rotate>
{{ comp.title }}
<template v-slot:actions>
<v-tooltip
v-if="statuses[comp.name].lastMessage !== null"
left
>
<template v-slot:activator="{ on }">
<v-icon
:color="iconClass(statuses[comp.name].success).color"
dark
v-on="on"
>
{{ iconClass(statuses[comp.name].success).icon }}
</v-icon>
</template>
<span>{{ statuses[comp.name].lastMessage }}</span>
</v-tooltip>
</template>
</v-expansion-panel-header>
<v-expansion-panel-content>
<component
:is="comp.name"
:message.sync="statuses[comp.name].lastMessage"
:success.sync="statuses[comp.name].success"
/>
</v-expansion-panel-content>
</v-expansion-panel>
</v-expansion-panels>
<exporter
v-for="vendor in vendors"
:key="vendor.name"
:vendor="vendor"
/>
</div>
</template>

<script>
import JsonExporter from './Exporters/JsonExporter';
import SpreadsheetExporter from './Exporters/SpreadsheetExporter';

const exportersComponents = {
JsonExporter,
SpreadsheetExporter,
};

const statuses = {};
Object.keys(exportersComponents).forEach((key) => {
statuses[key] = {
lastMessage: null,
success: null,
};
});
import { outputVendors } from '@/originalBudgetTrackingApp';
import Exporter from './Exporters/Exporter';

export default {
components: { ...exportersComponents },
components: { Exporter },
data() {
return {
accordionActiveItem: '',
exportersComponents,
statuses,
statuses: {},
};
},
methods: {
iconClass(success) {
if (success === true) {
return {
icon: 'mdi-check-circle',
color: 'green',
};
}
if (success === false) {
return {
icon: 'mdi-alert-circle',
color: 'error',
};
}
return {
icon: 'mdi-help-circle',
color: 'info',
};
},
computed: {
vendors: () => outputVendors,
},
};
</script>
Expand Down
83 changes: 83 additions & 0 deletions src/components/MainPage/Exporters/Exporter.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<template>
<v-expansion-panels>
<v-expansion-panel>
<v-expansion-panel-header disable-icon-rotate>
{{ vendor.displayName }}
</v-expansion-panel-header>
<v-expansion-panel-content>
<v-form
ref="form"
v-model="validated"
>
<form-field
v-for="(fieldProps, fieldName) in vendor.fields"
:key="fieldName"
v-bind="fieldProps"
:value="loadedExporter[fieldName]"
@input="updateExporter($event, fieldName)"
/>
<v-btn
color="primary"
:disabled="disableSave"
@click="submitForm()"
>
Save
</v-btn>
</v-form>
</v-expansion-panel-content>
</v-expansion-panel>
</v-expansion-panels>
</template>

<script>
import FormField from '@/components/shared/FormField';
import { GET_EXPORTER_GETTER, ADD_EXPORTER_ACTION } from '@/store/modules/Config';

// TODO checkbox enabled/disabled
// TODO rename to Exporter
export default {
name: 'JsonExporter',
components: {
// TODO register global
FormField
},
props: {
vendor: {
type: Object,
required: true,
}
},
data() {
return {
exporter: {},
validated: true,
changed: false,
};
},
computed: {
loadedExporter() {
return this.$store.getters[GET_EXPORTER_GETTER](this.vendor.name);
},
disableSave() {
return !this.validated || !this.changed;
}
},
methods: {
updateExporter(value, fieldName) {
this.changed = true;
this.exporter[fieldName] = value;
},
submitForm() {
if (this.$refs.form.validate()) {
// TODO the arguments should be simple
this.$store.dispatch(ADD_EXPORTER_ACTION, { name: this.vendor.name, ...this.loadedExporter, ...this.exporter })
.then(() => { this.changed = false; });
}
},
},
};
</script>

<style scoped>

</style>
94 changes: 0 additions & 94 deletions src/components/MainPage/Exporters/JsonExporter.vue

This file was deleted.

Loading