Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 1 | // Copyright 2019 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | import {fieldTypes} from 'shared/issue-fields.js'; |
| 6 | import {USER_REF} from './constants-users.js'; |
| 7 | import 'shared/typedef.js'; |
| 8 | |
| 9 | /** @type {string} */ |
| 10 | export const PROJECT_NAME = 'project-name'; |
| 11 | |
| 12 | /** @type {FieldDef} */ |
| 13 | export const FIELD_DEF_INT = Object.freeze({ |
| 14 | fieldRef: Object.freeze({ |
| 15 | fieldId: 123, |
| 16 | fieldName: 'field-name', |
| 17 | type: fieldTypes.INT_TYPE, |
| 18 | }), |
| 19 | }); |
| 20 | |
| 21 | /** @type {FieldDef} */ |
| 22 | export const FIELD_DEF_ENUM = Object.freeze({ |
| 23 | fieldRef: Object.freeze({ |
| 24 | fieldId: 456, |
| 25 | fieldName: 'enum', |
| 26 | type: fieldTypes.ENUM_TYPE, |
| 27 | }), |
| 28 | }); |
| 29 | |
| 30 | /** @type {Array<FieldDef>} */ |
| 31 | export const FIELD_DEFS = [ |
| 32 | FIELD_DEF_INT, |
| 33 | FIELD_DEF_ENUM, |
| 34 | ]; |
| 35 | |
| 36 | /** @type {Config} */ |
| 37 | export const CONFIG = Object.freeze({ |
| 38 | projectName: PROJECT_NAME, |
| 39 | fieldDefs: FIELD_DEFS, |
| 40 | labelDefs: [ |
| 41 | {label: 'One'}, |
| 42 | {label: 'EnUm'}, |
| 43 | {label: 'eNuM-Options'}, |
| 44 | {label: 'hello-world', docstring: 'hmmm'}, |
| 45 | {label: 'hello-me', docstring: 'hmmm'}, |
| 46 | ], |
| 47 | }); |
| 48 | |
| 49 | /** @type {string} */ |
| 50 | export const DEFAULT_QUERY = 'owner:me'; |
| 51 | |
| 52 | /** @type {PresentationConfig} */ |
| 53 | export const PRESENTATION_CONFIG = Object.freeze({ |
| 54 | projectThumbnailUrl: 'test.png', |
| 55 | defaultColSpec: 'ID+Summary+AllLabels', |
| 56 | defaultQuery: DEFAULT_QUERY, |
| 57 | }); |
| 58 | |
| 59 | /** @type {Array<string>} */ |
| 60 | export const CUSTOM_PERMISSIONS = ['google', 'security']; |
| 61 | |
| 62 | /** @type {{userRefs: Array<UserRef>, groupRefs: Array<UserRef>}} */ |
| 63 | export const VISIBLE_MEMBERS = Object.freeze({ |
| 64 | userRefs: [USER_REF], |
| 65 | groupRefs: [], |
| 66 | }); |
| 67 | |
| 68 | /** @type {TemplateDef} */ |
| 69 | export const TEMPLATE_DEF = Object.freeze({ |
| 70 | templateName: 'Template Name', |
| 71 | }); |
| 72 | |
| 73 | export const STATE = Object.freeze({projectV0: { |
| 74 | name: PROJECT_NAME, |
| 75 | configs: {[PROJECT_NAME]: CONFIG}, |
| 76 | presentationConfigs: {[PROJECT_NAME]: PRESENTATION_CONFIG}, |
| 77 | customPermissions: {[PROJECT_NAME]: CUSTOM_PERMISSIONS}, |
| 78 | visibleMembers: {[PROJECT_NAME]: VISIBLE_MEMBERS}, |
| 79 | templates: {[PROJECT_NAME]: TEMPLATE_DEF}, |
| 80 | }}); |