kafka_command 0.0.1 → 0.0.2
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 +2 -0
- data/CHANGELOG.md +11 -0
- data/app/controllers/kafka_command/application_controller.rb +25 -27
- data/app/controllers/kafka_command/clusters_controller.rb +1 -2
- data/app/controllers/kafka_command/topics_controller.rb +7 -36
- data/app/views/kafka_command/application/error.html.erb +1 -0
- data/app/views/kafka_command/configuration_error.html.erb +1 -1
- data/app/views/layouts/kafka_command/application.html.erb +3 -1
- data/config/routes.rb +1 -0
- data/lib/kafka_command/version.rb +1 -1
- metadata +6 -3
- data/Gemfile.lock +0 -194
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 200ff362598df84d5179f31ab49ad601ec8786f0efb6347aa433a1a3d52b346b
|
4
|
+
data.tar.gz: 55dea58cb3db1f2f12d4b55ae1c97dbd46fbd1aed257a3e13405b0d7764749a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2439e52c4d80c00bfa8908e48368142fed51087b7703efde7b041f4a0a738abe9fedf5165d29276bd71612a59ffacb0cc93c4845e7b1fd143c734d6dc33c9096
|
7
|
+
data.tar.gz: 0f072d7e529f3cc5997f238d48afa461662f574be785d4a08875cd3d24d18ec8648ec9ec06ee1e761a0926ba30d715435b91cdf96a5c2e71f16be733160d7e3a
|
data/.gitignore
CHANGED
data/CHANGELOG.md
ADDED
@@ -8,43 +8,30 @@ module KafkaCommand
|
|
8
8
|
rescue_from Kafka::ClusterAuthorizationFailed, with: :kafka_authorization_error
|
9
9
|
rescue_from UnsupportedApiError, with: :unsupported_api_error
|
10
10
|
|
11
|
-
before_action
|
12
|
-
unless KafkaCommand.config.valid?
|
13
|
-
flash[:error] = KafkaCommand.config.errors.join("\n")
|
14
|
-
render 'kafka_command/configuration_error'
|
15
|
-
end
|
16
|
-
end
|
11
|
+
before_action :check_config
|
17
12
|
|
18
13
|
protected
|
19
14
|
|
20
15
|
def unsupported_api_error(exception)
|
21
|
-
render_error(exception.message, status: 422
|
16
|
+
render_error(exception.message, status: 422)
|
22
17
|
end
|
23
18
|
|
24
19
|
def record_not_found
|
25
20
|
render_error('Not Found', status: :not_found)
|
26
21
|
end
|
27
22
|
|
23
|
+
# Handle this error separately
|
28
24
|
def kafka_connection_error
|
29
|
-
|
30
|
-
|
31
|
-
error_msg,
|
32
|
-
status: 500,
|
33
|
-
flash: { error: error_msg }
|
34
|
-
)
|
25
|
+
flash[:error] = 'Could not connect to Kafka with the specified brokers'
|
26
|
+
render 'kafka_command/application/error', status: 500
|
35
27
|
end
|
36
28
|
|
37
29
|
def kafka_authorization_error
|
38
|
-
|
39
|
-
render_error(
|
40
|
-
error_msg,
|
41
|
-
status: 401,
|
42
|
-
flash: { error: error_msg }
|
43
|
-
)
|
30
|
+
render_error('You are not authorized to perform that action', status: 401)
|
44
31
|
end
|
45
32
|
|
46
33
|
def serialize_json(data, **kwargs)
|
47
|
-
if data.is_a?(
|
34
|
+
if data.is_a?(Array)
|
48
35
|
return {
|
49
36
|
data: data.map { |d| d.as_json(**kwargs) }
|
50
37
|
}
|
@@ -69,18 +56,16 @@ module KafkaCommand
|
|
69
56
|
end
|
70
57
|
end
|
71
58
|
|
72
|
-
def render_error(data, status: :unprocessible_entity
|
59
|
+
def render_error(data, status: :unprocessible_entity)
|
73
60
|
respond_to do |format|
|
74
61
|
format.html do
|
75
|
-
|
76
|
-
|
77
|
-
case status
|
78
|
-
when :not_found, 404
|
79
|
-
render json: '404 Not Found', status: status, layout: false
|
62
|
+
if Rails::VERSION::MAJOR >= 5
|
63
|
+
redirect_back(fallback_location: error_path, flash: { error: data })
|
80
64
|
else
|
81
|
-
|
65
|
+
redirect_to :back, flash: { error: data }
|
82
66
|
end
|
83
67
|
end
|
68
|
+
|
84
69
|
format.json { render_json_errors(data, status: status) }
|
85
70
|
end
|
86
71
|
end
|
@@ -92,5 +77,18 @@ module KafkaCommand
|
|
92
77
|
def render_json_errors(errors, status: :unprocessible_entity)
|
93
78
|
render json: errors, status: status
|
94
79
|
end
|
80
|
+
|
81
|
+
def check_config
|
82
|
+
if KafkaCommand.config.blank?
|
83
|
+
flash[:error] = 'Kafka command is not configured'
|
84
|
+
render 'kafka_command/configuration_error'
|
85
|
+
return
|
86
|
+
end
|
87
|
+
|
88
|
+
unless KafkaCommand.config.valid?
|
89
|
+
flash[:error] = KafkaCommand.config.errors.join("\n")
|
90
|
+
render 'kafka_command/configuration_error'
|
91
|
+
end
|
92
|
+
end
|
95
93
|
end
|
96
94
|
end
|
@@ -17,8 +17,7 @@ module KafkaCommand
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
-
|
21
|
-
render_success(@clusters, redirection_path: redirection_path, flash: flash.to_hash)
|
20
|
+
render_success(@clusters, flash: flash.to_hash)
|
22
21
|
end
|
23
22
|
|
24
23
|
# GET /clusters/:id
|
@@ -129,59 +129,30 @@ module KafkaCommand
|
|
129
129
|
end
|
130
130
|
|
131
131
|
def invalid_partitions
|
132
|
-
|
133
|
-
|
134
|
-
render_error(
|
135
|
-
error_msg,
|
136
|
-
status: 422,
|
137
|
-
flash: { error: error_msg }
|
138
|
-
)
|
132
|
+
render_error('Num partitions must be > 0 or > current number of partitions', status: 422)
|
139
133
|
end
|
140
134
|
|
141
135
|
def invalid_replication_factor
|
142
|
-
|
143
|
-
|
144
|
-
render_error(
|
145
|
-
error_msg,
|
146
|
-
status: 422,
|
147
|
-
flash: { error: error_msg }
|
148
|
-
)
|
136
|
+
render_error('Replication factor must be > 0 and < total number of brokers', status: 422)
|
149
137
|
end
|
150
138
|
|
151
139
|
def invalid_topic_name
|
152
|
-
|
153
|
-
render_error(
|
154
|
-
error_msg,
|
155
|
-
status: 422,
|
156
|
-
flash: { error: error_msg }
|
157
|
-
)
|
140
|
+
render_error('Topic must have a name', status: 422)
|
158
141
|
end
|
159
142
|
|
160
143
|
def topic_already_exists
|
161
|
-
|
162
|
-
render_error(
|
163
|
-
error_msg,
|
164
|
-
status: 422,
|
165
|
-
flash: { error: error_msg }
|
166
|
-
)
|
144
|
+
render_error('Topic already exists', status: 422)
|
167
145
|
end
|
168
146
|
|
169
147
|
def unknown_error
|
170
|
-
error_msg = 'An unknown error occurred with the request to Kafka. Check any request parameters.'
|
171
|
-
|
172
148
|
render_error(
|
173
|
-
|
174
|
-
status: 422
|
175
|
-
flash: { error: error_msg }
|
149
|
+
'An unknown error occurred with the request to Kafka. Check any request parameters.',
|
150
|
+
status: 422
|
176
151
|
)
|
177
152
|
end
|
178
153
|
|
179
154
|
def topic_deletion_error(exception)
|
180
|
-
render_error(
|
181
|
-
exception.message,
|
182
|
-
status: 422,
|
183
|
-
flash: { error: exception.message }
|
184
|
-
)
|
155
|
+
render_error(exception.message, status: 422)
|
185
156
|
end
|
186
157
|
end
|
187
158
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render partial: 'kafka_command/shared/title', locals: { title: 'Woops', subtitle: 'An error has occurred.' } %>
|
@@ -1 +1 @@
|
|
1
|
-
<%= render partial: 'kafka_command/shared/title', locals: { title: '
|
1
|
+
<%= render partial: 'kafka_command/shared/title', locals: { title: 'Woops', subtitle: 'Configuration error' } %>
|
@@ -16,7 +16,9 @@
|
|
16
16
|
<div class="container">
|
17
17
|
<div class="navbar-brand kafka-logo">
|
18
18
|
<p class="navbar-item is-paddingless">
|
19
|
-
<%=
|
19
|
+
<%= link_to root_path do %>
|
20
|
+
<%= image_tag('kafka_command/kafka.png', alt: '') %>
|
21
|
+
<% end %>
|
20
22
|
</p>
|
21
23
|
</div>
|
22
24
|
<div class="navbar-start">
|
data/config/routes.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kafka_command
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jasondoc3
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-12-
|
11
|
+
date: 2018-12-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -66,8 +66,8 @@ files:
|
|
66
66
|
- ".rspec"
|
67
67
|
- ".rubocop.yml"
|
68
68
|
- ".ruby-version"
|
69
|
+
- CHANGELOG.md
|
69
70
|
- Gemfile
|
70
|
-
- Gemfile.lock
|
71
71
|
- LICENSE
|
72
72
|
- README.md
|
73
73
|
- Rakefile
|
@@ -99,6 +99,7 @@ files:
|
|
99
99
|
- app/models/kafka_command/group_member.rb
|
100
100
|
- app/models/kafka_command/partition.rb
|
101
101
|
- app/models/kafka_command/topic.rb
|
102
|
+
- app/views/kafka_command/application/error.html.erb
|
102
103
|
- app/views/kafka_command/brokers/index.html.erb
|
103
104
|
- app/views/kafka_command/clusters/_tabs.html.erb
|
104
105
|
- app/views/kafka_command/clusters/index.html.erb
|
@@ -181,6 +182,7 @@ files:
|
|
181
182
|
- spec/dummy/config/ssl/test_client_cert
|
182
183
|
- spec/dummy/config/ssl/test_client_cert_key
|
183
184
|
- spec/dummy/config/storage.yml
|
185
|
+
- spec/dummy/db/development.sqlite3
|
184
186
|
- spec/dummy/db/schema.rb
|
185
187
|
- spec/dummy/db/test.sqlite3
|
186
188
|
- spec/dummy/log/development.log
|
@@ -310,6 +312,7 @@ test_files:
|
|
310
312
|
- spec/dummy/bin/yarn
|
311
313
|
- spec/dummy/bin/bundle
|
312
314
|
- spec/dummy/db/test.sqlite3
|
315
|
+
- spec/dummy/db/development.sqlite3
|
313
316
|
- spec/dummy/db/schema.rb
|
314
317
|
- spec/spec_helper.rb
|
315
318
|
- spec/lib/kafka_command/configuration_spec.rb
|
data/Gemfile.lock
DELETED
@@ -1,194 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
kafka_command (0.0.1)
|
5
|
-
rails (>= 4)
|
6
|
-
rails-ujs
|
7
|
-
ruby-kafka (> 0.6.3)
|
8
|
-
|
9
|
-
GEM
|
10
|
-
remote: https://rubygems.org/
|
11
|
-
specs:
|
12
|
-
actioncable (5.2.1)
|
13
|
-
actionpack (= 5.2.1)
|
14
|
-
nio4r (~> 2.0)
|
15
|
-
websocket-driver (>= 0.6.1)
|
16
|
-
actionmailer (5.2.1)
|
17
|
-
actionpack (= 5.2.1)
|
18
|
-
actionview (= 5.2.1)
|
19
|
-
activejob (= 5.2.1)
|
20
|
-
mail (~> 2.5, >= 2.5.4)
|
21
|
-
rails-dom-testing (~> 2.0)
|
22
|
-
actionpack (5.2.1)
|
23
|
-
actionview (= 5.2.1)
|
24
|
-
activesupport (= 5.2.1)
|
25
|
-
rack (~> 2.0)
|
26
|
-
rack-test (>= 0.6.3)
|
27
|
-
rails-dom-testing (~> 2.0)
|
28
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
29
|
-
actionview (5.2.1)
|
30
|
-
activesupport (= 5.2.1)
|
31
|
-
builder (~> 3.1)
|
32
|
-
erubi (~> 1.4)
|
33
|
-
rails-dom-testing (~> 2.0)
|
34
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
35
|
-
activejob (5.2.1)
|
36
|
-
activesupport (= 5.2.1)
|
37
|
-
globalid (>= 0.3.6)
|
38
|
-
activemodel (5.2.1)
|
39
|
-
activesupport (= 5.2.1)
|
40
|
-
activerecord (5.2.1)
|
41
|
-
activemodel (= 5.2.1)
|
42
|
-
activesupport (= 5.2.1)
|
43
|
-
arel (>= 9.0)
|
44
|
-
activestorage (5.2.1)
|
45
|
-
actionpack (= 5.2.1)
|
46
|
-
activerecord (= 5.2.1)
|
47
|
-
marcel (~> 0.3.1)
|
48
|
-
activesupport (5.2.1)
|
49
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
50
|
-
i18n (>= 0.7, < 2)
|
51
|
-
minitest (~> 5.1)
|
52
|
-
tzinfo (~> 1.1)
|
53
|
-
arel (9.0.0)
|
54
|
-
ast (2.4.0)
|
55
|
-
builder (3.2.3)
|
56
|
-
byebug (10.0.2)
|
57
|
-
coderay (1.1.2)
|
58
|
-
concurrent-ruby (1.1.3)
|
59
|
-
crass (1.0.4)
|
60
|
-
diff-lcs (1.3)
|
61
|
-
digest-crc (0.4.1)
|
62
|
-
dotenv (2.5.0)
|
63
|
-
dotenv-rails (2.5.0)
|
64
|
-
dotenv (= 2.5.0)
|
65
|
-
railties (>= 3.2, < 6.0)
|
66
|
-
erubi (1.7.1)
|
67
|
-
globalid (0.4.1)
|
68
|
-
activesupport (>= 4.2.0)
|
69
|
-
i18n (1.1.1)
|
70
|
-
concurrent-ruby (~> 1.0)
|
71
|
-
jaro_winkler (1.5.1)
|
72
|
-
loofah (2.2.3)
|
73
|
-
crass (~> 1.0.2)
|
74
|
-
nokogiri (>= 1.5.9)
|
75
|
-
mail (2.7.1)
|
76
|
-
mini_mime (>= 0.1.1)
|
77
|
-
marcel (0.3.3)
|
78
|
-
mimemagic (~> 0.3.2)
|
79
|
-
method_source (0.9.2)
|
80
|
-
mimemagic (0.3.2)
|
81
|
-
mini_mime (1.0.1)
|
82
|
-
mini_portile2 (2.3.0)
|
83
|
-
minitest (5.11.3)
|
84
|
-
nio4r (2.3.1)
|
85
|
-
nokogiri (1.8.5)
|
86
|
-
mini_portile2 (~> 2.3.0)
|
87
|
-
parallel (1.12.1)
|
88
|
-
parser (2.5.3.0)
|
89
|
-
ast (~> 2.4.0)
|
90
|
-
powerpack (0.1.2)
|
91
|
-
pry (0.12.2)
|
92
|
-
coderay (~> 1.1.0)
|
93
|
-
method_source (~> 0.9.0)
|
94
|
-
pry-byebug (3.6.0)
|
95
|
-
byebug (~> 10.0)
|
96
|
-
pry (~> 0.10)
|
97
|
-
pry-rails (0.3.7)
|
98
|
-
pry (>= 0.10.4)
|
99
|
-
rack (2.0.6)
|
100
|
-
rack-test (1.1.0)
|
101
|
-
rack (>= 1.0, < 3)
|
102
|
-
rails (5.2.1)
|
103
|
-
actioncable (= 5.2.1)
|
104
|
-
actionmailer (= 5.2.1)
|
105
|
-
actionpack (= 5.2.1)
|
106
|
-
actionview (= 5.2.1)
|
107
|
-
activejob (= 5.2.1)
|
108
|
-
activemodel (= 5.2.1)
|
109
|
-
activerecord (= 5.2.1)
|
110
|
-
activestorage (= 5.2.1)
|
111
|
-
activesupport (= 5.2.1)
|
112
|
-
bundler (>= 1.3.0)
|
113
|
-
railties (= 5.2.1)
|
114
|
-
sprockets-rails (>= 2.0.0)
|
115
|
-
rails-dom-testing (2.0.3)
|
116
|
-
activesupport (>= 4.2.0)
|
117
|
-
nokogiri (>= 1.6)
|
118
|
-
rails-html-sanitizer (1.0.4)
|
119
|
-
loofah (~> 2.2, >= 2.2.2)
|
120
|
-
rails-ujs (0.1.0)
|
121
|
-
railties (>= 3.1)
|
122
|
-
railties (5.2.1)
|
123
|
-
actionpack (= 5.2.1)
|
124
|
-
activesupport (= 5.2.1)
|
125
|
-
method_source
|
126
|
-
rake (>= 0.8.7)
|
127
|
-
thor (>= 0.19.0, < 2.0)
|
128
|
-
rainbow (3.0.0)
|
129
|
-
rake (12.3.1)
|
130
|
-
rspec-core (3.8.0)
|
131
|
-
rspec-support (~> 3.8.0)
|
132
|
-
rspec-expectations (3.8.2)
|
133
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
134
|
-
rspec-support (~> 3.8.0)
|
135
|
-
rspec-mocks (3.8.0)
|
136
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
137
|
-
rspec-support (~> 3.8.0)
|
138
|
-
rspec-rails (3.8.1)
|
139
|
-
actionpack (>= 3.0)
|
140
|
-
activesupport (>= 3.0)
|
141
|
-
railties (>= 3.0)
|
142
|
-
rspec-core (~> 3.8.0)
|
143
|
-
rspec-expectations (~> 3.8.0)
|
144
|
-
rspec-mocks (~> 3.8.0)
|
145
|
-
rspec-support (~> 3.8.0)
|
146
|
-
rspec-support (3.8.0)
|
147
|
-
rubocop (0.60.0)
|
148
|
-
jaro_winkler (~> 1.5.1)
|
149
|
-
parallel (~> 1.10)
|
150
|
-
parser (>= 2.5, != 2.5.1.1)
|
151
|
-
powerpack (~> 0.1)
|
152
|
-
rainbow (>= 2.2.2, < 4.0)
|
153
|
-
ruby-progressbar (~> 1.7)
|
154
|
-
unicode-display_width (~> 1.4.0)
|
155
|
-
rubocop-rails_config (0.2.6)
|
156
|
-
railties (>= 3.0)
|
157
|
-
rubocop (~> 0.56)
|
158
|
-
rubocop-rspec (1.30.1)
|
159
|
-
rubocop (>= 0.60.0)
|
160
|
-
ruby-kafka (0.7.4)
|
161
|
-
digest-crc
|
162
|
-
ruby-progressbar (1.10.0)
|
163
|
-
sprockets (3.7.2)
|
164
|
-
concurrent-ruby (~> 1.0)
|
165
|
-
rack (> 1, < 3)
|
166
|
-
sprockets-rails (3.2.1)
|
167
|
-
actionpack (>= 4.0)
|
168
|
-
activesupport (>= 4.0)
|
169
|
-
sprockets (>= 3.0.0)
|
170
|
-
sqlite3 (1.3.13)
|
171
|
-
thor (0.20.3)
|
172
|
-
thread_safe (0.3.6)
|
173
|
-
tzinfo (1.2.5)
|
174
|
-
thread_safe (~> 0.1)
|
175
|
-
unicode-display_width (1.4.0)
|
176
|
-
websocket-driver (0.7.0)
|
177
|
-
websocket-extensions (>= 0.1.0)
|
178
|
-
websocket-extensions (0.1.3)
|
179
|
-
|
180
|
-
PLATFORMS
|
181
|
-
ruby
|
182
|
-
|
183
|
-
DEPENDENCIES
|
184
|
-
dotenv-rails
|
185
|
-
kafka_command!
|
186
|
-
pry-byebug
|
187
|
-
pry-rails
|
188
|
-
rspec-rails
|
189
|
-
rubocop-rails_config
|
190
|
-
rubocop-rspec
|
191
|
-
sqlite3
|
192
|
-
|
193
|
-
BUNDLED WITH
|
194
|
-
1.16.1
|