You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Merge pull request #18706 from Oats87/surpress-over-50
Automatic merge from submit-queue.
Surpress project list on login if you have access to greater than 50 projects
As a compromise to #18684 we are going to surpress the project list functionality if the number of projects available to a user is greater than 50
Original RFE was at BZ #1542326 - https://bugzilla.redhat.com/show_bug.cgi?id=1542326
RFE is within that BZ, but there was a compromise.
Copy file name to clipboardExpand all lines: pkg/oc/cli/cmd/login/loginoptions.go
+14-7Lines changed: 14 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -34,6 +34,8 @@ import (
34
34
35
35
constdefaultClusterURL="https://localhost:8443"
36
36
37
+
constprojectsItemsSuppressThreshold=50
38
+
37
39
// LoginOptions is a helper for the login and setup process, gathers all information required for a
38
40
// successful login and eventual update of config files.
39
41
// Depending on the Reader present it can be interactive, asking for terminal input in
@@ -317,15 +319,20 @@ func (o *LoginOptions) gatherProjectInfo() error {
317
319
}
318
320
o.Project=current.Name
319
321
320
-
fmt.Fprintf(o.Out, "You have access to the following projects and can switch between them with '%s project <projectname>':\n\n", o.CommandName)
321
-
for_, p:=rangeprojects.List() {
322
-
ifo.Project==p {
323
-
fmt.Fprintf(o.Out, " * %s\n", p)
324
-
} else {
325
-
fmt.Fprintf(o.Out, " %s\n", p)
322
+
// Suppress project listing if the number of projects available to the user is greater than the threshold. Prevents unnecessarily noisy logins on clusters with large numbers of projects
fmt.Fprintf(o.Out, "You have access to %d projects, the list has been suppressed. You can list all projects with '%s projects'\n\n", len(projectsItems), o.CommandName)
325
+
} else {
326
+
fmt.Fprintf(o.Out, "You have access to the following projects and can switch between them with '%s project <projectname>':\n\n", o.CommandName)
0 commit comments