-
Notifications
You must be signed in to change notification settings - Fork 43
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
Implement exporters config ui #107
Merged
Merged
Changes from 8 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
5b9e3ec
Add Json Exporter
Arielgordon123 40a903e
Merge remote-tracking branch 'origin/unifyRepos' into exportersBaruch
baruchiro 1ceb9e7
fix merge lint
baruchiro e32f357
main.ts remove @ts-nocheck use composition
baruchiro 9a48ff0
Merge branch 'unifyRepos' into exportersBaruch
baruchiro 508914c
Wrap exporters with ExpansionPanel
baruchiro a121a48
Merge branch 'unifyRepos' into exportersBaruch
baruchiro 1974ef0
Merge branch 'direct-vuex' into exportersBaruch
baruchiro ee613b6
Merge remote-tracking branch 'origin/unifyRepos' into exportersBaruch
baruchiro b50f477
Create JsonExporter (not saving)
baruchiro 49cd140
JsonExporter
baruchiro c5c7d9f
Merge remote-tracking branch 'origin/unifyRepos' into exportersBaruch
baruchiro 3fb7392
Initial implementation of google sheets exporter configuration component
brafdlog a11dce9
Initialize YnabExporter with almost nothing differ from JsonExporter
baruchiro 91cb9f6
Merge branch 'exportersBaruch' of https://github.com/brafdlog/budget-…
baruchiro 36d393d
Extract common exporter form logic to a common function
brafdlog 7f265b0
Add budget id input to ynab config
brafdlog 0a5ff4d
Allow saving when changing text in ynab exporter form
brafdlog ff03f32
Add ui for configuration of ynab account mapping
brafdlog 8abef66
Align the plus button to the right
brafdlog e1b30b6
Add required validation to account mapping fields
brafdlog ee0d950
Extract ynab account mapping table to a separate component
brafdlog 9a7dcb2
Don't set state to be the default config - fix issue with wrong accou…
brafdlog 360be86
Unify the two definitions of OutputVendorName
brafdlog 8eb9632
Make naming consistent
brafdlog a1bb31a
use emit from setup
baruchiro 62d4026
Apply suggestions from code review
baruchiro eff92df
Custom event name 'mappingChanged' must be kebab-case.eslint-plugin-vue
baruchiro e958ec1
change instead of custom name
baruchiro 8934166
Work with v-model
baruchiro 91feae6
Cleanup
baruchiro 3c4f936
change to input
baruchiro 9bc42d1
meaningful names
baruchiro File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<template> | ||
<v-simple-table dense> | ||
<template v-slot:default> | ||
<thead> | ||
<tr> | ||
<th>Account number</th> | ||
<th>Ynab account id</th> | ||
<th>Delete</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr | ||
v-for="accountNumberAndId in accountNumbersToYnabAccountIds" | ||
:key="accountNumberAndId.accountNumber" | ||
> | ||
<td> | ||
<v-text-field | ||
v-model="accountNumberAndId.accountNumber" | ||
full-width | ||
dense | ||
:rules="[rules.required]" | ||
@keydown="$emit('mappingChanged')" | ||
/> | ||
</td> | ||
<td> | ||
<v-text-field | ||
v-model="accountNumberAndId.ynabAccountId" | ||
full-width | ||
dense | ||
:rules="[rules.required]" | ||
@keydown="$emit('mappingChanged')" | ||
/> | ||
</td> | ||
<td> | ||
<v-btn | ||
icon | ||
color="red" | ||
@click="deleteAccountMapping(accountNumberAndId.accountNumber)" | ||
> | ||
<v-icon>mdi-delete</v-icon> | ||
</v-btn> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</template> | ||
</v-simple-table> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import Vue from 'vue'; | ||
import { required } from '@/components/shared/formValidations'; | ||
|
||
export default Vue.extend({ | ||
name: 'YnabAccountMappingTable', | ||
props: { | ||
accountNumbersToYnabAccountIds: { | ||
type: Array, | ||
required: true | ||
} | ||
}, | ||
setup(_props) { | ||
return { | ||
deleteAccountMapping(accountNumberToDelete) { | ||
// @ts-ignore | ||
this.$emit('deleteAccountMapping', accountNumberToDelete); | ||
}, | ||
addAccountMapping() { | ||
// @ts-ignore | ||
this.$emit('addAccountMapping'); | ||
}, | ||
rules: { | ||
required | ||
} | ||
}; | ||
} | ||
baruchiro marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}); | ||
</script> | ||
|
||
<style scoped> | ||
|
||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { cloneDeep } from 'lodash'; | ||
import { computed, reactive, ref } from '@vue/composition-api'; | ||
import { VForm } from '@/types/vuetify'; | ||
import store from '@/store'; | ||
import { OutputVendorName } from '@/originalBudgetTrackingApp/commonTypes'; | ||
|
||
export function setupExporterConfigForm<T extends OutputVendorName>(exporterName: T) { | ||
const vForm = ref<VForm>(); | ||
|
||
const exporter = reactive(cloneDeep(store.getters.Config.getExporter(exporterName))); | ||
|
||
const validated = ref(true); | ||
const changed = ref(false); | ||
const readyToSave = computed(() => validated && changed); | ||
const submit = async () => { | ||
if (vForm.value?.validate()) { | ||
await store.dispatch.Config.updateExporter({ name: exporterName, exporter }); | ||
baruchiro marked this conversation as resolved.
Show resolved
Hide resolved
|
||
changed.value = false; | ||
} | ||
}; | ||
|
||
return { | ||
validated, changed, readyToSave, submit, exporter, vForm | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export function required(value) { | ||
return !!value || 'Required.'; | ||
} | ||
|
||
export function positive(value: number) { | ||
return value > 0 || 'Must be grater than 0'; | ||
} | ||
baruchiro marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have a bug here:
Account number
.Also, the + button is stuck after that (and maybe without these steps)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't research this deeply. Just a question (I'm not sure how Two Way Binding works, I'm always googling it), why you're using these
events
and not just usev-model
?As I remember,
v-model
is shortcut forvalue
prop andinput
event, so you can get an array of pairs, and add/remove/change it insideYnabAccountMappingTable
, andemit
it in any change.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Solved. I don't know if my solution is better in all the aspects, but I think we need to use
v-model
.Then I had a lot of problems, I worked on this a day, so first I managed to get it to work, and now we have something to improve.