prometheus-splash 0.6.0 → 0.8.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +38 -1
- data/README.md +1 -1
- data/config/splash.yml +97 -11
- data/lib/splash/backends.rb +1 -0
- data/lib/splash/cli.rb +4 -1
- data/lib/splash/cli/commands.rb +127 -7
- data/lib/splash/cli/daemon.rb +41 -1
- data/lib/splash/cli/logs.rb +111 -47
- data/lib/splash/cli/process.rb +112 -52
- data/lib/splash/cli/sequences.rb +114 -0
- data/lib/splash/cli/transfers.rb +213 -0
- data/lib/splash/cli/webadmin.rb +3 -3
- data/lib/splash/commands.rb +89 -22
- data/lib/splash/config.rb +149 -62
- data/lib/splash/config/sanitycheck.rb +1 -1
- data/lib/splash/constants.rb +11 -11
- data/lib/splash/daemon/controller.rb +10 -10
- data/lib/splash/daemon/metrics.rb +8 -8
- data/lib/splash/daemon/orchestrator.rb +96 -35
- data/lib/splash/daemon/orchestrator/grammar.rb +16 -1
- data/lib/splash/dependencies.rb +8 -0
- data/lib/splash/exiter.rb +1 -1
- data/lib/splash/helpers.rb +22 -4
- data/lib/splash/loggers/cli.rb +2 -10
- data/lib/splash/logs.rb +91 -17
- data/lib/splash/processes.rb +88 -17
- data/lib/splash/sequences.rb +105 -0
- data/lib/splash/transfers.rb +229 -0
- data/lib/splash/transports/rabbitmq.rb +0 -1
- data/lib/splash/webadmin.rb +4 -4
- data/lib/splash/webadmin/api/routes/commands.rb +2 -2
- data/lib/splash/webadmin/api/routes/config.rb +53 -2
- data/lib/splash/webadmin/api/routes/logs.rb +32 -17
- data/lib/splash/webadmin/api/routes/process.rb +4 -4
- data/lib/splash/webadmin/api/routes/sequences.rb +28 -0
- data/lib/splash/webadmin/main.rb +3 -2
- data/lib/splash/webadmin/portal/controllers/commands.rb +2 -0
- data/lib/splash/webadmin/portal/controllers/documentation.rb +3 -1
- data/lib/splash/webadmin/portal/controllers/home.rb +24 -0
- data/lib/splash/webadmin/portal/controllers/logs.rb +44 -1
- data/lib/splash/webadmin/portal/controllers/processes.rb +2 -0
- data/lib/splash/webadmin/portal/controllers/proxy.rb +15 -8
- data/lib/splash/webadmin/portal/controllers/restclient.rb +7 -2
- data/lib/splash/webadmin/portal/controllers/sequences.rb +9 -0
- data/lib/splash/webadmin/portal/init.rb +2 -2
- data/lib/splash/webadmin/portal/public/css/ultragreen.css +6 -0
- data/lib/splash/webadmin/portal/public/favicon.ico +0 -0
- data/lib/splash/webadmin/portal/views/commands.slim +1 -1
- data/lib/splash/webadmin/portal/views/documentation.slim +1 -1
- data/lib/splash/webadmin/portal/views/home.slim +53 -9
- data/lib/splash/webadmin/portal/views/layout.slim +2 -2
- data/lib/splash/webadmin/portal/views/logs.slim +68 -21
- data/lib/splash/webadmin/portal/views/logs_form.slim +24 -0
- data/lib/splash/webadmin/portal/views/nav.slim +1 -1
- data/lib/splash/webadmin/portal/views/not_found.slim +1 -1
- data/lib/splash/webadmin/portal/views/processes.slim +1 -1
- data/lib/splash/webadmin/portal/views/proxy.slim +5 -2
- data/lib/splash/webadmin/portal/views/restclient.slim +7 -4
- data/lib/splash/webadmin/portal/views/restclient_result.slim +24 -20
- data/lib/splash/webadmin/portal/views/sequences.slim +50 -0
- data/prometheus-splash.gemspec +5 -2
- metadata +69 -4
@@ -0,0 +1,28 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
|
4
|
+
|
5
|
+
WebAdminApp.get '/api/sequences/list.?:format?' do
|
6
|
+
log = get_logger
|
7
|
+
format = (params[:format])? format_by_extensions(params[:format]) : format_by_extensions('json')
|
8
|
+
log.call "API : sequences, verb : GET, route : list, format : #{format}"
|
9
|
+
obj = splash_return case: :quiet_exit, :more => "Sequences list"
|
10
|
+
obj[:data] = get_config.sequences
|
11
|
+
content_type format
|
12
|
+
format_response(obj, (params[:format])? format_by_extensions(params[:format]): request.accept.first)
|
13
|
+
end
|
14
|
+
|
15
|
+
WebAdminApp.get '/api/sequences/show/:name.?:format?' do
|
16
|
+
log = get_logger
|
17
|
+
format = (params[:format])? format_by_extensions(params[:format]) : format_by_extensions('json')
|
18
|
+
log.call "API : sequences, verb : GET, route : show, item : #{params[:name]} , format : #{format}"
|
19
|
+
sequences_recordset = get_config.sequences[params[:name].to_sym]
|
20
|
+
unless sequences_recordset.nil? then
|
21
|
+
obj = splash_return case: :quiet_exit
|
22
|
+
obj[:data] = sequences_recordset
|
23
|
+
else
|
24
|
+
obj = splash_return case: :not_found, :more => "Sequence not configured"
|
25
|
+
end
|
26
|
+
content_type format
|
27
|
+
format_response(obj, (params[:format])? format_by_extensions(params[:format]): request.accept.first)
|
28
|
+
end
|
data/lib/splash/webadmin/main.rb
CHANGED
@@ -6,13 +6,14 @@ class WebAdminApp < Sinatra::Base
|
|
6
6
|
include Splash::Helpers
|
7
7
|
include Splash::Exiter
|
8
8
|
include Splash::Loggers
|
9
|
+
include Splash::Daemon::Controller
|
9
10
|
|
10
11
|
set :server, 'thin'
|
11
12
|
set :port, get_config.webadmin_port
|
12
13
|
set :bind, get_config.webadmin_ip
|
13
14
|
set :static, :enable
|
14
|
-
set :public_folder, 'lib/splash/webadmin/portal/public'
|
15
|
-
set :views, "lib/splash/webadmin/portal/views"
|
15
|
+
set :public_folder, search_file_in_gem("prometheus-splash", 'lib/splash/webadmin/portal/public')
|
16
|
+
set :views, search_file_in_gem("prometheus-splash", "lib/splash/webadmin/portal/views")
|
16
17
|
|
17
18
|
before do
|
18
19
|
rehash_config
|
@@ -1,5 +1,7 @@
|
|
1
1
|
WebAdminApp.get '/commands' do
|
2
2
|
get_menu 2
|
3
|
+
log = get_logger
|
4
|
+
log.call "WEB : commands, verb : GET, controller : /commands"
|
3
5
|
url = "http://#{get_config.webadmin_ip}:#{get_config.webadmin_port}/api/commands/list.yml"
|
4
6
|
raw = RestClient::Request.execute(method: 'GET', url: url,timeout: 10)
|
5
7
|
@data = YAML::load(raw)[:data]
|
@@ -1,5 +1,7 @@
|
|
1
1
|
WebAdminApp.get '/documentation' do
|
2
|
-
get_menu
|
2
|
+
get_menu 6
|
3
|
+
log = get_logger
|
4
|
+
log.call "WEB : documentation, verb : GET, controller : /documentation"
|
3
5
|
filename = search_file_in_gem("prometheus-splash","README.md")
|
4
6
|
@data = Kramdown::Document.new(File::readlines(filename).join).to_html
|
5
7
|
slim :documentation, :format => :html
|
@@ -1,12 +1,36 @@
|
|
1
1
|
WebAdminApp.get '/' do
|
2
|
+
log = get_logger
|
3
|
+
log.call "WEB : BASE, verb : GET, controller : /"
|
2
4
|
get_menu -1
|
3
5
|
url = "http://#{get_config.webadmin_ip}:#{get_config.webadmin_port}/api/config/full.yml"
|
4
6
|
@raw = RestClient::Request.execute(method: 'GET', url: url,timeout: 10)
|
5
7
|
@data = YAML::load(@raw)[:data]
|
8
|
+
@status = get_processes({ :pattern => get_config.daemon_process_name}).empty?
|
6
9
|
slim :home, :format => :html
|
7
10
|
end
|
8
11
|
|
9
12
|
WebAdminApp.get '/home' do
|
10
13
|
get_menu 0
|
14
|
+
log = get_logger
|
15
|
+
log.call "WEB : home, verb : GET, controller : /home"
|
11
16
|
slim :home, :format => :html
|
12
17
|
end
|
18
|
+
|
19
|
+
WebAdminApp.get '/daemon/:action' do
|
20
|
+
content_type :text
|
21
|
+
log = get_logger
|
22
|
+
log.call "WEB : daemon, verb : GET, controller : /daemon/:action"
|
23
|
+
case params[:action]
|
24
|
+
when 'start'
|
25
|
+
startdaemon scheduling: true, purge: false
|
26
|
+
return 'start'
|
27
|
+
when 'stop'
|
28
|
+
stopdaemon
|
29
|
+
return 'stop'
|
30
|
+
when 'restart'
|
31
|
+
stopdaemon
|
32
|
+
startdaemon scheduling: true, purge: false
|
33
|
+
return 'start'
|
34
|
+
else
|
35
|
+
end
|
36
|
+
end
|
@@ -1,5 +1,7 @@
|
|
1
|
-
WebAdminApp.get '/logs' do
|
1
|
+
WebAdminApp.get '/logs/?:status?/?:label?' do
|
2
2
|
get_menu 0
|
3
|
+
log = get_logger
|
4
|
+
log.call "WEB : logs, verb : GET, controller : /logs/?:status?/?:label?"
|
3
5
|
url = "http://#{get_config.webadmin_ip}:#{get_config.webadmin_port}/api/logs/list.yml"
|
4
6
|
raw = RestClient::Request.execute(method: 'GET', url: url,timeout: 10)
|
5
7
|
@data = YAML::load(raw)[:data]
|
@@ -7,8 +9,49 @@ WebAdminApp.get '/logs' do
|
|
7
9
|
raw = RestClient::Request.execute(method: 'POST', url: url,timeout: 10)
|
8
10
|
prov = YAML::load(raw)[:data]
|
9
11
|
@result = {}
|
12
|
+
@log_failed = params[:label] if params[:status] == 'failure'
|
13
|
+
@log_saved = params[:label] if params[:status] == 'success'
|
10
14
|
prov.each {|item|
|
11
15
|
@result[item[:label]] = item
|
12
16
|
}
|
13
17
|
slim :logs, :format => :html
|
14
18
|
end
|
19
|
+
|
20
|
+
|
21
|
+
WebAdminApp.get '/add_modify_log/?:label?' do
|
22
|
+
get_menu 0
|
23
|
+
log = get_logger
|
24
|
+
log.call "WEB : logs, verb : POST, controller : /add_modify_log/?:label?"
|
25
|
+
@data = {}
|
26
|
+
if params[:label] then
|
27
|
+
url = "http://#{get_config.webadmin_ip}:#{get_config.webadmin_port}/api/logs/show/#{params[:label].to_s}.yml"
|
28
|
+
raw = RestClient::Request.execute(method: 'GET', url: url,timeout: 10)
|
29
|
+
res = YAML::load(raw)
|
30
|
+
@data = res[:data] if res[:status] == :success
|
31
|
+
@data[:old_label] = params[:label].to_s
|
32
|
+
end
|
33
|
+
slim :logs_form, :format => :html
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
WebAdminApp.post '/save_log' do
|
38
|
+
get_menu 0
|
39
|
+
log = get_logger
|
40
|
+
log.call "WEB : logs, verb : POST, controller : /save_log/?:label?"
|
41
|
+
data = {}
|
42
|
+
data[:log] = params[:log]
|
43
|
+
data[:pattern] = params[:pattern]
|
44
|
+
data[:label] = params[:label].to_sym
|
45
|
+
if params[:update] then
|
46
|
+
url = "http://#{get_config.webadmin_ip}:#{get_config.webadmin_port}/api/config/deletelog/#{params[:old_label]}"
|
47
|
+
raw = RestClient::Request.execute(method: 'DELETE', url: url,timeout: 10)
|
48
|
+
end
|
49
|
+
url = "http://#{get_config.webadmin_ip}:#{get_config.webadmin_port}/api/config/addlog.yml"
|
50
|
+
raw = RestClient::Request.execute(method: 'POST', url: url,timeout: 10, payload: data.to_yaml)
|
51
|
+
res = YAML::load(raw)
|
52
|
+
if res[:status] == :success then
|
53
|
+
redirect "/logs/success/#{params[:label].to_s}"
|
54
|
+
else
|
55
|
+
redirect "/logs/failure/#{params[:label].to_s}"
|
56
|
+
end
|
57
|
+
end
|
@@ -1,5 +1,7 @@
|
|
1
1
|
WebAdminApp.get '/processes' do
|
2
2
|
get_menu 1
|
3
|
+
log = get_logger
|
4
|
+
log.call "WEB : processes, verb : GET, controller : /processes"
|
3
5
|
url = "http://#{get_config.webadmin_ip}:#{get_config.webadmin_port}/api/process/list.yml"
|
4
6
|
raw = RestClient::Request.execute(method: 'GET', url: url,timeout: 10)
|
5
7
|
@data = YAML::load(raw)[:data]
|
@@ -1,30 +1,37 @@
|
|
1
1
|
|
2
2
|
|
3
3
|
WebAdminApp.use Rack::ReverseProxy do
|
4
|
-
|
5
|
-
url = "http://#{config.prometheus_pushgateway_host}:#{config.prometheus_pushgateway_port}/#{config.prometheus_pushgateway_path}"
|
6
|
-
reverse_proxy /^\/pushgateway\/?(.*)$/, url
|
4
|
+
reverse_proxy /^\/pushgateway\/?(.*)$/, get_config.prometheus_pushgateway_url + '/'
|
7
5
|
reverse_proxy_options preserve_host: true
|
8
6
|
end
|
9
7
|
|
10
8
|
|
11
9
|
WebAdminApp.use Rack::ReverseProxy do
|
12
|
-
reverse_proxy /^\/prometheus\/?(.*)$/, get_config.prometheus_url
|
10
|
+
reverse_proxy /^\/prometheus\/?(.*)$/, get_config.prometheus_url + '/'
|
13
11
|
reverse_proxy_options preserve_host: true
|
14
12
|
end
|
15
13
|
|
16
|
-
WebAdminApp.get '/proxy/links' do
|
17
|
-
get_menu 4
|
18
14
|
|
15
|
+
WebAdminApp.use Rack::ReverseProxy do
|
16
|
+
reverse_proxy /^\/alertmanager\/?(.*)$/, get_config.prometheus_alertmanager_url + '/'
|
17
|
+
reverse_proxy_options preserve_host: true
|
18
|
+
end
|
19
|
+
|
20
|
+
WebAdminApp.get '/proxy/links' do
|
21
|
+
get_menu 5
|
22
|
+
log = get_logger
|
23
|
+
log.call "WEB : proxy, verb : GET, controller : /proxy/links"
|
19
24
|
config = get_config
|
20
25
|
if config.webadmin_proxy == true then
|
21
26
|
@proxy = true
|
22
27
|
@pushgateway_url = "http://#{config.webadmin_ip}:#{config.webadmin_port}/pushgateway"
|
23
28
|
@prometheus_url = "http://#{config.webadmin_ip}:#{config.webadmin_port}/prometheus"
|
29
|
+
@alertmanager_url = "http://#{config.webadmin_ip}:#{config.webadmin_port}/prometheus"
|
24
30
|
else
|
25
31
|
@proxy = false
|
26
|
-
@pushgateway_url = "
|
27
|
-
@
|
32
|
+
@pushgateway_url = "#{config.prometheus_pushgateway_url}"
|
33
|
+
@alertmanager_url = "#{config.prometheus_alertmanager_url}"
|
34
|
+
@prometheus_url = "#{config.prometheus_url}"
|
28
35
|
end
|
29
36
|
slim :proxy, :format => :html
|
30
37
|
end
|
@@ -1,14 +1,19 @@
|
|
1
1
|
WebAdminApp.get '/restclient' do
|
2
|
-
|
2
|
+
log = get_logger
|
3
|
+
log.call "WEB : restclient, verb : GET, controller : /restclient"
|
4
|
+
get_menu 4
|
3
5
|
slim :restclient, :format => :html
|
4
6
|
end
|
5
7
|
|
6
8
|
WebAdminApp.post '/restclient/query' do
|
9
|
+
log = get_logger
|
10
|
+
log.call "WEB : processes, verb : GET, controller : /restclient/query"
|
7
11
|
@method = params[:method]
|
8
12
|
@url = params[:url]
|
13
|
+
@body = params[:body]
|
9
14
|
@notfound = false
|
10
15
|
begin
|
11
|
-
@result = RestClient::Request.execute(method: @method.to_sym, url: @url,timeout: 10)
|
16
|
+
@result = RestClient::Request.execute(method: @method.to_sym, url: @url,timeout: 10, payload: @body)
|
12
17
|
rescue SocketError
|
13
18
|
@result = false
|
14
19
|
rescue RestClient::NotFound => e
|
@@ -0,0 +1,9 @@
|
|
1
|
+
WebAdminApp.get '/sequences' do
|
2
|
+
get_menu 3
|
3
|
+
log = get_logger
|
4
|
+
log.call "WEB : sequences, verb : GET, controller : /sequences"
|
5
|
+
url = "http://#{get_config.webadmin_ip}:#{get_config.webadmin_port}/api/sequences/list.yml"
|
6
|
+
raw = RestClient::Request.execute(method: 'GET', url: url,timeout: 10)
|
7
|
+
@data = YAML::load(raw)[:data]
|
8
|
+
slim :sequences, :format => :html
|
9
|
+
end
|
@@ -4,8 +4,8 @@ Dir[File.dirname(__FILE__) + '/helpers/*.rb'].each {|file| require file unless
|
|
4
4
|
Slim::Engine.set_options pretty: true
|
5
5
|
|
6
6
|
def get_menu(current)
|
7
|
-
@menu = ['Logs','Processes','Commands','RestCLIENT','Proxy/Links','Documentation']
|
8
|
-
@menu_icons = {'Logs' => "file-text",'Processes' => "cogs",'Commands' => 'play-circle-o','RestCLIENT' => "server",'Proxy/Links' => 'random','Documetation' => 'medkit'}
|
7
|
+
@menu = ['Logs','Processes','Commands','Sequences','RestCLIENT','Proxy/Links','Documentation']
|
8
|
+
@menu_icons = {'Logs' => "file-text",'Processes' => "cogs",'Commands' => 'play-circle-o','Sequences' => "cubes",'RestCLIENT' => "server",'Proxy/Links' => 'random','Documetation' => 'medkit'}
|
9
9
|
@current_item = nil
|
10
10
|
@current_item = @menu[current] unless current == -1
|
11
11
|
end
|
Binary file
|
@@ -1,4 +1,4 @@
|
|
1
|
-
h2 <i class="uk-icon-#{@menu_icons[@current_item]} uk-icon-medium "></i> Commands configured in Splash
|
1
|
+
h2.uk-text-success <i class="uk-icon-#{@menu_icons[@current_item]} uk-icon-medium "></i> Commands configured in Splash
|
2
2
|
|
3
3
|
div.uk-width-medium-1-1
|
4
4
|
div.uk-panel.uk-panel-box
|
@@ -1,12 +1,58 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
javascript:
|
2
|
+
|
3
|
+
|
4
|
+
|
5
|
+
$('body').on( 'click','button', function(){
|
6
|
+
var tmp = this.id
|
7
|
+
$("#stop").prop('disabled', true);
|
8
|
+
$("#start").prop('disabled', true);
|
9
|
+
var url = "/daemon/" + tmp;
|
10
|
+
$("#stop").prop('disabled', true);
|
11
|
+
$("#start").prop('disabled', true);
|
12
|
+
$.get(url, function( data ) {
|
13
|
+
|
14
|
+
console.log(data);
|
15
|
+
if (data == 'stop') {
|
16
|
+
$("#stop").prop('disabled', true);
|
17
|
+
$("#start").prop('disabled', false);
|
18
|
+
$("#daemon").removeClass('uk-badge-success').addClass('uk-badge-danger');
|
19
|
+
$("#daemon").text('OFF');
|
20
|
+
}
|
21
|
+
if (data == 'start') {
|
22
|
+
$("#stop").prop('disabled', false);
|
23
|
+
$("#start").prop('disabled', true);
|
24
|
+
$("#daemon").removeClass('uk-badge-danger').addClass('uk-badge-success');
|
25
|
+
$("#daemon").text('ON');
|
26
|
+
}
|
27
|
+
});
|
28
|
+
});
|
29
|
+
|
30
|
+
div.uk-grid
|
31
|
+
div.uk-width-medium-1-1
|
32
|
+
div.uk-panel.uk-panel-box
|
33
|
+
div.uk-grid
|
34
|
+
div.uk-width-1-3.uk-text-large.uk-text-bold.uk-text-success <i class="uk-icon-cogs uk-icon-justify uk-icon-large"></i> Splash Daemon status
|
35
|
+
div.uk-width-1-3
|
36
|
+
b Actions :
|
37
|
+
div.uk-button-group
|
38
|
+
- if @status == false
|
39
|
+
button.uk-button(id="start" disabled): i.uk-icon-play
|
40
|
+
button.uk-button(id="stop"): i.uk-icon-stop
|
41
|
+
- else
|
42
|
+
button.uk-button(id="start"): i.uk-icon-play
|
43
|
+
button.uk-button(id="stop" disabled): i.uk-icon-stop
|
44
|
+
div.uk-width-1-3
|
45
|
+
b Status :
|
46
|
+
- if @status == false
|
47
|
+
div.uk-badge.uk-badge-success.uk-badge-notifications(id="daemon") ON
|
48
|
+
- else
|
49
|
+
div.uk-badge.uk-badge-danger.uk-badge-notifications(id="daemon") OFF
|
3
50
|
|
4
51
|
|
5
52
|
div.uk-grid
|
6
53
|
div.uk-width-medium-1-2
|
7
54
|
div.uk-panel.uk-panel-box
|
8
|
-
span.uk-text-large.uk-text-bold Global Configuration
|
9
|
-
br
|
55
|
+
span.uk-text-large.uk-text-bold.uk-text-success Global Configuration
|
10
56
|
br
|
11
57
|
span.uk-text-bold <i>Logger and display</i> :
|
12
58
|
ul
|
@@ -21,8 +67,7 @@ div.uk-grid
|
|
21
67
|
|
22
68
|
div.uk-width-medium-1-2
|
23
69
|
div.uk-panel.uk-panel-box
|
24
|
-
span.uk-text-large.uk-text-bold Transport and Backend
|
25
|
-
br
|
70
|
+
span.uk-text-large.uk-text-bold.uk-text-success Transport and Backend
|
26
71
|
br
|
27
72
|
span.uk-text-bold <i>Backend</i> :
|
28
73
|
ul
|
@@ -48,7 +93,7 @@ div.uk-grid
|
|
48
93
|
div.uk-grid
|
49
94
|
div.uk-width-medium-1-2
|
50
95
|
div.uk-panel.uk-panel-box
|
51
|
-
span.uk-text-large.uk-text-bold Daemon
|
96
|
+
span.uk-text-large.uk-text-bold.uk-text-success Daemon
|
52
97
|
br
|
53
98
|
ul
|
54
99
|
li <b>Logs monitoring scheduling: </b> #{@data[:daemon_logmon_scheduling]}
|
@@ -64,8 +109,7 @@ div.uk-grid
|
|
64
109
|
|
65
110
|
div.uk-width-medium-1-2
|
66
111
|
div.uk-panel.uk-panel-box
|
67
|
-
span.uk-text-large.uk-text-bold Web UI
|
68
|
-
br
|
112
|
+
span.uk-text-large.uk-text-bold.uk-text-success Web UI
|
69
113
|
br
|
70
114
|
span.uk-text-bold <i>Webadmin</i> :
|
71
115
|
ul
|
@@ -11,8 +11,7 @@ html lang="fr-fr" dir="ltr"
|
|
11
11
|
link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/uikit/2.27.5/css/uikit.gradient.min.css" integrity="sha512-Vjr6Vz5D/gNvTBfQW581ssADQr1j8fAOU0seE2SxO8UvsCBZBoFQS9Lec3hkmZbpcYnsifkBtdQaHU4x6MylGw==" crossorigin="anonymous"
|
12
12
|
link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/uikit/2.27.5/css/components/sticky.gradient.css" integrity="sha512-BY0A+4FEGeikNxmo9Q30BZMGRDykKHScJlOSeGq0uq+ylGDJD3zAApnktyKv9tzira1p0ow+B7VqIlRR2CBWoA==" crossorigin="anonymous"
|
13
13
|
link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/uikit/2.27.5/css/components/accordion.gradient.min.css" integrity="sha512-Cfd5PRktfT5WA1yUJbYkzjEHvT+9KzqPP1Z1OJud3CFUrkoAc6iIWawoMqPFmtvmxxDNV5RAHfe5DCISV+Gd9A==" crossorigin="anonymous"
|
14
|
-
|
15
|
-
|
14
|
+
link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/uikit/2.27.5/css/components/notify.gradient.min.css" integrity="sha512-HOJctZ/0ww0jFHLHNlNODVEwKf1QxiDKyt3TQZRYZl7e7QSi6whfokIvuMJRoUwykB1SXW4eBeK6MecW4TWFFA==" crossorigin="anonymous"
|
16
15
|
|
17
16
|
link rel="stylesheet" href="/css/ultragreen.css"
|
18
17
|
|
@@ -20,6 +19,7 @@ html lang="fr-fr" dir="ltr"
|
|
20
19
|
script src="https://cdnjs.cloudflare.com/ajax/libs/uikit/2.27.5/js/uikit.min.js" integrity="sha512-KI08ZutCgdasDMwp5rPKd9nF8r+eAy/bZH3Rjova6HfkDv1W7J72sNW+K++KvMp3HL7z0cCykV9vixJACHeCew==" crossorigin="anonymous"
|
21
20
|
script src="https://cdnjs.cloudflare.com/ajax/libs/uikit/2.27.5/js/components/sticky.min.js" integrity="sha512-B21PoHN5PsI7sU3cUcNbitUsXp6Zzp81ZDlKJr1xRXwEh3WSftRmgSOgRYxB8h/SlgW+jazkmOXerT33NB7jGA==" crossorigin="anonymous"
|
22
21
|
script src="https://cdnjs.cloudflare.com/ajax/libs/uikit/2.27.5/js/components/accordion.min.js" integrity="sha512-7UmYoHJ9tTZiNqlBuUgnr2l82TmZxhiOVXIjiMVP/hPFQJopjEBfVEFPjNdv97OX8K/FIZ4kAXSE+SRTfUkPMg==" crossorigin="anonymous"
|
22
|
+
script src="https://cdnjs.cloudflare.com/ajax/libs/uikit/2.27.5/js/components/notify.min.js" integrity="sha512-gaUF+WYo5jZ2OjLCBfhz+4NAtt0YHDtcxulSv6/+1xDP9QysfsqljFadHN6sWkLvyXzKtQ7efofABRJfWOVwtw==" crossorigin="anonymous"
|
23
23
|
|
24
24
|
|
25
25
|
body
|
@@ -1,32 +1,79 @@
|
|
1
|
-
h2 <i class="uk-icon-#{@menu_icons[@current_item]} uk-icon-medium "></i> Logs configured in Splash
|
1
|
+
h2.uk-text-success <i class="uk-icon-#{@menu_icons[@current_item]} uk-icon-medium "></i> Logs configured in Splash
|
2
|
+
|
3
|
+
|
4
|
+
- unless @log_saved.nil?
|
5
|
+
javascript:
|
6
|
+
UIkit.notify("Log record #{@log_saved} saved", {status:'success'});
|
7
|
+
- unless @log_failed.nil?
|
8
|
+
javascript:
|
9
|
+
UIkit.notify("Log record #{@log_saved} not saved", {status:'danger'});
|
10
|
+
|
11
|
+
|
12
|
+
javascript:
|
13
|
+
$(document).on( 'click','input.delete-log',function(){
|
14
|
+
var id = this.id;
|
15
|
+
var url = "/api/config/deletelog/" + id + ".json";
|
16
|
+
UIkit.modal.confirm('Are you sure?', function(){
|
17
|
+
console.debug(url)
|
18
|
+
$.ajax({
|
19
|
+
url: url,
|
20
|
+
type: 'DELETE',
|
21
|
+
success: function( data ) {
|
22
|
+
console.debug(data)
|
23
|
+
if (data['status'] == 'success') {
|
24
|
+
$('table#logrecords tr#' + id).remove();
|
25
|
+
UIkit.notify("Deleting log for " + id + " done", {status:'success'});
|
26
|
+
}
|
27
|
+
else
|
28
|
+
{
|
29
|
+
UIkit.notify("Deleting log for " + id + " failed !", {status:'danger'});
|
30
|
+
}
|
31
|
+
},
|
32
|
+
error: function(e) {
|
33
|
+
UIkit.notify("Deleting log for " + id + " failed !", {status:'danger'});
|
34
|
+
}
|
35
|
+
});
|
36
|
+
});
|
37
|
+
});
|
2
38
|
|
3
39
|
div.uk-width-medium-1-1
|
4
40
|
div.uk-panel.uk-panel-box
|
5
41
|
span.uk-text-large.uk-text-bold List of logs monitored
|
6
42
|
br
|
7
|
-
table.uk-table.uk-table-hover.uk-table-striped
|
43
|
+
table#logrecords.uk-table.uk-table-hover.uk-table-striped
|
8
44
|
thead
|
9
45
|
tr
|
10
46
|
th Log record label
|
11
47
|
th Definition
|
12
48
|
th Status
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
49
|
+
th Actions
|
50
|
+
tbody
|
51
|
+
- @data.each do |log|
|
52
|
+
tr id="#{log[:label].to_s}"
|
53
|
+
td <b>Label</b> : #{log[:label]}
|
54
|
+
td
|
55
|
+
ul
|
56
|
+
li <b>File</b> : #{log[:log]}
|
57
|
+
li <b>Pattern</b> : #{log[:pattern]}
|
58
|
+
td
|
59
|
+
- if @result[log[:label]][:status] == :missing
|
60
|
+
div.uk-badge.uk-badge-warning missing
|
61
|
+
- if @result[log[:label]][:status] == :clean
|
62
|
+
div.uk-badge.uk-badge-success success
|
63
|
+
ul
|
64
|
+
li <b>Lines count</b> : #{@result[log[:label]][:lines]}
|
65
|
+
- if @result[log[:label]][:status] == :matched
|
66
|
+
div.uk-badge.uk-badge-danger matched
|
18
67
|
ul
|
19
|
-
li <b>
|
20
|
-
li <b>
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
li <b>Lines count</b> : #{@result[log[:label]][:lines]}
|
32
|
-
li <b class="uk-text-danger">Matchs count : #{@result[log[:label]][:count]} </b>
|
68
|
+
li <b>Lines count</b> : #{@result[log[:label]][:lines]}
|
69
|
+
li <b class="uk-text-danger">Matchs count : #{@result[log[:label]][:count]} </b>
|
70
|
+
td
|
71
|
+
input.delete-log.uk-button.uk-button-mini.uk-button-danger id="#{log[:label].to_s}" value="Delete"
|
72
|
+
br
|
73
|
+
input.modify-log.uk-button.uk-button-mini.uk-button-primary id="#{log[:label].to_s}" value="Modify" onclick="location.href='/add_modify_log/#{log[:label].to_s}';"
|
74
|
+
br
|
75
|
+
input.history-log.uk-button.uk-button-mini.uk-button-primary id="#{log[:label].to_s}" value="History" onclick="location.href='/history/#{log[:label].to_s}';"
|
76
|
+
div.uk-align-right
|
77
|
+
form.uk-form.uk-form-horizontal#query action="/add_modify_log" method="GET"
|
78
|
+
div
|
79
|
+
input.add-log.uk-button type="submit" value="Add new log"
|