Sha256: 0998c15ac94066e3b9a18b66c0090336c79ca6104ade94e0588180971183504c

Contents?: true

Size: 1.41 KB

Versions: 15

Compression:

Stored size: 1.41 KB

Contents

class Kaui::AdminController < Kaui::EngineController

  skip_before_action :check_for_redirect_to_tenant_screen

  def index
    begin
      @clock = Kaui::Admin.get_clock(nil, options_for_klient)
    rescue KillBillClient::API::NotFound
      flash[:error] = "Failed to get current KB clock: Kill Bill server must be started with system property org.killbill.server.test.mode=true"
      redirect_to admin_tenants_path and return
    end

    params.permit!

    respond_to do |format|
      format.html
      format.js
    end
  end

  def set_clock
    if params[:commit] == 'Submit'
      current_datetime = DateTime.parse(Kaui::Admin.get_clock(nil, options_for_klient)['currentUtcTime'])
      new_local_date = Date.parse(params[:new_date])
      new_datetime = DateTime.new(new_local_date.year, new_local_date.month, new_local_date.day, current_datetime.hour, current_datetime.min, current_datetime.sec, 'Z').to_s
      msg = "Clock was successfully updated to #{new_datetime}"
    else
      new_datetime = nil
      msg = 'Clock was successfully reset'
    end
    begin
      Kaui::Admin.set_clock(new_datetime, nil, options_for_klient)
    rescue KillBillClient::API::NotFound
      flash[:error] = "Failed to set current KB clock: Kill Bill server must be started with system property org.killbill.server.test.mode=true"
      redirect_to admin_tenants_path and return
    end

    redirect_to admin_path, :notice => msg
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
kaui-2.1.0 app/controllers/kaui/admin_controller.rb
kaui-2.0.4 app/controllers/kaui/admin_controller.rb
kaui-2.0.3 app/controllers/kaui/admin_controller.rb
kaui-2.0.2 app/controllers/kaui/admin_controller.rb
kaui-2.0.1 app/controllers/kaui/admin_controller.rb
kaui-2.0.0 app/controllers/kaui/admin_controller.rb
kaui-1.4.1 app/controllers/kaui/admin_controller.rb
kaui-1.4.0 app/controllers/kaui/admin_controller.rb
kaui-1.3.0 app/controllers/kaui/admin_controller.rb
kaui-1.2.0 app/controllers/kaui/admin_controller.rb
kaui-1.1.0 app/controllers/kaui/admin_controller.rb
kaui-1.0.0 app/controllers/kaui/admin_controller.rb
kaui-0.16.2 app/controllers/kaui/admin_controller.rb
kaui-0.16.1 app/controllers/kaui/admin_controller.rb
kaui-0.16.0 app/controllers/kaui/admin_controller.rb