Skip to content

Commit fc7c2c7

Browse files
Adriana IxbaDevtools-frontend LUCI CQ
authored andcommitted
[RPP] disable 3p checkbox with related insights dimming
this disables the 3p checkbox when insights dimming is enabled https://screencast.googleplex.com/cast/NjQ4OTE1OTU0Njk2MTkyMHw5ODc1ZDMzMC1jMg Bug:391589856 Change-Id: Iefe0b3772c1ac31880731d6a4ae423d07ff8aeef Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6199083 Commit-Queue: Adriana Ixba <[email protected]> Reviewed-by: Paul Irish <[email protected]>
1 parent 38b4fc6 commit fc7c2c7

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

front_end/panels/timeline/TimelinePanel.ts

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,7 @@ export class TimelinePanel extends UI.Panel.Panel implements Client, TimelineMod
384384
readonly #minimapComponent = new TimelineMiniMap();
385385
#viewMode: ViewMode = {mode: 'LANDING_PAGE'};
386386
readonly #dimThirdPartiesSetting: Common.Settings.Setting<boolean>|null = null;
387+
#thirdPartyCheckbox: UI.Toolbar.ToolbarSettingCheckbox|null = null;
387388

388389
/**
389390
* We get given any filters for a new trace when it is recorded/imported.
@@ -724,13 +725,33 @@ export class TimelinePanel extends UI.Panel.Panel implements Client, TimelineMod
724725
}
725726

726727
#setActiveInsight(insight: TimelineComponents.Sidebar.ActiveInsight|null): void {
728+
// When an insight is selected, ensure that the 3P checkbox is disabled
729+
// to avoid dimming interference.
727730
if (insight) {
728731
this.#splitWidget.showBoth();
732+
this.#set3PCheckboxDisabled(true);
733+
} else {
734+
this.#set3PCheckboxDisabled(false);
729735
}
730736
this.#sideBar.setActiveInsight(insight);
731737
this.flameChart.setActiveInsight(insight);
732738
}
733739

740+
/**
741+
* This "disables" the 3P checkbox in the toolbar.
742+
* Disabling here does a couple of things:
743+
* 1) updates the setting to "disabled"
744+
* 2) makes the checkbox dimmed and unclickable
745+
* 3) gives the checkbox UI an indeterminate state
746+
*/
747+
#set3PCheckboxDisabled(disabled: boolean): void {
748+
if (Root.Runtime.experiments.isEnabled(Root.Runtime.ExperimentName.TIMELINE_DIM_UNRELATED_EVENTS)) {
749+
this.#dimThirdPartiesSetting?.setDisabled(disabled);
750+
this.#thirdPartyCheckbox?.setIndeterminate(disabled);
751+
this.#thirdPartyCheckbox?.applyEnabledState(!disabled);
752+
}
753+
}
754+
734755
static instance(opts: {
735756
forceNew: boolean|null,
736757
isNode: boolean,
@@ -1026,7 +1047,7 @@ export class TimelinePanel extends UI.Panel.Panel implements Client, TimelineMod
10261047
}
10271048

10281049
private createSettingCheckbox(setting: Common.Settings.Setting<boolean>, tooltip: Platform.UIString.LocalizedString):
1029-
UI.Toolbar.ToolbarItem {
1050+
UI.Toolbar.ToolbarSettingCheckbox {
10301051
const checkboxItem = new UI.Toolbar.ToolbarSettingCheckbox(setting, tooltip);
10311052
this.recordingOptionUIControls.push(checkboxItem);
10321053
return checkboxItem;
@@ -1149,6 +1170,7 @@ export class TimelinePanel extends UI.Panel.Panel implements Client, TimelineMod
11491170
this.#dimThirdPartiesSetting) {
11501171
const dimThirdPartiesCheckbox =
11511172
this.createSettingCheckbox(this.#dimThirdPartiesSetting, i18nString(UIStrings.thirdPartiesByThirdPartyWeb));
1173+
this.#thirdPartyCheckbox = dimThirdPartiesCheckbox;
11521174
this.panelToolbar.appendToolbarItem(dimThirdPartiesCheckbox);
11531175
}
11541176

@@ -2146,7 +2168,7 @@ export class TimelinePanel extends UI.Panel.Panel implements Client, TimelineMod
21462168
return;
21472169
}
21482170

2149-
const checkboxState = this.#dimThirdPartiesSetting?.get() ?? false;
2171+
const checkboxState = this.#dimThirdPartiesSetting?.getIfNotDisabled() ?? false;
21502172
const thirdPartyEvents = this.#entityMapper?.thirdPartyEvents() ?? [];
21512173

21522174
if (checkboxState && thirdPartyEvents.length) {

0 commit comments

Comments
 (0)