|
@@ -32,6 +32,7 @@ import JobRunTable from "./chart/JobRunTable";
|
|
|
import SwitchBase from "@material-ui/core/internal/SwitchBase";
|
|
import SwitchBase from "@material-ui/core/internal/SwitchBase";
|
|
|
import Selector from "components/Selector";
|
|
import Selector from "components/Selector";
|
|
|
import TabSelector from "components/TabSelector";
|
|
import TabSelector from "components/TabSelector";
|
|
|
|
|
+import TagFilter from "./TagFilter";
|
|
|
|
|
|
|
|
// @ts-ignore
|
|
// @ts-ignore
|
|
|
const LazyDatabasesRoutes = loadable(() => import("./databases/routes.tsx"), {
|
|
const LazyDatabasesRoutes = loadable(() => import("./databases/routes.tsx"), {
|
|
@@ -60,6 +61,7 @@ type StateType = {
|
|
|
currentChart: ChartType | null;
|
|
currentChart: ChartType | null;
|
|
|
isMetricsInstalled: boolean;
|
|
isMetricsInstalled: boolean;
|
|
|
showRuns: boolean;
|
|
showRuns: boolean;
|
|
|
|
|
+ selectedTag: any;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
// TODO: should try to maintain single source of truth b/w router and context/state (ex: namespace -> being managed in parallel right now so highly inextensible and routing is fragile)
|
|
// TODO: should try to maintain single source of truth b/w router and context/state (ex: namespace -> being managed in parallel right now so highly inextensible and routing is fragile)
|
|
@@ -73,6 +75,7 @@ class ClusterDashboard extends Component<PropsType, StateType> {
|
|
|
currentChart: null as ChartType | null,
|
|
currentChart: null as ChartType | null,
|
|
|
isMetricsInstalled: false,
|
|
isMetricsInstalled: false,
|
|
|
showRuns: false,
|
|
showRuns: false,
|
|
|
|
|
+ selectedTag: "none",
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
componentDidMount() {
|
|
componentDidMount() {
|
|
@@ -114,7 +117,6 @@ class ClusterDashboard extends Component<PropsType, StateType> {
|
|
|
() => pushQueryParams(this.props, { namespace: "default" })
|
|
() => pushQueryParams(this.props, { namespace: "default" })
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
if (prevProps.currentView !== this.props.currentView) {
|
|
if (prevProps.currentView !== this.props.currentView) {
|
|
|
let params = this.props.match.params as any;
|
|
let params = this.props.match.params as any;
|
|
|
let currentNamespace = params.namespace;
|
|
let currentNamespace = params.namespace;
|
|
@@ -136,12 +138,34 @@ class ClusterDashboard extends Component<PropsType, StateType> {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- getDescription = (currentView: string): string => {
|
|
|
|
|
- if (currentView === "jobs") {
|
|
|
|
|
- return "Scripts and tasks that run once or on a repeating interval.";
|
|
|
|
|
- } else {
|
|
|
|
|
- return "Continuously running web services, workers, and add-ons.";
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ renderCommonFilters = () => {
|
|
|
|
|
+ const { currentView } = this.props;
|
|
|
|
|
+
|
|
|
|
|
+ return (
|
|
|
|
|
+ <>
|
|
|
|
|
+ <TagFilter
|
|
|
|
|
+ onSelect={(newSelectedTag) =>
|
|
|
|
|
+ this.setState({ selectedTag: newSelectedTag })
|
|
|
|
|
+ }
|
|
|
|
|
+ />
|
|
|
|
|
+ <NamespaceSelector
|
|
|
|
|
+ setNamespace={(namespace) =>
|
|
|
|
|
+ this.setState({ namespace }, () => {
|
|
|
|
|
+ console.log(window.location, namespace);
|
|
|
|
|
+ pushQueryParams(this.props, {
|
|
|
|
|
+ namespace: this.state.namespace || "ALL",
|
|
|
|
|
+ });
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ namespace={this.state.namespace}
|
|
|
|
|
+ />
|
|
|
|
|
+ <SortSelector
|
|
|
|
|
+ setSortType={(sortType) => this.setState({ sortType })}
|
|
|
|
|
+ sortType={this.state.sortType}
|
|
|
|
|
+ currentView={currentView}
|
|
|
|
|
+ />
|
|
|
|
|
+ </>
|
|
|
|
|
+ );
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
renderBodyForApps = () => {
|
|
renderBodyForApps = () => {
|
|
@@ -151,6 +175,7 @@ class ClusterDashboard extends Component<PropsType, StateType> {
|
|
|
[],
|
|
[],
|
|
|
["get", "create"]
|
|
["get", "create"]
|
|
|
);
|
|
);
|
|
|
|
|
+
|
|
|
return (
|
|
return (
|
|
|
<>
|
|
<>
|
|
|
<ControlRow>
|
|
<ControlRow>
|
|
@@ -163,31 +188,7 @@ class ClusterDashboard extends Component<PropsType, StateType> {
|
|
|
<i className="material-icons">add</i> Launch Template
|
|
<i className="material-icons">add</i> Launch Template
|
|
|
</Button>
|
|
</Button>
|
|
|
)}
|
|
)}
|
|
|
- <SortFilterWrapper>
|
|
|
|
|
- {currentView === "jobs" && (
|
|
|
|
|
- <LastRunStatusSelector
|
|
|
|
|
- lastRunStatus={this.state.lastRunStatus}
|
|
|
|
|
- setLastRunStatus={(lastRunStatus: JobStatusType) => {
|
|
|
|
|
- this.setState({ lastRunStatus });
|
|
|
|
|
- }}
|
|
|
|
|
- />
|
|
|
|
|
- )}
|
|
|
|
|
- <NamespaceSelector
|
|
|
|
|
- setNamespace={(namespace) =>
|
|
|
|
|
- this.setState({ namespace }, () => {
|
|
|
|
|
- pushQueryParams(this.props, {
|
|
|
|
|
- namespace: this.state.namespace || "ALL",
|
|
|
|
|
- });
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
- namespace={this.state.namespace}
|
|
|
|
|
- />
|
|
|
|
|
- <SortSelector
|
|
|
|
|
- setSortType={(sortType) => this.setState({ sortType })}
|
|
|
|
|
- sortType={this.state.sortType}
|
|
|
|
|
- currentView={currentView}
|
|
|
|
|
- />
|
|
|
|
|
- </SortFilterWrapper>
|
|
|
|
|
|
|
+ <SortFilterWrapper>{this.renderCommonFilters()}</SortFilterWrapper>
|
|
|
</ControlRow>
|
|
</ControlRow>
|
|
|
|
|
|
|
|
<ChartList
|
|
<ChartList
|
|
@@ -196,6 +197,7 @@ class ClusterDashboard extends Component<PropsType, StateType> {
|
|
|
lastRunStatus={this.state.lastRunStatus}
|
|
lastRunStatus={this.state.lastRunStatus}
|
|
|
namespace={this.state.namespace}
|
|
namespace={this.state.namespace}
|
|
|
sortType={this.state.sortType}
|
|
sortType={this.state.sortType}
|
|
|
|
|
+ selectedTag={this.state.selectedTag}
|
|
|
/>
|
|
/>
|
|
|
</>
|
|
</>
|
|
|
);
|
|
);
|
|
@@ -208,6 +210,7 @@ class ClusterDashboard extends Component<PropsType, StateType> {
|
|
|
[],
|
|
[],
|
|
|
["get", "create"]
|
|
["get", "create"]
|
|
|
);
|
|
);
|
|
|
|
|
+
|
|
|
return (
|
|
return (
|
|
|
<>
|
|
<>
|
|
|
<TabSelector
|
|
<TabSelector
|
|
@@ -235,29 +238,13 @@ class ClusterDashboard extends Component<PropsType, StateType> {
|
|
|
</Button>
|
|
</Button>
|
|
|
)}
|
|
)}
|
|
|
<SortFilterWrapper>
|
|
<SortFilterWrapper>
|
|
|
- {currentView === "jobs" && (
|
|
|
|
|
- <LastRunStatusSelector
|
|
|
|
|
- lastRunStatus={this.state.lastRunStatus}
|
|
|
|
|
- setLastRunStatus={(lastRunStatus: JobStatusType) => {
|
|
|
|
|
- this.setState({ lastRunStatus });
|
|
|
|
|
- }}
|
|
|
|
|
- />
|
|
|
|
|
- )}
|
|
|
|
|
- <NamespaceSelector
|
|
|
|
|
- setNamespace={(namespace) =>
|
|
|
|
|
- this.setState({ namespace }, () => {
|
|
|
|
|
- pushQueryParams(this.props, {
|
|
|
|
|
- namespace: this.state.namespace || "ALL",
|
|
|
|
|
- });
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
- namespace={this.state.namespace}
|
|
|
|
|
- />
|
|
|
|
|
- <SortSelector
|
|
|
|
|
- setSortType={(sortType) => this.setState({ sortType })}
|
|
|
|
|
- sortType={this.state.sortType}
|
|
|
|
|
- currentView={currentView}
|
|
|
|
|
|
|
+ <LastRunStatusSelector
|
|
|
|
|
+ lastRunStatus={this.state.lastRunStatus}
|
|
|
|
|
+ setLastRunStatus={(lastRunStatus: JobStatusType) => {
|
|
|
|
|
+ this.setState({ lastRunStatus });
|
|
|
|
|
+ }}
|
|
|
/>
|
|
/>
|
|
|
|
|
+ {this.renderCommonFilters()}
|
|
|
</SortFilterWrapper>
|
|
</SortFilterWrapper>
|
|
|
</ControlRow>
|
|
</ControlRow>
|
|
|
<HidableElement show={this.state.showRuns}>
|
|
<HidableElement show={this.state.showRuns}>
|
|
@@ -274,6 +261,7 @@ class ClusterDashboard extends Component<PropsType, StateType> {
|
|
|
lastRunStatus={this.state.lastRunStatus}
|
|
lastRunStatus={this.state.lastRunStatus}
|
|
|
namespace={this.state.namespace}
|
|
namespace={this.state.namespace}
|
|
|
sortType={this.state.sortType}
|
|
sortType={this.state.sortType}
|
|
|
|
|
+ selectedTag={this.state.selectedTag}
|
|
|
/>
|
|
/>
|
|
|
</HidableElement>
|
|
</HidableElement>
|
|
|
</>
|
|
</>
|
|
@@ -303,7 +291,7 @@ class ClusterDashboard extends Component<PropsType, StateType> {
|
|
|
<DashboardHeader
|
|
<DashboardHeader
|
|
|
image={monojob}
|
|
image={monojob}
|
|
|
title={currentView}
|
|
title={currentView}
|
|
|
- description={this.getDescription(currentView)}
|
|
|
|
|
|
|
+ description="Scripts and tasks that run once or on a repeating interval."
|
|
|
disableLineBreak
|
|
disableLineBreak
|
|
|
/>
|
|
/>
|
|
|
|
|
|
|
@@ -315,11 +303,10 @@ class ClusterDashboard extends Component<PropsType, StateType> {
|
|
|
resource=""
|
|
resource=""
|
|
|
verb={["get", "list"]}
|
|
verb={["get", "list"]}
|
|
|
>
|
|
>
|
|
|
- {/* {this.renderContents()} */}
|
|
|
|
|
<DashboardHeader
|
|
<DashboardHeader
|
|
|
image={monoweb}
|
|
image={monoweb}
|
|
|
title={currentView}
|
|
title={currentView}
|
|
|
- description={this.getDescription(currentView)}
|
|
|
|
|
|
|
+ description="Continuously running web services, workers, and add-ons."
|
|
|
/>
|
|
/>
|
|
|
|
|
|
|
|
{this.renderBodyForApps()}
|
|
{this.renderBodyForApps()}
|
|
@@ -361,7 +348,7 @@ const ControlRow = styled.div`
|
|
|
margin-left: auto;
|
|
margin-left: auto;
|
|
|
justify-content: space-between;
|
|
justify-content: space-between;
|
|
|
align-items: center;
|
|
align-items: center;
|
|
|
- margin-bottom: 35px;
|
|
|
|
|
|
|
+ flex-wrap: wrap;
|
|
|
padding-left: 0px;
|
|
padding-left: 0px;
|
|
|
`;
|
|
`;
|
|
|
|
|
|
|
@@ -409,7 +396,9 @@ const Button = styled.div`
|
|
|
border-radius: 20px;
|
|
border-radius: 20px;
|
|
|
color: white;
|
|
color: white;
|
|
|
height: 35px;
|
|
height: 35px;
|
|
|
|
|
+ margin-bottom: 35px;
|
|
|
padding: 0px 8px;
|
|
padding: 0px 8px;
|
|
|
|
|
+ min-width: 155px;
|
|
|
padding-bottom: 1px;
|
|
padding-bottom: 1px;
|
|
|
margin-right: 10px;
|
|
margin-right: 10px;
|
|
|
font-weight: 500;
|
|
font-weight: 500;
|
|
@@ -506,7 +495,8 @@ const Img = styled.img`
|
|
|
const SortFilterWrapper = styled.div`
|
|
const SortFilterWrapper = styled.div`
|
|
|
display: flex;
|
|
display: flex;
|
|
|
justify-content: space-between;
|
|
justify-content: space-between;
|
|
|
|
|
+ margin-bottom: 35px;
|
|
|
> div:not(:first-child) {
|
|
> div:not(:first-child) {
|
|
|
margin-left: 30px;
|
|
margin-left: 30px;
|
|
|
}
|
|
}
|
|
|
-`;
|
|
|
|
|
|
|
+`;
|