From 22b3e8ec354861b948a09ac0c8a14bac1e0952a1 Mon Sep 17 00:00:00 2001 From: Jason Wallace Date: Thu, 28 Mar 2024 15:28:47 +0200 Subject: [PATCH] Rename private statesWithoutDialogClose field with underscore prefix (#1761) Related https://github.com/tiny-pilot/tinypilot/issues/1120 This is non-functional change. Notes * Pattern matched: `this\.statesWithoutDialogClose(?=\W)` Replaced with: `this._statesWithoutDialogClose` * Pattern matched: `(?<=\s)statesWithoutDialogClose =` Replaced with: `_statesWithoutDialogClose =` Review
on CodeApprove --- CONTRIBUTING.md | 6 +++--- app/templates/custom-elements/change-hostname-dialog.html | 4 ++-- app/templates/custom-elements/debug-dialog.html | 4 ++-- app/templates/custom-elements/shutdown-dialog.html | 4 ++-- app/templates/custom-elements/update-dialog.html | 4 ++-- app/templates/custom-elements/video-settings-dialog.html | 4 ++-- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 046d75404..54ecb0494 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -384,7 +384,7 @@ Prefer to change a web component's appearance based on attributes and CSS rules For a component that is used within an overlay, there might be certain states that should prevent the user from closing the dialog. That’s typically the case when we are waiting for an action to complete (for example when loading something). -These particular states are listed in the `statesWithoutDialogClose` class property, like so: +These particular states are listed in the `_statesWithoutDialogClose` class property, like so: ```javascript class extends HTMLElement { @@ -393,7 +393,7 @@ class extends HTMLElement { FETCH_FROM_URL: "fetch-from-url", VIEW: "view", }; - statesWithoutDialogClose = new Set([this._states.INITIALIZING]); + _statesWithoutDialogClose = new Set([this._states.INITIALIZING]); ``` Note: for consistency, we always use a `Set` here, even if it only contains a single element. @@ -405,7 +405,7 @@ set _state(newValue) { this.setAttribute("state", newValue); this.dispatchEvent( new DialogCloseStateChangedEvent( - !this.statesWithoutDialogClose.has(newValue) + !this._statesWithoutDialogClose.has(newValue) ) ); } diff --git a/app/templates/custom-elements/change-hostname-dialog.html b/app/templates/custom-elements/change-hostname-dialog.html index 1947905aa..2ae3603e4 100644 --- a/app/templates/custom-elements/change-hostname-dialog.html +++ b/app/templates/custom-elements/change-hostname-dialog.html @@ -106,7 +106,7 @@

Changing Hostname

PROMPT: "prompt", CHANGING: "changing", }; - statesWithoutDialogClose = new Set([ + _statesWithoutDialogClose = new Set([ this._states.CHANGING, this._states.INITIALIZING, ]); @@ -150,7 +150,7 @@

Changing Hostname

this.setAttribute("state", newValue); this.dispatchEvent( new DialogCloseStateChangedEvent( - !this.statesWithoutDialogClose.has(newValue) + !this._statesWithoutDialogClose.has(newValue) ) ); } diff --git a/app/templates/custom-elements/debug-dialog.html b/app/templates/custom-elements/debug-dialog.html index 055daed2c..1cd1e0927 100644 --- a/app/templates/custom-elements/debug-dialog.html +++ b/app/templates/custom-elements/debug-dialog.html @@ -78,7 +78,7 @@

Debug Logs

LOGS_LOADING: "logs-loading", LOGS_SUCCESS: "logs-success", }; - statesWithoutDialogClose = new Set([this._states.LOGS_LOADING]); + _statesWithoutDialogClose = new Set([this._states.LOGS_LOADING]); constructor() { super(); @@ -129,7 +129,7 @@

Debug Logs

this.setAttribute("state", newValue); this.dispatchEvent( new DialogCloseStateChangedEvent( - !this.statesWithoutDialogClose.has(newValue) + !this._statesWithoutDialogClose.has(newValue) ) ); } diff --git a/app/templates/custom-elements/shutdown-dialog.html b/app/templates/custom-elements/shutdown-dialog.html index 18cf34e57..712020ab0 100644 --- a/app/templates/custom-elements/shutdown-dialog.html +++ b/app/templates/custom-elements/shutdown-dialog.html @@ -77,7 +77,7 @@

Shutdown Complete

SHUTTING_DOWN: "shutting-down", SHUTDOWN_COMPLETE: "shutdown-complete", }; - statesWithoutDialogClose = new Set([ + _statesWithoutDialogClose = new Set([ this._states.RESTARTING, this._states.SHUTTING_DOWN, this._states.SHUTDOWN_COMPLETE, @@ -118,7 +118,7 @@

Shutdown Complete

this.setAttribute("state", newValue); this.dispatchEvent( new DialogCloseStateChangedEvent( - !this.statesWithoutDialogClose.has(newValue) + !this._statesWithoutDialogClose.has(newValue) ) ); } diff --git a/app/templates/custom-elements/update-dialog.html b/app/templates/custom-elements/update-dialog.html index bf2b2a110..41e2e44d2 100644 --- a/app/templates/custom-elements/update-dialog.html +++ b/app/templates/custom-elements/update-dialog.html @@ -143,7 +143,7 @@

Update Complete

RESTARTING: "restarting", UPDATE_FINISHED: "update-finished", }; - statesWithoutDialogClose = new Set([ + _statesWithoutDialogClose = new Set([ this._states.CHECKING, this._states.UPDATING, this._states.RESTARTING, @@ -195,7 +195,7 @@

Update Complete

this.setAttribute("state", newValue); this.dispatchEvent( new DialogCloseStateChangedEvent( - !this.statesWithoutDialogClose.has(newValue) + !this._statesWithoutDialogClose.has(newValue) ) ); } diff --git a/app/templates/custom-elements/video-settings-dialog.html b/app/templates/custom-elements/video-settings-dialog.html index 5c22e9d4f..6b38c38c5 100644 --- a/app/templates/custom-elements/video-settings-dialog.html +++ b/app/templates/custom-elements/video-settings-dialog.html @@ -221,7 +221,7 @@

Applying Video Settings

EDIT: "edit", SAVING: "saving", }; - statesWithoutDialogClose = new Set([ + _statesWithoutDialogClose = new Set([ this._states.LOADING, this._states.SAVING, ]); @@ -358,7 +358,7 @@

Applying Video Settings

this.setAttribute("state", newValue); this.dispatchEvent( new DialogCloseStateChangedEvent( - !this.statesWithoutDialogClose.has(newValue) + !this._statesWithoutDialogClose.has(newValue) ) ); }