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

Set default availability mode to ALL #42200

Merged
merged 1 commit into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions lib/auth/userpreferences/userpreferencesv1/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,10 @@ func TestService_GetUserPreferences(t *testing.T) {
},
Theme: userpreferencesv1.Theme_THEME_UNSPECIFIED,
UnifiedResourcePreferences: &userpreferencesv1.UnifiedResourcePreferences{
DefaultTab: userpreferencesv1.DefaultTab_DEFAULT_TAB_ALL,
ViewMode: userpreferencesv1.ViewMode_VIEW_MODE_CARD,
LabelsViewMode: userpreferencesv1.LabelsViewMode_LABELS_VIEW_MODE_COLLAPSED,
DefaultTab: userpreferencesv1.DefaultTab_DEFAULT_TAB_ALL,
ViewMode: userpreferencesv1.ViewMode_VIEW_MODE_CARD,
LabelsViewMode: userpreferencesv1.LabelsViewMode_LABELS_VIEW_MODE_COLLAPSED,
AvailableResourceMode: userpreferencesv1.AvailableResourceMode_AVAILABLE_RESOURCE_MODE_ALL,
},
Onboard: &userpreferencesv1.OnboardUserPreferences{
PreferredResources: []userpreferencesv1.Resource{},
Expand Down
7 changes: 4 additions & 3 deletions lib/services/local/userpreferences.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@ func DefaultUserPreferences() *userpreferencesv1.UserPreferences {
},
Theme: userpreferencesv1.Theme_THEME_UNSPECIFIED,
UnifiedResourcePreferences: &userpreferencesv1.UnifiedResourcePreferences{
DefaultTab: userpreferencesv1.DefaultTab_DEFAULT_TAB_ALL,
ViewMode: userpreferencesv1.ViewMode_VIEW_MODE_CARD,
LabelsViewMode: userpreferencesv1.LabelsViewMode_LABELS_VIEW_MODE_COLLAPSED,
DefaultTab: userpreferencesv1.DefaultTab_DEFAULT_TAB_ALL,
ViewMode: userpreferencesv1.ViewMode_VIEW_MODE_CARD,
LabelsViewMode: userpreferencesv1.LabelsViewMode_LABELS_VIEW_MODE_COLLAPSED,
AvailableResourceMode: userpreferencesv1.AvailableResourceMode_AVAILABLE_RESOURCE_MODE_ALL,
},
Onboard: &userpreferencesv1.OnboardUserPreferences{
PreferredResources: []userpreferencesv1.Resource{},
Expand Down
43 changes: 34 additions & 9 deletions lib/services/local/userpreferences_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,28 @@ func TestUserPreferencesCRUD(t *testing.T) {
ClusterPreferences: defaultPref.ClusterPreferences,
},
},
{
name: "update the availability view only",
req: &userpreferencesv1.UpsertUserPreferencesRequest{
Preferences: &userpreferencesv1.UserPreferences{
UnifiedResourcePreferences: &userpreferencesv1.UnifiedResourcePreferences{
AvailableResourceMode: userpreferencesv1.AvailableResourceMode_AVAILABLE_RESOURCE_MODE_ACCESSIBLE,
},
},
},
expected: &userpreferencesv1.UserPreferences{
Assist: defaultPref.Assist,
Onboard: defaultPref.Onboard,
Theme: defaultPref.Theme,
UnifiedResourcePreferences: &userpreferencesv1.UnifiedResourcePreferences{
DefaultTab: userpreferencesv1.DefaultTab_DEFAULT_TAB_ALL,
ViewMode: userpreferencesv1.ViewMode_VIEW_MODE_CARD,
LabelsViewMode: userpreferencesv1.LabelsViewMode_LABELS_VIEW_MODE_COLLAPSED,
AvailableResourceMode: userpreferencesv1.AvailableResourceMode_AVAILABLE_RESOURCE_MODE_ACCESSIBLE,
},
ClusterPreferences: defaultPref.ClusterPreferences,
},
},
{
name: "update the unified tab preference only",
req: &userpreferencesv1.UpsertUserPreferencesRequest{
Expand All @@ -122,9 +144,10 @@ func TestUserPreferencesCRUD(t *testing.T) {
Onboard: defaultPref.Onboard,
Theme: defaultPref.Theme,
UnifiedResourcePreferences: &userpreferencesv1.UnifiedResourcePreferences{
DefaultTab: userpreferencesv1.DefaultTab_DEFAULT_TAB_PINNED,
ViewMode: userpreferencesv1.ViewMode_VIEW_MODE_CARD,
LabelsViewMode: userpreferencesv1.LabelsViewMode_LABELS_VIEW_MODE_COLLAPSED,
DefaultTab: userpreferencesv1.DefaultTab_DEFAULT_TAB_PINNED,
ViewMode: userpreferencesv1.ViewMode_VIEW_MODE_CARD,
LabelsViewMode: userpreferencesv1.LabelsViewMode_LABELS_VIEW_MODE_COLLAPSED,
AvailableResourceMode: userpreferencesv1.AvailableResourceMode_AVAILABLE_RESOURCE_MODE_ALL,
},
ClusterPreferences: defaultPref.ClusterPreferences,
},
Expand Down Expand Up @@ -233,9 +256,10 @@ func TestUserPreferencesCRUD(t *testing.T) {
Preferences: &userpreferencesv1.UserPreferences{
Theme: userpreferencesv1.Theme_THEME_LIGHT,
UnifiedResourcePreferences: &userpreferencesv1.UnifiedResourcePreferences{
DefaultTab: userpreferencesv1.DefaultTab_DEFAULT_TAB_PINNED,
ViewMode: userpreferencesv1.ViewMode_VIEW_MODE_LIST,
LabelsViewMode: userpreferencesv1.LabelsViewMode_LABELS_VIEW_MODE_COLLAPSED,
DefaultTab: userpreferencesv1.DefaultTab_DEFAULT_TAB_PINNED,
ViewMode: userpreferencesv1.ViewMode_VIEW_MODE_LIST,
LabelsViewMode: userpreferencesv1.LabelsViewMode_LABELS_VIEW_MODE_COLLAPSED,
AvailableResourceMode: userpreferencesv1.AvailableResourceMode_AVAILABLE_RESOURCE_MODE_ALL,
},
Assist: &userpreferencesv1.AssistUserPreferences{
PreferredLogins: []string{"baz"},
Expand All @@ -260,9 +284,10 @@ func TestUserPreferencesCRUD(t *testing.T) {
expected: &userpreferencesv1.UserPreferences{
Theme: userpreferencesv1.Theme_THEME_LIGHT,
UnifiedResourcePreferences: &userpreferencesv1.UnifiedResourcePreferences{
DefaultTab: userpreferencesv1.DefaultTab_DEFAULT_TAB_PINNED,
ViewMode: userpreferencesv1.ViewMode_VIEW_MODE_LIST,
LabelsViewMode: userpreferencesv1.LabelsViewMode_LABELS_VIEW_MODE_COLLAPSED,
DefaultTab: userpreferencesv1.DefaultTab_DEFAULT_TAB_PINNED,
ViewMode: userpreferencesv1.ViewMode_VIEW_MODE_LIST,
LabelsViewMode: userpreferencesv1.LabelsViewMode_LABELS_VIEW_MODE_COLLAPSED,
AvailableResourceMode: userpreferencesv1.AvailableResourceMode_AVAILABLE_RESOURCE_MODE_ALL,
},
Assist: &userpreferencesv1.AssistUserPreferences{
PreferredLogins: []string{"baz"},
Expand Down
Loading