diff options
author | Lena <lena.becker-3@mni.thm.de> | 2021-03-18 19:13:57 +0100 |
---|---|---|
committer | Sascha <GlancingMind@outlook.com> | 2021-04-13 19:07:57 +0200 |
commit | cf1e13b6837d6dda794b9c0dca5af1bb8e095794 (patch) | |
tree | 9d9938155069972b82cb45063d3aa469563d0c88 /webui | |
parent | ad51d884a6926bc69073d1d5aaf584acd7db2c34 (diff) | |
download | git-bug-cf1e13b6837d6dda794b9c0dca5af1bb8e095794.tar.gz |
Add basic bug listing
Diffstat (limited to 'webui')
-rw-r--r-- | webui/src/pages/identity/BugList.tsx | 32 | ||||
-rw-r--r-- | webui/src/pages/identity/GetBugsByUser.graphql | 10 | ||||
-rw-r--r-- | webui/src/pages/identity/Identity.tsx | 5 |
3 files changed, 47 insertions, 0 deletions
diff --git a/webui/src/pages/identity/BugList.tsx b/webui/src/pages/identity/BugList.tsx new file mode 100644 index 00000000..e1083cfb --- /dev/null +++ b/webui/src/pages/identity/BugList.tsx @@ -0,0 +1,32 @@ +import React from 'react'; + +import { Link } from '@material-ui/core'; +import CircularProgress from '@material-ui/core/CircularProgress'; + +import { useGetBugsByUserQuery } from './GetBugsByUser.generated'; + +type Props = { + humanId: string; +}; + +function BugList({ humanId }: Props) { + const { loading, error, data } = useGetBugsByUserQuery({ + variables: { + query: 'author:' + humanId, + }, + }); + + if (loading) return <CircularProgress />; + if (error) return <p>Error: {error}</p>; + const bugs = data?.repository?.allBugs.nodes; + + console.log(bugs); + return ( + <ol> + <li>{bugs ? bugs[0].title : ''}</li> + <Link href={'/bug/' + (bugs ? bugs[0].id : '')}>Klick</Link> + </ol> + ); +} + +export default BugList; diff --git a/webui/src/pages/identity/GetBugsByUser.graphql b/webui/src/pages/identity/GetBugsByUser.graphql new file mode 100644 index 00000000..0be85578 --- /dev/null +++ b/webui/src/pages/identity/GetBugsByUser.graphql @@ -0,0 +1,10 @@ +query GetBugsByUser ($query: String){ + repository { + allBugs(query: $query) { + nodes { + id + title + } + } + } +} diff --git a/webui/src/pages/identity/Identity.tsx b/webui/src/pages/identity/Identity.tsx index 22691b1c..43925f4f 100644 --- a/webui/src/pages/identity/Identity.tsx +++ b/webui/src/pages/identity/Identity.tsx @@ -14,6 +14,9 @@ import Avatar from '@material-ui/core/Avatar'; import { makeStyles } from '@material-ui/core/styles'; import { useCurrentIdentityQuery } from '../../components/CurrentIdentity/CurrentIdentity.generated'; + +import BugList from './BugList'; + const useStyles = makeStyles((theme) => ({ main: { maxWidth: 1200, @@ -59,6 +62,7 @@ const Identity = () => { const { data } = useCurrentIdentityQuery(); const user = data?.repository?.userIdentity; console.log(user); + return ( <main className={classes.main}> <div className={classes.container}> @@ -126,6 +130,7 @@ const Identity = () => { </Avatar> </div> </div> + <BugList humanId={user?.humanId ? user?.humanId : ''} /> </main> ); }; |