|
@@ -3,15 +3,18 @@ import styled from "styled-components";
|
|
|
import gradient from "assets/gradient.jpg";
|
|
import gradient from "assets/gradient.jpg";
|
|
|
import monojob from "assets/monojob.png";
|
|
import monojob from "assets/monojob.png";
|
|
|
import monoweb from "assets/monoweb.png";
|
|
import monoweb from "assets/monoweb.png";
|
|
|
|
|
+import sliders from "assets/sliders.svg";
|
|
|
|
|
|
|
|
import { Context } from "shared/Context";
|
|
import { Context } from "shared/Context";
|
|
|
import { ChartType, ClusterType } from "shared/types";
|
|
import { ChartType, ClusterType } from "shared/types";
|
|
|
import { PorterUrl } from "shared/routing";
|
|
import { PorterUrl } from "shared/routing";
|
|
|
|
|
|
|
|
import ChartList from "./chart/ChartList";
|
|
import ChartList from "./chart/ChartList";
|
|
|
|
|
+import EnvGroupList from "./env-groups/EnvGroupList";
|
|
|
import NamespaceSelector from "./NamespaceSelector";
|
|
import NamespaceSelector from "./NamespaceSelector";
|
|
|
import SortSelector from "./SortSelector";
|
|
import SortSelector from "./SortSelector";
|
|
|
import ExpandedChart from "./expanded-chart/ExpandedChart";
|
|
import ExpandedChart from "./expanded-chart/ExpandedChart";
|
|
|
|
|
+import ExpandedEnvGroup from "./env-groups/ExpandedEnvGroup";
|
|
|
import ExpandedJobChart from "./expanded-chart/ExpandedJobChart";
|
|
import ExpandedJobChart from "./expanded-chart/ExpandedJobChart";
|
|
|
import { RouteComponentProps, withRouter } from "react-router";
|
|
import { RouteComponentProps, withRouter } from "react-router";
|
|
|
|
|
|
|
@@ -27,6 +30,7 @@ type StateType = {
|
|
|
namespace: string;
|
|
namespace: string;
|
|
|
sortType: string;
|
|
sortType: string;
|
|
|
currentChart: ChartType | null;
|
|
currentChart: ChartType | null;
|
|
|
|
|
+ expandedEnvGroup: any;
|
|
|
isMetricsInstalled: boolean;
|
|
isMetricsInstalled: boolean;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -37,6 +41,7 @@ class ClusterDashboard extends Component<PropsType, StateType> {
|
|
|
? localStorage.getItem("SortType")
|
|
? localStorage.getItem("SortType")
|
|
|
: "Newest",
|
|
: "Newest",
|
|
|
currentChart: null as ChartType | null,
|
|
currentChart: null as ChartType | null,
|
|
|
|
|
+ expandedEnvGroup: null as any,
|
|
|
isMetricsInstalled: false,
|
|
isMetricsInstalled: false,
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -83,11 +88,85 @@ class ClusterDashboard extends Component<PropsType, StateType> {
|
|
|
renderDashboardIcon = () => {
|
|
renderDashboardIcon = () => {
|
|
|
if (this.props.currentView === "jobs") {
|
|
if (this.props.currentView === "jobs") {
|
|
|
return <Img src={monojob} />;
|
|
return <Img src={monojob} />;
|
|
|
|
|
+ } else if (this.props.currentView === "env-groups") {
|
|
|
|
|
+ return <Img src={sliders} />;
|
|
|
} else {
|
|
} else {
|
|
|
return <Img src={monoweb} />;
|
|
return <Img src={monoweb} />;
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+ getDescription = (currentView: string): string => {
|
|
|
|
|
+ if (currentView === "jobs") {
|
|
|
|
|
+ return "Scripts and tasks that run once or on a repeating interval.";
|
|
|
|
|
+ } else if (currentView === "env-groups") {
|
|
|
|
|
+ return "Groups of environment variables for storing secrets and configuration."
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return "Continuously running web services, workers, and add-ons.";
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ renderBody = () => {
|
|
|
|
|
+ let { currentCluster, setSidebar, currentView } = this.props;
|
|
|
|
|
+ if (currentView === "env-groups") {
|
|
|
|
|
+ return (
|
|
|
|
|
+ <>
|
|
|
|
|
+ <ControlRow>
|
|
|
|
|
+ <Button onClick={() => this.props.history.push("launch")}>
|
|
|
|
|
+ <i className="material-icons">add</i> Create Env Group
|
|
|
|
|
+ </Button>
|
|
|
|
|
+ <SortFilterWrapper>
|
|
|
|
|
+ <SortSelector
|
|
|
|
|
+ setSortType={(sortType) => this.setState({ sortType })}
|
|
|
|
|
+ sortType={this.state.sortType}
|
|
|
|
|
+ />
|
|
|
|
|
+ <NamespaceSelector
|
|
|
|
|
+ setNamespace={(namespace) => this.setState({ namespace })}
|
|
|
|
|
+ namespace={this.state.namespace}
|
|
|
|
|
+ />
|
|
|
|
|
+ </SortFilterWrapper>
|
|
|
|
|
+ </ControlRow>
|
|
|
|
|
+
|
|
|
|
|
+ <EnvGroupList
|
|
|
|
|
+ currentCluster={currentCluster}
|
|
|
|
|
+ namespace={this.state.namespace}
|
|
|
|
|
+ sortType={this.state.sortType}
|
|
|
|
|
+ setExpandedEnvGroup={(envGroup: any) => this.setState({ expandedEnvGroup: envGroup })}
|
|
|
|
|
+ />
|
|
|
|
|
+ </>
|
|
|
|
|
+ );
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return (
|
|
|
|
|
+ <>
|
|
|
|
|
+ <ControlRow>
|
|
|
|
|
+ <Button onClick={() => this.props.history.push("launch")}>
|
|
|
|
|
+ <i className="material-icons">add</i> Launch Template
|
|
|
|
|
+ </Button>
|
|
|
|
|
+ <SortFilterWrapper>
|
|
|
|
|
+ <SortSelector
|
|
|
|
|
+ setSortType={(sortType) => this.setState({ sortType })}
|
|
|
|
|
+ sortType={this.state.sortType}
|
|
|
|
|
+ />
|
|
|
|
|
+ <NamespaceSelector
|
|
|
|
|
+ setNamespace={(namespace) => this.setState({ namespace })}
|
|
|
|
|
+ namespace={this.state.namespace}
|
|
|
|
|
+ />
|
|
|
|
|
+ </SortFilterWrapper>
|
|
|
|
|
+ </ControlRow>
|
|
|
|
|
+
|
|
|
|
|
+ <ChartList
|
|
|
|
|
+ currentView={currentView}
|
|
|
|
|
+ currentCluster={currentCluster}
|
|
|
|
|
+ namespace={this.state.namespace}
|
|
|
|
|
+ sortType={this.state.sortType}
|
|
|
|
|
+ setCurrentChart={(x: ChartType | null) =>
|
|
|
|
|
+ this.setState({ currentChart: x })
|
|
|
|
|
+ }
|
|
|
|
|
+ />
|
|
|
|
|
+ </>
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
renderContents = () => {
|
|
renderContents = () => {
|
|
|
let { currentCluster, setSidebar, currentView } = this.props;
|
|
let { currentCluster, setSidebar, currentView } = this.props;
|
|
|
if (this.state.currentChart && currentView === "jobs") {
|
|
if (this.state.currentChart && currentView === "jobs") {
|
|
@@ -111,13 +190,22 @@ class ClusterDashboard extends Component<PropsType, StateType> {
|
|
|
setSidebar={setSidebar}
|
|
setSidebar={setSidebar}
|
|
|
/>
|
|
/>
|
|
|
);
|
|
);
|
|
|
|
|
+ } else if (this.state.expandedEnvGroup && currentView === "env-groups") {
|
|
|
|
|
+ return (
|
|
|
|
|
+ <ExpandedEnvGroup
|
|
|
|
|
+ namespace={this.state.namespace}
|
|
|
|
|
+ currentCluster={this.props.currentCluster}
|
|
|
|
|
+ initialEnvGroup={this.state.expandedEnvGroup}
|
|
|
|
|
+ closeExpanded={() => this.setState({ expandedEnvGroup: null })}
|
|
|
|
|
+ />
|
|
|
|
|
+ );
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
|
<div>
|
|
<div>
|
|
|
<TitleSection>
|
|
<TitleSection>
|
|
|
{this.renderDashboardIcon()}
|
|
{this.renderDashboardIcon()}
|
|
|
- <Title>{currentView}</Title>
|
|
|
|
|
|
|
+ <Title>{currentView === "env-groups" ? "Environment Groups" : currentView}</Title>
|
|
|
</TitleSection>
|
|
</TitleSection>
|
|
|
|
|
|
|
|
<InfoSection>
|
|
<InfoSection>
|
|
@@ -127,39 +215,13 @@ class ClusterDashboard extends Component<PropsType, StateType> {
|
|
|
</InfoLabel>
|
|
</InfoLabel>
|
|
|
</TopRow>
|
|
</TopRow>
|
|
|
<Description>
|
|
<Description>
|
|
|
- {currentView === "jobs"
|
|
|
|
|
- ? `An overview of past and current jobs for ${currentCluster.name}.`
|
|
|
|
|
- : `An overview of web services and workers running on ${currentCluster.name}.`}
|
|
|
|
|
|
|
+ {this.getDescription(currentView)}
|
|
|
</Description>
|
|
</Description>
|
|
|
</InfoSection>
|
|
</InfoSection>
|
|
|
|
|
|
|
|
<LineBreak />
|
|
<LineBreak />
|
|
|
|
|
|
|
|
- <ControlRow>
|
|
|
|
|
- <Button onClick={() => this.props.history.push("launch")}>
|
|
|
|
|
- <i className="material-icons">add</i> Launch Template
|
|
|
|
|
- </Button>
|
|
|
|
|
- <SortFilterWrapper>
|
|
|
|
|
- <SortSelector
|
|
|
|
|
- setSortType={(sortType) => this.setState({ sortType })}
|
|
|
|
|
- sortType={this.state.sortType}
|
|
|
|
|
- />
|
|
|
|
|
- <NamespaceSelector
|
|
|
|
|
- setNamespace={(namespace) => this.setState({ namespace })}
|
|
|
|
|
- namespace={this.state.namespace}
|
|
|
|
|
- />
|
|
|
|
|
- </SortFilterWrapper>
|
|
|
|
|
- </ControlRow>
|
|
|
|
|
-
|
|
|
|
|
- <ChartList
|
|
|
|
|
- currentView={currentView}
|
|
|
|
|
- currentCluster={currentCluster}
|
|
|
|
|
- namespace={this.state.namespace}
|
|
|
|
|
- sortType={this.state.sortType}
|
|
|
|
|
- setCurrentChart={(x: ChartType | null) =>
|
|
|
|
|
- this.setState({ currentChart: x })
|
|
|
|
|
- }
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ {this.renderBody()}
|
|
|
</div>
|
|
</div>
|
|
|
);
|
|
);
|
|
|
};
|
|
};
|