-
Notifications
You must be signed in to change notification settings - Fork 27
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
Implemented: support to sync the mappings with server, added support to update and delete field mapping, and improved the UI for the functionality(#85zrhcq56) #159
Conversation
…mproved logic related to creating the mappings(#85zrhcq56)
…roved the code to save the mappings in state(#85zrhcq56)
…ue regarding mapping pref id is not behaving correctly(#85zrhcq56)
… and added toast message on api success(#85zrhcq56)
…mapping when selete a mapping(#85zrhcq56)
…ated structure(#85zrhcq56)
9e79d68
to
e3c4795
Compare
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.
LGTM 👍🏻
…of unwanted variable(#85zrhcq56)
areAllFieldsSelected() { | ||
return Object.values(this.fieldMapping).every(field => field !== ""); | ||
}, | ||
generateUniqueMappingPrefId(): any { |
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.
If we are using the server APIs this might not be needed
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.
Sir, as the id is required in the api when creating preference, so generating the id here.
Will create an issue to remove this code when the api will be updated.
return | ||
} | ||
const id = this.generateUniqueMappingPrefId(); | ||
return this.store.dispatch("user/createFieldMapping", { id, name: this.mappingName, value: this.fieldMapping }).then(() => { |
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.
We could use await
<ion-list> | ||
<ion-item> | ||
<ion-label>{{ $t("Order ID") }}</ion-label> | ||
<ion-select interface="popover" v-if="content.length" :placeholder = "$t('Select')" v-model="fieldMapping.orderId"> |
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 think we should not have content check here, we should not allow the user to open create mapping modal if there is no content from the parent page
src/store/modules/user/actions.ts
Outdated
// TODO add any other tasks if need | ||
commit(types.USER_END_SESSION) | ||
resetConfig(); | ||
this.dispatch('order/clearOrderList'); | ||
// clearning field mappings and current mapping when user logout |
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.
// clearning field mappings and current mapping when user logout | |
// clearing field mappings and current mapping when the user logout |
src/store/modules/user/actions.ts
Outdated
// TODO add any other tasks if need | ||
commit(types.USER_END_SESSION) | ||
resetConfig(); | ||
this.dispatch('order/clearOrderList'); | ||
// clearning field mappings and current mapping when user logout | ||
commit(types.USER_FIELD_MAPPING_UPDATED, {}) | ||
dispatch('updateCurrentMapping', '') |
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.
We should not pass an empty string, even if we want to reset. Think of better approach.
"inputFields": { | ||
"mappingPrefTypeEnumId": "IMPORT_MAPPING_PREF" | ||
}, | ||
"fieldList": ["mappingPrefName", "mappingPrefId", "mappingPrefValue"], |
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.
Add filter by date condition
src/store/modules/user/mutations.ts
Outdated
state.fieldMappings[payload.mappingPrefId] = payload; | ||
}, | ||
[types.USER_FIELD_MAPPING_UPDATED] (state, payload) { | ||
if(payload.id) { |
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.
This should not be done here, we should set the mapping value in mutation and modifications should be done actions
src/store/modules/user/mutations.ts
Outdated
state.fieldMappings = payload; | ||
} | ||
}, | ||
[types.USER_FIELD_MAPPING_DELETED] (state, id) { |
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.
This might not be needed, we could use USER_FIELD_MAPPING_UPDATED
src/views/PurchaseOrder.vue
Outdated
}, | ||
areAllFieldsSelected() { | ||
return Object.values(this.fieldMapping).every(field => field !== ""); | ||
}, | ||
async addFieldMapping() { | ||
const fieldMappingModal = await modalController.create({ |
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.
const fieldMappingModal = await modalController.create({ | |
const createMappingModal = await modalController.create({ |
src/views/SavedMappings.vue
Outdated
async viewMappingConfiguration(mapping: any, id: string) { | ||
this.currentMapping = { | ||
id, | ||
...mapping |
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 think this might not be needed
…rhcq56) Removed: deleted mapping mutation and used updated mutation for deletion of mappings Improved: comment and variable name for mapping modal Moved: logic from mutation to actions
Related Issues
Closes #129
Short Description and Why It's Useful
Screenshots of Visual Changes before/after (If There Are Any)
Saved Mapping:
Saved Mapping with configuration component:
Purchase Order:
Create field mapping model:
Mobile View (for configuration component):
IMPORTANT NOTICE - Remember to add changelog entry
Contribution and Currently Important Rules Acceptance
Additional Information: