OLD | NEW |
(Empty) | |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is govered by a BSD-style |
| 3 # license that can be found in the LICENSE file or at |
| 4 # https://developers.google.com/open-source/licenses/bsd |
| 5 |
| 6 """Some constants used in Monorail issue tracker pages.""" |
| 7 |
| 8 import re |
| 9 |
| 10 from proto import user_pb2 |
| 11 |
| 12 |
| 13 # Default columns shown on issue list page, and other built-in cols. |
| 14 DEFAULT_COL_SPEC = 'ID Type Status Priority Milestone Owner Summary' |
| 15 OTHER_BUILT_IN_COLS = ['Attachments', 'Stars', 'Opened', 'Closed', 'Modified', |
| 16 'BlockedOn', 'Blocking', 'Blocked', 'MergedInto', |
| 17 'Reporter', 'Cc', 'Project', 'Component'] |
| 18 |
| 19 # These are label prefixes that would conflict with built-in column names. |
| 20 # E.g., no issue should have a *label* id-1234 or status-foo because any |
| 21 # search for "id:1234" or "status:foo" would not look at labels. |
| 22 RESERVED_PREFIXES = [ |
| 23 'id', 'project', 'reporter', 'summary', 'status', 'owner', 'cc', |
| 24 'attachments', 'attachment', 'component', 'opened', 'closed', |
| 25 'modified', 'is', 'has', 'blockedon', 'blocking', 'blocked', 'mergedinto', |
| 26 'stars', 'starredby', 'description', 'comment', 'commentby', 'label', |
| 27 'hotlist', 'rank', 'explicit_status', 'derived_status', 'explicit_owner', |
| 28 'derived_owner', 'explicit_cc', 'derived_cc', 'explicit_label', |
| 29 'derived_label', 'last_comment_by', 'exact_component', |
| 30 'explicit_component', 'derived_component'] |
| 31 |
| 32 # These columns are sorted as user names. |
| 33 USERNAME_COLS = ['owner', 'reporter', 'cc'] |
| 34 |
| 35 # The columns are useless in the grid view, so don't offer them. |
| 36 NOT_USED_IN_GRID_AXES = ['Summary', 'ID', 'Opened', 'Closed', 'Modified'] |
| 37 |
| 38 # Issues per page in the issue list |
| 39 DEFAULT_RESULTS_PER_PAGE = 100 |
| 40 |
| 41 # Search field input indicating that the user wants to |
| 42 # jump to the specified issue. |
| 43 JUMP_RE = re.compile(r'^\d+$') |
| 44 |
| 45 # Regular expression defining a single search term. |
| 46 # Used when parsing the contents of the issue search field. |
| 47 TERM_RE = re.compile(r'[-a-zA-Z0-9._]+') |
| 48 |
| 49 # Regular expression used to validate new component leaf names. |
| 50 # This should never match any string with a ">" in it. |
| 51 COMPONENT_NAME_RE = re.compile(r'^[a-zA-Z]([-_]?[a-zA-Z0-9])+$') |
| 52 |
| 53 # Regular expression used to validate new field names. |
| 54 FIELD_NAME_RE = re.compile(r'^[a-zA-Z]([-_]?[a-zA-Z0-9])*$') |
| 55 |
| 56 # The next few items are specifications of the defaults for project |
| 57 # issue configurations. These are used for projects that do not have |
| 58 # their own config. |
| 59 DEFAULT_CANNED_QUERIES = [ |
| 60 # Query ID, Name, Base query ID (not used for built-in queries), conditions |
| 61 (1, 'All issues', 0, ''), |
| 62 (2, 'Open issues', 0, 'is:open'), |
| 63 (3, 'Open and owned by me', 0, 'is:open owner:me'), |
| 64 (4, 'Open and reported by me', 0, 'is:open reporter:me'), |
| 65 (5, 'Open and starred by me', 0, 'is:open is:starred'), |
| 66 (6, 'New issues', 0, 'status:new'), |
| 67 (7, 'Issues to verify', 0, 'status=fixed,done'), |
| 68 (8, 'Open with comment by me', 0, 'is:open commentby:me'), |
| 69 ] |
| 70 |
| 71 DEFAULT_CANNED_QUERY_CONDS = { |
| 72 query_id: cond |
| 73 for (query_id, _name, _base, cond) in DEFAULT_CANNED_QUERIES} |
| 74 |
| 75 ALL_ISSUES_CAN = 1 |
| 76 OPEN_ISSUES_CAN = 2 |
| 77 |
| 78 # Define well-known issue statuses. Each status has 3 parts: a name, a |
| 79 # description, and True if the status means that an issue should be |
| 80 # considered to be open or False if it should be considered closed. |
| 81 DEFAULT_WELL_KNOWN_STATUSES = [ |
| 82 # Name, docstring, means_open, deprecated |
| 83 ('New', 'Issue has not had initial review yet', True, False), |
| 84 ('Accepted', 'Problem reproduced / Need acknowledged', True, False), |
| 85 ('Started', 'Work on this issue has begun', True, False), |
| 86 ('Fixed', 'Developer made source code changes, QA should verify', False, |
| 87 False), |
| 88 ('Verified', 'QA has verified that the fix worked', False, False), |
| 89 ('Invalid', 'This was not a valid issue report', False, False), |
| 90 ('Duplicate', 'This report duplicates an existing issue', False, False), |
| 91 ('WontFix', 'We decided to not take action on this issue', False, False), |
| 92 ('Done', 'The requested non-coding task was completed', False, False), |
| 93 ] |
| 94 |
| 95 DEFAULT_WELL_KNOWN_LABELS = [ |
| 96 # Name, docstring, deprecated |
| 97 ('Type-Defect', 'Report of a software defect', False), |
| 98 ('Type-Enhancement', 'Request for enhancement', False), |
| 99 ('Type-Task', 'Work item that doesn\'t change the code or docs', False), |
| 100 ('Type-Other', 'Some other kind of issue', False), |
| 101 ('Priority-Critical', 'Must resolve in the specified milestone', False), |
| 102 ('Priority-High', 'Strongly want to resolve in the specified milestone', |
| 103 False), |
| 104 ('Priority-Medium', 'Normal priority', False), |
| 105 ('Priority-Low', 'Might slip to later milestone', False), |
| 106 ('OpSys-All', 'Affects all operating systems', False), |
| 107 ('OpSys-Windows', 'Affects Windows users', False), |
| 108 ('OpSys-Linux', 'Affects Linux users', False), |
| 109 ('OpSys-OSX', 'Affects Mac OS X users', False), |
| 110 ('Milestone-Release1.0', 'All essential functionality working', False), |
| 111 ('Security', 'Security risk to users', False), |
| 112 ('Performance', 'Performance issue', False), |
| 113 ('Usability', 'Affects program usability', False), |
| 114 ('Maintainability', 'Hinders future changes', False), |
| 115 ] |
| 116 |
| 117 # Exclusive label prefixes are ones that can only be used once per issue. |
| 118 # For example, an issue would normally have only one Priority-* label, whereas |
| 119 # an issue might have many OpSys-* labels. |
| 120 DEFAULT_EXCL_LABEL_PREFIXES = ['Type', 'Priority', 'Milestone'] |
| 121 |
| 122 DEFAULT_USER_DEFECT_REPORT_TEMPLATE = { |
| 123 'name': 'Defect report from user', |
| 124 'summary': 'Enter one-line summary', |
| 125 'summary_must_be_edited': True, |
| 126 'content': ( |
| 127 'What steps will reproduce the problem?\n' |
| 128 '1. \n' |
| 129 '2. \n' |
| 130 '3. \n' |
| 131 '\n' |
| 132 'What is the expected output?\n' |
| 133 '\n' |
| 134 '\n' |
| 135 'What do you see instead?\n' |
| 136 '\n' |
| 137 '\n' |
| 138 'What version of the product are you using? ' |
| 139 'On what operating system?\n' |
| 140 '\n' |
| 141 '\n' |
| 142 'Please provide any additional information below.\n'), |
| 143 'status': 'New', |
| 144 'labels': ['Type-Defect', 'Priority-Medium'], |
| 145 } |
| 146 |
| 147 DEFAULT_DEVELOPER_DEFECT_REPORT_TEMPLATE = { |
| 148 'name': 'Defect report from developer', |
| 149 'summary': 'Enter one-line summary', |
| 150 'summary_must_be_edited': True, |
| 151 'content': ( |
| 152 'What steps will reproduce the problem?\n' |
| 153 '1. \n' |
| 154 '2. \n' |
| 155 '3. \n' |
| 156 '\n' |
| 157 'What is the expected output?\n' |
| 158 '\n' |
| 159 '\n' |
| 160 'What do you see instead?\n' |
| 161 '\n' |
| 162 '\n' |
| 163 'Please use labels and text to provide additional information.\n'), |
| 164 'status': 'Accepted', |
| 165 'labels': ['Type-Defect', 'Priority-Medium'], |
| 166 'members_only': True, |
| 167 } |
| 168 |
| 169 |
| 170 DEFAULT_TEMPLATES = [ |
| 171 DEFAULT_DEVELOPER_DEFECT_REPORT_TEMPLATE, |
| 172 DEFAULT_USER_DEFECT_REPORT_TEMPLATE, |
| 173 ] |
| 174 |
| 175 DEFAULT_STATUSES_OFFER_MERGE = ['Duplicate'] |
| 176 |
| 177 |
| 178 # This is used by JS on the issue admin page to indicate that the user deleted |
| 179 # this template, so it should not be considered when updating the project's |
| 180 # issue config. |
| 181 DELETED_TEMPLATE_NAME = '<DELETED>' |
| 182 |
| 183 |
| 184 # This is the default maximum total bytes of files attached |
| 185 # to all the issues in a project. |
| 186 ISSUE_ATTACHMENTS_QUOTA_HARD = 50 * 1024 * 1024L |
| 187 ISSUE_ATTACHMENTS_QUOTA_SOFT = ISSUE_ATTACHMENTS_QUOTA_HARD - 1 * 1024 * 1024L |
| 188 |
| 189 # Default value for nav action after updating an issue. |
| 190 DEFAULT_AFTER_ISSUE_UPDATE = user_pb2.IssueUpdateNav.STAY_SAME_ISSUE |
| 191 |
| 192 # Maximum comment length to mitigate spammy comments |
| 193 MAX_COMMENT_CHARS = 50 * 1024 |
| 194 MAX_SUMMARY_CHARS = 500 |
| 195 |
| 196 SHORT_SUMMARY_LENGTH = 45 |
| 197 |
| 198 # Number of recent commands to offer the user on the quick edit form. |
| 199 MAX_RECENT_COMMANDS = 5 |
| 200 |
| 201 # These recent commands are shown if the user has no history of their own. |
| 202 DEFAULT_RECENT_COMMANDS = [ |
| 203 ('owner=me status=Accepted', "I'll handle this one."), |
| 204 ('owner=me Priority=High status=Accepted', "I'll look into it soon."), |
| 205 ('status=Fixed', 'The change for this is done now.'), |
| 206 ('Type=Enhancement', 'This is an enhancement, not a defect.'), |
| 207 ('status=Invalid', 'Please report this in a more appropriate place.'), |
| 208 ] |
| 209 |
| 210 # Consider an issue to be a "noisy" issue if it has more than these: |
| 211 NOISY_ISSUE_COMMENT_COUNT = 100 |
| 212 NOISY_ISSUE_STARRER_COUNT = 100 |
| 213 |
| 214 # After a project owner edits the filter rules, we recompute the |
| 215 # derived field values in work items that each handle a chunk of |
| 216 # of this many items. |
| 217 RECOMPUTE_DERIVED_FIELDS_BLOCK_SIZE = 1000 |
| 218 |
| 219 # This is the number of issues listed in the ReindexQueue table that will |
| 220 # be processed each minute. |
| 221 MAX_ISSUES_TO_REINDEX_PER_MINUTE = 500 |
| 222 |
OLD | NEW |