Skip to content

Commit c3435f7

Browse files
committed
Disable environment actions menu in Sandbox mode
1 parent 726c2fd commit c3435f7

File tree

1 file changed

+21
-14
lines changed

1 file changed

+21
-14
lines changed

src/components/Admin/Environments/index.tsx

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,12 @@ import {
2222
setEnvironmentToDelete,
2323
setIsSidebarOpen
2424
} from "../../../redux/slices/environmentsSlice";
25+
import { useConfigSelector } from "../../../store/config/useConfigSelector";
2526
import { FeatureFlag } from "../../../types";
2627
import { sortEnvironments } from "../../common/IssuesReport/utils";
2728
import { Pagination } from "../../common/v3/Pagination";
2829
import { ConfirmationDialog } from "../../RecentActivity/ConfirmationDialog";
30+
import { ActionsMenuButton } from "./ActionsMenuButton";
2931
import { CreateEnvironmentSidebarOverlay } from "./CreateEnvironmentSidebarOverlay";
3032
import * as s from "./styles";
3133
import type { ColumnMeta } from "./types";
@@ -36,6 +38,7 @@ const columnHelper = createColumnHelper<Environment>();
3638
export const Environments = () => {
3739
const containerRef = useRef<HTMLDivElement>(null);
3840
const { data: about } = useGetAboutQuery();
41+
const { isSandboxModeEnabled } = useConfigSelector();
3942
const isCreateEnvironmentSidebarOpen = useAdminSelector(
4043
(state) => state.environmentsSlice.isSidebarOpen
4144
);
@@ -62,7 +65,7 @@ export const Environments = () => {
6265
columnHelper.accessor("name", {
6366
header: "Name",
6467
meta: {
65-
width: isEnvironmentLastActiveTimestampEnabled ? "70%" : "90%",
68+
width: "100%",
6669
minWidth: 60
6770
},
6871
cell: (info) => {
@@ -101,19 +104,23 @@ export const Environments = () => {
101104
const value = info.getValue();
102105
return <s.EnvironmentType>{value}</s.EnvironmentType>;
103106
}
104-
})
105-
// columnHelper.accessor((row) => row, {
106-
// header: "Actions",
107-
// meta: {
108-
// width: "10%",
109-
// minWidth: 60,
110-
// textAlign: "right"
111-
// },
112-
// cell: (info) => {
113-
// const value = info.getValue();
114-
// return <ActionsMenuButton environment={value} />;
115-
// }
116-
// })
107+
}),
108+
...(isSandboxModeEnabled
109+
? []
110+
: [
111+
columnHelper.accessor((row) => row, {
112+
header: "Actions",
113+
meta: {
114+
width: "10%",
115+
minWidth: 60,
116+
textAlign: "right"
117+
},
118+
cell: (info) => {
119+
const value = info.getValue();
120+
return <ActionsMenuButton environment={value} />;
121+
}
122+
})
123+
])
117124
];
118125

119126
const table = useReactTable({

0 commit comments

Comments
 (0)