-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Add #1206: Do not require a "friendly name" #1231
base: master
Are you sure you want to change the base?
Add #1206: Do not require a "friendly name" #1231
Conversation
When I save the friendly name, it can either be
but it would also show as an empty string in the prometheus metrics. For some reason it doesn't feel quite right just to leave it as an empty string in the metrics. Theoretically the empty string could just be changed to null when returning the prometheus metrics but this seems a bit messy. Any thoughts on what would be best here? |
@Computroniks, If the monitor name is empty, simply set the monitor name to its URL. So the only thing you need to change is the way the data is stored in the database. Ie. if the monitor name is empty => uptime-kuma/src/pages/EditMonitor.vue Line 41 in c811c1c
Here set it to not required if "monitor.type === 'http' || monitor.type === 'keyword' "
uptime-kuma/src/pages/EditMonitor.vue Line 473 in c811c1c
Here you will check if it's empty and set it to it's URL uptime-kuma/src/pages/EditMonitor.vue Line 439 in c811c1c
And here check if URL and name are same (also if monitor.type === 'http' || monitor.type === 'keyword' ) and if so, just set name to ""
|
@karelkryda I did consider that here:
Whilst it doesn't seem like such of a big deal if someone changes the url and then has to change the friendly name as well, it seems a bit like only half a job to just copy it over to the name field. |
@Computroniks I don't see a problem with that. |
Ahh yes, of course. If I just implement a check to see if the URL and friendly name match when a user edits the monitor, I can then work out if the name should change as well. Not sure why I didn't think of that before. Thanks |
This comment was marked as resolved.
This comment was marked as resolved.
When adding or updating a monitor, if a friendly name is not specified, the URL or hostname will be used instead. Note: the hostname has priority over the URL so if both are set (possible in instances where monitor type has been changed), the friendly name will be set to the hostname. Signed-off-by: Computroniks <[email protected]>
Signed-off-by: Computroniks <[email protected]>
Signed-off-by: Computroniks <[email protected]>
f1b899b
to
3e36d41
Compare
Signed-off-by: Computroniks <[email protected]> Co-authored-by: Adam Stachowicz <[email protected]>
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Anything I can do to help get this merged? |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
@louislam Sorry to ping you, is there anything stopping this PR getting merged or that needs changing? |
…iendly-name # Conflicts: # src/pages/EditMonitor.vue
Just testing it with different monitor types, found out that the friendly name sometimes do not follow the current url. This video may help. |
This is probably because the docker monitor was added after this PR was first created and I haven't updated it to fix. I will get on that |
Signed-off-by: Matthew Nickson <[email protected]>
Signed-off-by: Matthew Nickson <[email protected]>
@louislam this PR should have now been updated to match all of the monitor types added recently. I have also modified the logic for selecting the field to use for the friendly name so that we don't end up with the issue where we are using a http monitor but the tcp hostname is used. I also added a custom case for TCP monitors to include the port number being monitored. |
This comment has been minimized.
This comment has been minimized.
Signed-off-by: Matthew Nickson <[email protected]>
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.
LGTM :)
@louislam This has been open for 2 years, are there any plans of merging it? |
Description
When creating or updating a monitor, a friendly name will no longer be required for specific monitor types. If it is not specified it will be set either the hostname or URL. In cases where both the URL and hostname are set (possible in instances where monitor type has been changed), the hostname has priority over the URL and the friendly name will be set to the hostname.
The array
friendlyNameRequiredOptions
contains all monitor types that still require a friendly name because they don't have either a URL or hostname field. For any monitor type specified in this array, the friendly name field will still be required.Monitor types that no longer require a friendly name:
Closes #1206
Type of change
Checklist