Skip to content

Improve Workspace timeout settings error UX #18925

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

Conversation

Siddhant-K-code
Copy link
Member

@Siddhant-K-code Siddhant-K-code commented Oct 14, 2023

Description

UX in Prod. UX after this PR
Screen.Recording.2023-10-14.at.5.00.03.PM.mov
Screen.Recording.2023-10-14.at.4.56.34.PM.mov
Summary generated by Copilot

🤖 Generated by Copilot at b1a8634

Improve error handling and feedback for custom workspace timeout in user preferences. Refactor Preferences.tsx to use vertical flex layout.

Related Issue(s)

Fixes EXP-755

How to test

Documentation

Preview status

Gitpod was successfully deployed to your preview environment.

Build Options

Build
  • /werft with-werft
    Run the build with werft instead of GHA
  • leeway-no-cache
  • /werft no-test
    Run Leeway with --dont-test
Publish
  • /werft publish-to-npm
  • /werft publish-to-jb-marketplace
Installer
  • analytics=segment
  • with-dedicated-emulation
  • workspace-feature-flags
    Add desired feature flags to the end of the line above, space separated
Preview Environment / Integration Tests
  • /werft with-local-preview
    If enabled this will build install/preview
  • /werft with-preview
  • /werft with-large-vm
  • /werft with-gce-vm
    If enabled this will create the environment on GCE infra
  • with-integration-tests=all
    Valid options are all, workspace, webapp, ide, jetbrains, vscode, ssh. If enabled, with-preview and with-large-vm will be enabled.
  • with-monitoring

/hold

@laushinka
Copy link
Contributor

Thanks for working on this, @Siddhant-K-code! The error message actually already showed the important part "Invalid custom unit", but swallowed by the rest of the message so people miss it.

Could we change the text to something like "Timeout unit is invalid. Make sure to use [number]m or [number]h"?

Let me loop in @loujaybee so I don't butcher our error messages.

@Siddhant-K-code
Copy link
Member Author

Could we change the text to something like "Timeout unit is invalid. Make sure to use [number]m or [number]h"?

I agree with your observation, @laushinka, At the moment, the error message originates from the server side, with the prefix (Cannot set custom workspace timeout: ) being appended at the frontend level. I propose that we initiate a comprehensive refactor of the following code, treating this as an independent issue that warrants a detailed discussion (with/ @loujaybee) to strategize our error message approach.

const unit = duration.slice(-1);
if (!["m", "h"].includes(unit)) {
throw new Error(`Invalid timeout unit: ${unit}`);
}
const value = parseInt(duration.slice(0, -1), 10);
if (isNaN(value) || value <= 0) {
throw new Error(`Invalid timeout value: ${duration}`);
}

@akosyakov
Copy link
Member

@selfcontained Could you have a look please whether it makes sense?

@Siddhant-K-code
Copy link
Member Author

/gh run recreate-vm=true

@Siddhant-K-code
Copy link
Member Author

/unhold

@roboquat roboquat merged commit a55b2b8 into main Nov 6, 2023
@roboquat roboquat deleted the siddhant/exp-755-error-message-behaviour-on-custom-timeout-component branch November 6, 2023 16:46
@@ -70,10 +71,11 @@ export default function Preferences() {
);
}
}
// Reset creationError to avoid displaying the error message and toast the success message
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would have been a good opportunity to refactor this into a react-query mutation, which handles the error state for us automatically.

@@ -70,10 +71,11 @@ export default function Preferences() {
);
}
}
// Reset creationError to avoid displaying the error message and toast the success message
setCreationError(undefined);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I probably would have gone with a toast here for the error instead of an inline one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants