|
|
@@ -12,23 +12,16 @@ import ClusterSettings from "./ClusterSettings";
|
|
|
import useAuth from "shared/auth/useAuth";
|
|
|
import Metrics from "./Metrics";
|
|
|
import EventsTab from "./events/EventsTab";
|
|
|
-import EnvironmentList from "./preview-environments/EnvironmentList";
|
|
|
+import EnvironmentList from "../preview-environments/EnvironmentList";
|
|
|
import { useLocation } from "react-router";
|
|
|
import { getQueryParam } from "shared/routing";
|
|
|
|
|
|
-type TabEnum =
|
|
|
- | "preview_environments"
|
|
|
- | "nodes"
|
|
|
- | "settings"
|
|
|
- | "namespaces"
|
|
|
- | "metrics"
|
|
|
- | "events";
|
|
|
+type TabEnum = "nodes" | "settings" | "namespaces" | "metrics" | "events";
|
|
|
|
|
|
const tabOptions: {
|
|
|
label: string;
|
|
|
value: TabEnum;
|
|
|
}[] = [
|
|
|
- { label: "Preview Environments", value: "preview_environments" },
|
|
|
{ label: "Nodes", value: "nodes" },
|
|
|
{ label: "Events", value: "events" },
|
|
|
{ label: "Metrics", value: "metrics" },
|
|
|
@@ -38,9 +31,7 @@ const tabOptions: {
|
|
|
|
|
|
export const Dashboard: React.FunctionComponent = () => {
|
|
|
const { currentProject } = useContext(Context);
|
|
|
- const [currentTab, setCurrentTab] = useState<TabEnum>(() =>
|
|
|
- currentProject.preview_envs_enabled ? "preview_environments" : "nodes"
|
|
|
- );
|
|
|
+ const [currentTab, setCurrentTab] = useState<TabEnum>("nodes");
|
|
|
const [currentTabOptions, setCurrentTabOptions] = useState(tabOptions);
|
|
|
const [isAuthorized] = useAuth();
|
|
|
const location = useLocation();
|
|
|
@@ -48,11 +39,6 @@ export const Dashboard: React.FunctionComponent = () => {
|
|
|
const context = useContext(Context);
|
|
|
const renderTab = () => {
|
|
|
switch (currentTab) {
|
|
|
- case "preview_environments":
|
|
|
- if (currentProject.preview_envs_enabled) {
|
|
|
- return <EnvironmentList />;
|
|
|
- }
|
|
|
- return <NodeList />;
|
|
|
case "events":
|
|
|
return <EventsTab />;
|
|
|
case "settings":
|
|
|
@@ -70,10 +56,6 @@ export const Dashboard: React.FunctionComponent = () => {
|
|
|
useEffect(() => {
|
|
|
setCurrentTabOptions(
|
|
|
tabOptions.filter((option) => {
|
|
|
- if (option.value === "preview_environments") {
|
|
|
- return currentProject.preview_envs_enabled;
|
|
|
- }
|
|
|
-
|
|
|
if (option.value === "settings") {
|
|
|
return isAuthorized("cluster", "", ["get", "delete"]);
|
|
|
}
|