Sha256: 221773f0c4d8310ccb4f90cdceb1f9f5ccd7a87ed1ffb27c6c5d0b32c10d9398

Contents?: true

Size: 959 Bytes

Versions: 19

Compression:

Stored size: 959 Bytes

Contents

require_dependency "rearview/application_controller"

module Rearview
  class DashboardsController < ApplicationController
    respond_to :json

    def index
      @dashboards = Rearview::Dashboard.roots
    end

    def show
      @dashboard = Rearview::Dashboard.find(params[:id])
    end

    def create
      upsert
      render :show
    end

    def update
      upsert
      render :show
    end

    def destroy
      @dashboard = Rearview::Dashboard.find params[:id]
      @dashboard.destroy
      render :show
    end

    def errors
      @job_errors = Rearview::JobError.calculate_durations(Rearview::JobError.application_errors(params[:id]).order_created.load)
    end

    private

    def upsert
      @dashboard = Rearview::Dashboard.find_or_initialize_by(id: params[:id])
      @dashboard.name = params[:name]
      @dashboard.user = current_user
      @dashboard.description = params[:description]
      @dashboard.save!
    end

  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
rearview-1.1.2-jruby app/controllers/rearview/dashboards_controller.rb
rearview-1.1.1-jruby app/controllers/rearview/dashboards_controller.rb
rearview-1.1.0-jruby app/controllers/rearview/dashboards_controller.rb
rearview-1.0.3.rc.4-jruby app/controllers/rearview/dashboards_controller.rb
rearview-1.0.3.rc.3-jruby app/controllers/rearview/dashboards_controller.rb
rearview-1.0.3.rc.2-jruby app/controllers/rearview/dashboards_controller.rb
rearview-1.0.3.rc.1-jruby app/controllers/rearview/dashboards_controller.rb
rearview-1.0.2-jruby app/controllers/rearview/dashboards_controller.rb
rearview-1.0.2.rc.4-jruby app/controllers/rearview/dashboards_controller.rb
rearview-1.0.2.rc.3-jruby app/controllers/rearview/dashboards_controller.rb
rearview-1.0.2.rc.2-jruby app/controllers/rearview/dashboards_controller.rb
rearview-1.0.2.rc.1-jruby app/controllers/rearview/dashboards_controller.rb
rearview-1.0.1-jruby app/controllers/rearview/dashboards_controller.rb
rearview-1.0.0-jruby app/controllers/rearview/dashboards_controller.rb
rearview-1.0.0.rc5-jruby app/controllers/rearview/dashboards_controller.rb
rearview-1.0.0.rc4-jruby app/controllers/rearview/dashboards_controller.rb
rearview-1.0.0.rc3-jruby app/controllers/rearview/dashboards_controller.rb
rearview-1.0.0.rc2-jruby app/controllers/rearview/dashboards_controller.rb
rearview-1.0.0.rc1-jruby app/controllers/rearview/dashboards_controller.rb