diff options
| author | Christian Cleberg <[email protected]> | 2026-03-18 20:23:58 -0500 |
|---|---|---|
| committer | Christian Cleberg <[email protected]> | 2026-03-18 20:23:58 -0500 |
| commit | c41cd437acde4e4f4c0781cebd4d5f4bf9517bb9 (patch) | |
| tree | 28bf13b89e36774720d015a26a8979b567ad0be9 /Hutch/Views/Builds/BuildDetailViewModel.swift | |
| parent | 1745311950fd68ad81957b3ba64f8566cd86ce19 (diff) | |
| parent | 4dd920558a1c7174c0e9a5b872325df36e363516 (diff) | |
| download | hutch-c41cd437acde4e4f4c0781cebd4d5f4bf9517bb9.tar.gz hutch-c41cd437acde4e4f4c0781cebd4d5f4bf9517bb9.tar.bz2 hutch-c41cd437acde4e4f4c0781cebd4d5f4bf9517bb9.zip | |
v1.2: Merge branch 'dev'
Diffstat (limited to 'Hutch/Views/Builds/BuildDetailViewModel.swift')
| -rw-r--r-- | Hutch/Views/Builds/BuildDetailViewModel.swift | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/Hutch/Views/Builds/BuildDetailViewModel.swift b/Hutch/Views/Builds/BuildDetailViewModel.swift index c14e47b..1768e47 100644 --- a/Hutch/Views/Builds/BuildDetailViewModel.swift +++ b/Hutch/Views/Builds/BuildDetailViewModel.swift @@ -104,7 +104,11 @@ final class BuildDetailViewModel { variables: ["id": jobId], responseType: JobDetailResponse.self ) - job = result.job + var loadedJob = result.job + loadedJob.tasks = loadedJob.tasks.enumerated().map { index, task in + task.withOrdinal(index) + } + job = loadedJob } catch { self.error = error.localizedDescription } @@ -113,19 +117,20 @@ final class BuildDetailViewModel { } func loadTaskLog(task: BuildTask) async { + let cacheKey = task.logCacheKey guard let log = task.log, let logURL = URL(string: log.fullURL), - !loadingTaskLogs.contains(task.name), - taskLogs[task.name] == nil else { return } - loadingTaskLogs.insert(task.name) + !loadingTaskLogs.contains(cacheKey), + taskLogs[cacheKey] == nil else { return } + loadingTaskLogs.insert(cacheKey) do { - taskLogs[task.name] = try await client.fetchText(url: logURL) + taskLogs[cacheKey] = try await client.fetchText(url: logURL) } catch { self.error = error.localizedDescription } - loadingTaskLogs.remove(task.name) + loadingTaskLogs.remove(cacheKey) } func cancelJob() async { |
