-
Notifications
You must be signed in to change notification settings - Fork 1
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
Extend explorer - Templates #3358
Conversation
0c3cc5b
to
a302b9a
Compare
the current state in this PR is that templates will direct to the main templates page, where each template doesn't have a details page. There is also another option that I can remove the redirect so the yaml of the templates show in the explorer details rather than directing to the |
As a user, once you have found something in explorer you click to be able to do somethingelse with the found resource, i could think that in the context of templates is going to the templates page over the unstructured yaml (it does not allow the user to do another action than view raw data). A third option (that you could consider) is to redirect to Templates view with focus in the selected template by using a URL that searches by the name of the template. Something like this Given explorer with a template |
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.
Reviewed the code with some suggestions. Not yet tested as some of the suggestions could change how the feature behaves.
}, | ||
AddToSchemeFunc: gapiv1.AddToScheme, | ||
StatusFunc: func(obj client.Object) ObjectStatus { | ||
e, ok := obj.(*corev1.Event) |
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.
given obj
represents this interface which is a generic kube object, and you will use this function for templates, then the casting to Event on this line would always fail.
If you don't expect a status different to NoStatus
, you could just return it directly without any other logic for this function.
return Failed | ||
}, | ||
MessageFunc: func(obj client.Object) string { | ||
e, ok := obj.(*corev1.Event) |
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.
Same comment as mentioned for StatusFunc
. Here you could consider whether you want to use this field for giving another type of information to the user in a simplified manner to help them select: I could think that an option could be to return the description if that suits you.
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.
looking at the templates object, the description is probably the only item that could be used. But would it be confusing to the user to have some messages indicating the status message as actions while the templates have a description
action format example : Release reconciliation succeeded
description format example: Add a Helm Repository to all clusters
return &capiv1.CAPITemplate{} | ||
}, | ||
AddToSchemeFunc: capiv1.AddToScheme, | ||
StatusFunc: func(obj client.Object) ObjectStatus { |
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.
same comment as for GitopsTemplate
return Failed | ||
}, | ||
MessageFunc: func(obj client.Object) string { | ||
e, ok := obj.(*corev1.Event) |
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.
same comment as for GitopsTemplate
@@ -263,6 +326,9 @@ func defaultFluxObjectStatusFunc(obj client.Object) ObjectStatus { | |||
if err != nil { | |||
return Failed | |||
} | |||
if fo == nil { |
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.
do you still need this?
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.
no, it's replaced with the custom status and message functions
@@ -99,6 +101,16 @@ func TestMain(m *testing.M) { | |||
if err != nil { | |||
log.Fatalf("add GitopsSet to schema failed: %s", err) | |||
} | |||
|
|||
err = gapiv1.AddToScheme(scheme.Scheme) |
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.
you might want also to add a test case (as you did for gitopssets) for template resources
that's a nice idea, I'll look into the templates FE code to see it's feasibility |
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.
Code LGTM! Let us know if we need to update our extending-explorer.md
README with any new information.
45615ed
to
6823e84
Compare
current state:
|
Thanks @ranatrk! We were looking at the code and wondering if we could remove the explicit call to This would mean cc @enekofb does that make sense? There might be extra context. |
@foot definitely, it needs decoupling ... raising a PR, should be soon |
raised PR for the toFluxObject mandate |
f30c57a
to
d73137d
Compare
PR merged, please rebase |
d73137d
to
e029238
Compare
thanks @enekofb for the updates in the toFluxObject. I rebased and did a minor change in the url for the redirection to templates page |
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.
WIP testing
Add templates to ToFluxObject but ignore their status and return NoStatus for them
…he template kind objects as they dont have any status
…func and empty string for the message func
WIP return description instead of empty message from templates
f1c8a1f
to
fbccc98
Compare
Closes #2957
What changed?
Add capiTemplates and gitopsTemplates to explorer filters
Why was this change made?
Extending the explorer to be compatible to filter based on the kind CapiTemplates and GitOpsTemplates
How was this change implemented?
Add both templates to compatible objects used in the explorer filter
Returning no status when getting flux object to show no status in the ui
How did you validate the change?
manual test: Add a template(capi or gitops), then through the explorer view tab, enable the filter to only show that template type
Release notes
Add templates,Capi and GitOps, to explorer filters
Documentation Changes
N/A
Other follow ups