# frozen_string_literal: true

class UxToolkitCronRunsController < ApplicationController
  before_action :require_admin

  def create
    result = RedmineUxToolkit::Cron::Runner.new.run

    if result.status == 'failed'
      flash[:error] = result.message
    else
      flash[:notice] = result.message
    end

    redirect_to plugin_settings_path(:redmine_ux_toolkit, tab: 'system')
  end
end
