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

ui: add optional white background to PageConfig #87189

Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
z-index: 2;
background-color: $colors--background;

&__white-background {
background-color: $colors--white
}

&__list {
display: flex;
justify-content: flex-start;
Expand Down
3 changes: 2 additions & 1 deletion pkg/ui/workspaces/cluster-ui/src/pageConfig/pageConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import styles from "./pageConfig.module.scss";
export interface PageConfigProps {
layout?: "list" | "spread";
children?: React.ReactNode;
pageHasWhiteBackground?: boolean;
}

const cx = classnames.bind(styles);
Expand All @@ -26,7 +27,7 @@ export function PageConfig(props: PageConfigProps): React.ReactElement {
});

return (
<div className={cx("page-config")}>
<div className={cx("page-config", { "page-config__white-background": props.pageHasWhiteBackground })}>
<ul className={classes}>{props.children}</ul>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ export interface StatementsPageStateProps {
search: string;
isTenant?: UIConfigState["isTenant"];
hasViewActivityRedactedRole?: UIConfigState["hasViewActivityRedactedRole"];
pageHasWhiteBackground?: UIConfigState["pageHasWhiteBackground"];
}

export interface StatementsPageState {
Expand Down Expand Up @@ -624,6 +625,7 @@ export class StatementsPage extends React.Component<
databases,
search,
isTenant,
pageHasWhiteBackground,
nodeRegions,
} = this.props;

Expand All @@ -649,7 +651,7 @@ export class StatementsPage extends React.Component<

return (
<div className={cx("root", "table-area")}>
<PageConfig>
<PageConfig pageHasWhiteBackground={pageHasWhiteBackground}>
<PageConfigItem>
<Search
onSubmit={this.onSubmitSearchField as any}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import {
import {
selectIsTenant,
selectHasViewActivityRedactedRole,
selectPageHasWhiteBackground,
} from "../store/uiConfig";
import { nodeRegionsByIDSelector } from "../store/nodes";
import { StatementsRequest } from "src/api/statementsApi";
Expand Down Expand Up @@ -68,6 +69,7 @@ export const ConnectedStatementsPage = withRouter(
filters: selectFilters(state),
isTenant: selectIsTenant(state),
hasViewActivityRedactedRole: selectHasViewActivityRedactedRole(state),
pageHasWhiteBackground: selectPageHasWhiteBackground(state),
lastReset: selectLastReset(state),
nodeRegions: selectIsTenant(state) ? {} : nodeRegionsByIDSelector(state),
search: selectSearch(state),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export type UIConfigState = {
isTenant: boolean;
userSQLRoles: string[];
hasViewActivityRedactedRole: boolean;
pageHasWhiteBackground: boolean;
pages: {
statementDetails: {
showStatementDiagnosticsLink: boolean;
Expand All @@ -34,6 +35,7 @@ const initialState: UIConfigState = {
isTenant: false,
userSQLRoles: [],
hasViewActivityRedactedRole: false,
pageHasWhiteBackground: false,
pages: {
statementDetails: {
showStatementDiagnosticsLink: true,
Expand Down Expand Up @@ -76,4 +78,9 @@ export const selectHasViewActivityRedactedRole = createSelector(
uiConfig => uiConfig.userSQLRoles.includes("VIEWACTIVITYREDACTED"),
);

export const selectPageHasWhiteBackground = createSelector(
selectUIConfig,
uiConfig => uiConfig.pageHasWhiteBackground,
);

export const { actions, reducer } = uiConfigSlice;
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ export interface TransactionsPageStateProps {
error?: Error | null;
filters: Filters;
isTenant?: UIConfigState["isTenant"];
pageHasWhiteBackground?: UIConfigState["pageHasWhiteBackground"];
nodeRegions: { [nodeId: string]: string };
pageSize?: number;
search: string;
Expand Down Expand Up @@ -350,6 +351,7 @@ export class TransactionsPage extends React.Component<
columns: userSelectedColumnsToShow,
sortSetting,
search,
pageHasWhiteBackground,
} = this.props;
const internal_app_name_prefix = data?.internal_app_name_prefix || "";
const statements = data?.statements || [];
Expand Down Expand Up @@ -397,7 +399,7 @@ export class TransactionsPage extends React.Component<

return (
<>
<PageConfig>
<PageConfig pageHasWhiteBackground={pageHasWhiteBackground}>
<PageConfigItem>
<Search
onSubmit={this.onSubmitSearchField as any}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
selectFilters,
selectSearch,
} from "./transactionsPage.selectors";
import { selectIsTenant } from "../store/uiConfig";
import { selectIsTenant, selectPageHasWhiteBackground } from "../store/uiConfig";
import { nodeRegionsByIDSelector } from "../store/nodes";
import { selectTimeScale } from "src/statementsPage/statementsPage.selectors";
import { StatementsRequest } from "src/api/statementsApi";
Expand All @@ -49,6 +49,7 @@ export const TransactionsPageConnected = withRouter(
error: selectTransactionsLastError(state),
filters: selectFilters(state),
isTenant: selectIsTenant(state),
pageHasWhiteBackground: selectPageHasWhiteBackground(state),
nodeRegions: nodeRegionsByIDSelector(state),
search: selectSearch(state),
sortSetting: selectSortSetting(state),
Expand Down