Skip to content

Commit

Permalink
Merge pull request #259 from fluent/customize-header
Browse files Browse the repository at this point in the history
Add note to Fluentd model
  • Loading branch information
okkez authored Aug 17, 2018
2 parents 2423f65 + c7182e0 commit ff7bff0
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 4 deletions.
11 changes: 10 additions & 1 deletion app/assets/stylesheets/common.css.scss
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,16 @@ label {
resize: both;
}

.fluentd-note {
display: block;
padding: 0.5em 1rem;
color: #999;
}

.fluentd-note:hover {
color: #495057;
}

.fluentd-status {
.running {
color: #090;
Expand Down Expand Up @@ -188,4 +198,3 @@ label {
border-radius: 3px;
margin: 10px 0px;
}

4 changes: 2 additions & 2 deletions app/controllers/fluentd_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def update
end
redirect_to daemon_path
end

def destroy
@fluentd.agent.stop if @fluentd.agent.running?
@fluentd.destroy
Expand All @@ -51,7 +51,7 @@ def raw_log
private

def fluentd_params
params.require(:fluentd).permit(:log_file, :pid_file, :config_file, :variant, :api_endpoint)
params.require(:fluentd).permit(:log_file, :pid_file, :config_file, :note, :variant, :api_endpoint)
end

def check_fluentd_exists
Expand Down
2 changes: 1 addition & 1 deletion app/models/fluentd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Fluentd

before_validation :expand_paths

COLUMNS = [:id, :variant, :log_file, :pid_file, :config_file]
COLUMNS = [:id, :variant, :log_file, :pid_file, :config_file, :note]
DEFAULT_CONF = <<-CONF.strip_heredoc
<source>
# http://docs.fluentd.org/articles/in_forward
Expand Down
3 changes: 3 additions & 0 deletions app/views/fluentd/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,7 @@
= f.hidden_field :config_file
- else
= f.text_field :config_file, class: "form-control"
.form-group
= f.label :note
= f.text_field :note, class: "form-control"
= f.submit btn, class: "btn btn-primary"
3 changes: 3 additions & 0 deletions app/views/fluentd/show.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@
%tr
%th= @fluentd.class.human_attribute_name(:config_file)
%td= @fluentd.agent.config_file
%tr
%th= @fluentd.class.human_attribute_name(:note)
%td= @fluentd.note
.row
.col-xl-12
= preserve do # partial containing <pre>, so shouldn't break indent
Expand Down
3 changes: 3 additions & 0 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
<%= render partial: "shared/global_nav" %>
<ul class="navbar-nav ml-auto">
<%- if @fluentd %>
<li class="nav-item fluentd-note">
<%= @fluentd.note %>
</li>
<li class="nav-item fluentd-status">
<a class="nav-link" href="<%= daemon_path %>" data-toggle="tooltip" data-placement="bottom" title="fluentd <%= fluentd_status_message %>">
<%= fluentd_status_icon %>
Expand Down
1 change: 1 addition & 0 deletions config/locales/translation_en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ en:
log_file: Log file
pid_file: PID file
config_file: Config file
note: Note
variant: type
api_endpoint: API Endpoint

Expand Down
1 change: 1 addition & 0 deletions config/locales/translation_ja.yml
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ ja:
log_file: ログファイル
pid_file: PIDファイル
config_file: 設定ファイル
note: ノート
variant: タイプ
api_endpoint: APIエンドポイント

Expand Down

0 comments on commit ff7bff0

Please sign in to comment.