-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: My Documents + other bits (#57)
* feat: Map User to DatatrackerPerson * feat: set isManager flag in profile * chore: A few real managers for demo * feat: Only mgrs can Manage Assignments * chore: View page as another user for dev/demo * chore: "Documents" -> "My Documents" * feat: Pass rpcPersonId back with profile * feat: Show My Documents
- Loading branch information
1 parent
db8b75b
commit 1664f70
Showing
9 changed files
with
228 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,74 @@ | ||
<template> | ||
<TitleBlock title="Documents" summary="Beep boop"> | ||
<TitleBlock title="My Documents" summary="Beep boop"> | ||
<template #right> | ||
|
||
<RefreshButton class="mr-3"/> | ||
<NuxtLink | ||
v-if="userStore.isManager" | ||
class="max-w-l items-center rounded-md bg-violet-600 px-3 py-2 text-center text-sm font-semibold text-white shadow-sm hover:bg-violet-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600" | ||
to="/docs/assignments"> | ||
Manage Assignments | ||
</NuxtLink> | ||
</template> | ||
</TitleBlock> | ||
<div class="mt-8 flow-root"> | ||
<a href="/docs/assignments" | ||
class="max-w-l items-center rounded-md bg-violet-600 px-3 py-2 text-center text-sm font-semibold text-white shadow-sm hover:bg-violet-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"> | ||
Manage Assignments | ||
</a> | ||
<DocumentTable | ||
:columns="columns" | ||
:data="myAssignments.map(a => a.rfcToBe)" | ||
row-key="id" | ||
:loading="pending" | ||
/> | ||
</div> | ||
</template> | ||
|
||
<script setup> | ||
import { useAsyncData } from '#app' | ||
const api = useApi() | ||
const userStore = useUserStore() | ||
// COMPUTED | ||
const myAssignments = computed(() => allAssignments.value?.filter( | ||
(a) => a.person === userStore.rpcPersonId | ||
).map( | ||
(a) => ({ ...a, rfcToBe: allDocuments.value?.find(d => d.id === a.rfcToBe) }) | ||
)) | ||
const pending = computed(() => assignmentsPending.value || documentsPending.value) | ||
// DATA | ||
const columns = [ | ||
{ | ||
key: 'name', | ||
label: 'Document', | ||
field: 'name', | ||
classes: 'text-sm font-medium', | ||
link: row => `/docs/${row.name}` | ||
}, | ||
{ | ||
key: 'labels', | ||
label: 'Labels', | ||
labels: row => row.labels.map(lblId => labels.value.find(lbl => lbl.id === lblId)) || [] | ||
} | ||
] | ||
const { data: allAssignments, pending: assignmentsPending } = await useAsyncData( | ||
'allAssignments', | ||
() => api.assignmentsList(), | ||
{ server: false, default: () => ([]) } | ||
) | ||
const { data: allDocuments, pending: documentsPending } = await useAsyncData( | ||
'allDocuments', | ||
() => api.documentsList(), | ||
{ server: false, default: () => ([]) } | ||
) | ||
const { data: labels } = await useAsyncData( | ||
'labels', | ||
() => api.labelsList(), | ||
{ server: false, default: () => ([]) } | ||
) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters