Class: SystemControllerBase

Inherits:
ApplicationControllerBase show all
Includes:
ActionView::Helpers::DateHelper
Defined in:
lib/mrpin/controllers/system_controller_base.rb

Instance Method Summary collapse

Constructor Details

#initializeSystemControllerBase

Returns a new instance of SystemControllerBase.



85
86
87
# File 'lib/mrpin/controllers/system_controller_base.rb', line 85

def initialize
  super
end

Instance Method Details

#cleanup_dataObject



150
151
152
153
154
155
156
157
158
159
160
# File 'lib/mrpin/controllers/system_controller_base.rb', line 150

def cleanup_data
  result = nil

  begin
    result = get_response_ok(AppInfo.instance.cleanup_data)
  rescue Exception => e
    result = get_response_error(e.to_s)
  end

  render json: result
end

#downloadObject



163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
# File 'lib/mrpin/controllers/system_controller_base.rb', line 163

def download
  begin
    url = get_url_for_download(params['type'])

    assert(!url.nil?, "url is not specified for param #{params['type']}")

    redirect_to(url)

  rescue Exception => e
    result = get_response_error(e.to_s)

    render json: result
  end

end

#gc_statObject



68
69
70
71
72
73
74
75
76
77
78
# File 'lib/mrpin/controllers/system_controller_base.rb', line 68

def gc_stat
  result = nil

  begin
    result = get_response_ok(GC.stat)
  rescue Exception => e
    result = get_response_error(e.to_s)
  end

  render json: result
end

#generate_client_jsonObject



202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
# File 'lib/mrpin/controllers/system_controller_base.rb', line 202

def generate_client_json
  begin
    errors = AppInfo.instance.call_in_all_managers('generate_client_json')

    errors.map!(&:to_s)

    if errors.empty?
      result = get_response_ok
    else
      result = get_response_error(errors)
    end

  rescue Exception => e
    result = get_response_error(e.to_s)
  end

  render json: result
end

#infoObject



90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/mrpin/controllers/system_controller_base.rb', line 90

def info
  result = nil

  begin
    response = get_system_info

    result = get_response_ok(response)

  rescue Exception => e
    result = get_response_error(e.to_s)
  end

  render json: result
end

#invalidate_cacheObject



118
119
120
121
122
123
124
125
126
127
128
# File 'lib/mrpin/controllers/system_controller_base.rb', line 118

def invalidate_cache
  result = nil

  begin
    result = AppInfo.instance.invalidate_cache
  rescue Exception => e
    result = get_response_error(e.to_s)
  end

  render json: result
end

#send_notificationsObject



131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# File 'lib/mrpin/controllers/system_controller_base.rb', line 131

def send_notifications
  result = nil

  begin
    manager_notifications = AppInfo.instance.manager_notifications

    unless manager_notifications.nil?
      manager_notifications.send_notifications
    end

    result = get_response_ok
  rescue Exception => e
    result = get_response_error(e.to_s)
  end

  render json: result
end