rhea 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +5 -2
- data/Dockerfile +29 -0
- data/README.md +84 -41
- data/app/assets/stylesheets/rhea/layout.css.sass +3 -0
- data/app/controllers/rhea/commands_controller.rb +0 -1
- data/app/views/rhea/commands/_form.html.haml +7 -2
- data/app/views/rhea/commands/_table.html.haml +8 -7
- data/app/views/rhea/commands/index.html.haml +35 -28
- data/app/views/rhea/events/index.html.haml +3 -3
- data/app/views/rhea/nodes/index.html.haml +2 -2
- data/credentials/.gitkeep +0 -0
- data/examples/rhea-rails/.gitignore +13 -0
- data/examples/rhea-rails/Gemfile +4 -0
- data/examples/rhea-rails/README.rdoc +28 -0
- data/examples/rhea-rails/Rakefile +6 -0
- data/examples/rhea-rails/app/assets/images/.keep +0 -0
- data/examples/rhea-rails/app/assets/javascripts/application.js +1 -0
- data/examples/rhea-rails/app/assets/stylesheets/application.css +15 -0
- data/examples/rhea-rails/app/controllers/application_controller.rb +5 -0
- data/examples/rhea-rails/app/controllers/concerns/.keep +0 -0
- data/examples/rhea-rails/app/helpers/application_helper.rb +2 -0
- data/examples/rhea-rails/app/mailers/.keep +0 -0
- data/examples/rhea-rails/app/models/.keep +0 -0
- data/examples/rhea-rails/app/models/concerns/.keep +0 -0
- data/examples/rhea-rails/app/views/layouts/application.html.erb +14 -0
- data/examples/rhea-rails/bin/bundle +3 -0
- data/examples/rhea-rails/bin/rails +9 -0
- data/examples/rhea-rails/bin/rake +9 -0
- data/examples/rhea-rails/bin/setup +29 -0
- data/examples/rhea-rails/bin/spring +15 -0
- data/examples/rhea-rails/config.ru +4 -0
- data/examples/rhea-rails/config/application.rb +32 -0
- data/examples/rhea-rails/config/boot.rb +3 -0
- data/examples/rhea-rails/config/environment.rb +5 -0
- data/examples/rhea-rails/config/environments/development.rb +38 -0
- data/examples/rhea-rails/config/environments/production.rb +76 -0
- data/examples/rhea-rails/config/environments/test.rb +42 -0
- data/examples/rhea-rails/config/initializers/assets.rb +11 -0
- data/examples/rhea-rails/config/initializers/backtrace_silencers.rb +7 -0
- data/examples/rhea-rails/config/initializers/cookies_serializer.rb +3 -0
- data/examples/rhea-rails/config/initializers/filter_parameter_logging.rb +4 -0
- data/examples/rhea-rails/config/initializers/inflections.rb +16 -0
- data/examples/rhea-rails/config/initializers/mime_types.rb +4 -0
- data/examples/rhea-rails/config/initializers/session_store.rb +3 -0
- data/examples/rhea-rails/config/initializers/wrap_parameters.rb +9 -0
- data/examples/rhea-rails/config/locales/en.yml +23 -0
- data/examples/rhea-rails/config/routes.rb +3 -0
- data/examples/rhea-rails/config/secrets.yml +22 -0
- data/examples/rhea-rails/db/seeds.rb +7 -0
- data/examples/rhea-rails/lib/assets/.keep +0 -0
- data/examples/rhea-rails/lib/tasks/.keep +0 -0
- data/examples/rhea-rails/log/.keep +0 -0
- data/examples/rhea-rails/public/404.html +67 -0
- data/examples/rhea-rails/public/422.html +67 -0
- data/examples/rhea-rails/public/500.html +66 -0
- data/examples/rhea-rails/public/favicon.ico +0 -0
- data/examples/rhea-rails/public/robots.txt +5 -0
- data/examples/rhea-rails/vendor/assets/javascripts/.keep +0 -0
- data/examples/rhea-rails/vendor/assets/stylesheets/.keep +0 -0
- data/lib/rhea/command_type.rb +3 -1
- data/lib/rhea/version.rb +1 -1
- data/rhea.gemspec +1 -1
- data/rhea.rb.example +16 -0
- metadata +57 -5
- data/app/views/rhea/command_types/_list.html.haml +0 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c8f09f9a769acb9cda54ffa31ad07056446cabe4
|
|
4
|
+
data.tar.gz: 134245ddf59d1e8ab6ed27a7230bc0e7151a38e9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2eca1512f4b3febb16bda502565699e2b91a51096cfc684a20a114920141c00183ea9c8e117b04f8e979d3907a643edee4ceb8b27a020c5259dad80de81dbb86
|
|
7
|
+
data.tar.gz: de1e9be0fda7f30dfd81976815acd809f83bdb2baafd8c908bbe2403b3dda1f6f305fb0d7a52315e80513872f56c5d7aeae2fbbeb88f055defb701b1037039d0
|
data/.gitignore
CHANGED
data/Dockerfile
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
FROM alpine:3.4
|
|
2
|
+
MAINTAINER ayumi@entelo.com
|
|
3
|
+
|
|
4
|
+
RUN apk update && apk --update add ruby ruby-irb ruby-json ruby-rake \
|
|
5
|
+
ruby-bigdecimal ruby-io-console libstdc++ tzdata \
|
|
6
|
+
libxml2-dev libxslt-dev
|
|
7
|
+
|
|
8
|
+
ADD examples/rhea-rails/Gemfile /app/
|
|
9
|
+
ADD examples/rhea-rails/Gemfile.lock /app/
|
|
10
|
+
|
|
11
|
+
RUN apk --update add --virtual build-dependencies build-base git \
|
|
12
|
+
libc-dev linux-headers ruby-dev openssl-dev && \
|
|
13
|
+
gem install --no-rdoc --no-ri bundler && \
|
|
14
|
+
cd /app; bundle install --deployment --full-index --jobs 4 && \
|
|
15
|
+
apk del build-dependencies
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
ADD examples/rhea-rails/. /app
|
|
19
|
+
ADD credentials/. /app/config/credentials/
|
|
20
|
+
ADD rhea.rb /app/config/initializers/
|
|
21
|
+
RUN chown -R nobody:nogroup /app
|
|
22
|
+
USER nobody
|
|
23
|
+
|
|
24
|
+
EXPOSE 3000
|
|
25
|
+
|
|
26
|
+
ENV KUBE_API_URL "http://localhost:8080/api/"
|
|
27
|
+
|
|
28
|
+
WORKDIR /app
|
|
29
|
+
CMD ["bundle", "exec", "rails", "server", "--binding=0.0.0.0"]
|
data/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
A web UI for managing a Kubernetes cluster
|
|
4
4
|
|
|
5
5
|
Overview
|
|
6
|
-
|
|
6
|
+
---
|
|
7
7
|
|
|
8
8
|
Rhea is a web UI for managing a Kubernetes cluster. It makes it very easy to:
|
|
9
9
|
|
|
@@ -25,65 +25,75 @@ Monitor the nodes' pods and the cluster's events:
|
|
|
25
25
|
[<img src="docs/events.png?raw=true" width="440" />](docs/events.png?raw=true)
|
|
26
26
|
|
|
27
27
|
Installation
|
|
28
|
-
|
|
28
|
+
---
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
The included Dockerfile builds a container running a Rails app with Rhea.
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
1. Configure Rhea by copying and modifying `rhea.rb.example`:
|
|
33
|
+
* `cp rhea.rb.example rhea.rb`
|
|
34
|
+
* Modify `rhea.rb` (see [Configuration](#configuration))
|
|
35
|
+
2. Build the container: `docker build -it rhea .`
|
|
36
|
+
3. Run it: `docker run --rm -p 3000:3000 rhea`
|
|
35
37
|
|
|
36
|
-
Mount it in `routes.rb`:
|
|
37
38
|
|
|
38
|
-
```ruby
|
|
39
|
-
mount Rhea::Engine => '/rhea'
|
|
40
|
-
```
|
|
41
39
|
|
|
42
|
-
|
|
40
|
+
Configuration
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
Rhea is configured in `rhea.rb`. The only required configuration option is `kube_api`, which configures Rhea to talk to your Kubernetes API.
|
|
44
|
+
|
|
45
|
+
### kube_api
|
|
46
|
+
|
|
47
|
+
These options are passed through to [kubeclient](https://github.com/abonas/kubeclient), so anything that's valid in `kubeclient` is valid here.
|
|
48
|
+
|
|
49
|
+
#### No authentication
|
|
43
50
|
|
|
44
51
|
```ruby
|
|
52
|
+
# rhea.rb
|
|
45
53
|
require 'rhea'
|
|
46
54
|
|
|
47
55
|
Rhea.configure do |config|
|
|
48
56
|
config.kube_api = {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
client_key: OpenSSL::PKey::RSA.new(Rails.root.join(ENV['KEYS_DIRECTORY'], 'apiserver-key.pem').read),
|
|
52
|
-
client_cert: OpenSSL::X509::Certificate.new(Rails.root.join(ENV['KEYS_DIRECTORY'], 'apiserver.pem').read),
|
|
53
|
-
ca_file: Rails.root.join(ENV['KEYS_DIRECTORY'], 'ca.pem').to_s,
|
|
54
|
-
verify_ssl: OpenSSL::SSL::VERIFY_PEER
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
url: 'https://kubernetes.example.com/api/'
|
|
57
|
+
url: 'https://kubernetes.example.com/api/',
|
|
58
|
+
options: {}
|
|
58
59
|
}
|
|
59
|
-
config.default_image = 'docker.registry.com/myworker:latest'
|
|
60
60
|
end
|
|
61
61
|
```
|
|
62
62
|
|
|
63
|
-
|
|
64
|
-
-------------
|
|
63
|
+
#### Client certificate authentication
|
|
65
64
|
|
|
66
|
-
|
|
65
|
+
Create a `credentials` directory in the root of this directory and copy the following files into it:
|
|
67
66
|
|
|
68
|
-
|
|
67
|
+
```bash
|
|
68
|
+
credentials/apiserver.crt
|
|
69
|
+
credentials/apiserver.key
|
|
70
|
+
credentials/ca.crt
|
|
71
|
+
```
|
|
69
72
|
|
|
70
|
-
|
|
73
|
+
Then configure `rhea.rb` to use them:
|
|
71
74
|
|
|
72
75
|
```ruby
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
76
|
+
# rhea.rb
|
|
77
|
+
require 'rhea'
|
|
78
|
+
|
|
79
|
+
Rhea.configure do |config|
|
|
80
|
+
config.kube_api = {
|
|
81
|
+
url: 'https://kubernetes.example.com/api/',
|
|
82
|
+
options: {
|
|
83
|
+
ssl_options: {
|
|
84
|
+
client_key: OpenSSL::PKey::RSA.new(Rails.root.join('config/credentials/apiserver.key').read),
|
|
85
|
+
client_cert: OpenSSL::X509::Certificate.new(Rails.root.join('config/credentials/apiserver.crt').read),
|
|
86
|
+
ca_file: Rails.root.join('config/credentials/ca.crt').to_s,
|
|
87
|
+
verify_ssl: OpenSSL::SSL::VERIFY_PEER
|
|
88
|
+
}
|
|
80
89
|
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
}
|
|
90
|
+
}
|
|
91
|
+
end
|
|
84
92
|
```
|
|
85
93
|
|
|
86
|
-
|
|
94
|
+
The `credentials/*` files above are generated when you create the cluster. For example, if you're using minikube, they're located in `~/.minikube/`.
|
|
95
|
+
|
|
96
|
+
### command_types
|
|
87
97
|
|
|
88
98
|
Command types are custom templates that let you create commands more easily. They can be used in the command creation form. `$INPUT` is the value that's passed in from the form input.
|
|
89
99
|
|
|
@@ -112,7 +122,7 @@ config.command_types = [
|
|
|
112
122
|
]
|
|
113
123
|
```
|
|
114
124
|
|
|
115
|
-
|
|
125
|
+
### container_options
|
|
116
126
|
|
|
117
127
|
By default, each pod has a single, minimally-configured container. You can easily configure additional container options, which will be merged into the pod's `spec.template.spec.containers[0]`.
|
|
118
128
|
|
|
@@ -131,7 +141,7 @@ config.container_options = {
|
|
|
131
141
|
}
|
|
132
142
|
```
|
|
133
143
|
|
|
134
|
-
|
|
144
|
+
### default_command_type_key
|
|
135
145
|
|
|
136
146
|
This will be used to set the default command type when creating new commands.
|
|
137
147
|
|
|
@@ -139,7 +149,7 @@ This will be used to set the default command type when creating new commands.
|
|
|
139
149
|
config.default_command_type_key = 'goworker'
|
|
140
150
|
```
|
|
141
151
|
|
|
142
|
-
|
|
152
|
+
### default_image
|
|
143
153
|
|
|
144
154
|
This will be used to set the default image when creating new commands.
|
|
145
155
|
|
|
@@ -147,7 +157,7 @@ This will be used to set the default image when creating new commands.
|
|
|
147
157
|
config.default_image = 'docker.registry.com/myworker:latest'
|
|
148
158
|
```
|
|
149
159
|
|
|
150
|
-
|
|
160
|
+
### env_vars
|
|
151
161
|
|
|
152
162
|
This will be used to set custom environment variables in pods scheduled by Rhea.
|
|
153
163
|
|
|
@@ -157,6 +167,39 @@ config.env_vars = {
|
|
|
157
167
|
}
|
|
158
168
|
```
|
|
159
169
|
|
|
170
|
+
Using Rhea as a Rails engine
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
Rhea is also available as a Rails engine. To install it in a Rails app, include it in your `Gemfile`:
|
|
174
|
+
|
|
175
|
+
```ruby
|
|
176
|
+
gem 'rhea'
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
And mount it in `routes.rb`:
|
|
180
|
+
|
|
181
|
+
```ruby
|
|
182
|
+
mount Rhea::Engine => '/rhea'
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
You'll then configure Rhea in `config/initializers/rhea.rb`. See [Configuration](#configuration) for details.
|
|
186
|
+
|
|
187
|
+
Development
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
Use the sample Rails app with Rhea.
|
|
191
|
+
|
|
192
|
+
1. `cd examples/rhea-rails`
|
|
193
|
+
2. Update the rhea Gem in the sample app's `Gemfile`:
|
|
194
|
+
- `gem 'rhea', git: 'https://github.com/entelo/rhea.git'`
|
|
195
|
+
to
|
|
196
|
+
- `gem 'rhea', path: '../../'`
|
|
197
|
+
|
|
198
|
+
3. Modify `config/rhea.yml` for your needs
|
|
199
|
+
4. `bundle install`
|
|
200
|
+
5. `rails server KUBE_API_URL=http://localhost:8080/api/`
|
|
201
|
+
6. Visit http://localhost:3000
|
|
202
|
+
|
|
160
203
|
Testing
|
|
161
204
|
-------
|
|
162
205
|
|
|
@@ -4,7 +4,6 @@ module Rhea
|
|
|
4
4
|
@commands = Rhea::Kubernetes::Commands::All.new.perform
|
|
5
5
|
@default_image = Rhea.configuration.default_image
|
|
6
6
|
@images = (@commands.map(&:image) + [@default_image]).uniq.sort
|
|
7
|
-
params[:image] ||= @default_image
|
|
8
7
|
if params[:image].present?
|
|
9
8
|
@commands = @commands.select { |command| command.image == params[:image] }
|
|
10
9
|
end
|
|
@@ -9,7 +9,12 @@
|
|
|
9
9
|
.col-sm-9
|
|
10
10
|
= select_tag :command_type_key, options_for_select(Rhea::CommandType.options_for_select, Rhea.configuration.default_command_type_key), class: 'form-control', style: 'width: 90px;', required: 'required'
|
|
11
11
|
.form-group
|
|
12
|
-
= label_tag :
|
|
12
|
+
= label_tag :command_syntax, 'Command', class: 'col-sm-3 control-label', style: 'font-weight: normal;'
|
|
13
|
+
.col-sm-9
|
|
14
|
+
%pre.command-syntax{style: 'font-size: 12px;'}
|
|
15
|
+
= Rhea::CommandType.find(Rhea.configuration.default_command_type_key).displayed_format
|
|
16
|
+
.form-group
|
|
17
|
+
= label_tag :command_type_input, '$input', class: 'col-sm-3 control-label'
|
|
13
18
|
.col-sm-9
|
|
14
19
|
= text_field_tag :command_type_input, nil, class: 'form-control', style: 'width: 100%;'
|
|
15
20
|
.form-group
|
|
@@ -19,4 +24,4 @@
|
|
|
19
24
|
.form-group
|
|
20
25
|
.col-sm-3
|
|
21
26
|
.col-sm-9
|
|
22
|
-
= submit_tag 'Create', class: 'btn btn-
|
|
27
|
+
= submit_tag 'Create', class: 'btn btn-success'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
%table.table.table-condensed.table-striped
|
|
2
2
|
%thead
|
|
3
3
|
%tr
|
|
4
|
-
%th
|
|
4
|
+
%th{style: 'width: 25px;'}
|
|
5
5
|
%input{type: 'checkbox', id: 'check-all'}
|
|
6
6
|
%th Image
|
|
7
7
|
%th Command
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
- commands.each do |command|
|
|
14
14
|
- escaped_image_expression = CGI.escape([command.image, command.expression].join(Rhea::Command::IMAGE_EXPRESSION_SEPARATOR))
|
|
15
15
|
%tr
|
|
16
|
-
%td
|
|
16
|
+
%td
|
|
17
|
+
= check_box_tag 'batch_image_expressions[]', escaped_image_expression, false, class: 'command-checkbox checkbox'
|
|
17
18
|
%td= humanize_image(command.image)
|
|
18
19
|
%td= command.expression
|
|
19
20
|
%td= command.process_count
|
|
@@ -24,9 +25,9 @@
|
|
|
24
25
|
= time_ago_in_words(command.created_at.in_time_zone(Time.zone), include_seconds: true)
|
|
25
26
|
ago
|
|
26
27
|
%td{ style: 'white-space: nowrap;' }
|
|
27
|
-
= link_to redeploy_commands_path(image_expression: escaped_image_expression), title: 'Redeploy', class: 'btn btn-
|
|
28
|
+
= link_to redeploy_commands_path(image_expression: escaped_image_expression), title: 'Redeploy', class: 'btn btn-primary btn-xs btn-action', 'data-toggle': 'tooltip', 'data-placement': 'bottom' do
|
|
28
29
|
%span.glyphicon.glyphicon-cloud-download
|
|
29
|
-
= link_to reschedule_commands_path(image_expression: escaped_image_expression), title: 'Reschedule', class: 'btn btn-
|
|
30
|
+
= link_to reschedule_commands_path(image_expression: escaped_image_expression), title: 'Reschedule', class: 'btn btn-primary btn-xs btn-action', 'data-toggle': 'tooltip', 'data-placement': 'bottom' do
|
|
30
31
|
%span.glyphicon.glyphicon-fullscreen
|
|
31
32
|
- if command.process_count == 0
|
|
32
33
|
= link_to delete_commands_path(image_expression: escaped_image_expression), title: 'Delete', class: 'btn btn-danger btn-xs btn-action', 'data-toggle': 'tooltip', 'data-placement': 'bottom' do
|
|
@@ -37,15 +38,15 @@
|
|
|
37
38
|
%tr
|
|
38
39
|
%td{ colspan: 2 }
|
|
39
40
|
.batch-actions{ style: 'display: none;' }
|
|
40
|
-
= button_tag name: 'batch_action', value: 'redeploy', title: 'Redeploy', class: 'btn btn-
|
|
41
|
+
= button_tag name: 'batch_action', value: 'redeploy', title: 'Redeploy', class: 'btn btn-primary btn-xs btn-action', 'data-toggle': 'tooltip', 'data-placement': 'bottom' do
|
|
41
42
|
%span.glyphicon.glyphicon-cloud-download
|
|
42
|
-
= button_tag name: 'batch_action', value: 'reschedule', title: 'Reschedule', class: 'btn btn-
|
|
43
|
+
= button_tag name: 'batch_action', value: 'reschedule', title: 'Reschedule', class: 'btn btn-primary btn-xs btn-action', 'data-toggle': 'tooltip', 'data-placement': 'bottom' do
|
|
43
44
|
%span.glyphicon.glyphicon-fullscreen
|
|
44
45
|
= button_tag name: 'batch_action', value: 'stop', title: 'Stop', class: 'btn btn-warning btn-xs btn-action', 'data-toggle': 'tooltip', 'data-placement': 'bottom' do
|
|
45
46
|
%span.glyphicon.glyphicon-stop
|
|
46
47
|
%td
|
|
47
48
|
%td
|
|
48
49
|
%td
|
|
49
|
-
= button_tag 'Save', name: 'batch_action', value: 'scale', class: 'btn btn-
|
|
50
|
+
= button_tag 'Save', name: 'batch_action', value: 'scale', class: 'btn btn-success'
|
|
50
51
|
%td
|
|
51
52
|
%td
|
|
@@ -1,25 +1,31 @@
|
|
|
1
1
|
.row
|
|
2
2
|
.col-md-8
|
|
3
|
-
.
|
|
4
|
-
|
|
5
|
-
.
|
|
6
|
-
=
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
3
|
+
.row
|
|
4
|
+
.col-md-12
|
|
5
|
+
.pull-left
|
|
6
|
+
= form_tag commands_path, method: 'GET', class: 'form-inline' do
|
|
7
|
+
.form-group
|
|
8
|
+
= label_tag :image, 'Image', style: 'margin-right: 5px; font-size: 13px;'
|
|
9
|
+
- image_options = [['All', nil]] + @images.map { |image| [humanize_image(image), image] }
|
|
10
|
+
= select_tag :image, options_for_select(image_options, params[:image].presence), class: 'form-control', onchange: "$(this).closest('form').submit();"
|
|
11
|
+
.pull-right
|
|
12
|
+
= form_tag import_commands_path, method: 'PUT', multipart: true, style: 'display: inline-block;' do
|
|
13
|
+
%span.btn.btn-default.btn-file
|
|
14
|
+
Import
|
|
15
|
+
= file_field_tag :data, accept: 'application/json', onchange: "$(this).closest('form').submit();"
|
|
16
|
+
= link_to 'Export', export_commands_path(format: 'json'), class: 'btn btn-default'
|
|
17
|
+
%br
|
|
18
|
+
%br
|
|
19
|
+
%br
|
|
20
|
+
.row
|
|
21
|
+
.col-md-12
|
|
22
|
+
- if @commands.present?
|
|
23
|
+
= form_tag batch_update_commands_path, method: 'POST' do
|
|
24
|
+
= hidden_field_tag :redirect_to, request.fullpath
|
|
25
|
+
= render partial: 'rhea/commands/table', locals: { commands: @commands }
|
|
26
|
+
- else
|
|
27
|
+
%p
|
|
28
|
+
No commands found.
|
|
23
29
|
|
|
24
30
|
.col-md-4
|
|
25
31
|
.panel.panel-default
|
|
@@ -28,12 +34,6 @@
|
|
|
28
34
|
.panel-body
|
|
29
35
|
= render partial: 'rhea/commands/form'
|
|
30
36
|
|
|
31
|
-
.panel.panel-default
|
|
32
|
-
.panel-heading
|
|
33
|
-
%h4 Command Types
|
|
34
|
-
.panel-body
|
|
35
|
-
= render partial: 'rhea/command_types/list'
|
|
36
|
-
|
|
37
37
|
:javascript
|
|
38
38
|
var checkboxes = $('.command-checkbox');
|
|
39
39
|
var batchActions = $('.batch-actions');
|
|
@@ -41,11 +41,18 @@
|
|
|
41
41
|
var toggleBatchActions = function() {
|
|
42
42
|
batchActions.toggle(checkboxes.filter(':checked').length > 0);
|
|
43
43
|
return true;
|
|
44
|
-
}
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
var updateCommandSyntax = function() {
|
|
47
|
+
var syntax = this.selectedOptions[0].dataset.syntax;
|
|
48
|
+
$('.command-syntax').text(syntax);
|
|
49
|
+
};
|
|
45
50
|
|
|
46
51
|
checkboxes.on('click', toggleBatchActions);
|
|
47
52
|
|
|
48
53
|
$('#check-all').change(function(){
|
|
49
54
|
$(".command-checkbox").prop('checked', $(this).prop("checked"));
|
|
50
55
|
toggleBatchActions()
|
|
51
|
-
})
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
$('#command_type_key').on('change', updateCommandSyntax);
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
%th Time
|
|
5
5
|
%th
|
|
6
6
|
%th Host
|
|
7
|
-
%th Message
|
|
8
7
|
%th Type
|
|
9
8
|
%th Resource Type
|
|
10
9
|
%th Resource ID
|
|
@@ -16,9 +15,10 @@
|
|
|
16
15
|
= time_ago_in_words(event.created_at.in_time_zone(Time.zone), include_seconds: true)
|
|
17
16
|
ago
|
|
18
17
|
%td= event.hostname
|
|
19
|
-
%td= simple_format(event.message)
|
|
20
18
|
%td= event.type
|
|
21
19
|
%td= event.resource_type
|
|
22
20
|
%td= event.resource_id
|
|
21
|
+
%tr
|
|
22
|
+
%td{colspan: 6}= simple_format(event.message)
|
|
23
23
|
|
|
24
|
-
= paginate @events
|
|
24
|
+
= paginate @events
|