-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
248 additions
and
82 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,5 +4,6 @@ | |
<div> | ||
<ModalError /> | ||
<ModalLoading /> | ||
<ModalPermissionDenied /> | ||
</div> | ||
</template> |
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<script setup lang="ts"> | ||
const { permissionDenied: { permissionDeniedVisible, permissionDeniedError }, error: { error } } = useModal() | ||
const router = useRouter() | ||
const navigateBack = () => { | ||
// If the user didn't land here directly, go back to the previous page. | ||
if (window.history.length > 1) { | ||
router.back() | ||
return | ||
} | ||
// Otherwise, just take them home. | ||
return router.push('/') | ||
} | ||
</script> | ||
|
||
<template> | ||
<StandardModal | ||
v-model:visible="permissionDeniedVisible" | ||
header="Permission Denied" | ||
sub-header="You aren't authorized to view this page" | ||
@closed="navigateBack" | ||
> | ||
<p> | ||
It is likely that you have gotten here either by entering in an invalid | ||
URL, or by clicking on a link or button that is not set up correctly. | ||
</p> | ||
<p> | ||
If you think this is a bug (something that you should have access | ||
to), or if you want to let us know how you got here, please file a bug. | ||
</p> | ||
<StandardDebug | ||
label="Technical Error" | ||
:value="permissionDeniedError" | ||
always | ||
/> | ||
</StandardModal> | ||
</template> |
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 |
---|---|---|
|
@@ -36,5 +36,8 @@ | |
& > .p-button { | ||
margin: 0.5rem 0; | ||
} | ||
min-height: calc(100vh - 9rem - 4px); | ||
justify-content: center; | ||
} | ||
</style> |
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 |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<script setup lang="ts"> | ||
import { dialogBreakpoints, smallDialogBreakpoints } from '@/lib/breakpoints' | ||
const props = withDefaults(defineProps<{ | ||
small?: boolean | ||
visible: boolean | ||
header: string | ||
subHeader?: string | ||
}>(), { | ||
small: false, | ||
subHeader: '' | ||
}) | ||
const emit = defineEmits<{ | ||
(e: 'update:visible', value: boolean): void | ||
(e: 'closed'): void | ||
}>() | ||
const visible = computed<boolean>({ | ||
get: () => props.visible, | ||
set: (value) => { emit('update:visible', value) } | ||
}) | ||
const breakpoints = computed(() => props.small ? smallDialogBreakpoints : dialogBreakpoints) | ||
const onHide = () => { emit('closed') } | ||
</script> | ||
|
||
<template> | ||
<PVDialog | ||
v-model:visible="visible" | ||
:closable="true" | ||
:modal="true" | ||
:close-on-escape="true" | ||
:dismissable-mask="true" | ||
:draggable="false" | ||
:breakpoints="breakpoints" | ||
@hide="onHide" | ||
> | ||
<template #header> | ||
<div class="flex justify-content-between align-items-center w-full"> | ||
<div> | ||
<div class="font-bold text-xl mb-2"> | ||
{{ props.header }} | ||
</div> | ||
<div | ||
v-if="props.subHeader" | ||
class="text-md" | ||
> | ||
{{ props.subHeader }}} | ||
</div> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<div class="flex flex-column gap-3 reset-child-margin"> | ||
<slot /> | ||
</div> | ||
</PVDialog> | ||
</template> | ||
|
||
<style lang="scss"> | ||
.reset-child-margin { | ||
& > * { | ||
margin: 0; | ||
} | ||
} | ||
</style> |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export default defineNuxtRouteMiddleware(async () => { | ||
/* TODO(grady) add Authorization here | ||
const { getMe } = useMSAL() | ||
const { isAdmin } = await getMe() | ||
if (!isAdmin.value) { | ||
return await navigateTo('/denied') | ||
} | ||
*/ | ||
}) |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<script setup lang="ts"> | ||
definePageMeta({ | ||
middleware: 'admin' | ||
}) | ||
</script> | ||
|
||
<template> | ||
<div> | ||
<NuxtPage /> | ||
</div> | ||
</template> |
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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<script setup lang="ts"> | ||
interface AdminItem { | ||
title: string | ||
icon: string | ||
desc: string | ||
href: string | ||
} | ||
const adminItems: AdminItem[] = [ | ||
{ | ||
title: 'PACTA Versions', | ||
icon: 'pi pi-check-square', | ||
desc: 'Create, update + manage versions of the PACTA algorithm + docker image', | ||
href: '/admin/pacta-version' | ||
} | ||
] | ||
</script> | ||
|
||
<template> | ||
<StandardContent> | ||
<TitleBar title="Admin Console" /> | ||
<p> | ||
This is the home for administrators of the PACTA platform. | ||
</p> | ||
<div class="grid align-items-stretch pb-3"> | ||
<div | ||
v-for="item in adminItems" | ||
:key="item.title" | ||
class="col-12 md:col-6" | ||
> | ||
<PVCard class="h-full"> | ||
<template #title> | ||
<div class="flex align-items-center"> | ||
<i | ||
:class="item.icon" | ||
class="text-2xl mr-3" | ||
/> | ||
<span>{{ item.title }}</span> | ||
</div> | ||
</template> | ||
<template #content> | ||
{{ item.desc }} | ||
</template> | ||
<template #footer> | ||
<div class="flex justify-content-end w-full"> | ||
<LinkButton | ||
class="p-button-sm" | ||
:to="item.href" | ||
icon="pi pi-arrow-right" | ||
icon-pos="right" | ||
label="Go" | ||
/> | ||
</div> | ||
</template> | ||
</PVCard> | ||
</div> | ||
</div> | ||
</standardcontent> | ||
</template> |
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<template> | ||
<div /> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
const { permissionDenied: { setPermissionDenied } } = useModal() | ||
setPermissionDenied(new Error('permission denied')) | ||
</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
Oops, something went wrong.