feat: multi-query/upload .sql en query runner + selector BD por rol
This commit is contained in:
@@ -120,6 +120,7 @@
|
||||
Name = registro.name;
|
||||
Description = registro.description;
|
||||
Submodules = [...registro.submodules];
|
||||
ConxDBs = [...(registro.conx_dbs || [])];
|
||||
EsPortalCliente = registro.es_portal_cliente || false;
|
||||
EsPortalPartner = registro.es_portal_partner || false;
|
||||
HomeUrl = registro.home_url || '';
|
||||
@@ -254,6 +255,20 @@
|
||||
</template>
|
||||
</select>
|
||||
</div>
|
||||
<div class="mt-4 p-3 border rounded-md bg-slate-50">
|
||||
<p class="font-semibold text-sm mb-2">Bases de datos permitidas (Query Runner)</p>
|
||||
<div class="grid grid-cols-2 gap-1 max-h-32 overflow-y-auto">
|
||||
<template x-for="con in conexiones" :key="con.ID">
|
||||
<div>
|
||||
<input type="checkbox" :value="con.ID" :id="'edit-conxdb-' + con.ID"
|
||||
:checked="ConxDBs.some(c => c.ID === con.ID)"
|
||||
@change="if($event.target.checked) { ConxDBs.push(con) } else { ConxDBs = ConxDBs.filter(c => c.ID !== con.ID) }"
|
||||
class="mr-2">
|
||||
<label :for="'edit-conxdb-' + con.ID" x-text="con.nombre" class="text-xs"></label>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-4 flex justify-between">
|
||||
<button type="submit" class="bg-[#8eb02f] text-white px-4 py-2 rounded">Guardar Cambios</button>
|
||||
<button type="button" class="bg-gray-600 text-white px-4 py-2 rounded"
|
||||
@@ -326,6 +341,20 @@
|
||||
</template>
|
||||
</select>
|
||||
</div>
|
||||
<div class="mt-4 p-3 border rounded-md bg-slate-50">
|
||||
<p class="font-semibold text-sm mb-2">Bases de datos permitidas (Query Runner)</p>
|
||||
<div class="grid grid-cols-2 gap-1 max-h-32 overflow-y-auto">
|
||||
<template x-for="con in conexiones" :key="con.ID">
|
||||
<div>
|
||||
<input type="checkbox" :value="con.ID" :id="'add-conxdb-' + con.ID"
|
||||
:checked="newConxDBs.some(c => c.ID === con.ID)"
|
||||
@change="if($event.target.checked) { newConxDBs.push(con) } else { newConxDBs = newConxDBs.filter(c => c.ID !== con.ID) }"
|
||||
class="mr-2">
|
||||
<label :for="'add-conxdb-' + con.ID" x-text="con.nombre" class="text-xs"></label>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-4 flex justify-between">
|
||||
<button type="submit" class="bg-[#8eb02f] text-white px-4 py-2 rounded">Guardar</button>
|
||||
<button type="button" class="bg-gray-600 text-white px-4 py-2 rounded"
|
||||
@@ -378,6 +407,9 @@
|
||||
|
||||
sinregistro: '',
|
||||
modules: [],
|
||||
conexiones: [],
|
||||
ConxDBs: [],
|
||||
newConxDBs: [],
|
||||
|
||||
|
||||
|
||||
@@ -405,10 +437,11 @@
|
||||
fetch(`/app/loadroles?page=${page}${search}`)
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
this.totalRecords = data.total; // Establece el total de registros aquí
|
||||
this.totalRecords = data.total;
|
||||
this.modulos = data.modules;
|
||||
this.registros = data.roles; // Asignar
|
||||
this.totalPages = data.totalPages; // Asignar total de páginas
|
||||
this.registros = data.roles;
|
||||
this.conexiones = data.conexiones || [];
|
||||
this.totalPages = data.totalPages;
|
||||
this.createPagination(this.totalPages, page);
|
||||
if (data.roles.length === 0) {
|
||||
this.sinregistro = true;
|
||||
@@ -496,7 +529,8 @@
|
||||
es_portal_cliente: this.newEsPortalCliente,
|
||||
es_portal_partner: this.newEsPortalPartner,
|
||||
home_url: this.newHomeUrl,
|
||||
submodules: selectedSubmodules.flatMap(modulo => modulo.submodules)
|
||||
submodules: selectedSubmodules.flatMap(modulo => modulo.submodules),
|
||||
conx_dbs: this.newConxDBs
|
||||
};
|
||||
|
||||
fetch('/app/roles', {
|
||||
@@ -510,8 +544,9 @@
|
||||
this.newDescription = '';
|
||||
this.newEsPortalCliente = false;
|
||||
this.newEsPortalPartner = false;
|
||||
this.newConxDBs = [];
|
||||
this.modulos.forEach(modulo => {
|
||||
modulo.submodules.forEach(submodulo => submodulo.checked = false); // Reset checkboxes
|
||||
modulo.submodules.forEach(submodulo => submodulo.checked = false);
|
||||
});
|
||||
|
||||
this.closeModal();
|
||||
@@ -557,7 +592,8 @@
|
||||
es_portal_cliente: this.EsPortalCliente,
|
||||
es_portal_partner: this.EsPortalPartner,
|
||||
home_url: this.HomeUrl,
|
||||
submodules: this.submodulos
|
||||
submodules: this.submodulos,
|
||||
conx_dbs: this.ConxDBs
|
||||
})
|
||||
})
|
||||
.then(response => response.json())
|
||||
@@ -567,6 +603,7 @@
|
||||
this.EsPortalCliente = false;
|
||||
this.EsPortalPartner = false;
|
||||
this.submodulos = [];
|
||||
this.ConxDBs = [];
|
||||
this.modulos.forEach(modulo => {
|
||||
modulo.submodules.forEach(submodulo => {
|
||||
submodulo.checked = false;
|
||||
|
||||
Reference in New Issue
Block a user