blob: 0fa58f4e53a1f1505bc1adc947c17c2664d9540d [file] [log] [blame]
Tao Zhou4fd32d52020-04-06 17:23:10 +02001/**
2 * @license
Ben Rohlfs94fcbbc2022-05-27 10:45:03 +02003 * Copyright 2020 Google LLC
4 * SPDX-License-Identifier: Apache-2.0
Tao Zhou4fd32d52020-04-06 17:23:10 +02005 */
6
7/**
Ben Rohlfsf00a6cc2022-03-02 12:03:41 +01008 * Tab names for primary tabs on change view page.
Tao Zhou4fd32d52020-04-06 17:23:10 +02009 */
Ole Rehmsenc24795b2020-12-10 10:09:36 +010010import {DiffViewMode} from '../api/diff';
Ben Rohlfs3a6ff7e2021-01-18 14:08:39 +010011import {DiffPreferencesInfo} from '../types/diff';
12import {EditPreferencesInfo, PreferencesInfo} from '../types/common';
Ben Rohlfs9ec190e2021-07-05 17:11:13 +020013import {
Ben Rohlfsc830b272021-07-09 12:32:00 +020014 AuthType,
Ben Rohlfs9ec190e2021-07-05 17:11:13 +020015 ChangeStatus,
Frank Borden3cc48672023-07-28 18:02:40 +020016 CommentSide,
Ben Rohlfscab94212021-07-08 12:51:56 +020017 ConfigParameterInfoType,
Ben Rohlfsc830b272021-07-09 12:32:00 +020018 DefaultDisplayNameConfig,
19 EditableAccountField,
Ben Rohlfs9ec190e2021-07-05 17:11:13 +020020 FileInfoStatus,
21 GpgKeyInfoStatus,
22 HttpMethod,
Ben Rohlfscab94212021-07-08 12:51:56 +020023 InheritedBooleanInfoConfiguredValue,
Ben Rohlfsc830b272021-07-09 12:32:00 +020024 MergeabilityComputationBehavior,
Ben Rohlfs9ec190e2021-07-05 17:11:13 +020025 ProblemInfoStatus,
Ben Rohlfsbfc688b2022-10-21 12:38:37 +020026 RepoState,
Ben Rohlfs9ec190e2021-07-05 17:11:13 +020027 RequirementStatus,
28 ReviewerState,
29 RevisionKind,
30 SubmitType,
31} from '../api/rest-api';
32
33export {
Ben Rohlfsc830b272021-07-09 12:32:00 +020034 AuthType,
Ben Rohlfs9ec190e2021-07-05 17:11:13 +020035 ChangeStatus,
Frank Borden3cc48672023-07-28 18:02:40 +020036 CommentSide,
Ben Rohlfscab94212021-07-08 12:51:56 +020037 ConfigParameterInfoType,
Ben Rohlfsc830b272021-07-09 12:32:00 +020038 DefaultDisplayNameConfig,
39 EditableAccountField,
Ben Rohlfs9ec190e2021-07-05 17:11:13 +020040 FileInfoStatus,
41 GpgKeyInfoStatus,
42 HttpMethod,
Ben Rohlfscab94212021-07-08 12:51:56 +020043 InheritedBooleanInfoConfiguredValue,
Ben Rohlfsc830b272021-07-09 12:32:00 +020044 MergeabilityComputationBehavior,
Ben Rohlfs9ec190e2021-07-05 17:11:13 +020045 ProblemInfoStatus,
Ben Rohlfsbfc688b2022-10-21 12:38:37 +020046 RepoState,
Ben Rohlfs9ec190e2021-07-05 17:11:13 +020047 RequirementStatus,
48 ReviewerState,
49 RevisionKind,
50 SubmitType,
51};
Ben Rohlfs3a6ff7e2021-01-18 14:08:39 +010052
frankborden2@gmail.comc1ef1272021-09-03 15:42:38 +020053export enum AccountTag {
54 SERVICE_USER = 'SERVICE_USER',
55}
56
Ben Rohlfs132bf282022-08-15 19:29:22 +020057export enum Tab {
Dmitrii Filippova1ae1ba2020-07-28 14:01:25 +020058 FILES = 'files',
Gal Paikine6d6e1d2020-05-07 18:31:22 +020059 /**
Ben Rohlfs44496602020-11-20 16:58:45 +010060 * When renaming 'comments' or 'findings', UrlFormatter.java must be updated.
Gal Paikine6d6e1d2020-05-07 18:31:22 +020061 */
Dmitrii Filippova1ae1ba2020-07-28 14:01:25 +020062 COMMENT_THREADS = 'comments',
63 FINDINGS = 'findings',
Ben Rohlfs44496602020-11-20 16:58:45 +010064 CHECKS = 'checks',
Dmitrii Filippova1ae1ba2020-07-28 14:01:25 +020065}
Tao Zhou4fd32d52020-04-06 17:23:10 +020066
67/**
Ben Rohlfsf00a6cc2022-03-02 12:03:41 +010068 * Tag names of change log messages.
Tao Zhou0ae75962020-04-27 14:34:10 +020069 */
Dmitrii Filippova1ae1ba2020-07-28 14:01:25 +020070export enum MessageTag {
71 TAG_DELETE_REVIEWER = 'autogenerated:gerrit:deleteReviewer',
72 TAG_NEW_PATCHSET = 'autogenerated:gerrit:newPatchSet',
Ben Rohlfsc6449212022-09-05 10:37:53 +020073 TAG_NEW_PATCHSET_OUTDATED_VOTES = 'autogenerated:gerrit:newPatchSetOutdatedVotes',
Dmitrii Filippova1ae1ba2020-07-28 14:01:25 +020074 TAG_NEW_WIP_PATCHSET = 'autogenerated:gerrit:newWipPatchSet',
75 TAG_REVIEWER_UPDATE = 'autogenerated:gerrit:reviewerUpdate',
76 TAG_SET_PRIVATE = 'autogenerated:gerrit:setPrivate',
77 TAG_UNSET_PRIVATE = 'autogenerated:gerrit:unsetPrivate',
78 TAG_SET_READY = 'autogenerated:gerrit:setReadyForReview',
79 TAG_SET_WIP = 'autogenerated:gerrit:setWorkInProgress',
Dhruv Srivastavae5485712021-02-03 11:03:56 +010080 TAG_MERGED = 'autogenerated:gerrit:merged',
Dhruv Srivastava36158ca2021-03-16 13:53:29 +010081 TAG_REVERT = 'autogenerated:gerrit:revert',
Dmitrii Filippova1ae1ba2020-07-28 14:01:25 +020082}
Dhruv Srivastava9c853fc2020-05-05 13:48:25 +020083
84/**
Dhruv Srivastava310622d2022-02-23 11:21:26 +010085 * @description These values are directly displayed in the dialog to show progress of
86 * change.
87 */
88export enum ProgressStatus {
89 RUNNING = 'RUNNING',
90 FAILED = 'FAILED',
91 NOT_STARTED = 'NOT STARTED',
92 SUCCESSFUL = 'SUCCESSFUL',
93}
94
Dhruv980b9102022-05-05 14:22:24 +020095export enum ColumnNames {
96 SUBJECT = 'Subject',
Dhruv980b9102022-05-05 14:22:24 +020097 OWNER = 'Owner',
98 REVIEWERS = 'Reviewers',
Dhruv980b9102022-05-05 14:22:24 +020099 REPO = 'Repo',
100 BRANCH = 'Branch',
101 UPDATED = 'Updated',
102 SIZE = 'Size',
Ben Rohlfsf3f83a52023-08-23 10:49:12 +0200103 STATUS = 'Status',
Dhruv980b9102022-05-05 14:22:24 +0200104}
105
Dhruv Srivastava310622d2022-02-23 11:21:26 +0100106/**
107 * @description Modes for gr-diff-cursor
Dhruv Srivastava9c853fc2020-05-05 13:48:25 +0200108 * The scroll behavior for the cursor. Values are 'never' and
109 * 'keep-visible'. 'keep-visible' will only scroll if the cursor is beyond
110 * the viewport.
111 */
Dmitrii Filippova1ae1ba2020-07-28 14:01:25 +0200112export enum ScrollMode {
113 KEEP_VISIBLE = 'keep-visible',
114 NEVER = 'never',
115}
Dmitrii Filippov4e4522e2020-05-06 12:50:49 +0200116
117/**
Ben Rohlfsf00a6cc2022-03-02 12:03:41 +0100118 * Special file paths
Dhruv Srivastavadc6739b2020-05-06 17:24:31 +0200119 */
Dmitrii Filippova1ae1ba2020-07-28 14:01:25 +0200120export enum SpecialFilePath {
121 PATCHSET_LEVEL_COMMENTS = '/PATCHSET_LEVEL',
122 COMMIT_MESSAGE = '/COMMIT_MSG',
123 MERGE_LIST = '/MERGE_LIST',
124}
Dmitrii Filippovbfbd2752020-07-28 14:51:25 +0200125
Ole Rehmsen2e08f5e2021-01-14 14:20:19 +0100126export {Side} from '../api/diff';
Ben Rohlfs322b13e2020-08-07 21:41:44 +0200127
128/**
Milutin Kristoficbec88f12020-10-13 16:53:28 +0200129 * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#mergeable-info
130 */
131export enum MergeStrategy {
132 RECURSIVE = 'recursive',
133 RESOLVE = 'resolve',
134 SIMPLE_TWO_WAY_IN_CORE = 'simple-two-way-in-core',
135 OURS = 'ours',
136 THEIRS = 'theirs',
137}
138
Dmitrii Filippovd5b1dc72020-08-11 11:06:03 +0200139/**
140 * Enum for possible PermissionRuleInfo actions
141 * https://gerrit-review.googlesource.com/Documentation/rest-api-access.html#permission-info
142 */
143export enum PermissionAction {
144 ALLOW = 'ALLOW',
145 DENY = 'DENY',
146 BLOCK = 'BLOCK',
147 // Special values for global capabilities
148 INTERACTIVE = 'INTERACTIVE',
149 BATCH = 'BATCH',
150}
151
152/**
153 * This capability allows users to use the thread pool reserved for 'Non-Interactive Users'.
154 * https://gerrit-review.googlesource.com/Documentation/access-control.html#capability_priority
155 */
156export enum UserPriority {
157 BATCH = 'BATCH',
158 INTERACTIVE = 'INTERACTIVE',
159}
160
161/**
Dmitrii Filippovd5b1dc72020-08-11 11:06:03 +0200162 * Allowed app themes
163 * https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#preferences-input
164 */
165export enum AppTheme {
Milutin Kristofic1a311a42022-05-18 22:20:03 +0200166 AUTO = 'AUTO',
Dmitrii Filippovd5b1dc72020-08-11 11:06:03 +0200167 DARK = 'DARK',
168 LIGHT = 'LIGHT',
169}
170
171/**
172 * Date formats in preferences
173 * https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#preferences-input
174 */
175export enum DateFormat {
176 STD = 'STD',
177 US = 'US',
178 ISO = 'ISO',
179 EURO = 'EURO',
180 UK = 'UK',
181}
182
183/**
184 * Time formats in preferences
185 * https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#preferences-input
186 */
187export enum TimeFormat {
188 HHMM_12 = 'HHMM_12',
189 HHMM_24 = 'HHMM_24',
190}
191
Ole Rehmsenc24795b2020-12-10 10:09:36 +0100192export {DiffViewMode};
Dmitrii Filippovd5b1dc72020-08-11 11:06:03 +0200193
194/**
195 * The type of email strategy to use.
196 * https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#preferences-input
197 */
198export enum EmailStrategy {
199 ENABLED = 'ENABLED',
200 CC_ON_OWN_COMMENTS = 'CC_ON_OWN_COMMENTS',
Ben Rohlfs868fad42020-10-13 11:40:50 +0200201 ATTENTION_SET_ONLY = 'ATTENTION_SET_ONLY',
Dmitrii Filippovd5b1dc72020-08-11 11:06:03 +0200202 DISABLED = 'DISABLED',
203}
204
205/**
Dmitrii Filippovd883c792020-10-09 16:10:51 +0200206 * The type of email format to use.
207 * Doesn't mentioned in doc, but exists in Java class GeneralPreferencesInfo.
208 */
209
210export enum EmailFormat {
211 PLAINTEXT = 'PLAINTEXT',
212 HTML_PLAINTEXT = 'HTML_PLAINTEXT',
213}
214
215/**
Dmitrii Filippovd5b1dc72020-08-11 11:06:03 +0200216 * The base which should be pre-selected in the 'Diff Against' drop-down list when the change screen is opened for a merge commit
217 * https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#preferences-input
218 */
219export enum DefaultBase {
220 AUTO_MERGE = 'AUTO_MERGE',
221 FIRST_PARENT = 'FIRST_PARENT',
222}
223
224/**
Dmitrii Filippovd5b1dc72020-08-11 11:06:03 +0200225 * how draft comments are handled
226 */
227export enum DraftsAction {
228 PUBLISH = 'PUBLISH',
229 PUBLISH_ALL_REVISIONS = 'PUBLISH_ALL_REVISIONS',
230 KEEP = 'KEEP',
231}
232
233export enum NotifyType {
234 NONE = 'NONE',
235 OWNER = 'OWNER',
236 OWNER_REVIEWERS = 'OWNER_REVIEWERS',
237 ALL = 'ALL',
238}
Dmitrii Filippovad72bf92020-10-14 10:37:58 +0200239
240/**
Dmitrii Filippov78448cd2020-10-26 17:39:11 +0100241 * Controls visibility of other users' dashboard pages and completion suggestions to web users
242 * https://gerrit-review.googlesource.com/Documentation/config-gerrit.html#accounts.visibility
243 */
244export enum AccountsVisibility {
245 ALL = 'ALL',
246 SAME_GROUP = 'SAME_GROUP',
247 VISIBLE_GROUP = 'VISIBLE_GROUP',
248 NONE = 'NONE',
249}
250
Ben Rohlfs87069a12023-02-07 21:14:12 +0100251// These defaults should match the defaults in
252// java/com/google/gerrit/extensions/client/GeneralPreferencesInfo.java
Ben Rohlfs75b390c2022-04-04 14:56:06 +0200253export function createDefaultPreferences(): PreferencesInfo {
Ben Rohlfs3a6ff7e2021-01-18 14:08:39 +0100254 return {
255 changes_per_page: 25,
Ben Rohlfs3a6ff7e2021-01-18 14:08:39 +0100256 diff_view: DiffViewMode.SIDE_BY_SIDE,
257 size_bar_in_change_table: true,
Ben Rohlfs75b390c2022-04-04 14:56:06 +0200258 my: [],
Milutin Kristofic9f86cc02022-09-15 23:04:58 +0200259 theme: AppTheme.AUTO,
Ben Rohlfs87069a12023-02-07 21:14:12 +0100260 date_format: DateFormat.STD,
261 time_format: TimeFormat.HHMM_12,
Ben Rohlfs75b390c2022-04-04 14:56:06 +0200262 change_table: [],
263 email_strategy: EmailStrategy.ATTENTION_SET_ONLY,
264 default_base_for_merges: DefaultBase.AUTO_MERGE,
Milutin Kristofic9dfe4f62022-10-12 20:11:02 +0200265 allow_browser_notifications: false,
Milutin Kristoficba95beb2024-01-12 10:20:25 +0100266 allow_suggest_code_while_commenting: true,
Frank Bordena12b3d42023-10-17 14:55:17 +0200267 diff_page_sidebar: 'NONE',
Ben Rohlfs75b390c2022-04-04 14:56:06 +0200268 };
Ben Rohlfs3a6ff7e2021-01-18 14:08:39 +0100269}
270
271// These defaults should match the defaults in
272// java/com/google/gerrit/extensions/client/DiffPreferencesInfo.java
273// NOTE: There are some settings that don't apply to PolyGerrit
274// (Render mode being at least one of them).
275export function createDefaultDiffPrefs(): DiffPreferencesInfo {
276 return {
Ben Rohlfs3a6ff7e2021-01-18 14:08:39 +0100277 context: 10,
278 cursor_blink_rate: 0,
279 font_size: 12,
280 ignore_whitespace: 'IGNORE_NONE',
Ben Rohlfs3a6ff7e2021-01-18 14:08:39 +0100281 line_length: 100,
282 line_wrapping: false,
283 show_line_endings: true,
284 show_tabs: true,
285 show_whitespace_errors: true,
286 syntax_highlighting: true,
287 tab_size: 8,
Ben Rohlfs3a6ff7e2021-01-18 14:08:39 +0100288 };
289}
290
291// These defaults should match the defaults in
292// java/com/google/gerrit/extensions/client/EditPreferencesInfo.java
293export function createDefaultEditPrefs(): EditPreferencesInfo {
294 return {
295 auto_close_brackets: false,
296 cursor_blink_rate: 0,
297 hide_line_numbers: false,
298 hide_top_menu: false,
299 indent_unit: 2,
300 indent_with_tabs: false,
301 key_map_type: 'DEFAULT',
302 line_length: 100,
303 line_wrapping: false,
304 match_brackets: true,
305 show_base: false,
306 show_tabs: true,
307 show_whitespace_errors: true,
308 syntax_highlighting: true,
309 tab_size: 8,
310 theme: 'DEFAULT',
311 };
312}
Dhruv Srivastava36ff29d2021-09-22 18:31:02 +0200313
314export const RELOAD_DASHBOARD_INTERVAL_MS = 10 * 1000;
Frank Borden949a17d2021-09-28 11:30:41 +0000315
Dhruv Srivastavac01b0872022-02-02 10:33:00 +0000316export const WAITING = 'Waiting';