Skip to content

Commit

Permalink
ui: explain default settings changes in role events
Browse files Browse the repository at this point in the history
Resolves: #127182
Release note: None
  • Loading branch information
dhartunian committed Sep 16, 2024
1 parent bb82fb7 commit 64e19da
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 64e19da

Please sign in to comment.