Skip to content

Commit

Permalink
ui: tenant-gate transaction insights, change selection order of workl…
Browse files Browse the repository at this point in the history
…oad insights

Related to cockroachdb#96353, cockroachdb#92936.

This commit hides the dropdown to switch workload insights from
statement insights to transaction insights on tenants. When cockroachdb#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 cockroachdb#92936).

Release note: None
  • Loading branch information
ericharmeling committed Feb 16, 2023
1 parent f1958ad commit 09f1e61
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pkg/ui/workspaces/cluster-ui/src/insights/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,8 @@ export const getInsightFromCause = (
};

export const InsightExecOptions = new Map<string, string>([
[InsightExecEnum.TRANSACTION.toString(), "Transaction Executions"],
[InsightExecEnum.STATEMENT.toString(), "Statement Executions"],
[InsightExecEnum.TRANSACTION.toString(), "Transaction Executions"],
]);

export const InsightEnumToLabel = new Map<string, string>([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export type StatementInsightsViewStateProps = {
isLoading?: boolean;
dropDownSelect?: React.ReactElement;
timeScale?: TimeScale;
isTenant?: boolean;
};

export type StatementInsightsViewDispatchProps = {
Expand Down Expand Up @@ -105,6 +106,7 @@ export const StatementInsightsView: React.FC<StatementInsightsViewProps> = ({
setTimeScale,
selectedColumnNames,
dropDownSelect,
isTenant,
}: StatementInsightsViewProps) => {
const [pagination, setPagination] = useState<ISortedTablePagination>({
current: 1,
Expand Down Expand Up @@ -245,7 +247,7 @@ export const StatementInsightsView: React.FC<StatementInsightsViewProps> = ({
return (
<div className={cx("root")}>
<PageConfig>
<PageConfigItem>{dropDownSelect}</PageConfigItem>
{!isTenant && <PageConfigItem>{dropDownSelect}</PageConfigItem>}
<PageConfigItem>
<Search
placeholder="Search Statements"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,11 @@ export const WorkloadInsightsRootControl = ({
}: WorkloadInsightsViewProps): React.ReactElement => {
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,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,
Expand Down Expand Up @@ -78,6 +79,7 @@ const statementMapStateToProps = (
selectedColumnNames: selectColumns(state),
timeScale: selectTimeScale(state),
isLoading: selectStmtInsightsLoading(state),
isTenant: selectIsTenant(state),
});

const TransactionDispatchProps = (
Expand Down

0 comments on commit 09f1e61

Please sign in to comment.