mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
feat: show modal on action error when no form
This commit is contained in:
parent
12399ca3df
commit
7f79fc812c
2 changed files with 16 additions and 12 deletions
|
@ -39,8 +39,6 @@ const { infos, system, apps } = await api
|
||||||
|
|
||||||
const allKeys = [...Object.keys(apps), ...Object.keys(system)]
|
const allKeys = [...Object.keys(apps), ...Object.keys(system)]
|
||||||
const selected = ref(allKeys)
|
const selected = ref(allKeys)
|
||||||
const serverError = ref('')
|
|
||||||
const isValid = ref<boolean | null>(null)
|
|
||||||
|
|
||||||
const hasBackupData = computed(() => {
|
const hasBackupData = computed(() => {
|
||||||
return !isEmptyValue(system) || !isEmptyValue(apps)
|
return !isEmptyValue(system) || !isEmptyValue(apps)
|
||||||
|
@ -65,12 +63,15 @@ async function restoreBackup() {
|
||||||
humanKey: { key: 'backups.restore', name: props.name },
|
humanKey: { key: 'backups.restore', name: props.name },
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
isValid.value = null
|
// FIXME back to backup list or home ?
|
||||||
})
|
})
|
||||||
.catch((err: APIError) => {
|
.catch((err: APIError) => {
|
||||||
if (!(err instanceof APIBadRequestError)) throw err
|
if (!(err instanceof APIBadRequestError)) throw err
|
||||||
serverError.value = err.message
|
modalConfirm(
|
||||||
isValid.value = false
|
err.message,
|
||||||
|
{ title: t('error'), bodyVariant: 'danger' },
|
||||||
|
{ cancelable: false },
|
||||||
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -201,12 +202,6 @@ function downloadBackup() {
|
||||||
<BFormCheckbox :value="appName" :aria-label="$t('check')" />
|
<BFormCheckbox :value="appName" :aria-label="$t('check')" />
|
||||||
</BListGroupItem>
|
</BListGroupItem>
|
||||||
</BListGroup>
|
</BListGroup>
|
||||||
|
|
||||||
<BFormInvalidFeedback id="backup-restore-feedback" :state="isValid">
|
|
||||||
<YAlert alert variant="danger" class="mb-0">
|
|
||||||
{{ serverError }}
|
|
||||||
</YAlert>
|
|
||||||
</BFormInvalidFeedback>
|
|
||||||
</BFormCheckboxGroup>
|
</BFormCheckboxGroup>
|
||||||
|
|
||||||
<div v-else class="alert alert-warning mb-0">
|
<div v-else class="alert alert-warning mb-0">
|
||||||
|
|
|
@ -4,6 +4,7 @@ import { useI18n } from 'vue-i18n'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
|
|
||||||
import api, { objectToParams } from '@/api'
|
import api, { objectToParams } from '@/api'
|
||||||
|
import { APIBadRequestError } from '@/api/errors'
|
||||||
import ConfigPanelsComponent from '@/components/ConfigPanels.vue'
|
import ConfigPanelsComponent from '@/components/ConfigPanels.vue'
|
||||||
import { formatConfigPanels, useConfigPanels } from '@/composables/configPanels'
|
import { formatConfigPanels, useConfigPanels } from '@/composables/configPanels'
|
||||||
import { useDomains } from '@/composables/data'
|
import { useDomains } from '@/composables/data'
|
||||||
|
@ -82,7 +83,7 @@ async function deleteDomain() {
|
||||||
|
|
||||||
api
|
api
|
||||||
.delete({
|
.delete({
|
||||||
uri: 'domains',
|
uri: `domains/${props.name}`,
|
||||||
cachePath: `domains.${props.name}`,
|
cachePath: `domains.${props.name}`,
|
||||||
data,
|
data,
|
||||||
humanKey: {
|
humanKey: {
|
||||||
|
@ -93,6 +94,14 @@ async function deleteDomain() {
|
||||||
.then(() => {
|
.then(() => {
|
||||||
router.push({ name: 'domain-list' })
|
router.push({ name: 'domain-list' })
|
||||||
})
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
if (!(err instanceof APIBadRequestError)) throw err
|
||||||
|
modalConfirm(
|
||||||
|
err.data.error,
|
||||||
|
{ headerVariant: 'danger', title: t('error') },
|
||||||
|
{ markdown: true, cancelable: false },
|
||||||
|
)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async function setAsDefaultDomain() {
|
async function setAsDefaultDomain() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue