[enh] Add Import and export button

This commit is contained in:
ljf 2020-12-21 06:14:24 +01:00
parent f2dbbe91d0
commit ec61c84939
3 changed files with 67 additions and 5 deletions

View file

@ -491,6 +491,7 @@
"users_new": "New user", "users_new": "New user",
"users_no": "No users.", "users_no": "No users.",
"users_import": "Import users", "users_import": "Import users",
"users_export": "Export users",
"users_import_csv_file": "CSV File", "users_import_csv_file": "CSV File",
"users_import_update": "Update existing users", "users_import_update": "Update existing users",
"users_import_delete": "Delete non listed users", "users_import_delete": "Delete non listed users",

View file

@ -117,6 +117,42 @@ body {
width: 1.25em !important; width: 1.25em !important;
} }
// custom css
.actions {
margin-bottom: 2rem;
display: flex;
justify-content: space-between;
@include media-breakpoint-down(xs) {
.buttons {
flex-direction: column;
justify-content: space-between;
}
}
@include media-breakpoint-down(sm) {
flex-direction: column-reverse;
margin-bottom: 2rem;
.buttons {
display: flex;
justify-content: space-between;
.btn {
margin-bottom: .5rem;
}
}
}
@include media-breakpoint-up(md) {
.btn ~ .btn {
margin-left: .5rem;
}
.btn ~ .dropdown-toggle-split {
margin-left: 0;
}
}
}
// Do not display ligatures in invalid-feedback to avoid confusion. // Do not display ligatures in invalid-feedback to avoid confusion.
.invalid-feedback { .invalid-feedback {
code { code {

View file

@ -12,10 +12,30 @@
{{ $t('groups_and_permissions_manage') }} {{ $t('groups_and_permissions_manage') }}
</b-button> </b-button>
<b-button variant="success" :to="{ name: 'user-create' }"> <div class="btn-group">
<icon iname="plus" /> <b-dropdown split class="m-2" variant="success"
{{ $t('users_new') }} :split-to="{name: 'user-create'}">
</b-button> <template #button-content>
<icon iname="plus" />
{{ $t('users_new') }}
</template>
<b-dropdown-item :to="{name: 'user-import'}">
<icon iname="plus" /> {{ $t('users_import') }}
</b-dropdown-item>
<b-dropdown-item @click="downloadExport">
<icon iname="download" /> {{ $t('users_export') }}
</b-dropdown-item>
</b-dropdown>
</div>
</div>
</div>
<template v-if="users === null">
<b-alert variant="warning" show>
<icon iname="exclamation-triangle" class="fa-fw mr-1" />
{{ $t('users_no') }}
</b-alert>
</template> </template>
<b-list-group> <b-list-group>
@ -53,7 +73,12 @@ export default {
search: '' search: ''
} }
}, },
methods: {
downloadExport () {
const host = this.$store.getters.host
window.open(`https://${host}/yunohost/api/users/export`, '_blank')
}
},
computed: { computed: {
...mapGetters(['users']), ...mapGetters(['users']),