Add fields to CSV export

Kris Germann kgermann at portal.net.co
Wed Dec 14 15:11:20 EST 2016


I was wondering if anyone had an idea for the issue I’m facing (history below),

Kris

> On Nov 23, 2016, at 12:23 PM, Kris Germann <kgermann at portal.net.co> wrote:
> 
> Thanks for your patience Dan, here's the error I'm getting:
> 
> /opt/genieacs-gui/app/views/devices/index.csv.erb:6: syntax error, unexpected '(', expecting ')' ...;@output_buffer.append=( @tags(device['_tags']) );@output_b... ... ^ /opt/genieacs-gui/app/views/devices/index.csv.erb:6: syntax error, unexpected ')', expecting keyword_end ...end=( @tags(device['_tags']) );@output_buffer.safe_append='" ... ^
> 
> Extracted source (around line #6):
> 
> 
> "<%= param_names.keys.join('","').html_safe %>","Last inform"
> <% @devices.each do |device| %>
> "<%= param_names.collect{|k,v| (p = get_param(v, device)).is_a?(String) ? p : p['_value'] rescue ''}.join('","').html_safe %>","<%= @tags(device['_tags']) %>"
> <% end %>
> 
> Rails.root: /opt/genieacs-gui
> 
> Application Trace | Framework Trace | Full Trace
> app/views/devices/index.csv.erb:6: syntax error, unexpected '(', expecting ')'
> app/views/devices/index.csv.erb:6: syntax error, unexpected ')', expecting keyword_end
> app/controllers/devices_controller.rb:77:in `block in index'
> app/controllers/application_controller.rb:40:in `can?'
> app/controllers/devices_controller.rb:57:in `index'
> 
>> On November 23, 2016 at 11:31 AM Dan Morphis <dan at milkcarton.com> wrote:
>> 
>> replace tags(device['_tags'])  with @tags(device['_tags']) 
>> 
>> On Wed, Nov 23, 2016 at 6:12 AM, Kris Germann <kgermann at portal.net.co <mailto:kgermann at portal.net.co>> wrote:
>> 
>> Dan,
>> 
>> I am getting the following error:
>> 
>> undefined method `join' for nil:NilClass
>> 
>> Extracted source:
>> 
>> %>
>> “<%= param_names.keys.join('","').html_safe %>","Last inform”
>> <% @devices.each do |device| %>
>> “<%= param_names.collect{|k,v| (p = get_param(v, device)).is_a?(String) ? p : p['_value'] rescue ''}.join('","').html_safe %>","<%= tags(device['_tags']) %>”
>> <% end %>
>> 
>> Note I have removed the portion to sort by last inform, I only wish to sort by tags.
>> 
>> Kris
>>  
>> 
>>> On November 22, 2016 at 5:20 PM Dan Morphis <dan at milkcarton.com <mailto:dan at milkcarton.com>> wrote:
>>> 
>>> I haven't tried it, but try putting this at the end of the 6th line in genieacs-gui/app/views/devices/index.csv.erb:
>>> ,"<%= tags(device['_tags']) %>"
>>> 
>>> This to your genieacs-gui/config/parameter_renderers.yml file:
>>> _tags: tags
>>> 
>>> and create this file: genieacs-gui/config/parameter_renderers/tags.rb:
>>> def tags(val)
>>>   val.join(", ")
>>> end
>>> 
>>> 
>>> 
>>> On Tue, Nov 22, 2016 at 6:25 AM, Kris Germann <kgermann at portal.net.co <mailto:kgermann at portal.net.co>> wrote:
>>> I'd like to add a tag field to the CSV export and sort by that by default... is this possible?
>>> 
>>> I am building a reporting mechanism for new additions for some of my wholesalers that use my ACS and this would be quite useful.
>>> 
>>> Kris
>>> 
>>> 
>>> _______________________________________________
>>> Users mailing list
>>> Users at lists.genieacs.com <mailto:Users at lists.genieacs.com>
>>> http://lists.genieacs.com/mailman/listinfo/users <http://lists.genieacs.com/mailman/listinfo/users>
>>> 
>>> 
>>> _______________________________________________
>>> Users mailing list
>>> Users at lists.genieacs.com <mailto:Users at lists.genieacs.com>
>>> http://lists.genieacs.com/mailman/listinfo/users <http://lists.genieacs.com/mailman/listinfo/users>
>> 
> 
>  

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.genieacs.com/pipermail/users/attachments/20161214/8e788274/attachment.html>


More information about the Users mailing list