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

dashboard: Add certificate widget that displays CAs and Certs sorted by expiration date #8105

Merged
merged 10 commits into from
Dec 5, 2024

Conversation

Monviech
Copy link
Member

@Monviech Monviech commented Dec 3, 2024

Fixes: #7898

Adds a widget that pulls all CA and Certificates from the trust store API and displays them sorted by expiration date.

  • Certificates with more than 14 days show a green lock
  • with less than 14 days show yellow lock
  • with no days left show red log and expired

An additional self populating dropdown allows to configure the plugin, hiding certificates.
The default is displaying all existing certificates.

@Monviech Monviech added the feature Adding new functionality label Dec 3, 2024
@Monviech Monviech self-assigned this Dec 3, 2024
@Monviech Monviech marked this pull request as draft December 3, 2024 09:44
@fichtner
Copy link
Member

fichtner commented Dec 3, 2024

general question: are we able to open the edit page for a certificate via link yet?

@Monviech
Copy link
Member Author

Monviech commented Dec 3, 2024

I saw that in the user manager there is some kind of link that can open the certificates bootgrid with a preapplied filter to only show a single certificate (for the user certificate). Maybe that could be added? But I have to see how it works first.

@Monviech Monviech marked this pull request as ready for review December 3, 2024 15:08
@Monviech Monviech marked this pull request as draft December 4, 2024 16:11
…d of the bootgrid to display the certificate directly
@Monviech Monviech marked this pull request as ready for review December 4, 2024 19:15
@Monviech
Copy link
Member Author

Monviech commented Dec 4, 2024

general question: are we able to open the edit page for a certificate via link yet?

@fichtner I handled this with a trick that will populate the existing search-field with the common name of the certificate. This leverages existing things without creating too much overhead.

If a better solution can be found, I'm all for it, yet this piece of code is universal and can be dropped into any page that needs this functionality.

@fichtner
Copy link
Member

fichtner commented Dec 4, 2024

might be worth asking @AdSchellevis for an opinion, for me it's more difficult, but in general it would be nice opening the edit page so the save would immediately renew (I found out the hard way that it works this way).

@AdSchellevis
Copy link
Member

the "hacky" option of editing a uuid when jumping into the form:

// UIBootgrid doesn't return a promise, wait for some time before opening the requested item
setTimeout(function(){
ajaxGet("/api/firewall/alias/getAliasUUID/{{selected_alias}}", {}, function(data, status){
if (data.uuid !== undefined) {
var edit_item = $(".command-edit:eq(0)").clone(true);
edit_item.data('row-id', data.uuid).click();
}
});

but if we do want to use this more often, we likely better implement it in the bootgrid for reuse

@Monviech
Copy link
Member Author

Monviech commented Dec 5, 2024

@AdSchellevis I have pushed the current code of what I showed you earlier. If you like it, we could consolidate it to a different spot so it is not duplicated. I would need a pointer where to put it.

@AdSchellevis
Copy link
Member

@Monviech maybe keep it in the trust templates for now, if we are reusing the same pattern more often, it might get more clear where it belongs. This does work nice by the way.

@Monviech
Copy link
Member Author

Monviech commented Dec 5, 2024

@AdSchellevis Hehe thank you. This kinda fixes this indirectly:

#7895

Maybe if we want to use it in more widgets we could put it in a different place.

Copy link
Member

@swhite2 swhite2 left a comment

Choose a reason for hiding this comment

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

Looks good to me :)

@Monviech Monviech merged commit 397a3dc into master Dec 5, 2024
@fichtner
Copy link
Member

fichtner commented Dec 5, 2024

Nice work 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Adding new functionality
Development

Successfully merging this pull request may close these issues.

system: add a certificate widget to allow visibility for upcoming expiries
4 participants