5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-16 19:26:21 +00:00
panel/app/views/stats/index.haml

41 lines
1.7 KiB
Text
Raw Normal View History

2019-08-02 00:20:42 +00:00
.row
.col
%h1= t('.title')
%p.lead= t('.help')
%p
%small
= t('.last_update')
%time{ datetime: @last_stat.created_at }
2021-10-09 20:29:09 +00:00
#{time_ago_in_words @last_stat.created_at}.
2019-08-02 00:20:42 +00:00
2021-10-09 20:28:56 +00:00
.mb-5
2021-10-09 18:50:38 +00:00
- Stat::INTERVALS.each do |interval|
2021-10-09 20:28:26 +00:00
= link_to t(".#{interval}"), site_stats_path(interval: interval, urls: params[:urls]), class: "btn #{'btn-primary active' if @interval == interval}"
2021-10-08 19:31:02 +00:00
2021-10-09 20:28:56 +00:00
.mb-5
%h2= t('.host.title', count: @hostnames.size)
%p.lead= t('.host.description')
= line_chart site_stats_host_path(@chart_params), **@chart_options
2021-10-09 20:28:56 +00:00
.mb-5
- original_urls = params[:urls]&.split("\n")&.map(&:strip)
- rows = original_urls.size.zero? ? 3 : original_urls.size
%h2= t('.urls.title')
%p.lead= t('.urls.description')
%form
%input{ type: 'hidden', name: 'interval', value: @interval }
.form-group
%label{ for: 'urls' }= t('.urls.label')
%textarea#urls.form-control{ name: 'urls', autocomplete: 'on', required: true, rows: rows, aria_describedby: 'help-urls' }= params[:urls]
%small#help-urls.feedback.form-text.text-muted= t('.urls.help')
.form-group
%button.btn{ type: 'submit' }= t('.urls.submit')
- if @normalized_urls.present?
= line_chart site_stats_uris_path(urls: params[:urls], **@chart_params), **@chart_options
2021-10-09 18:50:38 +00:00
- Stat::RESOURCES.each do |resource|
2021-10-09 20:28:56 +00:00
.mb-5
%h2= t(".resources.#{resource}.title")
%p.lead= t(".resources.#{resource}.description")
2021-10-08 21:40:16 +00:00
= line_chart site_stats_resources_path(resource: resource, **@chart_params), **@chart_options.merge(StatsController::EXTRA_OPTIONS[resource])