gluster-web-interface/app/helpers/volume_helper.rb

59 lines
2.0 KiB
Ruby
Raw Normal View History

2016-08-22 09:41:25 +00:00
module VolumeHelper
2016-09-20 12:13:24 +00:00
def volume_info(volume)
2016-09-23 09:28:53 +00:00
params = ['Type', 'Volume ID', 'Status', 'Number of Bricks', 'Transport-type', 'Bricks', 'Options Reconfigured', 'Mount State', 'Mount Point']
2016-09-20 12:13:24 +00:00
html = ''
html << "<div>"
params.each do |t|
next if volume[t].nil?
html << "<p>"
html << t + " : " + volume[t]
html << "</p>"
end
html << "</div>"
raw(html)
end
2016-09-28 09:15:06 +00:00
2016-09-28 08:41:13 +00:00
def mount_table(dir = @current_dir, id = "mount_table", class_option = "table table-striped table-bordered jambo_table")
html = String.new
html << "<table id='#{id}' class='#{class_option}'>"
html << "<thead>"
html << "<tr class='headings'>"
html << "<th>Name</th>"
html << "<th>auth</th>"
html << "<th></th>"
html << "</tr>"
html << "</thead>"
html << "<tbody id='#{id}_body'>"
html << "<tr>"
html << "<td>"
2016-09-28 09:15:06 +00:00
html << "<a class='chupper' style='cursor: pointer'><i class='fa fa-reply'></i></a> #{@current_dir}"
2016-09-28 08:41:13 +00:00
html << "</td>"
html << "<td></td>"
html << "<td></td>"
html << "</tr>"
files(dir).each do |file|
if file["auth"][0]=='d'
html << "<td style='color:#0d8ade;'><i class='fa fa-folder-open-o'></i>"
html << "<a class='chdir' style='cursor: pointer'> #{file['name']}</a>"
html << "</td>"
html << "<td>#{file['auth']}"
html << "</td>"
html << "<td>"
html << "<form data-parsley-validate>"
2016-09-28 09:15:06 +00:00
html << "<input type='hidden' value='#{@current_dir}/#{file["name"]}'>"
2016-09-28 08:41:13 +00:00
html << "<button type='submit' class='btn btn-primary pull-right'>select</button>"
html << "</form>"
html << "</td>"
html << "</tr>"
end
end
html << "</tbody>"
html << "</table>"
return html
end
2016-09-28 09:15:06 +00:00
end