From 508a9c2152b1f2abd15f3b9b14b62a9e1a06a849 Mon Sep 17 00:00:00 2001 From: Eric Harmeling Date: Thu, 16 Feb 2023 13:33:22 -0500 Subject: [PATCH] ui: tenant-gate transaction insights, change selection order of workload insights Related to #96353, #92936. This commit hides the dropdown to switch workload insights from statement insights to transaction insights on tenants. When #96353 is resolved, we can re-enable transaction insights for tenant clusters. The commit also switches the order of workload insights, to show statement insights first (see #92936). Release note: None --- pkg/ui/workspaces/cluster-ui/src/insights/types.ts | 2 +- .../statementInsights/statementInsightsView.tsx | 4 +++- .../workloadInsights/workloadInsightRootControl.tsx | 7 +++---- .../workloadInsights/workloadInsightsPageConnected.tsx | 2 ++ 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/pkg/ui/workspaces/cluster-ui/src/insights/types.ts b/pkg/ui/workspaces/cluster-ui/src/insights/types.ts index 41e5bd5f99ef..889180bdf3b2 100644 --- a/pkg/ui/workspaces/cluster-ui/src/insights/types.ts +++ b/pkg/ui/workspaces/cluster-ui/src/insights/types.ts @@ -262,8 +262,8 @@ export const getInsightFromCause = ( }; export const InsightExecOptions = new Map([ - [InsightExecEnum.TRANSACTION.toString(), "Transaction Executions"], [InsightExecEnum.STATEMENT.toString(), "Statement Executions"], + [InsightExecEnum.TRANSACTION.toString(), "Transaction Executions"], ]); export const InsightEnumToLabel = new Map([ diff --git a/pkg/ui/workspaces/cluster-ui/src/insights/workloadInsights/statementInsights/statementInsightsView.tsx b/pkg/ui/workspaces/cluster-ui/src/insights/workloadInsights/statementInsights/statementInsightsView.tsx index a9b1518c9b8f..874ea2664022 100644 --- a/pkg/ui/workspaces/cluster-ui/src/insights/workloadInsights/statementInsights/statementInsightsView.tsx +++ b/pkg/ui/workspaces/cluster-ui/src/insights/workloadInsights/statementInsights/statementInsightsView.tsx @@ -76,6 +76,7 @@ export type StatementInsightsViewStateProps = { dropDownSelect?: React.ReactElement; timeScale?: TimeScale; maxSizeApiReached?: boolean; + isTenant?: boolean; }; export type StatementInsightsViewDispatchProps = { @@ -110,6 +111,7 @@ export const StatementInsightsView: React.FC = ({ selectedColumnNames, dropDownSelect, maxSizeApiReached, + isTenant, }: StatementInsightsViewProps) => { const [pagination, setPagination] = useState({ current: 1, @@ -250,7 +252,7 @@ export const StatementInsightsView: React.FC = ({ return (
- {dropDownSelect} + {!isTenant && {dropDownSelect}} { const location = useLocation(); const history = useHistory(); - let viewValue = - queryByName(location, viewAttr) || InsightExecEnum.TRANSACTION; - // Use the default Transaction page if an + let viewValue = queryByName(location, viewAttr) || InsightExecEnum.STATEMENT; + // Use the default Statement page if an // unrecognized string was passed in from the URL if (!InsightExecOptions.has(viewValue)) { - viewValue = InsightExecEnum.TRANSACTION; + viewValue = InsightExecEnum.STATEMENT; } const [selectedInsightView, setSelectedInsightView] = useState(viewValue); diff --git a/pkg/ui/workspaces/cluster-ui/src/insights/workloadInsights/workloadInsightsPageConnected.tsx b/pkg/ui/workspaces/cluster-ui/src/insights/workloadInsights/workloadInsightsPageConnected.tsx index 7a36dac96938..728e45ba4ebb 100644 --- a/pkg/ui/workspaces/cluster-ui/src/insights/workloadInsights/workloadInsightsPageConnected.tsx +++ b/pkg/ui/workspaces/cluster-ui/src/insights/workloadInsights/workloadInsightsPageConnected.tsx @@ -50,6 +50,7 @@ import { TimeScale } from "../../timeScaleDropdown"; import { StmtInsightsReq, TxnInsightsRequest } from "src/api"; import { selectTimeScale } from "../../store/utils/selectors"; import { actions as analyticsActions } from "../../store/analytics"; +import { selectIsTenant } from "../../store/uiConfig"; const transactionMapStateToProps = ( state: AppState, @@ -82,6 +83,7 @@ const statementMapStateToProps = ( timeScale: selectTimeScale(state), isLoading: selectStmtInsightsLoading(state), maxSizeApiReached: selectStmtInsightsMaxApiReached(state), + isTenant: selectIsTenant(state), }); const TransactionDispatchProps = (