Tao Zhou | 4fd32d5 | 2020-04-06 17:23:10 +0200 | [diff] [blame] | 1 | /** |
| 2 | * @license |
Ben Rohlfs | 94fcbbc | 2022-05-27 10:45:03 +0200 | [diff] [blame] | 3 | * Copyright 2020 Google LLC |
| 4 | * SPDX-License-Identifier: Apache-2.0 |
Tao Zhou | 4fd32d5 | 2020-04-06 17:23:10 +0200 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | /** |
Ben Rohlfs | f00a6cc | 2022-03-02 12:03:41 +0100 | [diff] [blame] | 8 | * Tab names for primary tabs on change view page. |
Tao Zhou | 4fd32d5 | 2020-04-06 17:23:10 +0200 | [diff] [blame] | 9 | */ |
Ole Rehmsen | c24795b | 2020-12-10 10:09:36 +0100 | [diff] [blame] | 10 | import {DiffViewMode} from '../api/diff'; |
Ben Rohlfs | 3a6ff7e | 2021-01-18 14:08:39 +0100 | [diff] [blame] | 11 | import {DiffPreferencesInfo} from '../types/diff'; |
| 12 | import {EditPreferencesInfo, PreferencesInfo} from '../types/common'; |
Ben Rohlfs | 9ec190e | 2021-07-05 17:11:13 +0200 | [diff] [blame] | 13 | import { |
Ben Rohlfs | c830b27 | 2021-07-09 12:32:00 +0200 | [diff] [blame] | 14 | AuthType, |
Ben Rohlfs | 9ec190e | 2021-07-05 17:11:13 +0200 | [diff] [blame] | 15 | ChangeStatus, |
Frank Borden | 3cc4867 | 2023-07-28 18:02:40 +0200 | [diff] [blame] | 16 | CommentSide, |
Ben Rohlfs | cab9421 | 2021-07-08 12:51:56 +0200 | [diff] [blame] | 17 | ConfigParameterInfoType, |
Ben Rohlfs | c830b27 | 2021-07-09 12:32:00 +0200 | [diff] [blame] | 18 | DefaultDisplayNameConfig, |
| 19 | EditableAccountField, |
Ben Rohlfs | 9ec190e | 2021-07-05 17:11:13 +0200 | [diff] [blame] | 20 | FileInfoStatus, |
| 21 | GpgKeyInfoStatus, |
| 22 | HttpMethod, |
Ben Rohlfs | cab9421 | 2021-07-08 12:51:56 +0200 | [diff] [blame] | 23 | InheritedBooleanInfoConfiguredValue, |
Ben Rohlfs | c830b27 | 2021-07-09 12:32:00 +0200 | [diff] [blame] | 24 | MergeabilityComputationBehavior, |
Ben Rohlfs | 9ec190e | 2021-07-05 17:11:13 +0200 | [diff] [blame] | 25 | ProblemInfoStatus, |
Ben Rohlfs | bfc688b | 2022-10-21 12:38:37 +0200 | [diff] [blame] | 26 | RepoState, |
Ben Rohlfs | 9ec190e | 2021-07-05 17:11:13 +0200 | [diff] [blame] | 27 | RequirementStatus, |
| 28 | ReviewerState, |
| 29 | RevisionKind, |
| 30 | SubmitType, |
| 31 | } from '../api/rest-api'; |
| 32 | |
| 33 | export { |
Ben Rohlfs | c830b27 | 2021-07-09 12:32:00 +0200 | [diff] [blame] | 34 | AuthType, |
Ben Rohlfs | 9ec190e | 2021-07-05 17:11:13 +0200 | [diff] [blame] | 35 | ChangeStatus, |
Frank Borden | 3cc4867 | 2023-07-28 18:02:40 +0200 | [diff] [blame] | 36 | CommentSide, |
Ben Rohlfs | cab9421 | 2021-07-08 12:51:56 +0200 | [diff] [blame] | 37 | ConfigParameterInfoType, |
Ben Rohlfs | c830b27 | 2021-07-09 12:32:00 +0200 | [diff] [blame] | 38 | DefaultDisplayNameConfig, |
| 39 | EditableAccountField, |
Ben Rohlfs | 9ec190e | 2021-07-05 17:11:13 +0200 | [diff] [blame] | 40 | FileInfoStatus, |
| 41 | GpgKeyInfoStatus, |
| 42 | HttpMethod, |
Ben Rohlfs | cab9421 | 2021-07-08 12:51:56 +0200 | [diff] [blame] | 43 | InheritedBooleanInfoConfiguredValue, |
Ben Rohlfs | c830b27 | 2021-07-09 12:32:00 +0200 | [diff] [blame] | 44 | MergeabilityComputationBehavior, |
Ben Rohlfs | 9ec190e | 2021-07-05 17:11:13 +0200 | [diff] [blame] | 45 | ProblemInfoStatus, |
Ben Rohlfs | bfc688b | 2022-10-21 12:38:37 +0200 | [diff] [blame] | 46 | RepoState, |
Ben Rohlfs | 9ec190e | 2021-07-05 17:11:13 +0200 | [diff] [blame] | 47 | RequirementStatus, |
| 48 | ReviewerState, |
| 49 | RevisionKind, |
| 50 | SubmitType, |
| 51 | }; |
Ben Rohlfs | 3a6ff7e | 2021-01-18 14:08:39 +0100 | [diff] [blame] | 52 | |
frankborden2@gmail.com | c1ef127 | 2021-09-03 15:42:38 +0200 | [diff] [blame] | 53 | export enum AccountTag { |
| 54 | SERVICE_USER = 'SERVICE_USER', |
| 55 | } |
| 56 | |
Ben Rohlfs | 132bf28 | 2022-08-15 19:29:22 +0200 | [diff] [blame] | 57 | export enum Tab { |
Dmitrii Filippov | a1ae1ba | 2020-07-28 14:01:25 +0200 | [diff] [blame] | 58 | FILES = 'files', |
Gal Paikin | e6d6e1d | 2020-05-07 18:31:22 +0200 | [diff] [blame] | 59 | /** |
Ben Rohlfs | 4449660 | 2020-11-20 16:58:45 +0100 | [diff] [blame] | 60 | * When renaming 'comments' or 'findings', UrlFormatter.java must be updated. |
Gal Paikin | e6d6e1d | 2020-05-07 18:31:22 +0200 | [diff] [blame] | 61 | */ |
Dmitrii Filippov | a1ae1ba | 2020-07-28 14:01:25 +0200 | [diff] [blame] | 62 | COMMENT_THREADS = 'comments', |
| 63 | FINDINGS = 'findings', |
Ben Rohlfs | 4449660 | 2020-11-20 16:58:45 +0100 | [diff] [blame] | 64 | CHECKS = 'checks', |
Dmitrii Filippov | a1ae1ba | 2020-07-28 14:01:25 +0200 | [diff] [blame] | 65 | } |
Tao Zhou | 4fd32d5 | 2020-04-06 17:23:10 +0200 | [diff] [blame] | 66 | |
| 67 | /** |
Ben Rohlfs | f00a6cc | 2022-03-02 12:03:41 +0100 | [diff] [blame] | 68 | * Tag names of change log messages. |
Tao Zhou | 0ae7596 | 2020-04-27 14:34:10 +0200 | [diff] [blame] | 69 | */ |
Dmitrii Filippov | a1ae1ba | 2020-07-28 14:01:25 +0200 | [diff] [blame] | 70 | export enum MessageTag { |
| 71 | TAG_DELETE_REVIEWER = 'autogenerated:gerrit:deleteReviewer', |
| 72 | TAG_NEW_PATCHSET = 'autogenerated:gerrit:newPatchSet', |
Ben Rohlfs | c644921 | 2022-09-05 10:37:53 +0200 | [diff] [blame] | 73 | TAG_NEW_PATCHSET_OUTDATED_VOTES = 'autogenerated:gerrit:newPatchSetOutdatedVotes', |
Dmitrii Filippov | a1ae1ba | 2020-07-28 14:01:25 +0200 | [diff] [blame] | 74 | 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 Srivastava | e548571 | 2021-02-03 11:03:56 +0100 | [diff] [blame] | 80 | TAG_MERGED = 'autogenerated:gerrit:merged', |
Dhruv Srivastava | 36158ca | 2021-03-16 13:53:29 +0100 | [diff] [blame] | 81 | TAG_REVERT = 'autogenerated:gerrit:revert', |
Dmitrii Filippov | a1ae1ba | 2020-07-28 14:01:25 +0200 | [diff] [blame] | 82 | } |
Dhruv Srivastava | 9c853fc | 2020-05-05 13:48:25 +0200 | [diff] [blame] | 83 | |
| 84 | /** |
Dhruv Srivastava | 310622d | 2022-02-23 11:21:26 +0100 | [diff] [blame] | 85 | * @description These values are directly displayed in the dialog to show progress of |
| 86 | * change. |
| 87 | */ |
| 88 | export enum ProgressStatus { |
| 89 | RUNNING = 'RUNNING', |
| 90 | FAILED = 'FAILED', |
| 91 | NOT_STARTED = 'NOT STARTED', |
| 92 | SUCCESSFUL = 'SUCCESSFUL', |
| 93 | } |
| 94 | |
Dhruv | 980b910 | 2022-05-05 14:22:24 +0200 | [diff] [blame] | 95 | export enum ColumnNames { |
| 96 | SUBJECT = 'Subject', |
Dhruv | 980b910 | 2022-05-05 14:22:24 +0200 | [diff] [blame] | 97 | OWNER = 'Owner', |
| 98 | REVIEWERS = 'Reviewers', |
Dhruv | 980b910 | 2022-05-05 14:22:24 +0200 | [diff] [blame] | 99 | REPO = 'Repo', |
| 100 | BRANCH = 'Branch', |
| 101 | UPDATED = 'Updated', |
| 102 | SIZE = 'Size', |
Ben Rohlfs | f3f83a5 | 2023-08-23 10:49:12 +0200 | [diff] [blame] | 103 | STATUS = 'Status', |
Dhruv | 980b910 | 2022-05-05 14:22:24 +0200 | [diff] [blame] | 104 | } |
| 105 | |
Dhruv Srivastava | 310622d | 2022-02-23 11:21:26 +0100 | [diff] [blame] | 106 | /** |
| 107 | * @description Modes for gr-diff-cursor |
Dhruv Srivastava | 9c853fc | 2020-05-05 13:48:25 +0200 | [diff] [blame] | 108 | * 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 Filippov | a1ae1ba | 2020-07-28 14:01:25 +0200 | [diff] [blame] | 112 | export enum ScrollMode { |
| 113 | KEEP_VISIBLE = 'keep-visible', |
| 114 | NEVER = 'never', |
| 115 | } |
Dmitrii Filippov | 4e4522e | 2020-05-06 12:50:49 +0200 | [diff] [blame] | 116 | |
| 117 | /** |
Ben Rohlfs | f00a6cc | 2022-03-02 12:03:41 +0100 | [diff] [blame] | 118 | * Special file paths |
Dhruv Srivastava | dc6739b | 2020-05-06 17:24:31 +0200 | [diff] [blame] | 119 | */ |
Dmitrii Filippov | a1ae1ba | 2020-07-28 14:01:25 +0200 | [diff] [blame] | 120 | export enum SpecialFilePath { |
| 121 | PATCHSET_LEVEL_COMMENTS = '/PATCHSET_LEVEL', |
| 122 | COMMIT_MESSAGE = '/COMMIT_MSG', |
| 123 | MERGE_LIST = '/MERGE_LIST', |
| 124 | } |
Dmitrii Filippov | bfbd275 | 2020-07-28 14:51:25 +0200 | [diff] [blame] | 125 | |
Ole Rehmsen | 2e08f5e | 2021-01-14 14:20:19 +0100 | [diff] [blame] | 126 | export {Side} from '../api/diff'; |
Ben Rohlfs | 322b13e | 2020-08-07 21:41:44 +0200 | [diff] [blame] | 127 | |
| 128 | /** |
Milutin Kristofic | bec88f1 | 2020-10-13 16:53:28 +0200 | [diff] [blame] | 129 | * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#mergeable-info |
| 130 | */ |
| 131 | export 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 Filippov | d5b1dc7 | 2020-08-11 11:06:03 +0200 | [diff] [blame] | 139 | /** |
| 140 | * Enum for possible PermissionRuleInfo actions |
| 141 | * https://gerrit-review.googlesource.com/Documentation/rest-api-access.html#permission-info |
| 142 | */ |
| 143 | export 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 | */ |
| 156 | export enum UserPriority { |
| 157 | BATCH = 'BATCH', |
| 158 | INTERACTIVE = 'INTERACTIVE', |
| 159 | } |
| 160 | |
| 161 | /** |
Dmitrii Filippov | d5b1dc7 | 2020-08-11 11:06:03 +0200 | [diff] [blame] | 162 | * Allowed app themes |
| 163 | * https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#preferences-input |
| 164 | */ |
| 165 | export enum AppTheme { |
Milutin Kristofic | 1a311a4 | 2022-05-18 22:20:03 +0200 | [diff] [blame] | 166 | AUTO = 'AUTO', |
Dmitrii Filippov | d5b1dc7 | 2020-08-11 11:06:03 +0200 | [diff] [blame] | 167 | 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 | */ |
| 175 | export 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 | */ |
| 187 | export enum TimeFormat { |
| 188 | HHMM_12 = 'HHMM_12', |
| 189 | HHMM_24 = 'HHMM_24', |
| 190 | } |
| 191 | |
Ole Rehmsen | c24795b | 2020-12-10 10:09:36 +0100 | [diff] [blame] | 192 | export {DiffViewMode}; |
Dmitrii Filippov | d5b1dc7 | 2020-08-11 11:06:03 +0200 | [diff] [blame] | 193 | |
| 194 | /** |
| 195 | * The type of email strategy to use. |
| 196 | * https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#preferences-input |
| 197 | */ |
| 198 | export enum EmailStrategy { |
| 199 | ENABLED = 'ENABLED', |
| 200 | CC_ON_OWN_COMMENTS = 'CC_ON_OWN_COMMENTS', |
Ben Rohlfs | 868fad4 | 2020-10-13 11:40:50 +0200 | [diff] [blame] | 201 | ATTENTION_SET_ONLY = 'ATTENTION_SET_ONLY', |
Dmitrii Filippov | d5b1dc7 | 2020-08-11 11:06:03 +0200 | [diff] [blame] | 202 | DISABLED = 'DISABLED', |
| 203 | } |
| 204 | |
| 205 | /** |
Dmitrii Filippov | d883c79 | 2020-10-09 16:10:51 +0200 | [diff] [blame] | 206 | * The type of email format to use. |
| 207 | * Doesn't mentioned in doc, but exists in Java class GeneralPreferencesInfo. |
| 208 | */ |
| 209 | |
| 210 | export enum EmailFormat { |
| 211 | PLAINTEXT = 'PLAINTEXT', |
| 212 | HTML_PLAINTEXT = 'HTML_PLAINTEXT', |
| 213 | } |
| 214 | |
| 215 | /** |
Dmitrii Filippov | d5b1dc7 | 2020-08-11 11:06:03 +0200 | [diff] [blame] | 216 | * 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 | */ |
| 219 | export enum DefaultBase { |
| 220 | AUTO_MERGE = 'AUTO_MERGE', |
| 221 | FIRST_PARENT = 'FIRST_PARENT', |
| 222 | } |
| 223 | |
| 224 | /** |
Dmitrii Filippov | d5b1dc7 | 2020-08-11 11:06:03 +0200 | [diff] [blame] | 225 | * how draft comments are handled |
| 226 | */ |
| 227 | export enum DraftsAction { |
| 228 | PUBLISH = 'PUBLISH', |
| 229 | PUBLISH_ALL_REVISIONS = 'PUBLISH_ALL_REVISIONS', |
| 230 | KEEP = 'KEEP', |
| 231 | } |
| 232 | |
| 233 | export enum NotifyType { |
| 234 | NONE = 'NONE', |
| 235 | OWNER = 'OWNER', |
| 236 | OWNER_REVIEWERS = 'OWNER_REVIEWERS', |
| 237 | ALL = 'ALL', |
| 238 | } |
Dmitrii Filippov | ad72bf9 | 2020-10-14 10:37:58 +0200 | [diff] [blame] | 239 | |
| 240 | /** |
Dmitrii Filippov | 78448cd | 2020-10-26 17:39:11 +0100 | [diff] [blame] | 241 | * 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 | */ |
| 244 | export enum AccountsVisibility { |
| 245 | ALL = 'ALL', |
| 246 | SAME_GROUP = 'SAME_GROUP', |
| 247 | VISIBLE_GROUP = 'VISIBLE_GROUP', |
| 248 | NONE = 'NONE', |
| 249 | } |
| 250 | |
Ben Rohlfs | 87069a1 | 2023-02-07 21:14:12 +0100 | [diff] [blame] | 251 | // These defaults should match the defaults in |
| 252 | // java/com/google/gerrit/extensions/client/GeneralPreferencesInfo.java |
Ben Rohlfs | 75b390c | 2022-04-04 14:56:06 +0200 | [diff] [blame] | 253 | export function createDefaultPreferences(): PreferencesInfo { |
Ben Rohlfs | 3a6ff7e | 2021-01-18 14:08:39 +0100 | [diff] [blame] | 254 | return { |
| 255 | changes_per_page: 25, |
Ben Rohlfs | 3a6ff7e | 2021-01-18 14:08:39 +0100 | [diff] [blame] | 256 | diff_view: DiffViewMode.SIDE_BY_SIDE, |
| 257 | size_bar_in_change_table: true, |
Ben Rohlfs | 75b390c | 2022-04-04 14:56:06 +0200 | [diff] [blame] | 258 | my: [], |
Milutin Kristofic | 9f86cc0 | 2022-09-15 23:04:58 +0200 | [diff] [blame] | 259 | theme: AppTheme.AUTO, |
Ben Rohlfs | 87069a1 | 2023-02-07 21:14:12 +0100 | [diff] [blame] | 260 | date_format: DateFormat.STD, |
| 261 | time_format: TimeFormat.HHMM_12, |
Ben Rohlfs | 75b390c | 2022-04-04 14:56:06 +0200 | [diff] [blame] | 262 | change_table: [], |
| 263 | email_strategy: EmailStrategy.ATTENTION_SET_ONLY, |
| 264 | default_base_for_merges: DefaultBase.AUTO_MERGE, |
Milutin Kristofic | 9dfe4f6 | 2022-10-12 20:11:02 +0200 | [diff] [blame] | 265 | allow_browser_notifications: false, |
Milutin Kristofic | ba95beb | 2024-01-12 10:20:25 +0100 | [diff] [blame] | 266 | allow_suggest_code_while_commenting: true, |
Frank Borden | a12b3d4 | 2023-10-17 14:55:17 +0200 | [diff] [blame] | 267 | diff_page_sidebar: 'NONE', |
Ben Rohlfs | 75b390c | 2022-04-04 14:56:06 +0200 | [diff] [blame] | 268 | }; |
Ben Rohlfs | 3a6ff7e | 2021-01-18 14:08:39 +0100 | [diff] [blame] | 269 | } |
| 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). |
| 275 | export function createDefaultDiffPrefs(): DiffPreferencesInfo { |
| 276 | return { |
Ben Rohlfs | 3a6ff7e | 2021-01-18 14:08:39 +0100 | [diff] [blame] | 277 | context: 10, |
| 278 | cursor_blink_rate: 0, |
| 279 | font_size: 12, |
| 280 | ignore_whitespace: 'IGNORE_NONE', |
Ben Rohlfs | 3a6ff7e | 2021-01-18 14:08:39 +0100 | [diff] [blame] | 281 | 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 Rohlfs | 3a6ff7e | 2021-01-18 14:08:39 +0100 | [diff] [blame] | 288 | }; |
| 289 | } |
| 290 | |
| 291 | // These defaults should match the defaults in |
| 292 | // java/com/google/gerrit/extensions/client/EditPreferencesInfo.java |
| 293 | export 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 Srivastava | 36ff29d | 2021-09-22 18:31:02 +0200 | [diff] [blame] | 313 | |
| 314 | export const RELOAD_DASHBOARD_INTERVAL_MS = 10 * 1000; |
Frank Borden | 949a17d | 2021-09-28 11:30:41 +0000 | [diff] [blame] | 315 | |
Dhruv Srivastava | c01b087 | 2022-02-02 10:33:00 +0000 | [diff] [blame] | 316 | export const WAITING = 'Waiting'; |