Sha256: 65164fd81621851ed1692b6b5d4304b50350f9fdd2a949ffb3595e385ba7a8cc
Contents?: true
Size: 1.22 KB
Versions: 3
Compression:
Stored size: 1.22 KB
Contents
class Kuroko2::TokensController < Kuroko2::ApplicationController before_action :set_token, only: %i(update) before_action :set_engine, only: %i(update) def index @definition = Kuroko2::JobDefinition.find(tokens_params[:job_definition_id]) @instance = Kuroko2::JobInstance.find(tokens_params[:job_instance_id]) @tokens = @instance.tokens render layout: false end def update @instance = @token.job_instance case when params[:invoke] == 'skip' && @token.skippable? @instance.logs.info("Skipped by #{current_user.name}.") @engine.skip(@token) when params[:invoke] == 'retry' && @token.retryable? @instance.logs.info("Retry by #{current_user.name}.") @engine.retry(@token) else raise Http::BadRequest end redirect_to job_definition_job_instance_path(job_definition_id: @token.job_definition_id, id: @token.job_instance.id) end private def set_engine @engine = Kuroko2::Workflow::Engine.new end def set_token @token = Kuroko2::Token.where(job_definition_id: params[:job_definition_id], job_instance_id: params[:job_instance_id]).find(params[:id]) end def tokens_params params.permit(:job_definition_id, :job_instance_id) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
kuroko2-0.8.0 | app/controllers/kuroko2/tokens_controller.rb |
kuroko2-0.7.0 | app/controllers/kuroko2/tokens_controller.rb |
kuroko2-0.6.0 | app/controllers/kuroko2/tokens_controller.rb |