Skip to content

Commit e1d00f2

Browse files
jalonthomasDevtools-frontend LUCI CQ
authored andcommitted
Create UI string mappings for formatting 'Type' column values
Bug: 382256016 Change-Id: I66d981af4c097b29c473c8fad2f628a2a6631925 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6112196 Commit-Queue: Jalon Thomas <[email protected]> Reviewed-by: Danil Somsikov <[email protected]> Reviewed-by: Kim-Anh Tran <[email protected]>
1 parent c9e63c8 commit e1d00f2

File tree

1 file changed

+97
-10
lines changed

1 file changed

+97
-10
lines changed

front_end/panels/security/CookieReportView.ts

Lines changed: 97 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -111,19 +111,71 @@ const UIStrings = {
111111
/**
112112
*@description String representing the GitHubResource insight type. Used as filter chip text to allow the user to filter the table based on recommendation.
113113
*/
114-
gitHubResourceTypeString: 'Github',
114+
gitHubResourceInsightTypeString: 'Github',
115115
/**
116116
*@description String representing the GracePeriod insight type. Used as filter chip text to allow the user to filter the table based on recommendation.
117117
*/
118-
gracePeriodTypeString: 'Grace Period',
118+
gracePeriodInsightTypeString: 'Grace Period',
119119
/**
120120
*@description String representing the GitHubResource insight type. Used as filter chip text to allow the user to filter the table based on recommendation.
121121
*/
122-
heuristicsTypeString: 'Heuristics',
122+
heuristicsInisightTypeString: 'Heuristics',
123123
/**
124124
*@description String representing a null insight type. Used as filter chip text to allow the user to filter the table based on recommendation.
125125
*/
126-
otherTypeString: 'Other',
126+
otherInsightTypeString: 'Other',
127+
/**
128+
*@description String representing the Advertising cookie type. Used to format 'ad' category from the Third Party Web dataset.
129+
*/
130+
adCookieTypeString: 'Advertising',
131+
/**
132+
*@description String representing the Analytics cookie type. Used to format 'analytics' category from the Third Party Web dataset.
133+
*/
134+
analyticsCookieTypeString: 'Analytics',
135+
/**
136+
*@description String representing the Social cookie type. Used to format 'social' category from the Third Party Web dataset.
137+
*/
138+
socialCookieTypeString: 'Social',
139+
/**
140+
*@description String representing the Video cookie type. Used to format 'video' category from the Third Party Web dataset.
141+
*/
142+
videoCookieTypeString: 'Video',
143+
/**
144+
*@description String representing the Utility cookie type. Used to format 'utility' category from the Third Party Web dataset.
145+
*/
146+
utilityCookieTypeString: 'Utility',
147+
/**
148+
*@description String representing the Hosting cookie type. Used to format 'hosting' category from the Third Party Web dataset.
149+
*/
150+
hostingCookieTypeString: 'Hosting',
151+
/**
152+
*@description String representing the Marketing cookie type. Used to format 'marketing' category from the Third Party Web dataset.
153+
*/
154+
marketingCookieTypeString: 'Marketing',
155+
/**
156+
*@description String representing the Customer Success cookie type. Used to format 'customer-success' category from the Third Party Web dataset.
157+
*/
158+
customerSuccessCookieTypeString: 'Customer Success',
159+
/**
160+
*@description String representing the Content cookie type. Used to format 'content' category from the Third Party Web dataset.
161+
*/
162+
contentCookieTypeString: 'Content',
163+
/**
164+
*@description String representing the CDN cookie type. Used to format 'cdn' category from the Third Party Web dataset.
165+
*/
166+
cdnCookieTypeString: 'CDN',
167+
/**
168+
*@description String representing the Tag Manager cookie type. Used to format 'tag-manager' category from the Third Party Web dataset.
169+
*/
170+
tagManagerCookieTypeString: 'Tag Manager',
171+
/**
172+
*@description String representing the Consent Provider cookie type. Used to format 'consent-provider' category from the Third Party Web dataset.
173+
*/
174+
consentProviderCookieTypeString: 'Consent Provider',
175+
/**
176+
*@description String representing the Other cookie type. Used to format 'other' category from the Third Party Web dataset.
177+
*/
178+
otherCookieTypeString: 'Other',
127179
};
128180
const str_ = i18n.i18n.registerUIStrings('panels/security/CookieReportView.ts', UIStrings);
129181
export const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
@@ -332,7 +384,7 @@ export class CookieReportView extends UI.Widget.VBox {
332384
{
333385
name: row.name,
334386
domain: row.domain,
335-
type: row.type ?? i18nString(UIStrings.unknown),
387+
type: CookieReportView.getCookieTypeString(row.type),
336388
platform: row.platform ?? i18nString(UIStrings.unknown),
337389
status: CookieReportView.getStatusString(row.status),
338390
recommendation: CookieReportView.getRecommendation(row.domain, row.insight),
@@ -359,18 +411,18 @@ export class CookieReportView extends UI.Widget.VBox {
359411

360412
static getInsightTypeString(insight?: Protocol.Audits.CookieIssueInsight): string {
361413
if (!insight) {
362-
return i18nString(UIStrings.otherTypeString);
414+
return i18nString(UIStrings.otherInsightTypeString);
363415
}
364416

365417
switch (insight.type) {
366418
case Protocol.Audits.InsightType.GitHubResource:
367-
return i18nString(UIStrings.gitHubResourceTypeString);
419+
return i18nString(UIStrings.gitHubResourceInsightTypeString);
368420
case Protocol.Audits.InsightType.GracePeriod:
369-
return i18nString(UIStrings.gracePeriodTypeString);
421+
return i18nString(UIStrings.gracePeriodInsightTypeString);
370422
case Protocol.Audits.InsightType.Heuristics:
371-
return i18nString(UIStrings.heuristicsTypeString);
423+
return i18nString(UIStrings.heuristicsInisightTypeString);
372424
default:
373-
return i18nString(UIStrings.otherTypeString);
425+
return i18nString(UIStrings.otherInsightTypeString);
374426
}
375427
}
376428

@@ -414,4 +466,39 @@ export class CookieReportView extends UI.Widget.VBox {
414466
return html`${i18nString(UIStrings.other)}`;
415467
}
416468
}
469+
470+
static getCookieTypeString(type?: string): string {
471+
if (!type) {
472+
return i18nString(UIStrings.otherCookieTypeString);
473+
}
474+
475+
switch (type) {
476+
case 'ad':
477+
return i18nString(UIStrings.adCookieTypeString);
478+
case 'analytics':
479+
return i18nString(UIStrings.analyticsCookieTypeString);
480+
case 'social':
481+
return i18nString(UIStrings.socialCookieTypeString);
482+
case 'video':
483+
return i18nString(UIStrings.videoCookieTypeString);
484+
case 'utility':
485+
return i18nString(UIStrings.utilityCookieTypeString);
486+
case 'hosting':
487+
return i18nString(UIStrings.hostingCookieTypeString);
488+
case 'marketing':
489+
return i18nString(UIStrings.marketingCookieTypeString);
490+
case 'customer-success':
491+
return i18nString(UIStrings.customerSuccessCookieTypeString);
492+
case 'content':
493+
return i18nString(UIStrings.contentCookieTypeString);
494+
case 'cdn':
495+
return i18nString(UIStrings.cdnCookieTypeString);
496+
case 'tag-manager':
497+
return i18nString(UIStrings.tagManagerCookieTypeString);
498+
case 'consent-provider':
499+
return i18nString(UIStrings.consentProviderCookieTypeString);
500+
default:
501+
return i18nString(UIStrings.otherCookieTypeString);
502+
}
503+
}
417504
}

0 commit comments

Comments
 (0)