Sha256: 02adee4ceb87e7f7d11ceb1b50176e8397152e352a16eb2e3ed4590955d04f55

Contents?: true

Size: 880 Bytes

Versions: 1

Compression:

Stored size: 880 Bytes

Contents

module Workarea
  module Admin
    class CircuitsController < Admin::ApplicationController
      def index
        @circuits = Admin::CircuitsViewModel.new
      end

      def disable
        circuit = CircuitViewModel.new(CircuitBreaker[params[:id]])
        circuit.add_failure(message: t('workarea.admin.circuit_breaker.manually_broke_circuit', user: current_user.name))
        circuit.break!

        flash[:success] = t('workarea.admin.circuit_breaker.flash_messages.turned_off', circuit: circuit.name, break_for: circuit.break_for.inspect)
        redirect_to circuits_path
      end

      def enable
        circuit = CircuitViewModel.new(CircuitBreaker[params[:id]])
        circuit.set_healthy!

        flash[:success] = t('workarea.admin.circuit_breaker.flash_messages.turned_on', circuit: circuit.name)
        redirect_to circuits_path
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
workarea-circuit_breaker-1.0.3 app/controllers/workarea/admin/circuits_controller.rb