Skip to content

Commit

Permalink
ui: unconditionally enable the terminate buttons
Browse files Browse the repository at this point in the history
Follow-on to cockroachdb#70832.

Clusters running the 21.2 release series had to be careful, because the
necessary endpoints weren't available until 21.2.2.

Now that master is headed for 22.1, we can remove the conditions.

Release note: None
  • Loading branch information
matthewtodd authored and Gerardo Torres committed Jan 24, 2022
1 parent cfe9338 commit 179ef67
Show file tree
Hide file tree
Showing 10 changed files with 64 additions and 254 deletions.
85 changes: 0 additions & 85 deletions pkg/ui/workspaces/cluster-ui/src/sessions/sessionDetails.spec.tsx

This file was deleted.

6 changes: 2 additions & 4 deletions pkg/ui/workspaces/cluster-ui/src/sessions/sessionDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export class SessionDetails extends React.Component<SessionDetailsProps> {
terminateSessionRef: React.RefObject<TerminateSessionModalRef>;
terminateQueryRef: React.RefObject<TerminateQueryModalRef>;
static defaultProps = {
uiConfig: { showGatewayNodeLink: true, showTerminateActions: true },
uiConfig: { showGatewayNodeLink: true },
isTenant: false,
};

Expand Down Expand Up @@ -135,13 +135,11 @@ export class SessionDetails extends React.Component<SessionDetailsProps> {
sessionError,
cancelSession,
cancelQuery,
uiConfig,
onTerminateSessionClick,
onTerminateStatementClick,
} = this.props;
const session = this.props.session?.session;
const showActionButtons =
!!session && !sessionError && uiConfig?.showTerminateActions;
const showActionButtons = !!session && !sessionError;
return (
<div className={cx("sessions-details")}>
<Helmet title={`Details | ${sessionID} | Sessions`} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ const sessionDetailsPropsBase: SessionDetailsProps = {
refreshNodesLiveness: () => {},
uiConfig: {
showGatewayNodeLink: true,
showTerminateActions: true,
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,6 @@ export const sessionsPagePropsFixture: SessionsPageProps = {
refreshSessions: () => {},
cancelSession: (req: CancelSessionRequestMessage) => {},
cancelQuery: (req: CancelQueryRequestMessage) => {},
uiConfig: { showTerminateActions: true },
onSortingChange: () => {},
};

Expand All @@ -192,6 +191,5 @@ export const sessionsPagePropsEmptyFixture: SessionsPageProps = {
refreshSessions: () => {},
cancelSession: (req: CancelSessionRequestMessage) => {},
cancelQuery: (req: CancelQueryRequestMessage) => {},
uiConfig: { showTerminateActions: true },
onSortingChange: () => {},
};
75 changes: 0 additions & 75 deletions pkg/ui/workspaces/cluster-ui/src/sessions/sessionsPage.spec.tsx

This file was deleted.

6 changes: 0 additions & 6 deletions pkg/ui/workspaces/cluster-ui/src/sessions/sessionsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import TerminateSessionModal, {
TerminateSessionModalRef,
} from "./terminateSessionModal";

import { UIConfigState } from "src/store";
import {
ICancelSessionRequest,
ICancelQueryRequest,
Expand All @@ -57,7 +56,6 @@ export interface OwnProps {
refreshSessions: () => void;
cancelSession: (payload: ICancelSessionRequest) => void;
cancelQuery: (payload: ICancelQueryRequest) => void;
uiConfig?: UIConfigState["pages"]["sessions"];
onPageChanged?: (newPage: number) => void;
onSortingChange?: (
name: string,
Expand All @@ -81,9 +79,6 @@ export class SessionsPage extends React.Component<
> {
terminateSessionRef: React.RefObject<TerminateSessionModalRef>;
terminateQueryRef: React.RefObject<TerminateQueryModalRef>;
static defaultProps = {
uiConfig: { showTerminateActions: true },
};

constructor(props: SessionsPageProps) {
super(props);
Expand Down Expand Up @@ -176,7 +171,6 @@ export class SessionsPage extends React.Component<
columns={makeSessionsColumns(
this.terminateSessionRef,
this.terminateQueryRef,
this.props.uiConfig?.showTerminateActions,
this.props.onSessionClick,
this.props.onTerminateStatementClick,
this.props.onTerminateSessionClick,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@ import { SessionsState } from "src/store/sessions";
import { createSelector } from "reselect";
import { SessionsPage } from "./index";

import {
actions as sessionsActions,
selectSessionsUiConfig,
} from "src/store/sessions";
import { actions as sessionsActions } from "src/store/sessions";
import { actions as localStorageActions } from "src/store/localStorage";
import {
actions as terminateQueryActions,
Expand Down Expand Up @@ -50,7 +47,6 @@ export const SessionsPageConnected = withRouter(
(state: AppState, props: RouteComponentProps) => ({
sessions: selectSessions(state),
sessionsError: state.adminUI.sessions.lastError,
uiConfig: selectSessionsUiConfig(state),
sortSetting: selectSortSetting(state),
}),
(dispatch: Dispatch) => ({
Expand Down
Loading

0 comments on commit 179ef67

Please sign in to comment.