Sha256: 6f008ed45e993d93478d09875e7e7a1751e22b58eedf7f2bb5dfd6668aea60ad

Contents?: true

Size: 1.45 KB

Versions: 4

Compression:

Stored size: 1.45 KB

Contents

require_dependency "myreplicator/application_controller"

module Myreplicator

  class HomeController < ApplicationController
    def index  
      @tab = 'home'
      @option = 'overview'
      @exports = Export.order('state DESC')
      @logs = Log.where(:state => 'running').order("started_at DESC")
      @now = Time.zone.now
      respond_to do |format|
        format.html # index.html.erb
        format.json { render json: @exports }
      end
    end

    def errors
      @tab = 'home'
      @option = 'errors'
      @exports = Export.where("error is not null").order('source_schema ASC')    
      @logs = Log.where(:state => 'error').order("started_at DESC") 
    end

    def kill
      @log = Log.find(params[:id])
      @log.kill
      redirect_to :action => 'index' 
    end
    
    def pause
      flash[:notice] = "Pause All DR Jobs"
      require 'rake'
      Rake::Task.load(Rails.root.to_s + "/lib/tasks/" + "maintenance.rake")
      resque_reload = Rake::Task['maintenance:stop_dr_jobs']
      resque_reload.reenable
      resque_reload.execute(ENV["RAILS_ENV"])
      redirect_to :action => 'index'
    end
        
    def resume
      flash[:notice] = "Resume All DR Jobs"
      require 'rake'
      Rake::Task.load(Rails.root.to_s + "/lib/tasks/" + "resque.rake")
      resque_reload = Rake::Task['maintenance:start_dr_jobs']
      resque_reload.reenable
      resque_reload.execute(ENV["RAILS_ENV"])
      redirect_to :action => 'index'
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
myreplicator-1.1.48 app/controllers/myreplicator/home_controller.rb
myreplicator-1.1.47 app/controllers/myreplicator/home_controller.rb
myreplicator-1.1.46 app/controllers/myreplicator/home_controller.rb
myreplicator-1.1.45 app/controllers/myreplicator/home_controller.rb