|
@@ -1,13 +1,18 @@
|
|
|
import DynamicLink from "components/DynamicLink";
|
|
import DynamicLink from "components/DynamicLink";
|
|
|
|
|
+import Selector from "components/Selector";
|
|
|
import React, { useEffect, useState } from "react";
|
|
import React, { useEffect, useState } from "react";
|
|
|
import { useHistory, useLocation } from "react-router";
|
|
import { useHistory, useLocation } from "react-router";
|
|
|
import { useRouting } from "shared/routing";
|
|
import { useRouting } from "shared/routing";
|
|
|
import styled from "styled-components";
|
|
import styled from "styled-components";
|
|
|
import DashboardHeader from "../DashboardHeader";
|
|
import DashboardHeader from "../DashboardHeader";
|
|
|
import NamespaceSelector from "../NamespaceSelector";
|
|
import NamespaceSelector from "../NamespaceSelector";
|
|
|
|
|
+import SortSelector from "../SortSelector";
|
|
|
import StackList from "./_StackList";
|
|
import StackList from "./_StackList";
|
|
|
const Dashboard = () => {
|
|
const Dashboard = () => {
|
|
|
const [currentNamespace, setCurrentNamespace] = useState("default");
|
|
const [currentNamespace, setCurrentNamespace] = useState("default");
|
|
|
|
|
+ const [currentSort, setCurrentSort] = useState<
|
|
|
|
|
+ "created_at" | "updated_at" | "alphabetical"
|
|
|
|
|
+ >("created_at");
|
|
|
|
|
|
|
|
const location = useLocation();
|
|
const location = useLocation();
|
|
|
const history = useHistory();
|
|
const history = useHistory();
|
|
@@ -38,18 +43,65 @@ const Dashboard = () => {
|
|
|
<i className="material-icons">add</i>
|
|
<i className="material-icons">add</i>
|
|
|
Create Stack
|
|
Create Stack
|
|
|
</Button>
|
|
</Button>
|
|
|
- <NamespaceSelector
|
|
|
|
|
- namespace={currentNamespace}
|
|
|
|
|
- setNamespace={handleNamespaceChange}
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ <FilterWrapper>
|
|
|
|
|
+ <StyledSortSelector>
|
|
|
|
|
+ <Label>
|
|
|
|
|
+ <i className="material-icons">sort</i> Sort
|
|
|
|
|
+ </Label>
|
|
|
|
|
+ <Selector
|
|
|
|
|
+ activeValue={currentSort}
|
|
|
|
|
+ setActiveValue={(sortType) => setCurrentSort(sortType as any)}
|
|
|
|
|
+ options={[
|
|
|
|
|
+ {
|
|
|
|
|
+ value: "created_at",
|
|
|
|
|
+ label: "Created at",
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ value: "updated_at",
|
|
|
|
|
+ label: "Last updated",
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ value: "alphabetical",
|
|
|
|
|
+ label: "Alphabetical",
|
|
|
|
|
+ },
|
|
|
|
|
+ ]}
|
|
|
|
|
+ dropdownLabel="Sort By"
|
|
|
|
|
+ width="150px"
|
|
|
|
|
+ dropdownWidth="230px"
|
|
|
|
|
+ closeOverlay={true}
|
|
|
|
|
+ />
|
|
|
|
|
+ </StyledSortSelector>
|
|
|
|
|
+ <NamespaceSelector
|
|
|
|
|
+ namespace={currentNamespace}
|
|
|
|
|
+ setNamespace={handleNamespaceChange}
|
|
|
|
|
+ />
|
|
|
|
|
+ </FilterWrapper>
|
|
|
</ActionRow>
|
|
</ActionRow>
|
|
|
- <StackList namespace={currentNamespace} />
|
|
|
|
|
|
|
+ <StackList namespace={currentNamespace} sortBy={currentSort} />
|
|
|
</>
|
|
</>
|
|
|
);
|
|
);
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
export default Dashboard;
|
|
export default Dashboard;
|
|
|
|
|
|
|
|
|
|
+const Label = styled.div`
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ margin-right: 12px;
|
|
|
|
|
+
|
|
|
|
|
+ > i {
|
|
|
|
|
+ margin-right: 8px;
|
|
|
|
|
+ font-size: 18px;
|
|
|
|
|
+ }
|
|
|
|
|
+`;
|
|
|
|
|
+
|
|
|
|
|
+const StyledSortSelector = styled.div`
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ align-items: center;
|
|
|
|
|
+ font-size: 13px;
|
|
|
|
|
+ margin-right: 30px;
|
|
|
|
|
+`;
|
|
|
|
|
+
|
|
|
const Button = styled(DynamicLink)`
|
|
const Button = styled(DynamicLink)`
|
|
|
display: flex;
|
|
display: flex;
|
|
|
flex-direction: row;
|
|
flex-direction: row;
|
|
@@ -101,3 +153,7 @@ const ActionRow = styled.div`
|
|
|
align-items: center;
|
|
align-items: center;
|
|
|
margin-bottom: 35px;
|
|
margin-bottom: 35px;
|
|
|
`;
|
|
`;
|
|
|
|
|
+
|
|
|
|
|
+const FilterWrapper = styled.div`
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+`;
|