Skip to content

Commit

Permalink
Hide deprecated fields that have no value.
Browse files Browse the repository at this point in the history
  • Loading branch information
jrobbins committed Jan 15, 2025
1 parent f6c1a85 commit 1f87a01
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
6 changes: 2 additions & 4 deletions client-src/elements/chromedash-feature-detail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import './chromedash-gate-chip';
import {GateDict} from './chromedash-gate-chip';
import {Process, ProgressItem} from './chromedash-gate-column';
import {
DEPRECATED_FIELDS,
GATE_ACTIVE_REVIEW_STATES,
GATE_FINISHED_REVIEW_STATES,
GATE_PREPARING,
Expand Down Expand Up @@ -387,11 +386,10 @@ export class ChromedashFeatureDetail extends LitElement {
}

renderField(fieldDef, feStage) {
const [fieldId, fieldDisplayName, fieldType] = fieldDef;
const [fieldId, fieldDisplayName, fieldType, deprecated] = fieldDef;
const value = getFieldValueFromFeature(fieldId, feStage, this.feature);
const isDefined = isDefinedValue(value);
const isDeprecatedField = DEPRECATED_FIELDS.has(fieldId);
if (!isDefined && isDeprecatedField) {
if (!isDefined && deprecated) {
return nothing;
}

Expand Down
3 changes: 3 additions & 0 deletions client-src/elements/chromedash-form-field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,9 @@ export class ChromedashFormField extends LitElement {
}

render() {
if (this.fieldProps.deprecated && !this.value) {
return nothing;
}
const helpText =
this.forEnterprise && this.fieldProps.enterprise_help_text !== undefined
? this.fieldProps.enterprise_help_text
Expand Down
8 changes: 0 additions & 8 deletions client-src/elements/form-field-enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -463,14 +463,6 @@ export const STAGE_FIELD_NAME_MAPPING: Record<string, string> = {
r4dt_url: 'intent_thread_url',
};

export const DEPRECATED_FIELDS = new Set<string>([
'experiment_timeline',
'i2e_lgtms',
'i2s_lgtms',
'r4dt_lgtms',
'standardization',
]);

export const GATE_TYPES: Record<string, number> = {
API_PROTOTYPE: 1,
API_ORIGIN_TRIAL: 2,
Expand Down
10 changes: 9 additions & 1 deletion client-src/elements/form-field-specs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ interface ResolvedField {
>;
displayLabel?: string;
disabled?: boolean;
deprecated?: boolean;
}

interface Field extends ResolvedField {
Expand Down Expand Up @@ -1269,6 +1270,7 @@ export const ALL_FIELDS: Record<string, Field> = {
label: 'Experiment Timeline',
help_text: html` When does the experiment start and expire? Deprecated:
Please use the numeric fields above instead.`,
deprecated: true,
},

ot_milestone_desktop_start: {
Expand Down Expand Up @@ -1684,6 +1686,7 @@ export const ALL_FIELDS: Record<string, Field> = {
label: 'Intent to Experiment LGTM by',
help_text: html` Full email address of API owner who LGTM'd the Intent to
Experiment email thread.`,
deprecated: true,
},

i2s_lgtms: {
Expand All @@ -1699,6 +1702,7 @@ export const ALL_FIELDS: Record<string, Field> = {
Comma separated list of email addresses of API owners who LGTM'd the
Intent to Ship email thread.
`,
deprecated: true,
},

r4dt_lgtms: {
Expand All @@ -1714,6 +1718,7 @@ export const ALL_FIELDS: Record<string, Field> = {
label: 'Request for Deprecation Trial LGTM by',
help_text: html` Full email addresses of API owners who LGTM'd the Request
for Deprecation Trial email thread.`,
deprecated: true,
},

debuggability: {
Expand Down Expand Up @@ -2076,6 +2081,8 @@ export const ALL_FIELDS: Record<string, Field> = {
label: 'Enterprise policies',
help_text: html` List the policies that are being introduced, removed, or
can be used to control the feature at this stage, if any.`,
disabled: true,
deprecated: true,
},

enterprise_feature_categories: {
Expand Down Expand Up @@ -2195,7 +2202,8 @@ function makeDisplaySpec(fieldName: string) {
const displayName =
fieldProps.label || fieldProps.displayLabel || makeHumanReadable(fieldName);
const fieldType = categorizeFieldType(fieldProps);
return [fieldName, displayName, fieldType];
const deprecated = fieldProps.deprecated;
return [fieldName, displayName, fieldType, deprecated];
}

export function makeDisplaySpecs(fieldNames: string[]) {
Expand Down

0 comments on commit 1f87a01

Please sign in to comment.