Commit 9f7b9fe809

9f7b9fe809617ccbdd1801abde713cffe352efc6

parent: 2a248c5e42

Verified · cmc

cmc <hello@cleberg.net> · 2026-09-07 00:56 UTC

Dependency section in repository settings

Layout: unified · split

gitbay/Views/Repos/RepoSettingsView.swift +63
@@ -29,6 +29,7 @@ struct RepoSettingsView: View {
2929 branchesSection(loaded)
3030 mergeRulesSection(loaded)
3131 daemonSection(loaded)
32 depsSection(loaded)
3233 }
3334 }
3435 .overlay { LoadStateOverlay(state: model.state) }
@@ -42,6 +43,7 @@ struct RepoSettingsView: View {
4243 loadedOnce = true
4344 }
4445 }
46 .task { await model.loadDeps() }
4547 .refreshable { await model.load() }
4648 }
4749
@@ -206,6 +208,67 @@ struct RepoSettingsView: View {
206208 }
207209 }
208210
211 private func depsSection(_ loaded: RepoSettingsViewModel.Loaded) -> some View {
212 Section {
213 SettingToggle(title: "Dependency checks", serverValue: model.deps?.enabled ?? false) {
214 await model.setDepsEnabled($0)
215 }
216 .disabled(model.deps == nil || model.working)
217 Text("Checks tell a public registry what this repository depends on.")
218 .font(.gbSans(.caption))
219 .foregroundStyle(.secondary)
220
221 if let deps = model.deps {
222 if deps.enabled {
223 if let lastCheck = deps.lastCheck {
224 Text(lastCheck, format: .relative(presentation: .named))
225 .font(.gbSans(.caption))
226 .foregroundStyle(.secondary)
227 } else {
228 Text("Never checked")
229 .font(.gbSans(.caption))
230 .foregroundStyle(.secondary)
231 }
232 if let lastError = deps.lastError {
233 GBNotice(lastError, .gbWarn)
234 }
235 if let issueNumber = deps.issueNumber {
236 NavigationLink(value: IssueRoute.issue(repo: model.repoPath, number: issueNumber)) {
237 Text("Tracking issue #\(issueNumber)")
238 }
239 }
240 if deps.behind.isEmpty {
241 if deps.lastCheck != nil {
242 Text("Everything is current.")
243 .font(.gbSans(.caption))
244 .foregroundStyle(.secondary)
245 }
246 } else {
247 ForEach(deps.behind) { dep in
248 VStack(alignment: .leading, spacing: 2) {
249 Text(dep.name)
250 .font(.gbSans(.subheadline))
251 Text("\(dep.ecosystem) · \(dep.current) → \(dep.latest)")
252 .font(.gbSans(.caption))
253 .foregroundStyle(.secondary)
254 }
255 }
256 }
257 }
258 } else if let depsError = model.depsError {
259 GBNotice(depsError, .gbWarn)
260 } else {
261 HStack {
262 Spacer()
263 ProgressView()
264 Spacer()
265 }
266 }
267 } header: {
268 Text("Dependencies")
269 }
270 }
271
209272 private func toggle(
210273 _ title: String,
211274 _ value: Bool,