-
-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shutdown #1216
Conversation
WalkthroughThe changes involve the addition of a new constant Changes
Suggested reviewers
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Outside diff range and nitpick comments (1)
apps/client/src/features/app-settings/panel/shutdown-panel/ShutdownPanel.tsx (1)
38-38
: Correct 'shutdown' to 'shut down' and adjust prepositionIn this context, 'shut down' should be two words when used as a verb. Additionally, it's more common to say "running on" rather than "running in."
Apply this diff to correct the text:
-<Panel.Description>Note: Ontime can only be shutdown from the machine it is running in.</Panel.Description> +<Panel.Description>Note: Ontime can only be shut down from the machine it is running on.</Panel.Description>
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- apps/client/src/common/api/constants.ts (1 hunks)
- apps/client/src/features/app-settings/panel/shutdown-panel/ShutdownPanel.tsx (2 hunks)
Additional comments not posted (1)
apps/client/src/features/app-settings/panel/shutdown-panel/ShutdownPanel.tsx (1)
35-35
: Logic for enabling the shutdown button looks correctThe updated
isDisabled
condition appropriately enables the shutdown button when running in Electron or on localhost.
@@ -18,6 +18,7 @@ const location = window.location; | |||
const socketProtocol = location.protocol === 'https:' ? 'wss' : 'ws'; | |||
export const isProduction = import.meta.env.MODE === 'production'; | |||
export const isDev = !isProduction; | |||
export const isLocalhost = location.hostname === 'localhost' || location.hostname === '127.0.0.1'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider supporting IPv6 localhost address '::1'
Currently, isLocalhost
only checks for 'localhost'
and '127.0.0.1'
. To ensure compatibility with IPv6 environments, you may want to include a check for '::1'
.
Apply this diff to include IPv6 localhost:
-export const isLocalhost = location.hostname === 'localhost' || location.hostname === '127.0.0.1';
+export const isLocalhost = ['localhost', '127.0.0.1', '::1'].includes(location.hostname);
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
export const isLocalhost = location.hostname === 'localhost' || location.hostname === '127.0.0.1'; | |
export const isLocalhost = ['localhost', '127.0.0.1', '::1'].includes(location.hostname); |
I can't think of any "gotchas" on the headless/docker side of things. |
small change to allow shutting down from localhost outside electron as discussed in #1215
This will also impact the users in node and docker environments.
As far as I can see, there are no downsides here, but thought of double checking @alex-Arc @jwetzell. Am I maybe missing something? In those environments, is there a reason for us not to want users to shutdown the process from the interface?