blob: 50be7eef8e3cac16fd833767800aff6491762c18 [file] [log] [blame]
Tao Zhou4fd32d52020-04-06 17:23:10 +02001/**
2 * @license
3 * Copyright (C) 2020 The Android Open Source Project
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18/**
Tao Zhou4fd32d52020-04-06 17:23:10 +020019 * @desc Tab names for primary tabs on change view page.
20 */
Ben Rohlfs3a6ff7e2021-01-18 14:08:39 +010021import {DiffPreferencesInfo} from '../types/diff';
22import {EditPreferencesInfo, PreferencesInfo} from '../types/common';
23
Dmitrii Filippova1ae1ba2020-07-28 14:01:25 +020024export enum PrimaryTab {
25 FILES = 'files',
Gal Paikine6d6e1d2020-05-07 18:31:22 +020026 /**
Ben Rohlfs44496602020-11-20 16:58:45 +010027 * When renaming 'comments' or 'findings', UrlFormatter.java must be updated.
Gal Paikine6d6e1d2020-05-07 18:31:22 +020028 */
Dmitrii Filippova1ae1ba2020-07-28 14:01:25 +020029 COMMENT_THREADS = 'comments',
30 FINDINGS = 'findings',
Ben Rohlfs44496602020-11-20 16:58:45 +010031 CHECKS = 'checks',
Dmitrii Filippova1ae1ba2020-07-28 14:01:25 +020032}
Tao Zhou4fd32d52020-04-06 17:23:10 +020033
34/**
Tao Zhou4fd32d52020-04-06 17:23:10 +020035 * @desc Tab names for secondary tabs on change view page.
36 */
Dmitrii Filippova1ae1ba2020-07-28 14:01:25 +020037export enum SecondaryTab {
38 CHANGE_LOG = '_changeLog',
39}
Tao Zhou4fd32d52020-04-06 17:23:10 +020040
Tao Zhou0ae75962020-04-27 14:34:10 +020041/**
Tao Zhou0ae75962020-04-27 14:34:10 +020042 * @desc Tag names of change log messages.
43 */
Dmitrii Filippova1ae1ba2020-07-28 14:01:25 +020044export enum MessageTag {
45 TAG_DELETE_REVIEWER = 'autogenerated:gerrit:deleteReviewer',
46 TAG_NEW_PATCHSET = 'autogenerated:gerrit:newPatchSet',
47 TAG_NEW_WIP_PATCHSET = 'autogenerated:gerrit:newWipPatchSet',
48 TAG_REVIEWER_UPDATE = 'autogenerated:gerrit:reviewerUpdate',
49 TAG_SET_PRIVATE = 'autogenerated:gerrit:setPrivate',
50 TAG_UNSET_PRIVATE = 'autogenerated:gerrit:unsetPrivate',
51 TAG_SET_READY = 'autogenerated:gerrit:setReadyForReview',
52 TAG_SET_WIP = 'autogenerated:gerrit:setWorkInProgress',
53 TAG_SET_ASSIGNEE = 'autogenerated:gerrit:setAssignee',
54 TAG_UNSET_ASSIGNEE = 'autogenerated:gerrit:deleteAssignee',
55}
Dhruv Srivastava9c853fc2020-05-05 13:48:25 +020056
57/**
Dhruv Srivastava9c853fc2020-05-05 13:48:25 +020058 * @desc Modes for gr-diff-cursor
59 * The scroll behavior for the cursor. Values are 'never' and
60 * 'keep-visible'. 'keep-visible' will only scroll if the cursor is beyond
61 * the viewport.
62 */
Dmitrii Filippova1ae1ba2020-07-28 14:01:25 +020063export enum ScrollMode {
64 KEEP_VISIBLE = 'keep-visible',
65 NEVER = 'never',
66}
Dmitrii Filippov4e4522e2020-05-06 12:50:49 +020067
68/**
Dmitrii Filippov4e4522e2020-05-06 12:50:49 +020069 * @desc Specifies status for a change
70 */
Dmitrii Filippova1ae1ba2020-07-28 14:01:25 +020071export enum ChangeStatus {
72 ABANDONED = 'ABANDONED',
73 MERGED = 'MERGED',
74 NEW = 'NEW',
75}
Dhruv Srivastavadc6739b2020-05-06 17:24:31 +020076
77/**
Dhruv Srivastavadc6739b2020-05-06 17:24:31 +020078 * @desc Special file paths
79 */
Dmitrii Filippova1ae1ba2020-07-28 14:01:25 +020080export enum SpecialFilePath {
81 PATCHSET_LEVEL_COMMENTS = '/PATCHSET_LEVEL',
82 COMMIT_MESSAGE = '/COMMIT_MSG',
83 MERGE_LIST = '/MERGE_LIST',
84}
Dmitrii Filippovbfbd2752020-07-28 14:51:25 +020085
86/**
87 * @desc The reviewer state
88 */
89export enum RequirementStatus {
90 OK = 'OK',
91 NOT_READY = 'NOT_READY',
92 RULE_ERROR = 'RULE_ERROR',
93}
94
95/**
96 * @desc The reviewer state
97 */
98export enum ReviewerState {
99 REVIEWER = 'REVIEWER',
100 CC = 'CC',
101 REMOVED = 'REMOVED',
102}
103
104/**
105 * @desc The patchset kind
106 */
107export enum RevisionKind {
108 REWORK = 'REWORK',
109 TRIVIAL_REBASE = 'TRIVIAL_REBASE',
110 MERGE_FIRST_PARENT_UPDATE = 'MERGE_FIRST_PARENT_UPDATE',
111 NO_CODE_CHANGE = 'NO_CODE_CHANGE',
112 NO_CHANGE = 'NO_CHANGE',
113}
114
115/**
116 * @desc The status of fixing the problem
117 */
118export enum ProblemInfoStatus {
119 FIXED = 'FIXED',
120 FIX_FAILED = 'FIX_FAILED',
121}
122
123/**
124 * @desc The status of the file
125 */
126export enum FileInfoStatus {
127 ADDED = 'A',
128 DELETED = 'D',
129 RENAMED = 'R',
130 COPIED = 'C',
131 REWRITTEN = 'W',
Tao Zhou7a514222020-08-03 15:21:07 +0200132 // Modifed = 'M', // but API not set it if the file was modified
133 UNMODIFIED = 'U', // Not returned by BE, but added by UI for certain files
Dmitrii Filippovbfbd2752020-07-28 14:51:25 +0200134}
135
136/**
137 * @desc The status of the file
138 */
139export enum GpgKeyInfoStatus {
140 BAD = 'BAD',
141 OK = 'OK',
142 TRUSTED = 'TRUSTED',
143}
Ben Rohlfsee775eb2020-07-31 16:10:15 +0200144
145/**
146 * @desc Used for server config of accounts
147 */
148export enum DefaultDisplayNameConfig {
149 USERNAME = 'USERNAME',
150 FIRST_NAME = 'FIRST_NAME',
151 FULL_NAME = 'FULL_NAME',
152}
Dmitrii Filippovec5d9462020-08-04 15:33:20 +0200153
154/**
155 * @desc The state of the projects
156 */
157export enum ProjectState {
158 ACTIVE = 'ACTIVE',
159 READ_ONLY = 'READ_ONLY',
160 HIDDEN = 'HIDDEN',
161}
Ben Rohlfs5f02faa2020-08-06 11:02:31 +0200162
163export enum Side {
164 LEFT = 'left',
165 RIGHT = 'right',
166}
Ben Rohlfs322b13e2020-08-07 21:41:44 +0200167
168/**
169 * The type in ConfigParameterInfo entity.
170 * https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#config-parameter-info
171 */
172export enum ConfigParameterInfoType {
Dmitrii Filippov782f0552020-08-14 13:28:34 +0200173 // Should be kept in sync with
174 // gerrit/java/com/google/gerrit/extensions/api/projects/ProjectConfigEntryType.java.
Ben Rohlfs322b13e2020-08-07 21:41:44 +0200175 STRING = 'STRING',
176 INT = 'INT',
177 LONG = 'LONG',
178 BOOLEAN = 'BOOLEAN',
179 LIST = 'LIST',
180 ARRAY = 'ARRAY',
181}
182
183/**
184 * All supported submit types.
185 * https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#submit-type-info
186 */
187export enum SubmitType {
188 MERGE_IF_NECESSARY = 'MERGE_IF_NECESSARY',
189 FAST_FORWARD_ONLY = 'FAST_FORWARD_ONLY',
190 REBASE_IF_NECESSARY = 'REBASE_IF_NECESSARY',
191 REBASE_ALWAYS = 'REBASE_ALWAYS',
192 MERGE_ALWAYS = 'MERGE_ALWAYS ',
193 CHERRY_PICK = 'CHERRY_PICK',
194 INHERIT = 'INHERIT',
195}
196
Milutin Kristoficbec88f12020-10-13 16:53:28 +0200197/**
198 * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#mergeable-info
199 */
200export enum MergeStrategy {
201 RECURSIVE = 'recursive',
202 RESOLVE = 'resolve',
203 SIMPLE_TWO_WAY_IN_CORE = 'simple-two-way-in-core',
204 OURS = 'ours',
205 THEIRS = 'theirs',
206}
207
Ben Rohlfs322b13e2020-08-07 21:41:44 +0200208/*
209 * Enum for possible configured value in InheritedBooleanInfo.
210 * https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#inherited-boolean-info
211 */
212export enum InheritedBooleanInfoConfiguredValue {
213 TRUE = 'TRUE',
214 FALSE = 'FALSE',
215 INHERITED = 'INHERITED',
216}
Ben Rohlfs417a3fd2020-08-11 16:53:20 +0200217
218export enum AccountTag {
219 SERVICE_USER = 'SERVICE_USER',
220}
Dmitrii Filippovd5b1dc72020-08-11 11:06:03 +0200221
222/**
223 * Enum for possible PermissionRuleInfo actions
224 * https://gerrit-review.googlesource.com/Documentation/rest-api-access.html#permission-info
225 */
226export enum PermissionAction {
227 ALLOW = 'ALLOW',
228 DENY = 'DENY',
229 BLOCK = 'BLOCK',
230 // Special values for global capabilities
231 INTERACTIVE = 'INTERACTIVE',
232 BATCH = 'BATCH',
233}
234
235/**
236 * This capability allows users to use the thread pool reserved for 'Non-Interactive Users'.
237 * https://gerrit-review.googlesource.com/Documentation/access-control.html#capability_priority
238 */
239export enum UserPriority {
240 BATCH = 'BATCH',
241 INTERACTIVE = 'INTERACTIVE',
242}
243
244/**
245 * Enum for all http methods used in Gerrit.
246 */
247export enum HttpMethod {
248 HEAD = 'HEAD',
249 POST = 'POST',
250 GET = 'GET',
251 DELETE = 'DELETE',
252 PUT = 'PUT',
253}
254
255/**
256 * The side on which the comment was added
257 * https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#comment-info
258 */
259export enum CommentSide {
260 REVISION = 'REVISION',
261 PARENT = 'PARENT',
262}
263
264/**
265 * Allowed app themes
266 * https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#preferences-input
267 */
268export enum AppTheme {
269 DARK = 'DARK',
270 LIGHT = 'LIGHT',
271}
272
273/**
274 * Date formats in preferences
275 * https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#preferences-input
276 */
277export enum DateFormat {
278 STD = 'STD',
279 US = 'US',
280 ISO = 'ISO',
281 EURO = 'EURO',
282 UK = 'UK',
283}
284
285/**
286 * Time formats in preferences
287 * https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#preferences-input
288 */
289export enum TimeFormat {
290 HHMM_12 = 'HHMM_12',
291 HHMM_24 = 'HHMM_24',
292}
293
294/**
295 * Diff type in preferences
296 * https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#preferences-input
297 */
298export enum DiffViewMode {
299 SIDE_BY_SIDE = 'SIDE_BY_SIDE',
300 UNIFIED = 'UNIFIED_DIFF',
301}
302
303/**
304 * The type of email strategy to use.
305 * https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#preferences-input
306 */
307export enum EmailStrategy {
308 ENABLED = 'ENABLED',
309 CC_ON_OWN_COMMENTS = 'CC_ON_OWN_COMMENTS',
Ben Rohlfs868fad42020-10-13 11:40:50 +0200310 ATTENTION_SET_ONLY = 'ATTENTION_SET_ONLY',
Dmitrii Filippovd5b1dc72020-08-11 11:06:03 +0200311 DISABLED = 'DISABLED',
312}
313
314/**
Dmitrii Filippovd883c792020-10-09 16:10:51 +0200315 * The type of email format to use.
316 * Doesn't mentioned in doc, but exists in Java class GeneralPreferencesInfo.
317 */
318
319export enum EmailFormat {
320 PLAINTEXT = 'PLAINTEXT',
321 HTML_PLAINTEXT = 'HTML_PLAINTEXT',
322}
323
324/**
Dmitrii Filippovd5b1dc72020-08-11 11:06:03 +0200325 * The base which should be pre-selected in the 'Diff Against' drop-down list when the change screen is opened for a merge commit
326 * https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#preferences-input
327 */
328export enum DefaultBase {
329 AUTO_MERGE = 'AUTO_MERGE',
330 FIRST_PARENT = 'FIRST_PARENT',
331}
332
333/**
Dmitrii Filippovd5b1dc72020-08-11 11:06:03 +0200334 * how draft comments are handled
335 */
336export enum DraftsAction {
337 PUBLISH = 'PUBLISH',
338 PUBLISH_ALL_REVISIONS = 'PUBLISH_ALL_REVISIONS',
339 KEEP = 'KEEP',
340}
341
342export enum NotifyType {
343 NONE = 'NONE',
344 OWNER = 'OWNER',
345 OWNER_REVIEWERS = 'OWNER_REVIEWERS',
346 ALL = 'ALL',
347}
Dmitrii Filippovad72bf92020-10-14 10:37:58 +0200348
349/**
350 * The authentication type that is configured on the server.
351 * https://gerrit-review.googlesource.com/Documentation/rest-api-config.html#auth-info
352 */
353export enum AuthType {
354 OPENID = 'OPENID',
355 OPENID_SSO = 'OPENID_SSO',
356 OAUTH = 'OAUTH',
357 HTTP = 'HTTP',
358 HTTP_LDAP = 'HTTP_LDAP',
359 CLIENT_SSL_CERT_LDAP = 'CLIENT_SSL_CERT_LDAP',
360 LDAP = 'LDAP',
361 LDAP_BIND = 'LDAP_BIND',
362 CUSTOM_EXTENSION = 'CUSTOM_EXTENSION',
363 DEVELOPMENT_BECOME_ANY_ACCOUNT = 'DEVELOPMENT_BECOME_ANY_ACCOUNT',
364}
Dmitrii Filippov78448cd2020-10-26 17:39:11 +0100365
366/**
367 * Controls visibility of other users' dashboard pages and completion suggestions to web users
368 * https://gerrit-review.googlesource.com/Documentation/config-gerrit.html#accounts.visibility
369 */
370export enum AccountsVisibility {
371 ALL = 'ALL',
372 SAME_GROUP = 'SAME_GROUP',
373 VISIBLE_GROUP = 'VISIBLE_GROUP',
374 NONE = 'NONE',
375}
376
377/**
378 * Account fields that are editable
379 * https://gerrit-review.googlesource.com/Documentation/rest-api-config.html#auth-info
380 */
381export enum EditableAccountField {
382 FULL_NAME = 'FULL_NAME',
383 USER_NAME = 'USER_NAME',
384 REGISTER_NEW_EMAIL = 'REGISTER_NEW_EMAIL',
385}
386
387/**
388 * This setting determines when Gerrit computes if a change is mergeable or not.
389 * https://gerrit-review.googlesource.com/Documentation/config-gerrit.html#change.mergeabilityComputationBehavior
390 */
391export enum MergeabilityComputationBehavior {
392 API_REF_UPDATED_AND_CHANGE_REINDEX = 'API_REF_UPDATED_AND_CHANGE_REINDEX',
393 REF_UPDATED_AND_CHANGE_REINDEX = 'REF_UPDATED_AND_CHANGE_REINDEX',
394 NEVER = 'NEVER',
395}
Ben Rohlfs3a6ff7e2021-01-18 14:08:39 +0100396
397// TODO(TS): Many properties are omitted here, but they are required.
398// Add default values for missing properties.
399export function createDefaultPreferences() {
400 return {
401 changes_per_page: 25,
402 default_diff_view: DiffViewMode.SIDE_BY_SIDE,
403 diff_view: DiffViewMode.SIDE_BY_SIDE,
404 size_bar_in_change_table: true,
405 } as PreferencesInfo;
406}
407
408// These defaults should match the defaults in
409// java/com/google/gerrit/extensions/client/DiffPreferencesInfo.java
410// NOTE: There are some settings that don't apply to PolyGerrit
411// (Render mode being at least one of them).
412export function createDefaultDiffPrefs(): DiffPreferencesInfo {
413 return {
414 auto_hide_diff_table_header: true,
415 context: 10,
416 cursor_blink_rate: 0,
417 font_size: 12,
418 ignore_whitespace: 'IGNORE_NONE',
419 intraline_difference: true,
420 line_length: 100,
421 line_wrapping: false,
422 show_line_endings: true,
423 show_tabs: true,
424 show_whitespace_errors: true,
425 syntax_highlighting: true,
426 tab_size: 8,
427 theme: 'DEFAULT',
428 };
429}
430
431// These defaults should match the defaults in
432// java/com/google/gerrit/extensions/client/EditPreferencesInfo.java
433export function createDefaultEditPrefs(): EditPreferencesInfo {
434 return {
435 auto_close_brackets: false,
436 cursor_blink_rate: 0,
437 hide_line_numbers: false,
438 hide_top_menu: false,
439 indent_unit: 2,
440 indent_with_tabs: false,
441 key_map_type: 'DEFAULT',
442 line_length: 100,
443 line_wrapping: false,
444 match_brackets: true,
445 show_base: false,
446 show_tabs: true,
447 show_whitespace_errors: true,
448 syntax_highlighting: true,
449 tab_size: 8,
450 theme: 'DEFAULT',
451 };
452}