Skip to content
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

show tags in monitor select list under status page #2752

Conversation

titanventura
Copy link
Contributor

@titanventura titanventura commented Feb 9, 2023

⚠️⚠️⚠️ Since we do not accept all types of pull requests and do not want to waste your time. Please be sure that you have read pull request rules:
https://github.com/louislam/uptime-kuma/blob/master/CONTRIBUTING.md#can-i-create-a-pull-request-for-uptime-kuma

Tick the checkbox if you understand [x]:

  • I have read and understand the pull request rules.

Description

Fixes #2739

Type of change

Please delete any options that are not relevant.

  • User interface (UI)

Checklist

  • My code follows the style guidelines of this project
  • I ran ESLint and other linters for modified files
  • I have performed a self-review of my own code and tested it
  • I have commented my code, particularly in hard-to-understand areas
    (including JSDoc for methods)
  • My changes generate no new warnings
  • My code needed automated testing. I have added them (this is optional task)

Screenshots (if any)

Please do not use any external image service. Instead, just paste in or drag and drop the image here, and it will be uploaded automatically.

Comment on lines 333 to 340
<option v-for="monitor in allMonitorList" :key="monitor.id" :value="monitor">
{{
monitor.name
}}
<span v-if="monitor.tags.length > 0">
[Tags: {{ monitor.tags.map(tag => tag.name).join(" ,") }} ]
</span>
</option>

Choose a reason for hiding this comment

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

Can you drop a screenshot of how does this change make on the UI?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure, it looks like this
uptime-kuma-screenshot

Choose a reason for hiding this comment

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

Thank you, I think that's all we need for the functionality.

Just a minor suggestion for the UI, do you think it would look better if we could display the tags as labels with color like this? We can get the color from the tag.color attribute.

Screen Shot 2023-02-13 at 13 03 25

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In that case, i think it is better if we implement vue-multiselect as the component instead of using a plain select. because a plain select does not render colors consistently. For example, In the above screenshot (mac os), you can see that the color will probably not be visible since it is using the styles provided by the host operating system (mac os in this case)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ping @khanh96le

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please validate the above idea @khanh96le so that I can know if I can start to work on refactoring the PR. Thanks !

Choose a reason for hiding this comment

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

Hi @titanventura,

I am sorry for the late response.

I really appreciate the idea you proposed, it looks great to me! When you have a moment, can you share another screenshot of the updated version? I'm excited to see how it looks and I'm sure everyone else is too.

Thank you so much for your hard work and contributions!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @khanh96le, no probs. thank you so much for taking the time to analyse and suggest. I have updated the select monitor component in edit status page. It uses vue-multiselect and shows tags with name and value (if present) with the background color of the tag. It looks like this.

image

Please do review and suggest changes if any. Thanks !

Copy link
Contributor Author

@titanventura titanventura Feb 18, 2023

Choose a reason for hiding this comment

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

BTW, the e2e tests seem to be flaky. dddc239 passed but 388da6f failed

@chakflying
Copy link
Collaborator

It would be better to use the existing Tag.vue component instead of duplicating the styling code.

@titanventura
Copy link
Contributor Author

sure @chakflying, thanks for the suggestion. Have made the changes !

@titanventura
Copy link
Contributor Author

titanventura commented Feb 20, 2023

Ping @chakflying
@khanh96le

@chakflying
Copy link
Collaborator

chakflying commented Feb 20, 2023

Since you aren't adding new packages, you can remove package-lock from the commits so it won't show up here. (I usually use rebase to fix it)

@louislam louislam added this to the 1.22.0 milestone Feb 20, 2023
@titanventura titanventura force-pushed the show-tags-in-status-page-monitor-select-list branch from e5eb836 to 948ff51 Compare February 22, 2023 07:00
@titanventura
Copy link
Contributor Author

I've removed the package-lock.json file. Please do review and suggest changes. Thanks !

@chakflying
Copy link
Collaborator

chakflying commented Feb 23, 2023

I got error when I tried to run this. Do you know what's the issue?

Uncaught (in promise) TypeError: monitor is undefined
    option StatusPage.vue:347
    renderFnWithContext runtime-core.esm-bundler.js:853
    renderSlot runtime-core.esm-bundler.js:2968
    default vue-multiselect.esm.js:1279
    renderList runtime-core.esm-bundler.js:2884
    default vue-multiselect.esm.js:1262

@titanventura
Copy link
Contributor Author

titanventura commented Feb 25, 2023

I guess this was a bug. Resolved it. I used the word monitor instead of option inside vue-multiselect. not sure why it didn't work with monitor though !

@chakflying
Copy link
Collaborator

Looks like the Tag component is not imported correctly so this still doesn't work. Don't want to be mean but looks like you did not test this before marking as ready.

Also recommend doing an actual rebase since master has the fix for the marked() issue, and you are now modifying the package-lock.json file twice instead of not touching it.

@louislam
Copy link
Owner

Also there are a lot of unrelated code changes. Please revert those changes. I guess you were using a incorrect eslint config.

And if you are not sure how to load the eslint config, you can use npm run lint-fix:style and npm run lint-fix:js

@titanventura titanventura force-pushed the show-tags-in-status-page-monitor-select-list branch from b5599f3 to db6b863 Compare February 26, 2023 10:56
@titanventura
Copy link
Contributor Author

Deleted the branch, created a new one and made changes only to StatusPage.vue. Works for me locally. Please do check if it works for you this time. Thanks for the suggestions !

@titanventura
Copy link
Contributor Author

can we merge this PR ?

louislam added 2 commits April 4, 2023 15:35
…-page-monitor-select-list

# Conflicts:
#	src/pages/StatusPage.vue
@louislam louislam merged commit be7d3f6 into louislam:master Apr 4, 2023
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.

Show tags on the dropdown list when adding a new monitor to a status page
4 participants