Add the selected patchset for Checks as a URL parameter Since we have a dedicated URL parameter for the checks patchset, we stop mirroring the files patchset over to the checks patchset. That was only a one-way sync and likely a bit confusing. It was also a stop-gap, such that users could point to checks for a specific patchset using the files patchset. Release-Notes: skip Google-Bug-Id: b/235185477 Change-Id: Ief5b2274c0cb8dbe63ede260f3455bee0387a4e6
diff --git a/polygerrit-ui/app/models/views/change.ts b/polygerrit-ui/app/models/views/change.ts index 4c97f60..826ec66 100644 --- a/polygerrit-ui/app/models/views/change.ts +++ b/polygerrit-ui/app/models/views/change.ts
@@ -9,6 +9,7 @@ RevisionPatchSetNum, BasePatchSetNum, ChangeInfo, + PatchSetNumber, } from '../../api/rest-api'; import {GerritView} from '../../services/router/router-model'; import {UrlEncodedCommentId} from '../../types/common'; @@ -25,22 +26,34 @@ export interface ChangeViewState extends ViewState { view: GerritView.CHANGE; + changeNum: NumericChangeId; project: RepoName; edit?: boolean; patchNum?: RevisionPatchSetNum; basePatchNum?: BasePatchSetNum; commentId?: UrlEncodedCommentId; - forceReload?: boolean; - openReplyDialog?: boolean; tab?: string; + + /** Checks related view state */ + + /** selected patchset for check runs (undefined=latest) */ + checksPatchset?: PatchSetNumber; /** regular expression for filtering check runs */ filter?: string; - /** selected attempt for selected check runs */ + /** selected attempt for check runs (undefined=latest) */ attempt?: AttemptChoice; + /** State properties that trigger one-time actions */ + + /** for scrolling a Change Log message into view in gr-change-view */ messageHash?: string; + /** for logging where the user came from */ usp?: string; + /** triggers all change related data to be reloaded */ + forceReload?: boolean; + /** triggers opening the reply dialog */ + openReplyDialog?: boolean; } /** @@ -85,6 +98,9 @@ } let suffix = `${range}`; const queries = []; + if (state.checksPatchset && state.checksPatchset > 0) { + queries.push(`checksPatchset=${state.checksPatchset}`); + } if (state.attempt) { if (state.attempt !== 'latest') queries.push(`attempt=${state.attempt}`); } @@ -126,6 +142,11 @@ export class ChangeViewModel extends Model<ChangeViewState | undefined> { public readonly tab$ = select(this.state$, state => state?.tab); + public readonly checksPatchset$ = select( + this.state$, + state => state?.checksPatchset + ); + public readonly attempt$ = select(this.state$, state => state?.attempt); public readonly filter$ = select(this.state$, state => state?.filter);