Skip to content

Commit

Permalink
Ux fixes for page header (opensearch-project#2108)
Browse files Browse the repository at this point in the history
* Fix audit logging spacing issue

Signed-off-by: Derek Ho <[email protected]>

* Fix a bug with undefined parsing and update breadcrumbs for edit pages, fixes test

Signed-off-by: Derek Ho <[email protected]>

---------

Signed-off-by: Derek Ho <[email protected]>
  • Loading branch information
derek-ho authored Sep 3, 2024
1 parent c143bce commit fb554bd
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 29 deletions.
7 changes: 4 additions & 3 deletions public/apps/configuration/app-router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,10 @@ export const allNavPanelUrls = (multitenancyEnabled: boolean) =>
...(multitenancyEnabled ? [buildUrl(ResourceType.tenantsConfigureTab)] : []),
]);

function decodeParams(params: { [k: string]: string }): any {
return Object.keys(params).reduce((obj: { [k: string]: string }, key: string) => {
obj[key] = decodeURIComponent(params[key]);
function decodeParams(params: { [k: string]: string | undefined }): any {
return Object.keys(params).reduce((obj: { [k: string]: string | undefined }, key: string) => {
const value = params[key];
obj[key] = value !== undefined ? decodeURIComponent(value) : undefined;
return obj;
}, {});
}
Expand Down
14 changes: 8 additions & 6 deletions public/apps/configuration/panels/audit-logging/audit-logging.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -263,15 +263,17 @@ export function AuditLogging(props: AuditLoggingProps) {
coreStart={props.coreStart}
navigation={props.depsStart.navigation}
fallBackComponent={
<EuiPageHeader>
<EuiText size="s">
<h1>Audit logging</h1>
</EuiText>
</EuiPageHeader>
<>
<EuiPageHeader>
<EuiText size="s">
<h1>Audit logging</h1>
</EuiText>
</EuiPageHeader>
<EuiSpacer />
</>
}
resourceType={ResourceType.auditLogging}
/>
<EuiSpacer />
{loading ? <EuiLoadingContent /> : content}
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,20 +273,22 @@ exports[`Audit logs render when AuditLoggingSettings.enabled is true 1`] = `
}
}
fallBackComponent={
<EuiPageHeader>
<EuiText
size="s"
>
<h1>
Audit logging
</h1>
</EuiText>
</EuiPageHeader>
<React.Fragment>
<EuiPageHeader>
<EuiText
size="s"
>
<h1>
Audit logging
</h1>
</EuiText>
</EuiPageHeader>
<EuiSpacer />
</React.Fragment>
}
navigation={Object {}}
resourceType="auditLogging"
/>
<EuiSpacer />
<EuiPanel>
<EuiForm>
<EuiDescribedFormGroup
Expand Down Expand Up @@ -705,20 +707,22 @@ exports[`Audit logs should load access error component 1`] = `
}
}
fallBackComponent={
<EuiPageHeader>
<EuiText
size="s"
>
<h1>
Audit logging
</h1>
</EuiText>
</EuiPageHeader>
<React.Fragment>
<EuiPageHeader>
<EuiText
size="s"
>
<h1>
Audit logging
</h1>
</EuiText>
</EuiPageHeader>
<EuiSpacer />
</React.Fragment>
}
navigation={Object {}}
resourceType="auditLogging"
/>
<EuiSpacer />
<AccessErrorComponent
loading={false}
message="You do not have permissions to configure audit logging settings"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ export function InternalUserEdit(props: InternalUserEditDeps) {
}
resourceType={ResourceType.users}
subAction={TITLE_TEXT_DICT[props.action]}
pageTitle={props.sourceUserName}
/>
<PanelWithHeader headerText="Credentials">
<EuiForm>
Expand Down
1 change: 1 addition & 0 deletions public/apps/configuration/panels/role-edit/role-edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ export function RoleEdit(props: RoleEditDeps) {
descriptionControls={descriptionData}
resourceType={ResourceType.roles}
subAction={TITLE_TEXT_DICT[props.action]}
pageTitle={props.sourceRoleName}
/>
<PanelWithHeader headerText="Name">
<EuiForm>
Expand Down

0 comments on commit fb554bd

Please sign in to comment.