mirror of
https://0xacab.org/sutty/sutty
synced 2025-01-19 05:13:39 +00:00
fix: solo vincular urls que tienen protocolo
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed
This commit is contained in:
parent
cd7c217920
commit
d8e21c97e2
5 changed files with 14 additions and 5 deletions
|
@ -22,7 +22,12 @@ class BuildStatsController < ApplicationController
|
||||||
|
|
||||||
@table = site.deployment_list.map do |deploy|
|
@table = site.deployment_list.map do |deploy|
|
||||||
type = deploy.class.name.underscore
|
type = deploy.class.name.underscore
|
||||||
urls = deploy.respond_to?(:urls) ? deploy.urls : [deploy.url].compact
|
urls = (deploy.respond_to?(:urls) ? deploy.urls : [deploy.url].compact).map do |url|
|
||||||
|
URI.parse(url)
|
||||||
|
rescue URI::Error
|
||||||
|
nil
|
||||||
|
end.compact
|
||||||
|
|
||||||
urls = [nil] if urls.empty?
|
urls = [nil] if urls.empty?
|
||||||
build_stat = deploy.build_stats.where(status: true).last
|
build_stat = deploy.build_stats.where(status: true).last
|
||||||
seconds = build_stat&.seconds || 0
|
seconds = build_stat&.seconds || 0
|
||||||
|
|
|
@ -51,7 +51,11 @@ class DeployJob < ApplicationJob
|
||||||
status = d.deploy(output: @output)
|
status = d.deploy(output: @output)
|
||||||
seconds = d.build_stats.last.try(:seconds) || 0
|
seconds = d.build_stats.last.try(:seconds) || 0
|
||||||
size = d.size
|
size = d.size
|
||||||
urls = d.respond_to?(:urls) ? d.urls : [d.url].compact
|
urls = (d.respond_to?(:urls) ? d.urls : [d.url].compact).map do |url|
|
||||||
|
URI.parse url
|
||||||
|
rescue URI::Error
|
||||||
|
nil
|
||||||
|
end.compact
|
||||||
rescue StandardError => e
|
rescue StandardError => e
|
||||||
status = false
|
status = false
|
||||||
seconds ||= 0
|
seconds ||= 0
|
||||||
|
|
|
@ -52,7 +52,7 @@ class DeployMailer < ApplicationMailer
|
||||||
t << (row.map do |k, v|
|
t << (row.map do |k, v|
|
||||||
case k
|
case k
|
||||||
when :seconds then v[:human]
|
when :seconds then v[:human]
|
||||||
when :urls then url
|
when :urls then url.to_s
|
||||||
else v
|
else v
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
- row[:urls].each do |url|
|
- row[:urls].each do |url|
|
||||||
%tr
|
%tr
|
||||||
%th{ scope: 'row' }= row[:title]
|
%th{ scope: 'row' }= row[:title]
|
||||||
%td= link_to_if url.present?, url, url, class: 'word-break-all'
|
%td= link_to_if (url.present? && uri.scheme.present?), url.to_s, url.to_s, class: 'word-break-all'
|
||||||
%td
|
%td
|
||||||
%time{ datetime: row[:seconds][:machine] }= row[:seconds][:human]
|
%time{ datetime: row[:seconds][:machine] }= row[:seconds][:human]
|
||||||
%td= row[:size]
|
%td= row[:size]
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
%tr
|
%tr
|
||||||
%td= row[:title]
|
%td= row[:title]
|
||||||
%td= row[:status]
|
%td= row[:status]
|
||||||
%td= link_to_if url.present?, url, url
|
%td= link_to_if (url.present? && uri.scheme.present?), url.to_s, url.to_s
|
||||||
%td
|
%td
|
||||||
%time{ datetime: row[:seconds][:machine] }= row[:seconds][:human]
|
%time{ datetime: row[:seconds][:machine] }= row[:seconds][:human]
|
||||||
%td= row[:size]
|
%td= row[:size]
|
||||||
|
|
Loading…
Reference in a new issue