forked from GoogleChrome/chromium-dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
guideforms.py
936 lines (783 loc) · 37.8 KB
/
guideforms.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
from __future__ import division
from __future__ import print_function
# -*- coding: utf-8 -*-
# Copyright 2020 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License")
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import logging
from django import forms
from google.appengine.api import users
import models
import processes
SHIPPED_HELP_TXT = (
'First milestone to ship with this status. Applies to: Enabled by '
'default, Behind a flag, Origin trial, Browser Intervention, and '
'Deprecated. If the flag is \'test\' rather than \'experimental\' set '
'status to In development. If the flag is for an origin trial set status '
'to Origin trial.')
# We define all form fields here so that they can be include in one or more
# stage-specific fields without repeating the details and help text.
ALL_FIELDS = {
'name': forms.CharField(
required=True, label='Feature name',
# Use a specific autocomplete value to avoid "name" autofill.
# https://bugs.chromium.org/p/chromium/issues/detail?id=468153#c164
widget=forms.TextInput(attrs={'autocomplete': 'feature-name'}),
help_text=
('Capitalize only the first letter and the beginnings of '
'proper nouns. '
'<a target="_blank" href="'
'https://github.com/GoogleChrome/chromium-dashboard/wiki/'
'EditingHelp#feature-name">Learn more</a>. '
'<a target="_blank" href="'
'https://github.com/GoogleChrome/chromium-dashboard/wiki/'
'EditingHelp#feature-name-example">Example</a>.'
)),
'summary': forms.CharField(
required=True,
widget=forms.Textarea(
attrs={'cols': 50, 'maxlength': 500, 'placeholder': models.FeatureForm.SUMMARY_PLACEHOLDER_TXT}),
help_text=
('<a target="_blank" href="'
'https://github.com/GoogleChrome/chromium-dashboard/wiki/'
'EditingHelp#summary-example">Guidelines and example</a>.'
)),
'owner': forms.EmailField(
required=True, label='Contact emails',
widget=forms.EmailInput(
attrs={'multiple': True, 'placeholder': 'email, email'}),
help_text=('Comma separated list of full email addresses. '
'Prefer @chromium.org.')),
'category': forms.ChoiceField(
required=False,
help_text=('Select the most specific category. If unsure, '
'leave as "%s".' % models.FEATURE_CATEGORIES[models.MISC]),
initial=models.MISC,
choices=sorted(models.FEATURE_CATEGORIES.items(), key=lambda x: x[1])),
'feature_type': forms.ChoiceField(
required=False,
help_text=('Select the feature type.'),
initial=models.FEATURE_TYPE_INCUBATE_ID,
choices=sorted(models.FEATURE_TYPES.items())),
'intent_stage': forms.ChoiceField(
required=False, label='Feature stage',
help_text='Select the appropriate process stage.',
initial=models.INTENT_IMPLEMENT,
choices=models.INTENT_STAGES.items()),
'motivation': forms.CharField(
label='Motivation', required=False,
widget=forms.Textarea(attrs={'cols': 50, 'maxlength': 1480}),
help_text=
('Explain why the web needs this change. It may be useful '
'to describe what web developers are forced to do without '
'it. When possible, add links to your explainer '
'backing up your claims. '
'<a target="_blank" href="'
'https://github.com/GoogleChrome/chromium-dashboard/wiki/'
'EditingHelp#motivation-example">Example</a>.'
)),
'doc_links': forms.CharField(
label='Doc link(s)', required=False,
widget=forms.Textarea(
attrs={'rows': 4, 'cols': 50, 'maxlength': 500,
'placeholder': 'https://\nhttps://'}),
help_text=('Links to design doc(s) (one URL per line), if and when '
'available. [This is not required to send out an Intent '
'to Prototype. Please update the intent thread with the '
'design doc when ready]. An explainer and/or design doc '
'is sufficient to start this process. [Note: Please '
'include links and data, where possible, to support any '
'claims.]')),
'measurement': forms.CharField(
label='Measurement', required=False,
widget=forms.Textarea(
attrs={'rows': 4, 'cols': 50, 'maxlength': 500}),
help_text=
('It\'s important to measure the adoption and success of web-exposed '
'features. Note here what measurements you have added to track the '
'success of this feature, such as a link to the UseCounter(s) you '
'have set up.')),
'standardization': forms.ChoiceField(
required=False, label='Standardization',
choices=models.STANDARDIZATION.items(),
initial=models.EDITORS_DRAFT,
help_text=("The standardization status of the API. In bodies that don't "
"use this nomenclature, use the closest equivalent.")),
'unlisted': forms.BooleanField(
required=False, initial=False,
help_text=('Check this box for draft features that should not appear '
'in the feature list. Anyone with the link will be able to '
'view the feature on the detail page.')),
'spec_link': forms.URLField(
required=False, label='Spec link',
widget=forms.URLInput(attrs={'placeholder': 'https://'}),
help_text=('Link to spec, if and when available. Please update the '
'chromestatus.com entry and the intent thread(s) with the '
'spec link when available.')),
'api_spec': forms.BooleanField(
required=False, initial=False, label='API spec',
help_text=('The spec document has details in a specification language '
'such as Web IDL, or there is an exsting MDN page.')),
'spec_mentors': forms.EmailField(
required=False, label='Spec mentor',
widget=forms.EmailInput(
attrs={'multiple': True, 'placeholder': 'email'}),
help_text=
('Experienced <a target="_blank" '
'href="https://www.chromium.org/blink/spec-mentors">'
'spec mentors</a> are available to help you improve your '
'feature spec.')),
'explainer_links': forms.CharField(
label='Explainer link(s)', required=False,
widget=forms.Textarea(
attrs={'rows': 4, 'cols': 50, 'maxlength': 500,
'placeholder': 'https://\nhttps://'}),
help_text=('Link to explainer(s) (one URL per line). You should have '
'at least an explainer in hand and have shared it on a '
'public forum before sending an Intent to Prototype in '
'order to enable discussion with other browser vendors, '
'standards bodies, or other interested parties.')),
'security_review_status': forms.ChoiceField(
required=False,
choices=models.REVIEW_STATUS_CHOICES.items(),
initial=models.REVIEW_PENDING,
help_text=('Status of the security review.')),
'privacy_review_status': forms.ChoiceField(
required=False,
choices=models.REVIEW_STATUS_CHOICES.items(),
initial=models.REVIEW_PENDING,
help_text=('Status of the privacy review.')),
'tag_review': forms.CharField(
label='TAG Review', required=False,
widget=forms.Textarea(attrs={'rows': 2, 'cols': 50, 'maxlength': 1480}),
help_text=('Link(s) to TAG review(s), or explanation why this is '
'not needed.')),
'tag_review_status': forms.ChoiceField(
required=False,
choices=models.REVIEW_STATUS_CHOICES.items(),
initial=models.REVIEW_PENDING,
help_text=('Status of the tag review.')),
'intent_to_implement_url': forms.URLField(
required=False, label='Intent to Prototype link',
widget=forms.URLInput(attrs={'placeholder': 'https://'}),
help_text=('After you have started the "Intent to Prototype" discussion '
'thread, link to it here.')),
'intent_to_ship_url': forms.URLField(
required=False, label='Intent to Ship link',
widget=forms.URLInput(attrs={'placeholder': 'https://'}),
help_text=('After you have started the "Intent to Ship" discussion '
'thread, link to it here.')),
'ready_for_trial_url': forms.URLField(
required=False, label='Ready for Trial link',
widget=forms.URLInput(attrs={'placeholder': 'https://'}),
help_text=('After you have started the "Ready for Trial" discussion '
'thread, link to it here.')),
'intent_to_experiment_url': forms.URLField(
required=False, label='Intent to Experiment link',
widget=forms.URLInput(attrs={'placeholder': 'https://'}),
help_text=('After you have started the "Intent to Experiment" discussion '
'thread, link to it here.')),
'interop_compat_risks': forms.CharField(
required=False, label='Interoperability and Compatibility Risks',
widget=forms.Textarea(attrs={'cols': 50, 'maxlength': 1480}),
help_text=
('Describe the degree of <a target="_blank" '
'href="https://www.chromium.org/blink/guidelines/'
'web-platform-changes-guidelines#TOC-Finding-balance'
'">interoperability risk</a>. For a new feature, the main risk is '
'that it fails to become an interoperable part of the web platform '
'if other browsers do not implement it. For a removal, please review '
'our <a target="_blank" href="'
'https://docs.google.com/document/d/'
'1RC-pBBvsazYfCNNUSkPqAVpSpNJ96U8trhNkfV0v9fk/edit">'
'principles of web compatibility</a>.<br>'
'<br>'
'Please include citation links below where possible. Examples include '
'resolutions from relevant standards bodies (e.g. W3C working group), '
'tracking bugs, or links to online conversations. '
'<a target="_blank" href="'
'https://github.com/GoogleChrome/chromium-dashboard/wiki/'
'EditingHelp#interoperability-and-compatibility-risks-example">'
'Example</a>.'
)),
'safari_views': forms.ChoiceField(
required=False, label='Safari views',
choices=models.VENDOR_VIEWS_WEBKIT.items(),
initial=models.NO_PUBLIC_SIGNALS,
help_text=(
'See <a target="_blank" href="https://bit.ly/blink-signals">'
'https://bit.ly/blink-signals</a>')),
'safari_views_link': forms.URLField(
required=False, label='',
widget=forms.URLInput(attrs={'placeholder': 'https://'}),
help_text='Citation link.'),
'safari_views_notes': forms.CharField(
required=False, label='',
widget=forms.Textarea(
attrs={'rows': 2, 'cols': 50, 'placeholder': 'Notes',
'maxlength': 1480})),
'ff_views': forms.ChoiceField(
required=False, label='Firefox views',
choices=models.VENDOR_VIEWS_GECKO.items(),
initial=models.NO_PUBLIC_SIGNALS,
help_text=(
'See <a target="_blank" href="https://bit.ly/blink-signals">'
'https://bit.ly/blink-signals</a>')),
'ff_views_link': forms.URLField(
required=False, label='',
widget=forms.URLInput(attrs={'placeholder': 'https://'}),
help_text='Citation link.'),
'ff_views_notes': forms.CharField(
required=False, label='',
widget=forms.Textarea(
attrs={'rows': 2, 'cols': 50, 'placeholder': 'Notes',
'maxlength': 1480})),
'ie_views': forms.ChoiceField(
required=False, label='Edge views',
choices=models.VENDOR_VIEWS_EDGE.items(),
initial=models.NO_PUBLIC_SIGNALS),
'ie_views_link': forms.URLField(
required=False, label='',
widget=forms.URLInput(attrs={'placeholder': 'https://'}),
help_text='Citation link.'),
'ie_views_notes': forms.CharField(
required=False, label='',
widget=forms.Textarea(
attrs={'rows': 2, 'cols': 50, 'placeholder': 'Notes',
'maxlength': 1480})),
'web_dev_views': forms.ChoiceField(
required=False, label='Web / Framework developer views',
choices=models.WEB_DEV_VIEWS.items(),
initial=models.DEV_NO_SIGNALS,
help_text=(
'If unsure, default to "No signals". '
'See <a target="_blank" href="https://goo.gle/developer-signals">'
'https://goo.gle/developer-signals</a>')),
'web_dev_views_link': forms.URLField(
required=False, label='',
widget=forms.URLInput(attrs={'placeholder': 'https://'}),
help_text='Citation link.'),
'web_dev_views_notes': forms.CharField(
required=False, label='',
widget=forms.Textarea(
attrs={'rows': 2, 'cols': 50, 'placeholder': 'Notes',
'maxlength': 1480}),
help_text=('Reference known representative examples of opinion, '
'both positive and negative.')),
'ergonomics_risks': forms.CharField(
label='Ergonomics Risks', required=False,
widget=forms.Textarea(attrs={'cols': 50, 'maxlength': 1480}),
help_text=
('Are there any other platform APIs this feature will frequently be '
'used in tandem with? Could the default usage of this API make it '
'hard for Chrome to maintain good performance (i.e. synchronous '
'return, must run on a certain thread, guaranteed return timing)?')),
'activation_risks': forms.CharField(
label='Activation Risks', required=False,
widget=forms.Textarea(attrs={'cols': 50, 'maxlength': 1480}),
help_text=
('Will it be challenging for developers to take advantage of this '
'feature immediately, as-is? Would this feature benefit from '
'having polyfills, significant documentation and outreach, and/or '
'libraries built on top of it to make it easier to use?')),
'security_risks': forms.CharField(
label='Security Risks', required=False,
widget=forms.Textarea(attrs={'cols': 50, 'maxlength': 1480}),
help_text=
('List any security considerations that were taken into account '
'when deigning this feature.')),
'experiment_goals': forms.CharField(
label='Experiment Goals', required=False,
widget=forms.Textarea(attrs={'cols': 50, 'maxlength': 1480}),
help_text=
('Which pieces of the API surface are you looking to gain insight on? '
'What metrics/measurement/feedback will you be using to validate '
'designs? Double check that your experiment makes sense given that '
'a large developer (e.g. a Google product or Facebook) likely '
'can\'t use it in production due to the limits enforced by origin '
'trials.\n\nIf Intent to Extend Origin Trial, highlight new/different '
'areas for experimentation. Should not be an exact copy of goals '
'from the first Intent to Experiment.')),
# TODO(jrobbins): consider splitting this into start and end fields.
'experiment_timeline': forms.CharField(
label='Experiment Timeline', required=False,
widget=forms.Textarea(attrs={
'rows': 2, 'cols': 50, 'maxlength': 1480,
'placeholder': 'This field is deprecated',
'disabled': 'disabled'}),
help_text=('When does the experiment start and expire? '
'Deprecated: '
'Please use the following numeric fields instead.')),
# TODO(jrobbins and jmedley): Refine help text.
'ot_milestone_desktop_start': forms.IntegerField(
required=False, label='OT desktop start',
widget=forms.NumberInput(attrs={'placeholder': 'Milestone #'}),
help_text=('First desktop milestone that will support an origin '
'trial of this feature.')),
'ot_milestone_desktop_end': forms.IntegerField(
required=False, label='OT desktop end',
widget=forms.NumberInput(attrs={'placeholder': 'Milestone #'}),
help_text=('Last desktop milestone that will support an origin '
'trial of this feature.')),
'ot_milestone_android_start': forms.IntegerField(
required=False, label='OT android start',
widget=forms.NumberInput(attrs={'placeholder': 'Milestone #'}),
help_text=('First android milestone that will support an origin '
'trial of this feature.')),
'ot_milestone_android_end': forms.IntegerField(
required=False, label='OT android end',
widget=forms.NumberInput(attrs={'placeholder': 'Milestone #'}),
help_text=('Last android milestone that will support an origin '
'trial of this feature.')),
'experiment_risks': forms.CharField(
label='Experiment Risks', required=False,
widget=forms.Textarea(attrs={'cols': 50, 'maxlength': 1480}),
help_text=
('When this experiment comes to an end are there any risks to the '
'sites that were using it, for example losing access to important '
'storage due to an experimental storage API?')),
'experiment_extension_reason': forms.CharField(
label='Experiment Extension Reason', required=False,
widget=forms.Textarea(attrs={'cols': 50, 'maxlength': 1480}),
help_text=
('If this is a repeat experiment, link to the previous Intent to '
'Experiment thread and explain why you want to extend this '
'experiment.')),
'ongoing_constraints': forms.CharField(
label='Ongoing Constraints', required=False,
widget=forms.Textarea(attrs={'cols': 50, 'maxlength': 1480}),
help_text=
('Do you anticipate adding any ongoing technical constraints to '
'the codebase while implementing this feature? We prefer to avoid '
'features which require or assume a specific architecture. '
'For most features, the answer here is "None."')),
'origin_trial_feedback_url': forms.URLField(
required=False, label='Origin trial feedback summary',
widget=forms.URLInput(attrs={'placeholder': 'https://'}),
help_text=
('If your feature was available as an origin trial, link to a summary '
'of usage and developer feedback. If not, leave this empty.')),
'i2e_lgtms': forms.EmailField(
required=False, label='Intent to Experiment LGTM by',
widget=forms.EmailInput(
attrs={'multiple': True, 'placeholder': 'email'}),
help_text=('Full email address of API owner who LGTM\'d the '
'Intent to Experiment email thread.')),
'i2s_lgtms': forms.EmailField(
required=False, label='Intent to Ship LGTMs by',
widget=forms.EmailInput(
attrs={'multiple': True, 'placeholder': 'email, email, email'}),
help_text=('Comma separated list of '
'full email addresses of API owners who LGTM\'d '
'the Intent to Ship email thread.')),
'r4dt_lgtms': forms.EmailField( # Sets i2e_lgtms field.
required=False, label='Request for Deprecation Trial LGTM by',
widget=forms.EmailInput(
attrs={'multiple': True, 'placeholder': 'email'}),
help_text=('Full email addresses of API owners who LGTM\'d '
'the Request for Deprecation Trial email thread.')),
'debuggability': forms.CharField(
label='Debuggability', required=False,
widget=forms.Textarea(attrs={'cols': 50, 'maxlength': 1480}),
help_text=
('Description of the desired DevTools debugging support for your '
'feature. Consider emailing the '
'<a href="https://groups.google.com/forum/?'
'fromgroups#!forum/google-chrome-developer-tools">'
'google-chrome-developer-tools</a> list for additional help. '
'For new language features in V8 specifically, refer to the '
'debugger support checklist. If your feature doesn\'t require '
'changes to DevTools to provide a good debugging '
'experience, feel free to leave this section empty.')),
'all_platforms': forms.BooleanField(
required=False, initial=False, label='Supported on all platforms?',
help_text=
('Will this feature be supported on all six Blink platforms '
'(Windows, Mac, Linux, Chrome OS, Android, and Android WebView)?')),
'all_platforms_descr': forms.CharField(
label='Platform Support Explanation', required=False,
widget=forms.Textarea(attrs={'rows': 2, 'cols': 50, 'maxlength': 2000}),
help_text=
('Explain why this feature is, or is not, '
'supported on all platforms.')),
'wpt': forms.BooleanField(
required=False, initial=False, label='Web Platform Tests',
help_text='Is this feature fully tested in Web Platform Tests?'),
'wpt_descr': forms.CharField(
label='Web Platform Tests Description', required=False,
widget=forms.Textarea(attrs={'cols': 50, 'maxlength': 1480}),
help_text=
('Please link to the <a href="https://wpt.fyi/results">results on '
'wpt.fyi</a>. If any part of the feature is not tested by '
'web-platform-tests. Please include links to issues, e.g. a '
'web-platform-tests issue with the "infra" label explaining why a '
'certain thing cannot be tested (<a '
'href="https://github.com/w3c/web-platform-tests/issues/3867">'
'example</a>), a spec issue for some change that would make it '
'possible to test. (<a href="'
'https://github.com/whatwg/fullscreen/issues/70">example</a>), or '
'a Chromium issue to upstream some existing tests (<a href="'
'https://bugs.chromium.org/p/chromium/issues/detail?id=695486">'
'example</a>).')),
'sample_links': forms.CharField(
label='Samples links', required=False,
widget=forms.Textarea(
attrs={'cols': 50, 'maxlength': 500,
'placeholder': 'https://\nhttps://'}),
help_text='Links to samples (one URL per line).'),
'bug_url': forms.URLField(
required=False, label='Tracking bug URL',
widget=forms.URLInput(attrs={'placeholder': 'https://'}),
help_text=
('Tracking bug url (https://bugs.chromium.org/...). This bug '
'should have "Type=Feature" set and be world readable. '
'Note: This field only accepts one URL.')),
# TODO(jrobbins): Consider a button to file the launch bug automatically,
# or a deep link that has some feature details filled in.
'launch_bug_url': forms.URLField(
required=False, label='Launch bug URL',
widget=forms.URLInput(attrs={'placeholder': 'https://'}),
help_text=(
'Launch bug url (https://bugs.chromium.org/...) to track launch '
'approvals. '
'<a target="_blank" href="'
'https://bugs.chromium.org/p/chromium/issues/'
'entry?template=Chrome+Launch+Feature" '
'>Create launch bug<a>.')),
'initial_public_proposal_url': forms.URLField(
required=False, label='Initial public proposal URL',
widget=forms.URLInput(attrs={'placeholder': 'https://'}),
help_text=(
'Link to the first public proposal to create this feature, e.g., '
'a WICG discourse post.')),
'blink_components': forms.ChoiceField(
required=False, label='Blink component',
help_text=
('Select the most specific component. If unsure, leave as "%s".' %
models.BlinkComponent.DEFAULT_COMPONENT),
choices=[(x, x) for x in models.BlinkComponent.fetch_all_components()],
initial=[models.BlinkComponent.DEFAULT_COMPONENT]),
'devrel': forms.EmailField(
required=False, label='Developer relations emails',
widget=forms.EmailInput(
attrs={'multiple': True, 'placeholder': 'email, email'}),
help_text='Comma separated list of full email addresses.'),
'impl_status_chrome': forms.ChoiceField(
required=False, label='Implementation status',
choices=models.IMPLEMENTATION_STATUS.items(),
help_text='Implementation status in Chromium'),
'shipped_milestone': forms.IntegerField(
required=False, label='Chrome for desktop',
widget=forms.NumberInput(attrs={'placeholder': 'Milestone #'}),
help_text=SHIPPED_HELP_TXT),
'shipped_android_milestone': forms.IntegerField(
required=False, label='Chrome for Android',
widget=forms.NumberInput(attrs={'placeholder': 'Milestone #'}),
help_text=SHIPPED_HELP_TXT),
'shipped_ios_milestone': forms.IntegerField(
required=False, label='Chrome for iOS (RARE)',
widget=forms.NumberInput(attrs={'placeholder': 'Milestone #'}),
help_text=SHIPPED_HELP_TXT),
'shipped_webview_milestone': forms.IntegerField(
required=False, label='Android Webview',
widget=forms.NumberInput(attrs={'placeholder': 'Milestone #'}),
help_text=SHIPPED_HELP_TXT),
'flag_name': forms.CharField(
label='Flag name', required=False,
help_text='Name of the flag that enables this feature.'),
'prefixed': forms.BooleanField(
required=False, initial=False, label='Prefixed?'),
'search_tags': forms.CharField(
label='Search tags', required=False,
help_text='Comma separated keywords used only in search'),
'comments': forms.CharField(
label='Comments', required=False,
widget=forms.Textarea(attrs={
'cols': 50, 'rows': 4, 'maxlength': 1480}),
help_text='Additional comments, caveats, info...'),
}
# These are shown in a top card for all processes.
METADATA_FIELDS = [
'name', 'summary', 'unlisted', 'owner',
'category',
'feature_type', 'intent_stage',
'search_tags',
# Implemention
'impl_status_chrome',
'blink_components',
'bug_url', 'launch_bug_url',
]
def define_form_class_using_shared_fields(class_name, field_spec_list):
"""Define a new subsblass of forms.Form with the given fields, in order."""
# field_spec_list is normally just a list of simple field names,
# but entries can also have syntax "form_field=shared_field".
class_dict = {'field_order': []}
for field_spec in field_spec_list:
form_field_name = field_spec.split('=')[0] # first or only
shared_field_name = field_spec.split('=')[-1] # last or only
class_dict[form_field_name] = ALL_FIELDS[shared_field_name]
class_dict['field_order'].append(form_field_name)
return type(class_name, (forms.Form,), class_dict)
NewFeatureForm = define_form_class_using_shared_fields(
'NewFeatureForm',
('name', 'summary',
'unlisted', 'owner',
'blink_components', 'category'))
# Note: feature_type is done with custom HTML
MetadataForm = define_form_class_using_shared_fields(
'MetadataForm', METADATA_FIELDS)
NewFeature_Incubate = define_form_class_using_shared_fields(
'NewFeature_Incubate',
('motivation', 'initial_public_proposal_url', 'explainer_links',
'bug_url', 'launch_bug_url', 'comments'))
NewFeature_Prototype = define_form_class_using_shared_fields(
'NewFeature_Prototype',
('spec_link', 'api_spec', 'spec_mentors',
'intent_to_implement_url', 'comments'))
# TODO(jrobbins): advise user to request a tag review
Any_DevTrial = define_form_class_using_shared_fields(
'Any_DevTrial',
('bug_url', 'doc_links',
'interop_compat_risks',
'safari_views', 'safari_views_link', 'safari_views_notes',
'ff_views', 'ff_views_link', 'ff_views_notes',
'ie_views', 'ie_views_link', 'ie_views_notes',
'web_dev_views', 'web_dev_views_link', 'web_dev_views_notes',
'security_review_status', 'privacy_review_status',
'ergonomics_risks', 'activation_risks', 'security_risks', 'debuggability',
'all_platforms', 'all_platforms_descr', 'wpt', 'wpt_descr',
'sample_links', 'devrel', 'ready_for_trial_url', 'comments'))
# TODO(jrobbins): api overview link
ImplStatus_DevTrial = define_form_class_using_shared_fields(
'ImplStatus_InDevTrial',
('shipped_milestone', 'shipped_android_milestone',
'shipped_ios_milestone', 'flag_name'))
NewFeature_EvalReadinessToShip = define_form_class_using_shared_fields(
'NewFeature_EvalReadinessToShip',
('doc_links', 'tag_review', 'spec_link', 'interop_compat_risks',
'safari_views', 'safari_views_link', 'safari_views_notes',
'ff_views', 'ff_views_link', 'ff_views_notes',
'ie_views', 'ie_views_link', 'ie_views_notes',
'web_dev_views', 'web_dev_views_link', 'web_dev_views_notes',
'prefixed', 'comments'))
ImplStatus_AllMilestones = define_form_class_using_shared_fields(
'ImplStatus_AllMilestones',
('shipped_milestone', 'shipped_android_milestone',
'shipped_ios_milestone', 'shipped_webview_milestone'))
ImplStatus_EvalReadinessToShip = define_form_class_using_shared_fields(
'ImplStatus_AllMilestones',
('shipped_milestone', 'shipped_android_milestone',
'shipped_ios_milestone', 'shipped_webview_milestone',
'measurement'))
NewFeature_OriginTrial = define_form_class_using_shared_fields(
'NewFeature_OriginTrial',
('experiment_goals', 'experiment_risks',
'experiment_extension_reason', 'ongoing_constraints',
'origin_trial_feedback_url', 'intent_to_experiment_url',
'i2e_lgtms', 'comments'))
ImplStatus_OriginTrial = define_form_class_using_shared_fields(
'ImplStatus_OriginTrial',
('experiment_timeline', # deprecated
'ot_milestone_desktop_start', 'ot_milestone_desktop_end',
'ot_milestone_android_start', 'ot_milestone_android_end'))
Most_PrepareToShip = define_form_class_using_shared_fields(
'Most_PrepareToShip',
('tag_review', 'tag_review_status',
'intent_to_implement_url', 'origin_trial_feedback_url',
'launch_bug_url', 'intent_to_ship_url', 'i2s_lgtms', 'comments'))
PSA_PrepareToShip = define_form_class_using_shared_fields(
'PSA_PrepareToShip',
('tag_review',
'intent_to_implement_url', 'origin_trial_feedback_url',
'launch_bug_url', 'intent_to_ship_url', 'comments'))
Any_Ship = define_form_class_using_shared_fields(
'Any_Ship',
('launch_bug_url', 'comments'))
Any_Identify = define_form_class_using_shared_fields(
'Any_Identify',
('owner', 'blink_components', 'motivation', 'explainer_links',
'spec_link', 'api_spec', 'bug_url', 'launch_bug_url', 'comments'))
Any_Implement = define_form_class_using_shared_fields(
'Any_Implement',
('spec_link', 'comments'))
# TODO(jrobbins): advise user to request a tag review
Existing_OriginTrial = define_form_class_using_shared_fields(
'Existing_OriginTrial',
('experiment_goals', 'experiment_risks',
'experiment_extension_reason', 'ongoing_constraints',
'intent_to_experiment_url', 'i2e_lgtms',
'origin_trial_feedback_url', 'comments'))
# Note: Even though this is similar to another form, it is likely to change.
Deprecation_PrepareToShip = define_form_class_using_shared_fields(
'Deprecation_PrepareToShip',
('impl_status_chrome', 'tag_review',
'intent_to_implement_url', 'origin_trial_feedback_url',
'launch_bug_url', 'comments'))
# Note: Even though this is similar to another form, it is likely to change.
Deprecation_DeprecationTrial = define_form_class_using_shared_fields(
'Deprecation_DeprecationTrial',
('experiment_goals', 'experiment_timeline', 'experiment_risks',
'experiment_extension_reason', 'ongoing_constraints',
'intent_to_experiment_url',
'i2e_lgtms=r4dt_lgtms', # form field name matches underlying DB field.
'origin_trial_feedback_url', 'comments'))
# Note: Even though this is similar to another form, it is likely to change.
Deprecation_PrepareToShip = define_form_class_using_shared_fields(
'Deprecation_PrepareToShip',
('impl_status_chrome', 'tag_review',
'intent_to_ship_url', 'i2s_lgtms',
'launch_bug_url', 'comments'))
Deprecation_Removed = define_form_class_using_shared_fields(
'Deprecation_Removed',
('comments',))
Flat_Metadata = define_form_class_using_shared_fields(
'Flat_Metadata',
(# Standardizaton
'name', 'summary', 'unlisted', 'owner',
'category',
'feature_type', 'intent_stage',
'search_tags',
# Implementtion
'impl_status_chrome',
'blink_components',
'bug_url', 'launch_bug_url',
'comments'))
Flat_Identify = define_form_class_using_shared_fields(
'Flat_Identify',
(# Standardization
'motivation', 'initial_public_proposal_url', 'explainer_links'))
Flat_Implement = define_form_class_using_shared_fields(
'Flat_Implement',
(# Standardization
'spec_link', 'api_spec', 'spec_mentors', 'intent_to_implement_url'))
Flat_DevTrial = define_form_class_using_shared_fields(
'Flat_DevTrial',
(# Standardizaton
'doc_links',
'interop_compat_risks',
'safari_views', 'safari_views_link', 'safari_views_notes',
'ff_views', 'ff_views_link', 'ff_views_notes',
'ie_views', 'ie_views_link', 'ie_views_notes',
'web_dev_views', 'web_dev_views_link', 'web_dev_views_notes',
'security_review_status', 'privacy_review_status',
'ergonomics_risks', 'activation_risks', 'security_risks', 'debuggability',
'all_platforms', 'all_platforms_descr', 'wpt', 'wpt_descr',
'sample_links', 'devrel', 'ready_for_trial_url',
# TODO(jrobbins): UA support signals section
# Implementation
'flag_name'))
# TODO(jrobbins): api overview link
Flat_OriginTrial = define_form_class_using_shared_fields(
'Flat_OriginTrial',
(# Standardization
'experiment_goals',
'experiment_risks',
'experiment_extension_reason', 'ongoing_constraints',
'intent_to_experiment_url', 'i2e_lgtms',
'origin_trial_feedback_url',
# Implementation
'experiment_timeline',
'ot_milestone_desktop_start', 'ot_milestone_desktop_end',
'ot_milestone_android_start', 'ot_milestone_android_end'))
Flat_PrepareToShip = define_form_class_using_shared_fields(
'Flat_PrepareToShip',
(# Standardization
'tag_review', 'tag_review_status',
'intent_to_ship_url', 'i2s_lgtms',
# Implementation
'measurement'))
Flat_Ship = define_form_class_using_shared_fields(
'Flat_Ship',
(# Implementation
'shipped_milestone', 'shipped_android_milestone',
'shipped_ios_milestone', 'shipped_webview_milestone'))
FIELD_NAME_TO_DISPLAY_TYPE = {
'doc_links': 'urllist',
'explainer_links': 'urllist',
'sample_links': 'urllist',
# Otherwise, FIELD_TYPE_TO_DISPLAY_TYPE is used.
}
FIELD_TYPE_TO_DISPLAY_TYPE = {
forms.BooleanField: 'bool',
forms.URLField: 'url',
# choice, char, int can all render as plain text.
}
def make_human_readable(field_name):
return field_name.replace('_', ' ').capitalize()
def make_display_spec(field_name):
"""Return a tuple of field info that can easily be sent in JSON."""
form_field = ALL_FIELDS[field_name]
display_name = form_field.label or make_human_readable(field_name)
field_type = (FIELD_NAME_TO_DISPLAY_TYPE.get(field_name) or
FIELD_TYPE_TO_DISPLAY_TYPE.get(type(form_field)) or
'text')
return (field_name, display_name, field_type)
def make_display_specs(*shared_field_names):
"""Return a list of field specs for each of the fields named in the args."""
return [make_display_spec(field_name)
for field_name in shared_field_names]
DEPRECATED_FIELDS = ['standardization']
DISPLAY_IN_FEATURE_HIGHLIGHTS = [
'name', 'summary',
'motivation',
'unlisted', 'owner',
'search_tags',
# Implementtion
'impl_status_chrome',
'blink_components',
'bug_url',
'comments',
]
DISPLAY_FIELDS_IN_STAGES = {
'Metadata': make_display_specs(
'category', 'feature_type', 'intent_stage',
),
models.INTENT_INCUBATE: make_display_specs(
'initial_public_proposal_url', 'explainer_links'),
models.INTENT_IMPLEMENT: make_display_specs(
'spec_link', 'api_spec', 'spec_mentors', 'intent_to_implement_url'),
models.INTENT_EXPERIMENT: make_display_specs(
'doc_links',
'interop_compat_risks',
'safari_views', 'safari_views_link', 'safari_views_notes',
'ff_views', 'ff_views_link', 'ff_views_notes',
'ie_views', 'ie_views_link', 'ie_views_notes',
'web_dev_views', 'web_dev_views_link', 'web_dev_views_notes',
'security_review_status', 'privacy_review_status',
'ergonomics_risks', 'activation_risks', 'security_risks',
'debuggability',
'all_platforms', 'all_platforms_descr', 'wpt', 'wpt_descr',
'sample_links', 'devrel', 'ready_for_trial_url',
'flag_name'),
models.INTENT_IMPLEMENT_SHIP: make_display_specs(
'launch_bug_url',
'tag_review', 'tag_review_status',
'measurement', 'prefixed'),
models.INTENT_EXTEND_TRIAL: make_display_specs(
'experiment_goals', 'experiment_risks',
'experiment_extension_reason', 'ongoing_constraints',
'origin_trial_feedback_url', 'intent_to_experiment_url',
'i2e_lgtms', 'r4dt_lgtms',
'experiment_timeline', # Deprecated
'ot_milestone_desktop_start', 'ot_milestone_desktop_end',
'ot_milestone_android_start', 'ot_milestone_android_end',
),
models.INTENT_SHIP: make_display_specs(
'shipped_milestone', 'shipped_android_milestone',
'shipped_ios_milestone', 'shipped_webview_milestone',
'intent_to_ship_url', 'i2s_lgtms'),
models.INTENT_SHIPPED: make_display_specs(
),
'Misc': make_display_specs(
),
}