-
Notifications
You must be signed in to change notification settings - Fork 58
[1337] Add user and equipment CSV export #1340
Conversation
@@ -9,7 +9,8 @@ | |||
<%= link_to "View All Equipment Models", equipment_models_path, :class => 'btn btn-default' %> | |||
<% else %> | |||
<%= link_to "New Equipment Model", new_equipment_model_path, :class => "btn btn-primary" %> | |||
<%= link_to "Import Equipment Models", equip_import_page_path, :class => "btn btn-default" %> | |||
<%= link_to "Import Equipment Models", equip_import_page_path, :class => "btn btn-default" %> | |||
<%= link_to "Export Equipment Data", categories_path(format: 'zip'), :class => "btn btn-default" %> |
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.
Should we add this link to the equipment items index as well?
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.
sure!
This looks really good! I want to take another look at the module when it's not this late at night but overall this seems to really solve the issue. I was able to export equipment and (after tweaking the names to avoid duplicates) import new data based on the exported files. The same was true for user export/import. A few notes:
Again, great work! Why don't you start working on the above and I'll re-review the module tomorrow to see if anything other than what I already commented on jumps out at me. Thanks! |
columns = data.size == 1 ? objects.first.attributes.keys : data[1] | ||
|
||
# we never need to export ids | ||
columns.delete('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 is good, any thoughts on also removing any password / authentication stuff if it's there? We could set up an array of columns to delete and simply call something like PROTECTED_COLS.each { |col| columns.delete(col) }
. I don't love it since that array is coupled to the schema of our users table, but there's no specific harm in calling Hash#delete
with a key that doesn't exist. Thoughts?
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 sounds good
Ok, second read-through complete, ready for updates! |
95a5c5f
to
95d6c09
Compare
Replied to some of your comments, not sure if you're done (rubocop error / any other changes) so we can do a complete review once you give the go-ahead. |
Looks like we have some merge conflicts following tonight's PR mergings - can you rebase onto |
bed420a
to
c67b782
Compare
done! |
@@ -28,6 +28,9 @@ gem 'net-ldap', '~> 0.13.0' | |||
# attachments | |||
gem 'paperclip', '~> 4.3.2' | |||
|
|||
# for exporting multiple files | |||
gem 'rubyzip' |
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.
Can you specify a version here?
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.
Also, make sure to use the latest version, thanks 😄
Don't have time for full review, will get to it tomorrow. |
end | ||
|
||
# downloads a csv of the given model table | ||
# expects table to be an array with the following format: |
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 believe that these comments are outdated / unnecessary.
A few small comments but this is really close. Let me know what you think about the ActionController dependency thing and once we've wrapped up the other stuff we can merge this in. Nice work! |
c67b782
to
2978340
Compare
Resolves #1337 - adds the module CsvExport to handle exporting CSV files - also supports exporting multiple CSVs at once in a zip file
2978340
to
38b0948
Compare
[1337] Add user and equipment CSV export
Resolves #1337