.container-fluid data-controller="tasks" h1 = t(:system_tasks) table.table.table-striped.table-borderless thead tr th = t(:initiated) th = t(:user) th = t(:task) th = t(:task_type) th = t(:details) th.text-right = t(:status) th.text-right = t(:actions) tbody - @tasks.each do |task| - meta = task.metadata&.with_indifferent_access || {} tr.align-middle td - if task.created_at span title=task.created_at.strftime("%a %d %b, %Y - %H:%M") = distance_of_time_in_words(Time.current - task.created_at) | #{t(:ago)} td = task.user&.name td = "##{task.id}" td = task.pretty_name - if task.task_type&.include?("Transcribe") && (resp = @respondents[meta[:respondent_id]]) br span.bg-dark.badge style="font-size: 7px;" = resp.model_display_name td - case - when %w[WxTranscribe TranscribeV2 TranscribeV3 TranscribeV4 TranscribeV5 TranscribeV6 GenerateAssistant VectorAnalysis SectionSummaries TranscriptSummary GenerateBookmarks].include?(task.task_type) = render_entity_links(@respondents[meta[:respondent_id]]) || render_entity_links(@categories[meta[:respondent_category_id]]) - when %w[InsightsReportSummary SectionReportSummary].include?(task.task_type) - if (cat = @categories[meta[:respondent_category_id]]) = render_entity_links(cat) br | #{t(:reports_small)}: - if cat.project - begin = link_to cat.project.title, insights_project_respondent_category_path(cat.project, cat) - rescue | Not available - when %w[QuantifiableQuestion].include?(task.task_type) - if (q = @questions[meta[:quantifiable_question_id]]) && q.respondent_category = render_entity_links(q.respondent_category) br | #{t(:reports_small)}: - if q.respondent_category.project - begin = link_to q.respondent_category.project.title, insights_project_respondent_category_path(q.respondent_category.project, q.respondent_category) - rescue | Not available - when %w[TranscriptTranslation VideoConversion].include?(task.task_type) = render_entity_links(@respondents[meta[:respondent_id]]) - when %w[ReelCreation].include?(task.task_type) - respondent = @highlights[meta[:transcript_highlight_id]]&.respondent = render_entity_links(respondent) - else = render_entity_links(@categories[meta[:respondent_category_id]]) td.text-right - if task.status == "running" - if task.progress.to_i > 0 .progress .progress-bar data-id="#{task.id}" style="width: #{task.progress}%;" span.complete-badge.badge.bg-success data-id="#{task.id}" style="display: none;" = t(:complete) - else span.badge.bg-primary = task.status&.downcase - elsif task.status&.downcase == "complete" span.badge.bg-success = task.status - elsif task.status.present? && !task.status.downcase.include?("failed") && (task.status.downcase.include?("transcribing") || task.status.downcase.include?("aligning") || task.status.downcase.include?("diarizing")) span.badge.bg-warning.text-black = task.status - elsif task.status.present? && task.status.downcase.include?("queued") span.badge.bg-dark = task.status - else span.badge.bg-danger = task.status td.text-right - if task.status.present? && ["queued", "running"].include?(task.status) && Time.current - task.created_at > 10.minutes || (current_user.developer? && task.running) = button_to "Cancel", cancel_system_task_path(task), class: "btn btn-danger btn-sm", data: { turbo_method: :post, turbo_confirm: "Are you sure you want to cancel this task?"}