Added information page about components in UI v2

This commit is contained in:
Antoine Nguyen
2023-01-25 13:57:44 +01:00
parent 354ab68840
commit 2d9ae1c89b
12 changed files with 155 additions and 4 deletions
+7
View File
@@ -0,0 +1,7 @@
import repository from './repository'
export default {
getComponentsInformation () {
return repository.get('/admin/components')
}
}
@@ -0,0 +1,72 @@
<template>
<v-card class="mt-6">
<v-card-title>
<translate>Installed components</translate>
</v-card-title>
<v-card-text>
<v-alert
outlined
type="success"
text
border="left"
v-if="updatesAvailable"
>
<translate tag="p">One or more updates are available</translate>
<translate tag="p" class="text-body-2">
Check out the following list to find related components
</translate>
</v-alert>
<v-data-table
:headers="headers"
:items="components"
:item-class="getItemBackground"
hide-default-footer
>
<template v-slot:item.last_version="{ item }">
<template v-if="item.changelog_url">
<a :href="item.changelog_url" target="_blank">{{ item.last_version }}</a>
</template>
<template v-else>
{{ item.last_version }}
</template>
</template>
</v-data-table>
</v-card-text>
</v-card>
</template>
<script>
import adminApi from '@/api/admin'
export default {
computed: {
updatesAvailable () {
return this.components.filter(item => item.update).length > 0
}
},
data () {
return {
components: [],
headers: [
{ text: this.$gettext('Name'), value: 'name' },
{ text: this.$gettext('Installed version'), value: 'version' },
{ text: this.$gettext('Latest version'), value: 'last_version' },
{ text: this.$gettext('Description'), value: 'description' }
]
}
},
methods: {
getItemBackground (item) {
if (item.update) {
return 'green lighten-5'
}
return ''
}
},
mounted () {
adminApi.getComponentsInformation().then(resp => {
this.components = resp.data
})
}
}
</script>
@@ -165,7 +165,7 @@ export default {
headers: [
{ text: this.$gettext('Name'), value: 'name' },
{ text: this.$gettext('Aliases'), value: 'domainalias_count' },
{ text: this.$gettext('DNS status'), value: 'dns_global_status', sortable: false, align: 'center' },
{ text: this.$gettext('DNS status'), value: 'dns_global_status', sortable: false },
{ text: this.$gettext('Sending limit'), value: 'message_limit' },
{ text: this.$gettext('Quota'), value: 'allocated_quota_in_percent' },
{ text: this.$gettext('Actions'), value: 'actions', sortable: false, align: 'right' }
@@ -201,6 +201,12 @@ export default {
text: this.$gettext('Settings'),
children: [],
roles: ['SuperAdmins']
},
{
icon: 'mdi-information',
text: this.$gettext('Information'),
roles: ['SuperAdmins'],
to: { name: 'Information' }
}
],
userSettingsMenuItems: [
+9
View File
@@ -136,6 +136,15 @@ const routes = [
allowedRoles: ['DomainAdmins', 'SuperAdmins']
}
},
{
path: '/information',
name: 'Information',
component: () => import('../views/admin/Information.vue'),
meta: {
requiresAuth: true,
allowedRoles: ['SuperAdmins']
}
},
{
path: '/user/api',
name: 'APISetup',
+19
View File
@@ -0,0 +1,19 @@
<template>
<div>
<v-toolbar flat>
<v-toolbar-title><translate>Information</translate></v-toolbar-title>
</v-toolbar>
<components-information-table />
</div>
</template>
<script>
import ComponentsInformationTable from '@/components/admin/ComponentsInformationTable'
export default {
components: {
ComponentsInformationTable
}
}
</script>
@@ -35,7 +35,7 @@
</v-btn>
</div>
<div>
<a @click="returnLogin" class="float-right primary--text"><translate>Return to login?</translate></a>
<a @click="returnLogin" class="float-right primary--text"><translate>Return to login</translate></a>
</div>
</v-col>
<confirm-dialog ref="dialog_response">