Class: Adminix::Web::Router
Instance Method Summary
collapse
Methods included from ViewHelper
#retrieve_data
Methods inherited from Server
#http_request_errback, #not_found_route, #process_http_request
Instance Method Details
#dashboard_route ⇒ Object
49
50
51
52
|
# File 'lib/adminix/web/router.rb', line 49
def dashboard_route
content = view('dashboard.html')
render html: content, content_type: 'text/html'
end
|
#job_route ⇒ Object
68
69
70
71
72
73
|
# File 'lib/adminix/web/router.rb', line 68
def job_route
@page = !params['page'].nil? ? params['page'].to_i : 1
@per_page = 2
content = view('job.html')
render html: content, content_type: 'text/html'
end
|
#link_route ⇒ Object
54
55
56
57
58
59
|
# File 'lib/adminix/web/router.rb', line 54
def link_route
@page = !params['page'].nil? ? params['page'].to_i : 1
@per_page = 2
content = view('link.html')
render html: content, content_type: 'text/html'
end
|
#loadstamp_route ⇒ Object
76
77
78
79
80
81
82
|
# File 'lib/adminix/web/router.rb', line 76
def loadstamp_route
@page = !params['page'].nil? ? params['page'].to_i : 1
@per_page = 2
content = view('loadstamp.html')
render html: content, content_type: 'text/html'
end
|
#log_route ⇒ Object
61
62
63
64
65
66
|
# File 'lib/adminix/web/router.rb', line 61
def log_route
@page = !params['page'].nil? ? params['page'].to_i : 1
@per_page = 2
content = view('log.html')
render html: content, content_type: 'text/html'
end
|
#params ⇒ Object
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/adminix/web/router.rb', line 35
def params
params = {}
ls = @http_query_string.to_s.split('&')
return params if ls == ''
ls.each do |p|
parts = p.split('=')
params[parts[0]] = parts[1]
end
return params
end
|
#process_request ⇒ Object
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/adminix/web/router.rb', line 5
def process_request
if @http_request_uri == '/ping'
render text: 'pong'
elsif @http_request_uri == '/'
dashboard_route
elsif @http_request_uri == '/link'
link_route
elsif @http_request_uri =="/log"
log_route
elsif @http_request_uri =="/job"
job_route
elsif @http_request_uri =="/loadstamp"
loadstamp_route
elsif @http_request_uri =="/start"
start_route
elsif @http_request_uri == "/stop"
stop_route
else
asset = Helpers::Files.read_asset(@http_request_uri)
if asset
render text: asset
else
not_found_route
end
end
end
|
#start_route ⇒ Object
84
85
86
87
88
|
# File 'lib/adminix/web/router.rb', line 84
def start_route
Adminix.watcher.app_service.start_process
content = {"status": "process started"}.to_json
render json: content
end
|
#stop_route ⇒ Object
90
91
92
93
94
|
# File 'lib/adminix/web/router.rb', line 90
def stop_route
Adminix.watcher.app_service.stop_process
content = {"status": "process stopped"}.to_json
render json: content
end
|