Skip to content
Snippets Groups Projects
Unverified Commit 4b8f9e55 authored by ludovicm67's avatar ludovicm67
Browse files

webui: valid labels query

parent fabd12d9
Branches
Tags
No related merge requests found
import React, { useState } from 'react';
import CircularProgress from '@material-ui/core/CircularProgress';
import { useValidLabelsQuery } from './ValidLabelsQuery.generated';
const ValidLabels: React.FC = () => {
const { loading, error, data } = useValidLabelsQuery();
const [filter, setFilter] = useState('');
if (loading) return <CircularProgress />;
if (error) return <p>Error: {error}</p>;
const labels = data?.repository?.validLabels.nodes.filter(
label =>
filter === '' || label.name.toLowerCase().includes(filter.toLowerCase())
);
return (
<>
<input
type="text"
placeholder="Filter labels…"
onChange={e => setFilter(e.target.value)}
value={filter}
/>
<ul>
{labels?.map(l => (
<li>{l.name}</li>
))}
</ul>
</>
);
};
export default ValidLabels;
#import "../../components/fragments.graphql"
query ValidLabels {
repository {
validLabels {
nodes {
...Label
}
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment