Sha256: 834ab2908d5482538d077ea3915710970b8b759054fa1944a00f078d2d919d70

Contents?: true

Size: 1.84 KB

Versions: 3

Compression:

Stored size: 1.84 KB

Contents

require_dependency 'pg_bouncer_hero/application_controller'

module PgBouncerHero
  class DatabaseController < ApplicationController
    def summary
      if @database.connection
        @dbs = @database.summary
      else
        flash[:error] = "#{@database.name} does not look online."
      end
    end
    def databases
      if @database.connection
        @dbs = @database.databases
      else
        flash[:error] = "#{@database.name} does not look online."
      end
    end
    def stats
      if @database.connection
        @stats = @database.stats
      else
        flash[:error] = "#{@database.name} does not look online."
      end
    end
    def pools
      if @database.connection
        @pools = @database.pools
      else
        flash[:error] = "#{@database.name} does not look online."
      end
    end
    def clients
      if @database.connection
        @clients = @database.clients
      else
        flash[:error] = "#{@database.name} does not look online."
      end
    end
    def conf
      if @database.connection
        @conf = @database.conf
      else
        flash[:error] = "#{@database.name} does not look online."
      end
    end
    def reload
      if @database.connection
        @database.reload
        flash[:success] = "#{@database.name} has been reloaded."
      else
        flash[:error] = "#{@database.name} does not look online."
      end
    end
    def suspend
      if @database.connection
        @database.suspend
        flash[:success] = "#{@database.name} has been suspended."
      else
        flash[:error] = "#{@database.name} does not look online."
      end
    end
    def shutdown
      if @database.connection
        @database.shutdown
        flash[:success] = "#{@database.name} has been shutdown."
      else
        flash[:error] = "#{@database.name} does not look online."
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pgbouncerhero-2.0.0 app/controllers/pg_bouncer_hero/database_controller.rb
pgbouncerhero-1.0.3 app/controllers/pg_bouncer_hero/database_controller.rb
pgbouncerhero-1.0.1 app/controllers/pg_bouncer_hero/database_controller.rb