aboutsummaryrefslogtreecommitdiffstats
path: root/webui/src
diff options
context:
space:
mode:
authorAien Saidi <aien.saidi@gmail.com>2021-03-18 18:09:03 +0100
committerSascha <GlancingMind@outlook.com>2021-04-07 13:08:26 +0200
commit31871f29f13677131d7cb66da189d74fb1d48696 (patch)
tree9a145f77a394327908a74590b624b28ba740a132 /webui/src
parent54c5b66271f4f3d95881a186c8124e7e5dcdb6d4 (diff)
downloadgit-bug-31871f29f13677131d7cb66da189d74fb1d48696.tar.gz
feat: add filter by label
Diffstat (limited to 'webui/src')
-rw-r--r--webui/src/pages/list/FilterToolbar.tsx31
-rw-r--r--webui/src/pages/list/ListLabels.graphql9
2 files changed, 35 insertions, 5 deletions
diff --git a/webui/src/pages/list/FilterToolbar.tsx b/webui/src/pages/list/FilterToolbar.tsx
index 92154ad2..37f63b98 100644
--- a/webui/src/pages/list/FilterToolbar.tsx
+++ b/webui/src/pages/list/FilterToolbar.tsx
@@ -17,6 +17,7 @@ import {
} from './Filter';
import { useBugCountQuery } from './FilterToolbar.generated';
import { useListIdentitiesQuery } from './ListIdentities.generated';
+import { useListLabelsQuery } from './ListLabels.generated';
const useStyles = makeStyles((theme) => ({
toolbar: {
@@ -63,16 +64,29 @@ type Props = {
function FilterToolbar({ query, queryLocation }: Props) {
const classes = useStyles();
const params: Query = parse(query);
- const { data } = useListIdentitiesQuery();
+ const { data: identitiesData } = useListIdentitiesQuery();
+ const { data: labelsData } = useListLabelsQuery()
let identities: any = [];
+ let labels: any = [];
if (
- data?.repository &&
- data.repository.allIdentities &&
- data.repository.allIdentities.nodes
+ identitiesData?.repository &&
+ identitiesData.repository.allIdentities &&
+ identitiesData.repository.allIdentities.nodes
) {
- identities = data.repository.allIdentities.nodes.map((node) => [
+ identities = identitiesData.repository.allIdentities.nodes.map((node) => [
+ node.name,
+ node.name,
+ ]);
+ }
+
+ if (
+ labelsData?.repository &&
+ labelsData.repository.validLabels &&
+ labelsData.repository.validLabels.nodes
+ ) {
+ labels = labelsData.repository.validLabels.nodes.map((node) => [
node.name,
node.name,
]);
@@ -140,6 +154,13 @@ function FilterToolbar({ query, queryLocation }: Props) {
Author
</FilterDropdown>
<FilterDropdown
+ dropdown={labels}
+ itemActive={(key) => hasValue('label', key)}
+ to={(key) => pipe(replaceParam('label', key), loc)(params)}
+ >
+ Label
+ </FilterDropdown>
+ <FilterDropdown
dropdown={[
['id', 'ID'],
['creation', 'Newest'],
diff --git a/webui/src/pages/list/ListLabels.graphql b/webui/src/pages/list/ListLabels.graphql
new file mode 100644
index 00000000..dcb44b67
--- /dev/null
+++ b/webui/src/pages/list/ListLabels.graphql
@@ -0,0 +1,9 @@
+query ListLabels {
+ repository {
+ validLabels {
+ nodes {
+ name
+ }
+ }
+ }
+}