Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions internal/agent/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,35 @@ func applyDetectedMachineMetadata(summary *types.MetricsSummary) {
summary.DetectedMachineMatchReason = reason
summary.DetectedMachineConfidenceLevel = confidenceLevel(confidence)
if machine == nil {
summary.DetectedMachine = fallbackDetectedMachine(summary.CIPlatform, v, m)
summary.DetectedMachineConfidence = 0
summary.DetectedMachineConfidenceLevel = "unknown"
summary.DetectedMachineMatchReason = "no catalog match found; using runtime self-hosted machine metadata"
}
}

func fallbackDetectedMachine(ciPlatform string, vcpus int, memGiB float64) *types.MachineType {
id := "self-hosted"
if runner := strings.TrimSpace(os.Getenv("RUNNER_NAME")); runner != "" {
id = runner
}

provider := types.Provider("")
if ciPlatform == "github" {
provider = types.ProviderGitHub
}

return &types.MachineType{
ID: id,
Provider: provider,
Family: "self-hosted",
Series: "self-hosted",
VCPUs: vcpus,
MemoryGiB: math.Round(memGiB*100) / 100,
StorageType: "unknown",
Architecture: runtime.GOARCH,
OnDemandPricePerHour: 0,
Tags: []string{"self-hosted", "runtime-detected"},
}
}

Expand Down
28 changes: 24 additions & 4 deletions web/src/pages/JobsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export default function JobsPage() {
const { currency } = useCurrencyPreference()
const [jobs, setJobs] = useState<Job[]>([])
const [loading, setLoading] = useState(true)
const [refreshing, setRefreshing] = useState(false)
const [error, setError] = useState<string | null>(null)

const [search, setSearch] = useState('')
Expand All @@ -31,11 +32,23 @@ export default function JobsPage() {
const [page, setPage] = useState(1)
const [pageSize, setPageSize] = useState(10)

async function loadJobs(showInitialLoader = false) {
if (showInitialLoader) setLoading(true)
else setRefreshing(true)
setError(null)
try {
const data = await fetchJobs()
setJobs(data)
} catch (e) {
setError((e as Error).message)
} finally {
if (showInitialLoader) setLoading(false)
else setRefreshing(false)
}
}

useEffect(() => {
fetchJobs()
.then(setJobs)
.catch((e) => setError(e.message))
.finally(() => setLoading(false))
void loadJobs(true)
}, [])

// Reset to page 1 on filter/page-size change
Expand Down Expand Up @@ -235,6 +248,13 @@ export default function JobsPage() {
Clear
</button>
)}
<button
onClick={() => void loadJobs(false)}
disabled={refreshing}
className="border border-[var(--border)] text-[var(--text-light)] font-deco text-[13px] tracking-[1px] px-3 py-2 bg-transparent hover:border-[var(--border-dark)] hover:text-[var(--text-mid)] transition-colors cursor-pointer disabled:opacity-60 disabled:cursor-not-allowed"
>
{refreshing ? 'Refreshing…' : 'Refresh'}
</button>
<span className="w-full sm:w-auto sm:ml-auto font-deco text-[13px] tracking-[1px] text-[var(--text-light)] self-center whitespace-nowrap text-right sm:text-left">
{filtered.length} {filtered.length === 1 ? 'job' : 'jobs'}
</span>
Expand Down
Loading