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">
|
<script setup lang="ts">
|
||||||
import { computed } from 'vue'
|
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<{
|
const props = defineProps<{
|
||||||
request: Obj
|
request: APIRequest
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const store = useStore()
|
// FIXME probably doesn't need a computed here
|
||||||
|
const warningMessage = computed(() => {
|
||||||
const warning = computed(() => {
|
const messages = props.request.action!.messages
|
||||||
const messages = props.request.messages
|
|
||||||
return messages[messages.length - 1]
|
return messages[messages.length - 1]
|
||||||
})
|
})
|
||||||
|
|
||||||
function dismiss() {
|
|
||||||
store.dispatch('DISMISS_WARNING', props.request)
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<!-- This card receives style from `ViewLockOverlay` if used inside it -->
|
<ModalOverlay
|
||||||
<div>
|
:request="request"
|
||||||
<BCardBody body-class="alert alert-warning">
|
footer-variant="warning"
|
||||||
<div v-html="warning.text" />
|
body-variant="warning"
|
||||||
</BCardBody>
|
:hide-footer="false"
|
||||||
|
>
|
||||||
<BCardFooter footer-bg-variant="warning">
|
<div v-html="warningMessage.text" />
|
||||||
<BButton variant="light" size="sm" v-t="'ok'" @click="dismiss" />
|
</ModalOverlay>
|
||||||
</BCardFooter>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.card-body {
|
|
||||||
padding-bottom: 1.5rem !important;
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue