Use bootstrap-vue for misc/information

Signed-off-by: Kenji Okimoto <okimoto@clear-code.com>
This commit is contained in:
Kenji Okimoto 2018-10-03 16:09:41 +09:00
parent ea66cdc07e
commit d1a1affae3
No known key found for this signature in database
GPG Key ID: F9E3E329A5C5E4A1
2 changed files with 55 additions and 42 deletions

View File

@ -4,6 +4,8 @@ require "zip"
class MiscController < ApplicationController class MiscController < ApplicationController
after_action :update!, only: [:update_fluentd_ui] after_action :update!, only: [:update_fluentd_ui]
helper_method :env_items
def show def show
redirect_to misc_information_path redirect_to misc_information_path
end end
@ -75,4 +77,10 @@ class MiscController < ApplicationController
def update! def update!
FluentdUiRestart.perform_later FluentdUiRestart.perform_later
end end
def env_items
@env.map do |key, value|
{ key: key, value: value }
end
end
end end

View File

@ -1,23 +1,23 @@
- add_javascript_pack_tag("information")
- page_title t('.page_title') do - page_title t('.page_title') do
- link_to misc_download_info_path, class: "btn btn-primary float-right mt-3" do - link_to misc_download_info_path, class: "btn btn-primary float-right mt-3" do
= icon('fa-download') = icon('fa-download')
= t('.download_system_information') = t('.download_system_information')
- if FluentdUI.update_available? && !FluentdUI.td_agent_ui? #information
- # NOTE: td-agent-ui shouldn't have auto update feature - if FluentdUI.update_available? && !FluentdUI.td_agent_ui?
.row - # NOTE: td-agent-ui shouldn't have auto update feature
.col-xl-12 .row
%p .col-xl-12
= link_to misc_update_fluentd_ui_path, class: "btn btn-primary btn-lg", method: :post do %p
= t('.update_fluentd_ui', version: FluentdUI.latest_version, title: fluentd_ui_title) = link_to misc_update_fluentd_ui_path, class: "btn btn-primary btn-lg", method: :post do
= t('.update_fluentd_ui_caution', brand: fluentd_ui_brand) = t('.update_fluentd_ui', version: FluentdUI.latest_version, title: fluentd_ui_title)
= t('.update_fluentd_ui_caution', brand: fluentd_ui_brand)
.row .row
.col-xl-6.col-sm-6.mb-3 .col-xl-6.col-sm-6.mb-3
.card.card-default %b-card{"header" => t("terms.version"),
.card-header "header-tags" => "h4"}
%h4= t("terms.version")
.card-body
%dl{class: "dl-horizontal"} %dl{class: "dl-horizontal"}
%dt ruby %dt ruby
%dd= RUBY_DESCRIPTION %dd= RUBY_DESCRIPTION
@ -27,11 +27,9 @@
%dt fluentd-ui %dt fluentd-ui
%dd= FluentdUI::VERSION %dd= FluentdUI::VERSION
.col-xl-6.col-sm-6.mb-3 .col-xl-6.col-sm-6.mb-3
.card.card-default %b-card{"header" => t('terms.installed_plugins'),
.card-header "header-tags" => "h4"}
%h4= t('terms.installed_plugins')
.card-body
- if @plugins.present? - if @plugins.present?
%table{class: "table table-hover", id: "plugins-table"} %table{class: "table table-hover", id: "plugins-table"}
%thead %thead
@ -46,31 +44,38 @@
- else - else
= t "plugins.common.no_installed" = t "plugins.common.no_installed"
.row .row
.col-xl-12.col-sm-12 .col-xl-12.col-sm-12
.card.card-default %b-card
.card-header %template{"slot" => "header"}
%h4{"data-toggle" => "collapse", "href" => "#env-table"} %h4{"v-b-toggle.env-table" => ""}
= icon('fa-caret-down') = icon('fa-caret-down')
= t('.env') = t('.env')
%table{class: "table table-hover collapse", id: "env-table"} %b-collapse#env-table
%thead %b-form-group(horizontal){"label" => "Filter"}
%tr %b-input-group
%th= t('.env_key') %b-form-input{"v-model" => "filter"}
%th= t('.env_value') %b-input-group-append
%tbody %b-btn{ "v-bind:disabled" => "!filter", "v-on:click" => "filter = ''" }
- @env.each_pair do |key, value| Clear
%tr %b-table(stripped hover small){"v-bind:items" => "items",
%td= key "v-bind:fields" => "fields",
%td= value "v-bind:filter" => "filter"}
:javascript :javascript
window.addEventListener("load", () => { window.addEventListener("load", () => {
$('#env-table').dataTable({ new Vue({
"autoWidth": false, name: "Information",
"ordering": true, el: "#information",
"paging": false, data() {
"info": false, return {
"searching": false fields: {
key: { label: "#{t('.env_key')}", sortable: true },
value: { label: "#{t('.env_value')}" }
},
items: #{env_items.to_json.html_safe},
filter: null
};
}
}); });
}); });