mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
refactor: rework ModalWarning to new requests
This commit is contained in:
parent
f0bd35e2b1
commit
519de69d29
1 changed files with 15 additions and 28 deletions
|
@ -1,40 +1,27 @@
|
|||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import { useStore } from 'vuex'
|
||||
|
||||
import type { Obj } from '@/types/commons'
|
||||
import ModalOverlay from '@/components/modals/ModalOverlay.vue'
|
||||
import type { APIRequest } from '@/composables/useRequests'
|
||||
|
||||
const props = defineProps<{
|
||||
request: Obj
|
||||
request: APIRequest
|
||||
}>()
|
||||
|
||||
const store = useStore()
|
||||
|
||||
const warning = computed(() => {
|
||||
const messages = props.request.messages
|
||||
// FIXME probably doesn't need a computed here
|
||||
const warningMessage = computed(() => {
|
||||
const messages = props.request.action!.messages
|
||||
return messages[messages.length - 1]
|
||||
})
|
||||
|
||||
function dismiss() {
|
||||
store.dispatch('DISMISS_WARNING', props.request)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<!-- This card receives style from `ViewLockOverlay` if used inside it -->
|
||||
<div>
|
||||
<BCardBody body-class="alert alert-warning">
|
||||
<div v-html="warning.text" />
|
||||
</BCardBody>
|
||||
|
||||
<BCardFooter footer-bg-variant="warning">
|
||||
<BButton variant="light" size="sm" v-t="'ok'" @click="dismiss" />
|
||||
</BCardFooter>
|
||||
</div>
|
||||
<ModalOverlay
|
||||
:request="request"
|
||||
footer-variant="warning"
|
||||
body-variant="warning"
|
||||
:hide-footer="false"
|
||||
>
|
||||
<div v-html="warningMessage.text" />
|
||||
</ModalOverlay>
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.card-body {
|
||||
padding-bottom: 1.5rem !important;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
</style>
|
||||
|
|
Loading…
Reference in a new issue