|
@@ -6,25 +6,28 @@ import TabSelector from "components/TabSelector";
|
|
|
|
|
|
|
|
import NodeList from "./NodeList";
|
|
import NodeList from "./NodeList";
|
|
|
import { ClusterSettings } from "./ClusterSettings";
|
|
import { ClusterSettings } from "./ClusterSettings";
|
|
|
|
|
+import { NamespaceList } from "./NamespaceList";
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-type TabEnum = "nodes" | "settings";
|
|
|
|
|
|
|
+type TabEnum = "nodes" | "settings" | "namespaces";
|
|
|
|
|
|
|
|
const tabOptions: {
|
|
const tabOptions: {
|
|
|
label: string;
|
|
label: string;
|
|
|
- value: TabEnum
|
|
|
|
|
|
|
+ value: TabEnum;
|
|
|
}[] = [
|
|
}[] = [
|
|
|
{ label: "Nodes", value: "nodes" },
|
|
{ label: "Nodes", value: "nodes" },
|
|
|
- { label: "Settings", value: "settings"}
|
|
|
|
|
|
|
+ { label: "Namespaces", value: "namespaces" },
|
|
|
|
|
+ { label: "Settings", value: "settings" },
|
|
|
];
|
|
];
|
|
|
|
|
|
|
|
-export const Dashboard: React.FC = ({ children }) => {
|
|
|
|
|
|
|
+export const Dashboard: React.FunctionComponent = () => {
|
|
|
const [currentTab, setCurrentTab] = useState<TabEnum>("nodes");
|
|
const [currentTab, setCurrentTab] = useState<TabEnum>("nodes");
|
|
|
const context = useContext(Context);
|
|
const context = useContext(Context);
|
|
|
- const renderTab = (cluster: any) => {
|
|
|
|
|
|
|
+ const renderTab = () => {
|
|
|
switch (currentTab) {
|
|
switch (currentTab) {
|
|
|
- case "settings":
|
|
|
|
|
- return <ClusterSettings />
|
|
|
|
|
|
|
+ case "settings":
|
|
|
|
|
+ return <ClusterSettings />;
|
|
|
|
|
+ case "namespaces":
|
|
|
|
|
+ return <NamespaceList />;
|
|
|
case "nodes":
|
|
case "nodes":
|
|
|
default:
|
|
default:
|
|
|
return <NodeList />;
|
|
return <NodeList />;
|
|
@@ -32,7 +35,6 @@ export const Dashboard: React.FC = ({ children }) => {
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
|
-
|
|
|
|
|
<>
|
|
<>
|
|
|
<TitleSection>
|
|
<TitleSection>
|
|
|
<DashboardIcon>
|
|
<DashboardIcon>
|
|
@@ -47,18 +49,18 @@ export const Dashboard: React.FC = ({ children }) => {
|
|
|
<i className="material-icons">info</i> Info
|
|
<i className="material-icons">info</i> Info
|
|
|
</InfoLabel>
|
|
</InfoLabel>
|
|
|
</TopRow>
|
|
</TopRow>
|
|
|
- <Description>Cluster dashboard for {context.currentCluster.name}</Description>
|
|
|
|
|
|
|
+ <Description>
|
|
|
|
|
+ Cluster dashboard for {context.currentCluster.name}
|
|
|
|
|
+ </Description>
|
|
|
</InfoSection>
|
|
</InfoSection>
|
|
|
|
|
|
|
|
<TabSelector
|
|
<TabSelector
|
|
|
options={tabOptions}
|
|
options={tabOptions}
|
|
|
currentTab={currentTab}
|
|
currentTab={currentTab}
|
|
|
- setCurrentTab={(value: TabEnum) =>
|
|
|
|
|
- setCurrentTab(value)
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ setCurrentTab={(value: TabEnum) => setCurrentTab(value)}
|
|
|
/>
|
|
/>
|
|
|
|
|
|
|
|
- {renderTab(context.currentCluster)}
|
|
|
|
|
|
|
+ {renderTab()}
|
|
|
</>
|
|
</>
|
|
|
);
|
|
);
|
|
|
};
|
|
};
|
|
@@ -134,8 +136,8 @@ const TitleSection = styled.div`
|
|
|
> i {
|
|
> i {
|
|
|
margin-left: 10px;
|
|
margin-left: 10px;
|
|
|
cursor: pointer;
|
|
cursor: pointer;
|
|
|
- font-size 18px;
|
|
|
|
|
- color: #858FAAaa;
|
|
|
|
|
|
|
+ font-size: 18px;
|
|
|
|
|
+ color: #858faaaa;
|
|
|
padding: 5px;
|
|
padding: 5px;
|
|
|
border-radius: 100px;
|
|
border-radius: 100px;
|
|
|
:hover {
|
|
:hover {
|