|
|
@@ -0,0 +1,127 @@
|
|
|
+import React, { useContext, useState } from "react";
|
|
|
+import styled from "styled-components";
|
|
|
+
|
|
|
+import { Context } from "shared/Context";
|
|
|
+import TabSelector from "components/TabSelector";
|
|
|
+
|
|
|
+import NodeList from "./NodeList";
|
|
|
+
|
|
|
+
|
|
|
+type TabEnum = "nodes";
|
|
|
+
|
|
|
+const tabOptions: {
|
|
|
+ label: string;
|
|
|
+ value: TabEnum
|
|
|
+}[] = [
|
|
|
+ { label: "Nodes", value: "nodes" },
|
|
|
+];
|
|
|
+
|
|
|
+export const Dashboard: React.FC = ({ children }) => {
|
|
|
+ const [currentTab, setCurrentTab] = useState<TabEnum>("nodes");
|
|
|
+ const context = useContext(Context);
|
|
|
+ const renderTab = (cluster: any) => {
|
|
|
+ switch (currentTab) {
|
|
|
+ case "nodes":
|
|
|
+ default:
|
|
|
+ return <NodeList />;
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ return (
|
|
|
+
|
|
|
+ <>
|
|
|
+ <TitleSection>
|
|
|
+ <i className="material-icons">device_hub</i>
|
|
|
+ <Title>{context.currentCluster.name}</Title>
|
|
|
+ </TitleSection>
|
|
|
+
|
|
|
+ <InfoSection>
|
|
|
+ <TopRow>
|
|
|
+ <InfoLabel>
|
|
|
+ <i className="material-icons">info</i> Info
|
|
|
+ </InfoLabel>
|
|
|
+ </TopRow>
|
|
|
+ <Description>Some text</Description>
|
|
|
+ </InfoSection>
|
|
|
+
|
|
|
+ <TabSelector
|
|
|
+ options={tabOptions}
|
|
|
+ currentTab={currentTab}
|
|
|
+ setCurrentTab={(value: TabEnum) =>
|
|
|
+ setCurrentTab(value)
|
|
|
+ }
|
|
|
+ />
|
|
|
+
|
|
|
+ {renderTab(context.currentCluster)}
|
|
|
+ </>
|
|
|
+ );
|
|
|
+};
|
|
|
+
|
|
|
+
|
|
|
+const TopRow = styled.div`
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+`;
|
|
|
+
|
|
|
+const Description = styled.div`
|
|
|
+ color: #aaaabb;
|
|
|
+ margin-top: 13px;
|
|
|
+ margin-left: 2px;
|
|
|
+ font-size: 13px;
|
|
|
+`;
|
|
|
+
|
|
|
+const InfoLabel = styled.div`
|
|
|
+ width: 72px;
|
|
|
+ height: 20px;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ color: #7a838f;
|
|
|
+ font-size: 13px;
|
|
|
+ > i {
|
|
|
+ color: #8b949f;
|
|
|
+ font-size: 18px;
|
|
|
+ margin-right: 5px;
|
|
|
+ }
|
|
|
+`;
|
|
|
+
|
|
|
+const InfoSection = styled.div`
|
|
|
+ margin-top: 20px;
|
|
|
+ font-family: "Work Sans", sans-serif;
|
|
|
+ margin-left: 0px;
|
|
|
+ margin-bottom: 35px;
|
|
|
+`;
|
|
|
+
|
|
|
+const Title = styled.div`
|
|
|
+ font-size: 20px;
|
|
|
+ font-weight: 500;
|
|
|
+ font-family: "Work Sans", sans-serif;
|
|
|
+ margin-left: 18px;
|
|
|
+ color: #ffffff;
|
|
|
+ white-space: nowrap;
|
|
|
+ overflow: hidden;
|
|
|
+ text-overflow: ellipsis;
|
|
|
+ text-transform: capitalize;
|
|
|
+`;
|
|
|
+
|
|
|
+const TitleSection = styled.div`
|
|
|
+ height: 80px;
|
|
|
+ margin-top: 10px;
|
|
|
+ margin-bottom: 10px;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: row;
|
|
|
+ align-items: center;
|
|
|
+ padding-left: 0px;
|
|
|
+
|
|
|
+ > i {
|
|
|
+ margin-left: 10px;
|
|
|
+ cursor: pointer;
|
|
|
+ font-size 18px;
|
|
|
+ color: #858FAAaa;
|
|
|
+ padding: 5px;
|
|
|
+ border-radius: 100px;
|
|
|
+ :hover {
|
|
|
+ background: #ffffff11;
|
|
|
+ }
|
|
|
+ margin-bottom: -3px;
|
|
|
+ }
|
|
|
+`;
|