╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ Issues.zig ───────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │http│ ssh │ │ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
69 // window. 70 next_id: ?[]const u8, 71 // how many issues the listing holds across all windows. 72 count: usize, 73 // whether a search stopped counting at its cap, so `count` is a floor. 74 more: bool = false, 75 76 pub const empty: Window = .{ .items = &.{}, .prev_id = null, .next_id = null, .count = 0 }; 77 }; 78 79 // "owner:name", so the view can build /owner:name/issues/... links. 80 identity: []const u8, 81 // the url-encoded label the lists are filtered to ("" = unfiltered). 82 label: []const u8, 83 // the url-encoded name or email the lists are filtered to, as typed ("" = unfiltered). 84 assignee: []const u8, 85 // false when the assignee names no user or no assigned issue, which lists nothing 86 assignee_found: bool = true, 87 // the decoded query the lists are filtered to, or null when unfiltered. 88 search: ?[]const u8 = null, 89 // the hex event id of the issue its status's window is rooted at ("" = the 90 // first window), mirrored into the url. 91 selected_id: []const u8, 92 // the comment shown in the selected issue's detail pane. 93 comment_id: []const u8, 94 // the selected issue's comment window (0 = the first window). 95 comments_start: usize, 96 // the selected comment and its immediate replies. 97 comment_page: ?Comment.Permalink = null, 98 // who the page is built for, null when logged out 99 viewer: ?ui.Viewer = null, 100 open: Window, 101 closed: Window, 102 // the conflicted issues' listing; its count also gates the conflicts tab. 103 conflicts: Window, 104 // the selected issue's conflict, set when the page shows the resolve view. 105 conflict: ?Conflict = null, 106 // the resolve view's comma-separated fields prefilled from their side, 107 // mirrored from the url. 108 theirs_picks: []const u8 = "", 109 // the view the page shows initially (a selected issue's status overrides the route's) 110 view: ui.RoutablePage.IssuesView, 111 // the /description page: the detail pane shows the selected issue's whole 112 // description behind a back link. 113 description_page: bool = false, 114 // every label in the repo, in sorted order, for the labels view. 115 labels: []const []const u8, 116 // the on-disk repo this page was read from, for the terminal submit path 117 // (the web posts the new-issue form to the issue route instead). 118 repo_source: ?ui.RepoSource = null, 119 120 const Self = @This(); 121 122 pub const Event = evt.Issue; 123 pub const Status = evt.Issue.Status; 124 pub const ViewKind = ui.RoutablePage.IssuesView; 125 pub const thread_name = "issue"; 126 pub const header_widget_name = "repo_issues_header"; 127 128 pub fn statusKind(event: Event) Status { 129 return event.status; 130 } 131 132 pub fn listRoute(identity: []const u8, status: Status, label: []const u8, selected: []const u8) ?ui.RoutablePage { 133 return ui.RoutablePage.repoIssuesRoute(identity, status, label, selected); 134 } 135 136 pub fn conflictsRoute(identity: []const u8, selected: []const u8) ?ui.RoutablePage { 137 return ui.RoutablePage.repoIssuesConflictsRoute(identity, selected); 138 } 139 140 pub fn resolveRoute(identity: []const u8, selected: []const u8, picks: []const u8) ?ui.RoutablePage { 141 return ui.RoutablePage.repoIssuesResolveRoute(identity, selected, picks); 142 } 143 144 // `status`'s windowed listing. 145 pub fn window(self: *const Self, status: evt.Issue.Status) *const Window { 146 return switch (status) { 147 .open => &self.open, 148 .closed => &self.closed, 149 }; 150 } 151 152 // whether `field` (a field name or "d<n>" hunk name) is listed in the url's 153 // theirs: picks. 154 pub fn theirsPicked(self: *const Self, field: []const u8) bool { 155 var it = std.mem.splitScalar(u8, self.theirs_picks, ','); 156 while (it.next()) |pick| { 157 if (std.mem.eql(u8, pick, field)) return true; 158 } 159 return false; 160 } 161 162 // the issue `selected_id` names, in whichever window holds it. 163 pub fn selectedThread(self: *const Self) ?*const IssueWithId { 164 if (self.selected_id.len == 0) return null; 165 for ([_]*const Window{ &self.open, &self.closed }) |win| { 166 for (win.items) |*entry| { 167 if (std.mem.eql(u8, entry.id, self.selected_id)) return entry; 168 } 169 } 170 return null; 171 } 172 173 // an empty listing, for the wasm / no-repo paths. 174 pub fn emptyResult(aa: std.mem.Allocator, identity: []const u8, label: []const u8, assignee: []const u8, search: []const u8, selected_id: []const u8, comment_id: []const u8, comments_start: usize, theirs_picks: []const u8, view: ui.RoutablePage.IssuesView) !Self { 175 return .{ 176 .identity = try aa.dupe(u8, identity), 177 .label = try aa.dupe(u8, label), 178 .assignee = try aa.dupe(u8, assignee), 179 .search = if (search.len == 0) null else std.Uri.percentDecodeInPlace(try aa.dupe(u8, search)), 180 .selected_id = try aa.dupe(u8, selected_id), 181 .comment_id = try aa.dupe(u8, comment_id), 182 .comments_start = comments_start, 183 .open = .empty, 184 .closed = .empty, 185 .conflicts = .empty, 186 .theirs_picks = try aa.dupe(u8, theirs_picks), 187 // a description url shows a status list, the issue's own status 188 // picking it once the issue is read; conflicts and resolve urls also 189 // start there, upgraded by init when the conflict data exists. 190 .view = switch (view) { 191 .description, .conflicts, .resolve => .open, 192 else => view, 193 }, 194 .description_page = view == .description, 195 .labels = &.{}, 196 }; 197 } 198 199 // read one window per status of an opened repo's issues (filtered to `label` 200 // and `assignee` when set), ordered by creation (newest first). the window of 201 // the issue `selected_id` names starts at it ("" = the beginning). a git repo reads the 202 // event db next to it (synced from the events branch on each page build); a 203 // xit repo reads its own db. 204 pub fn init( 205 comptime repo_kind: rp.RepoKind, 206 comptime repo_opts: rp.RepoOpts(repo_kind), 207 arena: *std.heap.ArenaAllocator, 208 repo: *rp.Repo(repo_kind, repo_opts), 209 io: std.Io, 210 // the admin db's moment, for resolving author emails to user names (null 211 // in local mode, which has no users) 212 admin_moment: ?evt.AdminDB.HashMap(.read_only), 213 identity: []const u8, 214 label: []const u8, 215 assignee: []const u8, 216 search: []const u8, 217 selected_id: []const u8, 218 comment_id: []const u8, 219 comments_start: usize, 220 theirs_picks: []const u8, 221 view: ui.RoutablePage.IssuesView, 222 viewer: ?ui.Viewer, 223 ) !Self { 224 const empty = try emptyResult(arena.allocator(), identity, label, assignee, search, selected_id, comment_id, comments_start, theirs_picks, view); 225 226 const aa = arena.allocator(); 227 const DB = evt.EventDB(repo_opts.hash); 228 const rooted = empty.selected_id.len != 0; 229 const labeled = empty.label.len != 0; 230 // an explicitly named issue or label that doesn't exist is a bad url 231 // (NotFound -> 404); the bare route falls through to an empty listing. 232 const strict = rooted or labeled; 233 234 // a repo with no consumed events has no moment yet. 235 const gpa = arena.child_allocator; 236 var event_db_maybe: ?evt.LocalEventDB(repo_opts.hash) = if (repo_kind == .git) try evt.LocalEventDB(repo_opts.hash).openReadOnly(io, gpa, repo.core.repo_dir) else null; 237 defer if (event_db_maybe) |*event_db| event_db.deinit(io, gpa); 238 const haxy_moment = (if (event_db_maybe) |*event_db| 239 evt.currentMomentFromDb(repo_opts.hash, event_db.db) 240 else if (repo_kind == .git) 241 return empty 242 else 243 evt.currentMoment(repo_opts, repo)) catch { 244 if (strict) return error.NotFound; 245 return empty; 246 }; 247 248 // the sorted sets to window, per status: the label's sets when filtered, 249 // else the top-level per-status sets. a missing set is an empty window. 250 var open_set: ?DB.SortedSet(.read_only) = null; 251 var closed_set: ?DB.SortedSet(.read_only) = null; 252 if (labeled) { 253 const label_to_issues_cursor = try haxy_moment.getCursor(hash.hashInt(repo_opts.hash, evt.Issue.label_status_to_id_set_key)) orelse return error.NotFound; 254 const label_to_issues = try DB.SortedMap(.read_only).init(label_to_issues_cursor); 255 const decoded = std.Uri.percentDecodeInPlace(try aa.dupe(u8, empty.label)); 256 open_set = try thread.labelStatusSet(Self, DB, label_to_issues, decoded, .open); 257 closed_set = try thread.labelStatusSet(Self, DB, label_to_issues, decoded, .closed); 258 // a label no issue carries is a bad url 259 if (open_set == null and closed_set == null) return error.NotFound; 260 } else if (try haxy_moment.getCursor(hash.hashInt(repo_opts.hash, evt.Issue.status_to_id_set_key))) |status_to_issues_cursor| { 261 const status_to_issues = try DB.SortedMap(.read_only).init(status_to_issues_cursor); 262 open_set = try thread.statusSet(Self, DB, status_to_issues, .open); 263 closed_set = try thread.statusSet(Self, DB, status_to_issues, .closed); 264 } else if (rooted) return error.NotFound; 265 266 // the assignee's issues, intersected with each status's set when windowed. 267 // a name resolves to its user's email. an unknown name or an email no 268 // issue carries lists nothing and marks the box, like the assign input. 269 var assignee_set: ?DB.SortedSet(.read_only) = null; 270 const assignee_found = empty.assignee.len == 0 or found: { 271 const decoded = std.Uri.percentDecodeInPlace(try aa.dupe(u8, empty.assignee)); 272 const email = switch (try ui.assigneeEmail(admin_moment, arena, decoded)) { 273 .email => |email| email, 274 .failure => break :found false, 275 }; 276 const by_assignee_cursor = try haxy_moment.getCursor(hash.hashInt(repo_opts.hash, evt.Assignment.assignee_to_issue_id_set_key)) orelse break :found false; 277 const by_assignee = try DB.HashMap(.read_only).init(by_assignee_cursor); 278 const set_cursor = try by_assignee.getCursor(hash.hashInt(repo_opts.hash, email)) orelse break :found false; 279 assignee_set = try DB.SortedSet(.read_only).init(set_cursor); 280 break :found true; 281 }; 282 if (!assignee_found) { 283 open_set = null; 284 closed_set = null; 285 } 286 287 const event_id_to_issue_cursor = try haxy_moment.getCursor(hash.hashInt(repo_opts.hash, evt.Issue.record_map_key)) orelse { 288 if (strict) return error.NotFound; 289 return empty; 290 }; 291 const event_id_to_issue = try DB.HashMap(.read_only).init(event_id_to_issue_cursor); 292 293 // the conflicted issues' container: a set view for membership and 294 // windowing, a map view for the resolve entry, over the same cursor. 295 var conflict_set: ?DB.SortedSet(.read_only) = null; 296 var conflicts_map: ?DB.SortedMap(.read_only) = null; 297 if (try haxy_moment.getCursor(hash.hashInt(repo_opts.hash, evt.Issue.conflicts_key))) |cursor| { 298 conflict_set = try DB.SortedSet(.read_only).init(cursor); 299 conflicts_map = try DB.SortedMap(.read_only).init(cursor); 300 } 301 302 // a named issue roots its own status's window at itself (the conflicts 303 // view's window instead); the other windows start at the beginning. 304 var resolved_view = empty.view; 305 var open_root: ?[]const u8 = null; 306 var closed_root: ?[]const u8 = null; 307 var conflicts_root: ?[]const u8 = null; 308 var conflict_data: ?Conflict = null; 309 if (rooted) { 310 const id_bytes = evt.parseEventId(empty.selected_id) catch return error.NotFound; 311 const issue_cursor = try event_id_to_issue.getCursor(hash.hashInt(repo_opts.hash, &id_bytes)) orelse return error.NotFound; 312 const issue_map = try DB.HashMap(.read_only).init(issue_cursor); 313 const issue_event = try evt.read(evt.Issue.Record, DB, repo_opts.hash, arena, issue_map); 314 const order_key = try aa.dupe(u8, &evt.orderKeyDesc(issue_event.created_order, &id_bytes)); 315 316 if (view == .conflicts) { 317 // the id roots the conflicts window, so it must be conflicted 318 const set = conflict_set orelse return error.NotFound; 319 if (!try set.contains(order_key)) return error.NotFound; 320 conflicts_root = order_key; 321 } else { 322 // the named issue must be in its windowed set (a label url can name 323 // an issue that doesn't carry the label). 324 const set = (switch (issue_event.event.status) { 325 .open => open_set, 326 .closed => closed_set, 327 }) orelse return error.NotFound; 328 if (!try set.contains(order_key)) return error.NotFound; 329 if (assignee_set) |assignee_issues| if (!try assignee_issues.contains(order_key)) return error.NotFound; 330 331 switch (issue_event.event.status) { 332 .open => open_root = order_key, 333 .closed => closed_root = order_key, 334 } 335 // form urls keep their view; otherwise the issue's status picks it. 336 if (view != .edit and view != .new_comment and view != .edit_comment and view != .remove) resolved_view = switch (issue_event.event.status) { 337 .open => .open, 338 .closed => .closed, 339 }; 340 341 // a resolve url shows the resolve view only while the issue still 342 // has a conflict entry; otherwise the status list stands. the 343 // wasm client renders from the snapshot, so the diff machinery 344 // this pulls in is gated out of its build. 345 if (comptime !wasm) { 346 if (view == .resolve) { 347 if (conflicts_map) |map| { 348 if (try map.getCursor(order_key)) |conflict_cursor| { 349 const conflict_entry = try DB.HashMap(.read_only).init(conflict_cursor); 350 conflict_data = try thread.readConflict(Self, repo_kind, repo_opts, arena, repo, io, admin_moment, haxy_moment, &id_bytes, issue_event, conflict_entry); 351 resolved_view = .resolve; 352 } 353 } 354 } 355 } 356 } 357 } 358 359 const thread_comments_start = if (empty.comment_id.len == 0) comments_start else 0; 360 const open_window = try thread.loadWindow(Self, .issue, repo_opts.hash, arena, admin_moment, haxy_moment, event_id_to_issue, open_set, open_root, conflict_set, empty.selected_id, thread_comments_start, empty.search, assignee_set, viewer); 361 const closed_window = try thread.loadWindow(Self, .issue, repo_opts.hash, arena, admin_moment, haxy_moment, event_id_to_issue, closed_set, closed_root, conflict_set, empty.selected_id, thread_comments_start, empty.search, assignee_set, viewer); 362 const conflicts_window = try thread.loadWindow(Self, .issue, repo_opts.hash, arena, admin_moment, haxy_moment, event_id_to_issue, conflict_set, conflicts_root, conflict_set, empty.selected_id, thread_comments_start, null, null, viewer); 363 if (view == .conflicts and conflicts_window.count > 0) resolved_view = .conflicts; 364 365 const comment_page = if (empty.comment_id.len == 0) 366 null 367 else 368 try Comment.init(repo_opts.hash, arena, admin_moment, haxy_moment, empty.selected_id, empty.comment_id, comments_start, viewer); 369 370 const labels = try thread.loadLabels(Self, repo_opts.hash, arena, haxy_moment); 371 372 return .{ 373 .identity = empty.identity, 374 .label = empty.label, 375 .assignee = empty.assignee, 376 .assignee_found = assignee_found, 377 .search = empty.search, 378 .selected_id = empty.selected_id, 379 .comment_id = empty.comment_id, 380 .comments_start = comments_start, 381 .comment_page = comment_page, 382 .viewer = viewer, 383 .open = open_window, 384 .closed = closed_window, 385 .conflicts = conflicts_window, 386 .conflict = conflict_data, 387 .theirs_picks = empty.theirs_picks, 388 .view = resolved_view, 389 .description_page = empty.description_page, 390 .labels = labels, 391 }; 392 } 393 394 pub const View = thread.View(.issue, Self); 395 pub const Detail = thread.Detail(.issue, Self); 396 pub const detail_widget_name = "repo_issue_detail"; 397 398 pub const Header = thread.Header; 399 400 const open_tab_label = "open"; 401 const closed_tab_label = "closed"; 402 const labels_tab_label = "labels"; 403 const edit_tab_label = "edit"; 404 const reply_tab_label = "reply"; 405 const remove_tab_label = "remove"; 406 const resolve_tab_label = "resolve"; 407 const new_tab_label = "new"; 408 const conflicts_tab_label = "conflicts"; 409 410 // tabs switching between the issues page's views 411 pub fn initHeader(allocator: std.mem.Allocator, session: *ui.Session, data: *const Self) !Header { 412 var header = try Header.init(allocator, session, data.search, .{ 413 .label = if (data.assignee_found) " assignee " else " assignee (not found) ", 414 .text = std.Uri.percentDecodeInPlace(try session.page_arena.allocator().dupe(u8, data.assignee)), 415 }); 416 errdefer header.deinit(allocator); 417 const selected_index = View.viewIndex(data.view); 418 const page_selected = std.meta.activeTag(session.data.current_page) == .repo_issues; 419 420 // a list tab per status, labeled with its listing's issue count 421 const status_labels = [_][]const u8{ open_tab_label, closed_tab_label }; 422 for ([_]evt.Issue.Status{ .open, .closed }, status_labels, 0..) |status, status_label, index| { 423 const route = try thread.searchRoute(ui.RoutablePage.withEncodedAssignee(ui.RoutablePage.repoIssuesRoute(data.identity, status, data.label, ""), data.assignee), data.search); 424 const link = try ui.inPageTabLink(session, route, page_selected and selected_index == index); 425 var label_buf: [64]u8 = undefined; 426 const label = try thread.countLabel(&label_buf, status_label, data.window(status).*); 427 try header.addTab(allocator, label, link, index); 428 } 429 430 // labels tab 431 { 432 const labels_route = try thread.searchRoute(ui.RoutablePage.withEncodedAssignee(ui.RoutablePage.repoThreadLabelsRoute(.issue, data.identity, data.label), data.assignee), data.search); 433 const labels_link = try ui.inPageTabLink(session, labels_route, page_selected and selected_index == View.viewIndex(.labels)); 434 try header.addTab(allocator, labels_tab_label, labels_link, View.viewIndex(.labels)); 435 } 436 437 // new-issue tab; an edit or resolve url shows its tab in this place 438 { 439 const route = switch (data.view) { 440 .edit => ui.RoutablePage.repoThreadEditRoute(.issue, data.identity, data.selected_id) orelse return error.RouteTooLong, 441 .new_comment => ui.RoutablePage.repoThreadCommentNewRoute(.issue, data.identity, data.selected_id, data.comment_id) orelse return error.RouteTooLong, 442 .edit_comment => ui.RoutablePage.repoThreadCommentEditRoute(.issue, data.identity, data.selected_id, data.comment_id) orelse return error.RouteTooLong, 443 .remove => ui.RoutablePage.repoThreadRemoveRoute(.issue, data.identity, data.selected_id, data.comment_id) orelse return error.RouteTooLong, 444 .resolve => ui.RoutablePage.repoIssuesResolveRoute(data.identity, data.selected_id, data.theirs_picks) orelse return error.RouteTooLong, 445 else => ui.RoutablePage.repoThreadNewRoute(.issue, data.identity) orelse return error.RouteTooLong, 446 }; 447 const link = try ui.inPageTabLink(session, route, page_selected and selected_index == View.viewIndex(.new)); 448 const label: []const u8 = switch (data.view) { 449 .edit => edit_tab_label, 450 .new_comment => reply_tab_label, 451 .edit_comment => edit_tab_label, 452 .remove => remove_tab_label, 453 .resolve => resolve_tab_label, 454 else => new_tab_label, 455 }; 456 try header.addTab(allocator, label, link, View.viewIndex(.new)); 457 } 458 459 // conflicts tab, labeled with the conflict count 460 if (data.conflicts.count > 0) { 461 const route = ui.RoutablePage.repoIssuesConflictsRoute(data.identity, "") orelse return error.RouteTooLong; 462 const link = try ui.inPageTabLink(session, route, page_selected and selected_index == View.viewIndex(.conflicts)); 463 var label_buf: [64]u8 = undefined; 464 const label = try std.fmt.bufPrint(&label_buf, conflicts_tab_label ++ " ({d})", .{data.conflicts.count}); 465 try header.addTab(allocator, label, link, View.viewIndex(.conflicts)); 466 } 467 468 header.select(View.viewIndex(data.view)); 469 return header; 470 } 471