-
Notifications
You must be signed in to change notification settings - Fork 102
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
Journal export csv with custom options #1554
Journal export csv with custom options #1554
Conversation
☔ The latest upstream changes (presumably 033d9cd) made this pull request unmergeable. Please resolve the merge conflicts. |
☔ The latest upstream changes (presumably ac06db3) made this pull request unmergeable. Please resolve the merge conflicts. |
☔ The latest upstream changes (presumably 9f17d54) made this pull request unmergeable. Please resolve the merge conflicts. |
@jniles could you review this PR |
Working on it! |
☔ The latest upstream changes (presumably 4df53c2) made this pull request unmergeable. Please resolve the merge conflicts. |
☔ The latest upstream changes (presumably 7cf8682) made this pull request unmergeable. Please resolve the merge conflicts. |
☔ The latest upstream changes (presumably 6bc89ba) made this pull request unmergeable. Please resolve the merge conflicts. |
…into fix_journal_export
…into fix_journal_export
…into fix_journal_export
…into fix_journal_export
@jniles could you review this PR please |
@@ -60,7 +60,7 @@ | |||
"MISSING_DATES":"Date(s) manquante(s)", | |||
"MISSING_DOCUMENT_ID":"Ligne(s) sans ID Document", | |||
"MISSING_ENTITY":"Ligne(s) sans ID entite", | |||
"MISSING_FISCAL_OR_PERIOD":"Annee fiscale ou periode omise", | |||
"MISSING_FISCAL_OR_PERIOD":"Année fiscale ou periode omise", |
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.
👍
@@ -5,7 +5,8 @@ var bhima = angular.module('bhima', [ | |||
'tmh.dynamicLocale', 'ngFileUpload', 'ui.grid', | |||
'ui.grid.selection', 'ui.grid.autoResize', 'ui.grid.resizeColumns', | |||
'ui.grid.edit', 'ui.grid.grouping', 'ui.grid.treeView', 'ui.grid.cellNav', | |||
'ui.grid.pagination', 'ui.grid.moveColumns', 'angularMoment', 'ngMessages', | |||
'ui.grid.pagination', 'ui.grid.moveColumns', 'ui.grid.exporter', |
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.
Hmm... is this possible to do without the exporter service? I don't see where it is used and I hate to introduce another dependency for something we can almost already do...
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.
Yes but with a lot of supplementary request to the server, also if we don't use the exporter service we cannot share the client service for exporting with custom name to other modules.
The first reason of using exporter service
was because the trial balance request is so complex, and using this request again and again is not useful when we don't have a lot of data at client and data are already at the client we have just to export them.
Also exporter service
give us more options for exportation which are flexible and we can use them in other modules with less effort
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.
Your analysis is correct - for the trial balance, it is more work to export a CSV from the server side.
My biggest worry with this change is that, as a developer, I do not know when to use the server-side CSV rather than the client-side CSV. It creates another question to ask during development and something else to test....
function GridExport(gridOptions, defaultRows, defaultCols) { | ||
|
||
this.gridOptions = gridOptions; | ||
this.ROWS = defaultRows; |
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.
It took me a little while to realize that these aren't actually rows .. it's a string. Could you name it something like defaultRowKey
or something?
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.
👍
@@ -50,6 +50,9 @@ function JournalController(Journal, Sorting, Grouping, | |||
// top level cache | |||
var cache = AppCache(cacheKey + '-module'); | |||
var vm = this; | |||
|
|||
var gridApi; |
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 think you use gridApi
here.
headerCellFilter : 'translate', | ||
headerCellClass : cssClass, | ||
}, { | ||
field : 'trans_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.
👍 Good catch.
var gridOptions = Data.options || {}; | ||
var gridApi = Data.api || {}; | ||
var filename = Data.filename || 'Export ' + moment().format('YYYY-MM-DD'); | ||
var ROWS = Data.rows || 'visible'; |
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.
For simplicity, I propose we always render all rows in the grid. That's how our PDFs work and it makes sense that the filters chosen will be the ones applied to the dataset.
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.
The current state of the exporter
is just for csv
, so we render what is visible to the client with the possibility of choosing other options (selected or all). This flexibility is useful because we have some grid which has grouped data and other not, for grid which has grouped data with the option visible
the service export what is visible (ex. only grouping rows in the case of posting journal with grouped rows) and the user can select other options if he want, and developers can set the default option for grid according needs.
…into fix_journal_export
@jniles could you review this PR |
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.
@mbayopanda, I need a second opinion on this.
I'm concerned about having two ways of doing things - one on the client and one on the server. It feels like unnecessary code bloat and technical debt... kind of against both DRY and KISS principles.
@sfount, could you provide your perspective?
@@ -5,7 +5,8 @@ var bhima = angular.module('bhima', [ | |||
'tmh.dynamicLocale', 'ngFileUpload', 'ui.grid', | |||
'ui.grid.selection', 'ui.grid.autoResize', 'ui.grid.resizeColumns', | |||
'ui.grid.edit', 'ui.grid.grouping', 'ui.grid.treeView', 'ui.grid.cellNav', | |||
'ui.grid.pagination', 'ui.grid.moveColumns', 'angularMoment', 'ngMessages', | |||
'ui.grid.pagination', 'ui.grid.moveColumns', 'ui.grid.exporter', |
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.
Your analysis is correct - for the trial balance, it is more work to export a CSV from the server side.
My biggest worry with this change is that, as a developer, I do not know when to use the server-side CSV rather than the client-side CSV. It creates another question to ask during development and something else to test....
☔ The latest upstream changes (presumably 89a3272) made this pull request unmergeable. Please resolve the merge conflicts. |
Since the work has already been done for this, we'll merge it and see how it works in production. If necessary, we can revert changes or implement something different/more. |
…into fix_journal_export
This PR allows to:
Closes #1543