Sha256: e75107d340ab3edf32bd8610b306b576e3ea194cbeab27f0ef763c1e63413d87

Contents?: true

Size: 1.78 KB

Versions: 3

Compression:

Stored size: 1.78 KB

Contents

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-1.0.0 app/controllers/pg_bouncer_hero/database_controller.rb
pgbouncerhero-0.1.1 app/controllers/pg_bouncer_hero/database_controller.rb
pgbouncerhero-0.1.0 app/controllers/pg_bouncer_hero/database_controller.rb