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> <template>
<b-form-group <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" :description="description"
> >
<b-input <b-input

View file

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

View file

@ -79,7 +79,7 @@ export default {
}, },
setupForm (data) { setupForm (data) {
if (!data.config_panel) { if (!data.config_panel || data.config_panel.length === 0) {
this.panels = null this.panels = null
return 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 => { api.post(`apps/${this.id}/config`, { args: objectToParams(args) }).then(response => {
console.log('SUCCESS', response) console.log('SUCCESS', response)
}).catch(err => { }).catch(err => {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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