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

Add ShowResources to UIConfig #41064

Merged
merged 1 commit into from
May 2, 2024
Merged

Add ShowResources to UIConfig #41064

merged 1 commit into from
May 2, 2024

Conversation

avatus
Copy link
Contributor

@avatus avatus commented Apr 30, 2024

This PR will allow admins to disable the option in the UI to IncludeRequestable when listing unified resources. The upcoming unified resources pages will by default include both "has access" and "requestable" resources. This adds a bit of overhead because each page will need to double check RBAC to add the new flag to know if a resource is requestable.

The UI will have a dropdown of

  • Has Access And Requestable
  • Access Only
  • Requestable Only

With this configuration, the UI will hide the "Has Access And Requestable" option and allow only access or requestable (similar to how the requests work today) as a backdoor for any customers who notice a performance hit.

@github-actions github-actions bot added size/sm tctl tctl - Teleport admin tool ui labels Apr 30, 2024
Copy link

The PR changelog entry failed validation: Changelog entry not found in the PR body. Please add a "no-changelog" label to the PR, or changelog lines starting with changelog: followed by the changelog entries for the PR.

@avatus avatus removed request for kimlisa and rudream April 30, 2024 18:04
@avatus avatus added the no-changelog Indicates that a PR does not require a changelog entry label Apr 30, 2024
@avatus avatus force-pushed the avatus/uiconfig branch 2 times, most recently from 361d080 to 0e67d81 Compare April 30, 2024 18:29
// DisableIncludeRequestableRequests will turn off the option in the web UI to request resources with the "includeRequestable" flag.
// This will make resource requests NOT include the "RequiresRequest" field and thus not display both types of resources
// to users ("have access" and "requires request") in the unified resources UI.
DisableIncludeRequestableRequests bool `json:"disableIncludeRequestableRequests,omitempty"`
Copy link
Collaborator

@zmb3 zmb3 Apr 30, 2024

Choose a reason for hiding this comment

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

Having a bool field that you set to true to disable is counter-intuitive and often causes confusion.

WDYT about instead having a string/enum instead?

show_resources: accessible # or 'all', defaults to accessible if unset

all, might be a bit confusing, as you still have to have the ability to request them. Maybe accessible or requestable are better names.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Whats funny is I originally had this as "Allow" with default to true but thought "no, having to configure an "allow" to false is counter intuitive". Seems like its confusing all around!

I think show_resources might be a bit too ambiguous but can probably be cleared up with a comment. It needs to state that if this is set to accessible than you won't even be able to select "all" in the dropdown.

I'll fiddle with it and resort to show_resources if I don't think of a better option.

Thank you!

Copy link
Contributor Author

@avatus avatus May 1, 2024

Choose a reason for hiding this comment

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

Updated to show_resources with the valid values accessible_only and requestable (default)

@avatus avatus changed the title Add DisableIncludeRequestableRequests to UIConfig Add ShowResources to UIConfig May 1, 2024
Comment on lines 576 to 579
t := asciitable.MakeTable([]string{"Scrollback Lines"})
t.AddRow([]string{string(c.uiconfig.GetScrollbackLines())})
t.AddRow([]string{string(c.uiconfig.GetShowResources())})
_, err := t.AsBuffer().WriteTo(w)
return trace.Wrap(err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
t := asciitable.MakeTable([]string{"Scrollback Lines"})
t.AddRow([]string{string(c.uiconfig.GetScrollbackLines())})
t.AddRow([]string{string(c.uiconfig.GetShowResources())})
_, err := t.AsBuffer().WriteTo(w)
return trace.Wrap(err)
t := asciitable.MakeTable([]string{"Scrollback Lines", "Show Resources"})
t.AddRow([]string{string(c.uiconfig.GetScrollbackLines()), string(c.uiconfig.GetShowResources())})
_, err := t.AsBuffer().WriteTo(w)
return trace.Wrap(err)

Or some other wording
But the current output doesn't seem correct to me 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.

Scrollback Lines Show Resources  
---------------- --------------- 
499              accessible_only 

Comment on lines 135 to 138
// SetShowResources will set which resources should be shown in the unified resources UI
func (c *UIConfigV1) SetShowResources(value constants.ShowResources) {
c.Spec.ShowResources = value
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this being used?
I didn't find a reference to it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This method or the value? The method I added just because I've seen the get/set for the other values in ui/other configs.

Copy link
Contributor

Choose a reason for hiding this comment

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

Method.
I think we can remove it, but no big deal

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed 👍

@avatus avatus requested a review from marcoandredinis May 2, 2024 16:15
@avatus avatus force-pushed the avatus/uiconfig branch from 43058f3 to 25f45af Compare May 2, 2024 16:37
@avatus avatus enabled auto-merge May 2, 2024 16:37
@avatus avatus added this pull request to the merge queue May 2, 2024
Merged via the queue into master with commit 80f314a May 2, 2024
45 checks passed
@avatus avatus deleted the avatus/uiconfig branch May 2, 2024 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-changelog Indicates that a PR does not require a changelog entry size/sm tctl tctl - Teleport admin tool ui
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants