Skip to content

Commit 3da6f98

Browse files
Nancy LiDevtools-frontend LUCI CQ
authored andcommitted
[RPP icicle blowtorch] Whenever there is a change in the ignore list, revalidate the current input
Fixed: 389493170 Change-Id: I14dbcc0ab6f8578748c78e134939e4eebad0a8c0 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6172436 Commit-Queue: Nancy Li <[email protected]> Reviewed-by: Jack Franklin <[email protected]>
1 parent e46659d commit 3da6f98

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

front_end/panels/timeline/components/IgnoreListSetting.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ export class IgnoreListSetting extends HTMLElement {
118118
}
119119

120120
#startEditing(): void {
121+
// Do not need to trim here because this is a temporary one, we will trim the input when finish editing,
121122
this.#editingRegexSetting = {pattern: this.#newRegexInput.value, disabled: false, disabledForUrl: undefined};
122123
// We need to push the temp regex here to update the flame chart.
123124
// We are using the "skip-stack-frames-pattern" setting to determine which is rendered on flame chart. And the push
@@ -145,6 +146,9 @@ export class IgnoreListSetting extends HTMLElement {
145146
#resetInput(): void {
146147
this.#newRegexCheckbox.checkboxElement.checked = false;
147148
this.#newRegexInput.value = '';
149+
150+
this.#newRegexIsValid = true;
151+
this.#newRegexValidationMessage = undefined;
148152
}
149153

150154
#addNewRegexToIgnoreList(): void {
@@ -197,7 +201,7 @@ export class IgnoreListSetting extends HTMLElement {
197201
return this.#regexPatterns;
198202
}
199203

200-
#handleInputChange(): void {
204+
#validateInput(): void {
201205
const newRegex = this.#newRegexInput.value.trim();
202206
const newRegexIsNotEmpty = Boolean(newRegex);
203207
// Enable the rule if the text input field is not empty.
@@ -208,10 +212,15 @@ export class IgnoreListSetting extends HTMLElement {
208212
UI.ARIAUtils.setInvalid(this.#newRegexInput, !valid);
209213
this.#newRegexIsValid = valid;
210214
this.#newRegexValidationMessage = message;
215+
}
216+
217+
#handleInputChange(): void {
218+
this.#validateInput();
211219

212220
if (this.#editingRegexSetting) {
213-
this.#editingRegexSetting.pattern = this.#newRegexInput.value.trim();
214-
this.#editingRegexSetting.disabled = !newRegexIsNotEmpty;
221+
const newRegex = this.#newRegexInput.value.trim();
222+
this.#editingRegexSetting.pattern = newRegex;
223+
this.#editingRegexSetting.disabled = !Boolean(newRegex);
215224
this.#getSkipStackFramesPatternSetting().setAsArray(this.#regexPatterns);
216225
}
217226
}
@@ -245,7 +254,7 @@ export class IgnoreListSetting extends HTMLElement {
245254

246255
#onRegexEnableToggled(regex: Common.Settings.RegExpSettingItem, checkbox: UI.UIUtils.CheckboxLabel): void {
247256
regex.disabled = !checkbox.checkboxElement.checked;
248-
257+
this.#validateInput();
249258
// Technically we don't need to call the set function, because the regex is a reference, so it changed the setting
250259
// value directly.
251260
// But we need to call the set function to trigger the setting change event. which is needed by view update of flame
@@ -257,6 +266,9 @@ export class IgnoreListSetting extends HTMLElement {
257266

258267
#removeRegexByIndex(index: number): void {
259268
this.#regexPatterns.splice(index, 1);
269+
this.#validateInput();
270+
// Call the set function to trigger the setting change event. we listen to this event and will update this component
271+
// and the flame chart.
260272
this.#getSkipStackFramesPatternSetting().setAsArray(this.#regexPatterns);
261273
}
262274

0 commit comments

Comments
 (0)