Skip to content

A failed Create call now switches to the page with an error#177

Merged
KSJaay merged 1 commit into
KSJaay:0.10.13from
JosephB10:feature/switch-page-on-error
Nov 28, 2025
Merged

A failed Create call now switches to the page with an error#177
KSJaay merged 1 commit into
KSJaay:0.10.13from
JosephB10:feature/switch-page-on-error

Conversation

@JosephB10
Copy link
Copy Markdown
Contributor

lunaGif

Summary

If you selected "Create" when making a new monitor, unless you were on the page with the error it was unclear what went wrong. Now it switches to a page with an error on it and every page that has an error is marked with a red dot.

New Features

  • Not really a feature just an update

Updates

.../hooks/useMonitorForm.tsx

  • Within the useMonitorForm.tsx file I created a helper function getPagesWithErrors that returns a set with pages that have errors
  • This set is used in useMonitorForm to setPageId which I passed from it's parent configure.tsx
    • This allows it to set the page to one with an error.

.../monitor/configure.tsx

  • That same set of error pages is then returned to configure.tsx where it is used to add the error-circle class to any page with an error
  • The onClick event handler for each page was updated to also remove the previous error page from the error set (which subsequently removes the red dot.)
    • When you click to a new page the red dot is removed from the previous page

.../monitor/styles.scss

  • error-circle was added to styles.scss and styled to create a red dot

Additional Info

I'm not 100% convinced that it's necessary to remove the red dot when clicking away from a page with an error. At the moment the error messages that are associated with each input will stay until you "Submit" again. But this way if there are multiple pages that have an error, it is clear which pages you've already been to.
(If you prefer to keep the red dots visible until a new Submit, it just requires the onClick logic in configure.tsx to be removed.)

Ideally I think the most informative way to handle errors on the forms would be to validate each separately onBlur so the user has instant feedback. But that would be a fairly involved overhaul of the entire system. So I offer this as an option to make any errors more clear to the user.

  • [No ] Does this update require migration? (If yes, add extra details)
  • [No ] Are there any other PRs that need to be merged? (If yes, add extra details)

@KSJaay
Copy link
Copy Markdown
Owner

KSJaay commented Nov 25, 2025

That's actually really nice! I'm on holiday right now but once I get back I'll have a full look through this and merge it!

@KSJaay KSJaay changed the base branch from main to 0.10.13 November 28, 2025 17:37
Copy link
Copy Markdown
Owner

@KSJaay KSJaay left a comment

Choose a reason for hiding this comment

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

Left some comments for myself to make a few improvements in the future. Overall an amazing update and definitely something we need to improve on.

I might actually overhaul the whole system to add support for this, along with adding support in status pages as well.

Comment on lines +69 to +72
className={`monitor-configure-page-button
${page.id === pageId ? 'active' : ''}
${errorPages.has(page.id) ? 'error-circle' : ''}`}

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Move this to classnames to make it a bit easier to read

Comment on lines +36 to +45
&.error-circle::after {
content: "";
position: absolute;
top: 40%;
right: 10px;
width: 10px;
height: 10px;
background-color: red;
border-radius: 50%;
}
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Not now but moving this to an explanation mark or some sort of icon in the future

Comment on lines +43 to +59
const associatedPage: Record<string, string> = {
'name': "basic",
'type': "basic",
'url': "basic",
'port': "basic",
'icon': "basic",
'method': "basic",
'json_query': "basic",
'interval': "interval",
'retry': "interval",
'retryInterval': "interval",
'requestTimeout': "interval",
'notificationType': "notification",
'headers': "advanced",
'body': "advanced",
'valid_status_codes': "advanced",
}
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Figuring out a way to create a consistent list between all input types so this doesn't need to be updated every time a new monitor type is created.

@KSJaay
Copy link
Copy Markdown
Owner

KSJaay commented Nov 28, 2025

Going to merge this into 0.10.13 and release later this week.

@KSJaay KSJaay merged commit 091d7b8 into KSJaay:0.10.13 Nov 28, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants