Separa i canali app e mostra il nodo ingest nelle sessioni admin. Co-authored-by: Cursor <cursoragent@cursor.com>
44 lines
1.6 KiB
Ruby
44 lines
1.6 KiB
Ruby
module Admin
|
|
class SessionsController < Admin::BaseController
|
|
def index
|
|
@sessions = StreamSession.includes(:stream_node, :user, match: :team).order(created_at: :desc).limit(50)
|
|
end
|
|
|
|
def show
|
|
@session = StreamSession.includes(:stream_node, match: :team).find(params[:id])
|
|
@events = @session.stream_events.recent.limit(50)
|
|
end
|
|
|
|
def stop
|
|
@session = StreamSession.find(params[:id])
|
|
if @session.terminal?
|
|
redirect_to admin_session_path(@session), alert: t("admin.flash.session_already_terminated", status: @session.status)
|
|
return
|
|
end
|
|
|
|
Sessions::Stop.new(@session).call
|
|
redirect_to admin_session_path(@session), notice: t("admin.flash.session_stopped")
|
|
rescue StandardError => e
|
|
Rails.logger.error("[admin] stop session #{@session.id}: #{e.class} #{e.message}")
|
|
redirect_to admin_session_path(@session), alert: t("admin.flash.session_stop_error", error: e.message)
|
|
end
|
|
|
|
def regia_link
|
|
@session = StreamSession.find(params[:id])
|
|
if @session.terminal?
|
|
redirect_to admin_session_path(@session), alert: t("admin.flash.session_terminated_no_regia")
|
|
return
|
|
end
|
|
|
|
access = Sessions::RegiaAccess.new(@session)
|
|
token = access.issue_token!
|
|
redirect_to admin_session_path(@session),
|
|
notice: t("admin.flash.session_regia_generated"),
|
|
flash: {
|
|
regia_url: access.url(token),
|
|
regia_expires_at: @session.regia_token_expires_at&.iso8601
|
|
}
|
|
end
|
|
end
|
|
end
|