commit 8e684b9673b8e0aee68151a5ab30e1ff1c534262 Author: Ben Rohlfs Date: Wed Oct 7 09:09:38 2020 +0200 Add 'Since' and 'Submitted' columns to dashboard sections Change-Id: I45944beb1a4b03a475442f074275cd2b5d83296c diff --git a/polygerrit-ui/app/elements/change-list/gr-change-list-item/gr-change-list-item.ts b/polygerrit-ui/app/elements/change-list/gr-change-list-item/gr-change-list-item.ts index 5a345f2..fee5247 100644 --- a/polygerrit-ui/app/elements/change-list/gr-change-list-item/gr-change-list-item.ts +++ b/polygerrit-ui/app/elements/change-list/gr-change-list-item/gr-change-list-item.ts @@ -46,6 +46,7 @@ import { ServerInfo, AccountInfo, QuickLabelInfo, + Timestamp, } from '../../../types/common'; import {hasOwnProperty} from '../../../utils/common-util'; @@ -383,6 +384,14 @@ export class GrChangeListItem extends ChangeTableMixin( } } + _computeSince( + account?: AccountInfo, + change?: ChangeInfo + ): Timestamp | undefined { + if (!account?._account_id || !change?.attention_set) return undefined; + return change?.attention_set[account._account_id]?.last_update; + } + toggleReviewed() { const newVal = !this.change?.reviewed; this.set('change.reviewed', newVal); diff --git a/polygerrit-ui/app/elements/change-list/gr-change-list-item/gr-change-list-item_html.ts b/polygerrit-ui/app/elements/change-list/gr-change-list-item/gr-change-list-item_html.ts index 2e98349..2ae6c37 100644 --- a/polygerrit-ui/app/elements/change-list/gr-change-list-item/gr-change-list-item_html.ts +++ b/polygerrit-ui/app/elements/change-list/gr-change-list-item/gr-change-list-item_html.ts @@ -265,6 +265,26 @@ export const htmlTemplate = html` > + + + + + + diff --git a/polygerrit-ui/app/elements/change-list/gr-change-list/gr-change-list.ts b/polygerrit-ui/app/elements/change-list/gr-change-list/gr-change-list.ts index 974d648..974238f 100644 --- a/polygerrit-ui/app/elements/change-list/gr-change-list/gr-change-list.ts +++ b/polygerrit-ui/app/elements/change-list/gr-change-list/gr-change-list.ts @@ -38,6 +38,7 @@ import { GerritNav, DashboardSection, YOUR_TURN, + CLOSED, } from '../../core/gr-navigation/gr-navigation'; import {getPluginEndpoints} from '../../shared/gr-js-api-interface/gr-plugin-endpoints'; import {getPluginLoader} from '../../shared/gr-js-api-interface/gr-plugin-loader'; @@ -59,6 +60,8 @@ const LABEL_PREFIX_INVALID_PROLOG = 'Invalid-Prolog-Rules-Label-Name--'; const MAX_SHORTCUT_CHARS = 5; export interface ChangeListSection { + name?: string; + query?: string; results: ChangeInfo[]; } export interface GrChangeList { @@ -231,9 +234,35 @@ export class GrChangeList extends ChangeTableMixin( } } - _computeColspan(changeTableColumns: string[], labelNames: string[]) { - if (!changeTableColumns || !labelNames) return; - return changeTableColumns.length + labelNames.length + NUMBER_FIXED_COLUMNS; + /** + * This methods allows us to customize the columns per section. + * + * @param visibleColumns are the columns according to configs and user prefs + */ + _computeColumns( + section?: ChangeListSection, + visibleColumns?: string[] + ): string[] { + if (!section || !visibleColumns) return []; + const cols = [...visibleColumns]; + const updatedIndex = cols.indexOf('Updated'); + if (section.name === YOUR_TURN.name && updatedIndex !== -1) { + cols[updatedIndex] = 'Since'; + } + if (section.name === CLOSED.name && updatedIndex !== -1) { + cols[updatedIndex] = 'Submitted'; + } + return cols; + } + + _computeColspan( + section?: ChangeListSection, + visibleColumns?: string[], + labelNames?: string[] + ) { + const cols = this._computeColumns(section, visibleColumns); + if (!cols || !labelNames) return 1; + return cols.length + labelNames.length + NUMBER_FIXED_COLUMNS; } _computeLabelNames(sections: ChangeListSection[]) { diff --git a/polygerrit-ui/app/elements/change-list/gr-change-list/gr-change-list_html.ts b/polygerrit-ui/app/elements/change-list/gr-change-list/gr-change-list_html.ts index eb489b0..6a66472 100644 --- a/polygerrit-ui/app/elements/change-list/gr-change-list/gr-change-list_html.ts +++ b/polygerrit-ui/app/elements/change-list/gr-change-list/gr-change-list_html.ts @@ -61,7 +61,7 @@ export const htmlTemplate = html` >