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

Support custom labels (to replace the hard-coded dependencies label) #230

Closed
czy-29 opened this issue May 31, 2024 · 4 comments · Fixed by #231
Closed

Support custom labels (to replace the hard-coded dependencies label) #230

czy-29 opened this issue May 31, 2024 · 4 comments · Fixed by #231
Labels
enhancement New feature or request

Comments

@czy-29
Copy link
Contributor

czy-29 commented May 31, 2024

Support custom labels (to replace the hard-coded dependencies label)

@Enet4
Copy link
Contributor

Enet4 commented May 31, 2024

Do you mean being able to replace the text presented in the dependency status badge?

@Enet4 Enet4 added the enhancement New feature or request label May 31, 2024
@czy-29
Copy link
Contributor Author

czy-29 commented May 31, 2024

Do you mean being able to replace the text presented in the dependency status badge?

Yep!
I want to show two dependency status badges at the same time: a specific crate version, and the github repository version. If both badges show the word dependencies on the left, it will cause some confusion, so I want to customize the text on the left, which is what I call the label.

@czy-29
Copy link
Contributor Author

czy-29 commented Jun 1, 2024

@Enet4 I read the code, and it seems that it is relatively simple to add this feature.

To customize the subject text on the left through URL query parameters, we only need to add a subject: Option<String> field to the server::ExtraConfig structure, and then modify the implementation of the server::views::badge::badge function.

Then when the subject parameter exists in the URL, we ignore the compact parameter and use the text specified by subject. But when subject does not exist, we still use the logic of compact to achieve API compatibility.

Finally, we update the document in README and add the description of the new subject parameter, and everything is done.

If such a change meets your expectations, I think I can implement it and submit a PR, which does not seem difficult.

@czy-29
Copy link
Contributor Author

czy-29 commented Jun 1, 2024

I have submitted the PR: #231
Welcome to review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants