forked from verdnatura/salix-front
Merge pull request 'Account connections' (!424) from hyervoni/salix-front-mindshore:feature/AccountConnections into dev
Reviewed-on: verdnatura/salix-front#424 Reviewed-by: Alex Moreno <alexm@verdnatura.es> Reviewed-by: Javier Segarra <jsegarra@verdnatura.es>
This commit is contained in:
commit
57eadbc74e
|
@ -28,7 +28,7 @@ const toggleCardCheck = (item) => {
|
|||
<div class="title text-primary text-weight-bold text-h5">
|
||||
{{ $props.title }}
|
||||
</div>
|
||||
<QChip class="q-chip-color" outline size="sm">
|
||||
<QChip v-if="$props.id" class="q-chip-color" outline size="sm">
|
||||
{{ t('ID') }}: {{ $props.id }}
|
||||
</QChip>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,112 @@
|
|||
<script setup>
|
||||
import { ref } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import VnPaginate from 'components/ui/VnPaginate.vue';
|
||||
import CardList from 'src/components/ui/CardList.vue';
|
||||
import VnLv from 'src/components/ui/VnLv.vue';
|
||||
|
||||
import { toDateTimeFormat } from 'src/filters/date.js';
|
||||
import axios from 'axios';
|
||||
import useNotify from 'src/composables/useNotify.js';
|
||||
import { useVnConfirm } from 'composables/useVnConfirm';
|
||||
|
||||
const { t } = useI18n();
|
||||
const router = useRouter();
|
||||
const { notify } = useNotify();
|
||||
const { openConfirmationModal } = useVnConfirm();
|
||||
|
||||
const paginateRef = ref(null);
|
||||
const filter = {
|
||||
fields: ['id', 'created', 'userId'],
|
||||
include: {
|
||||
relation: 'user',
|
||||
scope: {
|
||||
fields: ['username'],
|
||||
},
|
||||
},
|
||||
order: 'created DESC',
|
||||
};
|
||||
|
||||
const urlPath = 'AccessTokens';
|
||||
|
||||
const refresh = () => paginateRef.value.fetch();
|
||||
|
||||
const navigate = (id) => router.push({ name: 'AccountSummary', params: { id } });
|
||||
|
||||
const killSession = async (id) => {
|
||||
try {
|
||||
await axios.delete(`${urlPath}/${id}`);
|
||||
paginateRef.value.fetch();
|
||||
notify(t('Session killed'), 'positive');
|
||||
} catch (error) {
|
||||
console.error('Error killing session', error);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<QPage class="column items-center q-pa-md">
|
||||
<div class="vn-card-list">
|
||||
<VnPaginate
|
||||
:data-key="urlPath"
|
||||
ref="paginateRef"
|
||||
:filter="filter"
|
||||
:url="urlPath"
|
||||
order="created DESC"
|
||||
auto-load
|
||||
>
|
||||
<template #body="{ rows }">
|
||||
<CardList
|
||||
:key="row.id"
|
||||
:title="row.user?.username"
|
||||
@click="navigate(row.userId)"
|
||||
v-for="row of rows"
|
||||
>
|
||||
<template #list-items>
|
||||
<div style="flex-direction: column; width: 100%">
|
||||
<VnLv
|
||||
:label="t('connections.username')"
|
||||
:value="row.user?.username"
|
||||
>
|
||||
</VnLv>
|
||||
<VnLv
|
||||
:label="t('connections.created')"
|
||||
:value="toDateTimeFormat(row.created)"
|
||||
>
|
||||
</VnLv>
|
||||
</div>
|
||||
</template>
|
||||
<template #actions>
|
||||
<QBtn
|
||||
class="q-mt-xs"
|
||||
:label="t('connections.killSession')"
|
||||
@click.stop="
|
||||
openConfirmationModal(
|
||||
t('Session will be killed'),
|
||||
t('Are you sure you want to continue?'),
|
||||
() => killSession(row.id)
|
||||
)
|
||||
"
|
||||
outline
|
||||
/>
|
||||
</template>
|
||||
</CardList>
|
||||
</template>
|
||||
</VnPaginate>
|
||||
</div>
|
||||
<QPageSticky position="bottom-right" :offset="[18, 18]">
|
||||
<QBtn fab icon="refresh" color="primary" @click="refresh()">
|
||||
<QTooltip>{{ t('connections.refresh') }}</QTooltip>
|
||||
</QBtn>
|
||||
</QPageSticky>
|
||||
</QPage>
|
||||
</template>
|
||||
|
||||
<i18n>
|
||||
es:
|
||||
Session killed: Sesión matada
|
||||
Session will be killed: Se va a matar la sesión
|
||||
Are you sure you want to continue?: ¿Seguro que quieres continuar?
|
||||
</i18n>
|
|
@ -78,6 +78,11 @@ samba:
|
|||
verifyCertificate: Verify certificate
|
||||
testConnection: Test connection
|
||||
success: Samba connection established!
|
||||
connections:
|
||||
refresh: Refresh
|
||||
username: Username
|
||||
created: Created
|
||||
killSession: Kill session
|
||||
acls:
|
||||
role: Role
|
||||
accessType: Access type
|
||||
|
|
|
@ -89,6 +89,11 @@ samba:
|
|||
Verify certificate: Verificar certificado
|
||||
testConnection: Probar conexión
|
||||
success: ¡Conexión con Samba establecida!
|
||||
connections:
|
||||
refresh: Actualizar
|
||||
username: Nombre de usuario
|
||||
created: Creado
|
||||
killSession: Matar sesión
|
||||
acls:
|
||||
role: Rol
|
||||
accessType: Tipo de acceso
|
||||
|
|
|
@ -11,7 +11,13 @@ export default {
|
|||
component: RouterView,
|
||||
redirect: { name: 'AccountMain' },
|
||||
menus: {
|
||||
main: ['AccountList', 'AccountAliasList', 'AccountRoles', 'AccountAcls'],
|
||||
main: [
|
||||
'AccountList',
|
||||
'AccountAliasList',
|
||||
'AccountRoles',
|
||||
'AccountAcls',
|
||||
'AccountConnections',
|
||||
],
|
||||
card: [],
|
||||
},
|
||||
children: [
|
||||
|
@ -39,6 +45,15 @@ export default {
|
|||
},
|
||||
component: () => import('src/pages/Account/AccountAliasList.vue'),
|
||||
},
|
||||
{
|
||||
path: 'connections',
|
||||
name: 'AccountConnections',
|
||||
meta: {
|
||||
title: 'connections',
|
||||
icon: 'check',
|
||||
},
|
||||
component: () => import('src/pages/Account/AccountConnections.vue'),
|
||||
},
|
||||
{
|
||||
path: 'acls',
|
||||
name: 'AccountAcls',
|
||||
|
|
|
@ -10,6 +10,7 @@ import wagon from './modules/wagon';
|
|||
import supplier from './modules/Supplier';
|
||||
import travel from './modules/travel';
|
||||
import department from './modules/department';
|
||||
import role from './modules/role';
|
||||
import ItemType from './modules/itemType';
|
||||
import shelving from 'src/router/modules/shelving';
|
||||
import order from 'src/router/modules/order';
|
||||
|
@ -21,7 +22,6 @@ import zone from 'src/router/modules/zone';
|
|||
import account from './modules/account';
|
||||
import monitor from 'src/router/modules/monitor';
|
||||
import mailAlias from './modules/mailAlias';
|
||||
import role from './modules/role';
|
||||
|
||||
const routes = [
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue