Skip to content

Commit

Permalink
Merge #130835
Browse files Browse the repository at this point in the history
130835: ui: explain default settings changes in role events r=dhartunian a=dhartunian

Resolves: #127182
Release note: None

Co-authored-by: David Hartunian <[email protected]>
  • Loading branch information
craig[bot] and dhartunian committed Sep 20, 2024
2 parents ed3d337 + 64e19da commit 2e318cb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/ui/workspaces/db-console/src/util/events.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ describe("getEventDescription", function () {
},
expected: "Role Altered: User abc altered role 123",
},
{
event: {
eventType: "alter_role",
info: '{"User": "abc", "RoleName": "123", "SetInfo": ["DEFAULTSETTINGS"]}',
},
expected:
"Role Altered: User abc altered default settings for role 123",
},
{
event: {
eventType: "alter_role",
Expand Down
7 changes: 7 additions & 0 deletions pkg/ui/workspaces/db-console/src/util/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,12 @@ export function getEventDescription(e: clusterUiApi.EventColumns): string {
case eventTypes.ALTER_ROLE:
if (info.Options && info.Options.length > 0) {
return `Role Altered: User ${info.User} altered role ${info.RoleName} with options ${info.Options}`;
} else if (
info.SetInfo &&
info.SetInfo.length === 1 &&
info.SetInfo[0] === "DEFAULTSETTINGS"
) {
return `Role Altered: User ${info.User} altered default settings for role ${info.RoleName}`;
} else {
return `Role Altered: User ${info.User} altered role ${info.RoleName}`;
}
Expand Down Expand Up @@ -240,6 +246,7 @@ export interface EventInfo {
RoleName?: string;
SchemaName?: string;
SequenceName?: string;
SetInfo?: string[];
SettingName?: string;
Statement?: string;
TableName?: string;
Expand Down

0 comments on commit 2e318cb

Please sign in to comment.