fix some cols and catch

This commit is contained in:
Axolotle 2020-10-13 21:26:46 +02:00
parent 14bdfbce2f
commit 3cb031df99
10 changed files with 62 additions and 38 deletions

View file

@ -1,6 +1,7 @@
<template>
<b-form-group
label-cols="auto" :label="label" :label-for="'input-' + id"
label-cols-md="4" label-cols-lg="2"
:label="label" :label-for="'input-' + id"
:description="description"
>
<b-input

View file

@ -21,7 +21,7 @@
<small v-html="$t('domain_add_dns_doc')" />
<b-form-group
label-cols="auto" class="mt-2"
label-cols-md="2" class="mt-2"
:label="$t('domain_name')" label-for="input-domain" label-tag="strong"
>
<b-input
@ -52,7 +52,7 @@
<small>{{ $t('domain_add_dyndns_doc') }}</small>
<b-form-group
label-cols="auto" class="mt-2"
label-cols-md="2" class="mt-2"
:label="$t('domain_name')" label-for="input-dynDomain"
>
<adress-input-select

View file

@ -79,7 +79,7 @@ export default {
},
setupForm (data) {
if (!data.config_panel) {
if (!data.config_panel || data.config_panel.length === 0) {
this.panels = null
return
}
@ -114,6 +114,7 @@ export default {
}
}
// FIXME not tested at all, route is currently broken
api.post(`apps/${this.id}/config`, { args: objectToParams(args) }).then(response => {
console.log('SUCCESS', response)
}).catch(err => {

View file

@ -167,11 +167,7 @@ export default {
else if (action === 'manual_renew_LE') uri += '?force'
else if (action === 'revert_to_selfsigned') uri += '?self_signed&force'
api.post(uri, {}).then(response => {
this.fetchData()
}).catch(() => {
// FIXME api POST calls seems to always return null, error or not
})
api.post(uri, {}).then(() => this.fetchData())
}
},

View file

@ -98,11 +98,8 @@ export default {
setAsDefaultDomain () {
this.$store.dispatch('PUT',
{ uri: 'domains/main', data: { new_main_domain: this.name }, storeKey: 'main_domain' }
).then(data => {
console.log(data)
}).catch(() => {
// FIXME PUT /domains/main return empty text response instead of json
// commit from here for now
).then(() => {
// FIXME have to commit here since the response's is empty
this.$store.commit('UPDATE_MAIN_DOMAIN', this.name)
})
}

View file

@ -48,7 +48,6 @@ export default {
api.post('login', { password: this.currentPassword }).then(() => {
api.put('adminpw', { new_password: password }).then(() => {
this.$store.dispatch('DISCONNECT')
this.$router.push({ name: 'login' })
}).catch(err => {
this.error.password = err.message
this.isValid.password = false

View file

@ -18,7 +18,10 @@
</template>
<!-- REBOOT -->
<b-form-group label-cols="auto" :label="$t('tools_reboot_btn')" label-for="reboot">
<b-form-group
label-cols="5" label-cols-sm="3" label-cols-md="2"
:label="$t('tools_reboot_btn')" label-for="reboot"
>
<b-button
variant="danger" id="reboot" v-b-modal.confirm-action
@click="action = 'reboot'"
@ -29,7 +32,10 @@
<hr>
<!-- SHUTDOWN -->
<b-form-group label-cols="auto" :label="$t('tools_shutdown_btn')" label-for="shutdown">
<b-form-group
label-cols="5" label-cols-sm="3" label-cols-md="2"
:label="$t('tools_shutdown_btn')" label-for="shutdown"
>
<b-button
variant="danger" id="shutdown" v-b-modal.confirm-action
@click="action = 'shutdown'"
@ -68,11 +74,10 @@ export default {
methods: {
triggerAction (action) {
api.put(action + '?force').then(() => {
// Use 'RESET_CONNECTED' and not 'DISCONNECT' else user will be redirect to login
this.$store.dispatch('RESET_CONNECTED')
this.inProcess = true
this.tryToReconnect()
}).catch(err => {
console.log('ERR', err)
})
},
@ -80,7 +85,7 @@ export default {
// FIXME need to be tested out of webpack-dev-server
setTimeout(() => {
// Try to get a response from the server after boot/reboot
// use `api.fetch` to not trigger base response helpers
// use `api.fetch` to not trigger base response handlers
api.fetch('GET', 'logout').then(response => {
// Server responds with `Unauthorized`, we can display the login input
if (response.status === 401) {

View file

@ -2,7 +2,7 @@
<basic-form :header="$t('tools_webadmin_settings')" @submit.prevent="onSubmit" no-footer>
<!-- LOCALE -->
<b-form-group
label-cols="0" label-cols-lg="2" label-class="font-weight-bold"
label-cols-md="4" label-cols-lg="2" label-class="font-weight-bold"
:label="$t('tools_webadmin.locale')" label-for="locale"
>
<b-select
@ -15,7 +15,7 @@
<!-- FALLBACK LOCALE -->
<b-form-group
label-cols="0" label-cols-lg="2" label-class="font-weight-bold"
label-cols-md="4" label-cols-lg="2" label-class="font-weight-bold"
:label="$t('tools_webadmin.fallback_locale')" label-for="fallback-locale"
>
<b-select
@ -28,7 +28,7 @@
<!-- CACHE -->
<b-form-group
label-cols="0" label-cols-lg="2"
label-cols-md="4" label-cols-lg="2"
:label="$t('tools_webadmin.cache')" label-for="cache" label-class="font-weight-bold"
>
<b-checkbox v-model="currentCache" id="cache" switch>
@ -43,7 +43,7 @@
<!-- TRANSITIONS -->
<b-form-group
label-cols="0" label-cols-lg="2"
label-cols-md="4" label-cols-lg="2"
:label="$t('tools_webadmin.transitions')" label-for="transitions" label-class="font-weight-bold"
>
<b-checkbox v-model="currentTransitions" id="transitions" switch>
@ -55,7 +55,7 @@
<!-- EXPERIMENTAL MODE (dev environment only)-->
<b-form-group
v-if="isDev"
label-cols="0" label-cols-lg="2" label-class="font-weight-bold"
label-cols-md="4" label-cols-lg="2" label-class="font-weight-bold"
label-for="experimental"
>
<template v-slot:label>

View file

@ -1,7 +1,10 @@
<template lang="html">
<basic-form :header="$t('users_new')" @submit.prevent="onSubmit">
<!-- USER NAME -->
<b-form-group label-cols="auto" :label="$t('user_username')" label-for="input-username">
<b-form-group
label-cols-md="4" label-cols-lg="2"
:label="$t('user_username')" label-for="input-username"
>
<b-input
id="input-username" :placeholder="$t('placeholder.username')"
aria-describedby="username-feedback" required
@ -14,7 +17,7 @@
</b-form-group>
<!-- USER FULLNAME -->
<b-form-group label-cols="auto">
<b-form-group label-cols-md="4" label-cols-lg="2">
<template v-slot:label aria-hidden="true">
{{ $t('user_fullname') }}
</template>
@ -51,7 +54,10 @@
</b-form-group>
<!-- USER EMAIL -->
<b-form-group label-cols="auto" :label="$t('user_email')" label-for="input-email">
<b-form-group
label-cols-md="4" label-cols-lg="2"
:label="$t('user_email')" label-for="input-email"
>
<adress-input-select
id="input-email" feedback-id="email-feedback"
v-model="form.mail" :options="domains"
@ -65,7 +71,8 @@
<!-- MAILBOX QUOTA -->
<b-form-group
label-cols="auto" :label="$t('user_mailbox_quota')" label-for="input-mailbox-quota"
label-cols-md="4" label-cols-lg="2"
:label="$t('user_mailbox_quota')" label-for="input-mailbox-quota"
:description="$t('mailbox_quota_description')"
>
<b-input-group append="M">
@ -77,7 +84,10 @@
</b-form-group>
<!-- USER PASSWORD -->
<b-form-group label-cols="auto" :label="$t('password')" label-for="input-password">
<b-form-group
label-cols-md="4" label-cols-lg="2"
:label="$t('password')" label-for="input-password"
>
<b-input
id="input-password" placeholder="••••••••"
aria-describedby="password-feedback" required
@ -91,7 +101,8 @@
<!-- USER PASSWORD CONFIRMATION -->
<b-form-group
label-cols="auto" :label="$t('password_confirmation')" label-for="input-confirmation"
label-cols-md="4" label-cols-lg="2"
:label="$t('password_confirmation')" label-for="input-confirmation"
:description="$t('good_practices_about_user_password')"
>
<b-input

View file

@ -4,7 +4,7 @@
@submit.prevent="onSubmit"
>
<!-- USER FULLNAME -->
<b-form-group label-cols="auto">
<b-form-group label-cols-md="4" label-cols-lg="2">
<template v-slot:label aria-hidden="true">
{{ $t('user_fullname') }}
</template>
@ -41,7 +41,10 @@
</b-form-group>
<!-- USER EMAIL -->
<b-form-group label-cols="auto" :label="$t('user_email')" label-for="input-email">
<b-form-group
label-cols-md="4" label-cols-lg="2"
:label="$t('user_email')" label-for="input-email"
>
<adress-input-select
id="input-email" feedback-id="email-feedback"
v-model="form.mail" :options="domains"
@ -57,7 +60,8 @@
<!-- MAILBOX QUOTA -->
<hr>
<b-form-group
label-cols="auto" :label="$t('user_mailbox_quota')" label-for="input-mailbox-quota"
label-cols-md="4" label-cols-lg="2"
:label="$t('user_mailbox_quota')" label-for="input-mailbox-quota"
:description="$t('mailbox_quota_description')"
>
<b-input-group append="M">
@ -70,7 +74,10 @@
<!-- MAIL ALIASES -->
<hr>
<b-form-group label-cols="auto" :label="$t('user_emailaliases')" class="mail-list">
<b-form-group
label-cols-md="4" label-cols-lg="2"
:label="$t('user_emailaliases')" class="mail-list"
>
<adress-input-select
v-for="(alias, index) in form['mail-aliases']" :key="index"
v-model="form['mail-aliases'][index]" :options="domains"
@ -80,7 +87,10 @@
<!-- MAIL FORWARD -->
<hr>
<b-form-group label-cols="auto" :label="$t('user_emailforward')" class="mail-list">
<b-form-group
label-cols-md="4" label-cols-lg="2"
:label="$t('user_emailforward')" class="mail-list"
>
<b-input
v-for="(forward, index) in form['mail-forward']" :key="index"
id="input-mailbox-quota" :placeholder="$t('user_new_forward')"
@ -90,7 +100,10 @@
<!-- USER PASSWORD -->
<hr>
<b-form-group label-cols="auto" :label="$t('password')" label-for="input-password">
<b-form-group
label-cols-md="4" label-cols-lg="2"
:label="$t('password')" label-for="input-password"
>
<b-input
id="input-password" placeholder="••••••••"
aria-describedby="password-feedback"
@ -104,7 +117,8 @@
<!-- USER PASSWORD CONFIRMATION -->
<b-form-group
label-cols="auto" :label="$t('password_confirmation')" label-for="input-confirmation"
label-cols-md="4" label-cols-lg="2"
:label="$t('password_confirmation')" label-for="input-confirmation"
:description="$t('good_practices_about_user_password')"
>
<b-input