forked from osoc24/loama
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(loama): add inbox to view & remove access request responses
- Loading branch information
1 parent
749a074
commit ba27728
Showing
5 changed files
with
110 additions
and
4 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 |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<template> | ||
<div class="container"> | ||
<div><p class="prefix">Accepted:</p><PhCheckCircle v-if="message.isAccepted" weight="bold" /><PhXCircle v-else weight="bold" /></div> | ||
<p><span class="prefix">To:</span> {{ message.target }}</p> | ||
<div> | ||
<span class="prefix">Requested Permissions: </span> | ||
<p v-for="label in aclLabels" :key="label">{{ label }}</p> | ||
</div> | ||
<div class="actions"> | ||
<LoButton @click="confirmMessage">Confirm</LoButton> | ||
</div> | ||
</div> | ||
</template> | ||
<script setup lang="ts"> | ||
import { PhCheckCircle, PhXCircle } from '@phosphor-icons/vue'; | ||
import { activeController, type RequestResponseMessage } from 'loama-controller'; | ||
import { computed } from 'vue'; | ||
import LoButton from '../LoButton.vue'; | ||
const props = defineProps<{ | ||
message: RequestResponseMessage, | ||
}>(); | ||
const emit = defineEmits<{ | ||
(e: "reload"): void, | ||
}>(); | ||
const aclLabels = computed(() => props.message.permissions.map(p => aclToLabel[p] ?? p)); | ||
const aclToLabel: Record<string, string> = { | ||
"acl:Read": "Read", | ||
"acl:Append": "Append", | ||
"acl:Write": "Write", | ||
"acl:Control": "Control", | ||
} | ||
const confirmMessage = async () => { | ||
await activeController.AccessRequest().removeRequest(props.message.id); | ||
emit("reload") | ||
} | ||
</script> | ||
<style lang="scss" scoped> | ||
.container { | ||
padding: .5rem; | ||
border: 1px solid var(--solid-purple); | ||
border-radius: .5rem; | ||
text-align: left; | ||
&>div { | ||
display: flex; | ||
flex-direction: row; | ||
align-items: center; | ||
gap: .25rem; | ||
} | ||
&>p { | ||
display: inline; | ||
} | ||
} | ||
.actions { | ||
float: right; | ||
} | ||
</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,41 @@ | ||
<template> | ||
<div class="header"> | ||
<h3>Request Responses</h3> | ||
<PhArrowClockwise weight="bold" :size="32" @click="reloadMessages" /> | ||
</div> | ||
<div class="request-list"> | ||
<RequestResponseMessage v-for="message in messages" :key="message.id" :message="message" | ||
@reload="reloadMessages" /> | ||
</div> | ||
</template> | ||
<script setup lang="ts"> | ||
import { activeController } from 'loama-controller'; | ||
import { PhArrowClockwise } from '@phosphor-icons/vue'; | ||
import RequestResponseMessage from './RequestResponseMessage.vue'; | ||
import { ref } from 'vue'; | ||
let messages = ref(await activeController.AccessRequest().loadRequestResponses()); | ||
const reloadMessages = async () => { | ||
messages.value = await activeController.AccessRequest().loadRequestResponses(); | ||
} | ||
</script> | ||
<style scoped lang="scss"> | ||
.request-list { | ||
display: flex; | ||
flex-direction: column; | ||
gap: .5rem; | ||
} | ||
.header { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
gap: 0.5rem; | ||
&>svg { | ||
justify-self: end; | ||
cursor: pointer; | ||
} | ||
} | ||
</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