Campi separati per copiaDaSelect
This commit is contained in:
parent
1d42f4f06c
commit
2630838c5c
@ -344,7 +344,7 @@
|
||||
<!-- Selezione Job -->
|
||||
<div style="flex: 1;">
|
||||
<label for="jobSelect" style="display: block; margin-bottom: 5px; font-weight: bold;">Seleziona Job:</label>
|
||||
<select id="jobSelect" style="width: 100%; padding: 8px; border: 1px solid #ccc; border-radius: 4px;">
|
||||
<select id="jobSelect" onchange="toggleJobSpecificFields()" style="width: 100%; padding: 8px; border: 1px solid #ccc; border-radius: 4px;">
|
||||
<option value="">Caricamento job disponibili...</option>
|
||||
</select>
|
||||
</div>
|
||||
@ -370,10 +370,31 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Seconda riga: Parametri e Pulsante -->
|
||||
<!-- Sezione specifica per copiaDaSelectJob -->
|
||||
<div id="copiaDaSelectFields" style="display: none; width: 100%; margin-bottom: 15px; padding: 15px; background-color: #e3f2fd; border-radius: 5px; border-left: 4px solid #2196f3;">
|
||||
<h4 style="margin-top: 0; color: #1976d2;">📊 Parametri Copia da SELECT Query</h4>
|
||||
|
||||
<!-- Query SQL -->
|
||||
<div style="margin-bottom: 15px;">
|
||||
<label for="selectQuery" style="display: block; margin-bottom: 5px; font-weight: bold;">🔍 Query SQL SELECT:</label>
|
||||
<textarea id="selectQuery" placeholder="SELECT p.* FROM CONSUNI_PERIODICO.ConsulenzaUnica.dbo.Proposta p WHERE..."
|
||||
style="width: 100%; height: 120px; padding: 8px; border: 1px solid #ccc; border-radius: 4px; font-family: 'Courier New', monospace; font-size: 13px; resize: vertical;"></textarea>
|
||||
<small style="color: #666; display: block; margin-top: 2px;">Inserisci la query SQL completa. Supporta query complesse con JOIN, WHERE, funzioni, ecc.</small>
|
||||
</div>
|
||||
|
||||
<!-- Tabella di destinazione -->
|
||||
<div style="margin-bottom: 15px;">
|
||||
<label for="outputTable" style="display: block; margin-bottom: 5px; font-weight: bold;">🎯 Tabella di Destinazione:</label>
|
||||
<input type="text" id="outputTable" placeholder="es: CONSUNI_PERIODICO.ConsulenzaUnica.dbo.Proposta"
|
||||
style="width: 100%; padding: 8px; border: 1px solid #ccc; border-radius: 4px;">
|
||||
<small style="color: #666; display: block; margin-top: 2px;">Nome completo della tabella di destinazione (schema.database.tabella)</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Seconda riga: Parametri generici e Pulsante -->
|
||||
<div style="display: flex; gap: 15px; width: 100%; align-items: flex-end;">
|
||||
<!-- Parametri Job -->
|
||||
<div style="flex: 2;">
|
||||
<!-- Parametri Job generici -->
|
||||
<div id="genericParameters" style="flex: 2;">
|
||||
<label for="jobParameters" style="display: block; margin-bottom: 5px; font-weight: bold;">Parametri Job (formato: chiave=valore, separati da virgola):</label>
|
||||
<input type="text" id="jobParameters" placeholder="es: tabelle=C6Mart.SPB_W6CatESG,C6mart.W6CLIESG"
|
||||
style="width: 100%; padding: 8px; border: 1px solid #ccc; border-radius: 4px;">
|
||||
@ -1067,6 +1088,21 @@
|
||||
}
|
||||
}
|
||||
|
||||
// Funzione per mostrare/nascondere campi specifici per job
|
||||
function toggleJobSpecificFields() {
|
||||
const jobSelect = document.getElementById('jobSelect');
|
||||
const copiaDaSelectFields = document.getElementById('copiaDaSelectFields');
|
||||
const genericParameters = document.getElementById('genericParameters');
|
||||
|
||||
if (jobSelect.value === 'copiaDaSelectJob') {
|
||||
copiaDaSelectFields.style.display = 'block';
|
||||
genericParameters.style.display = 'none';
|
||||
} else {
|
||||
copiaDaSelectFields.style.display = 'none';
|
||||
genericParameters.style.display = 'block';
|
||||
}
|
||||
}
|
||||
|
||||
// Carica i job disponibili per il lancio
|
||||
function loadAvailableJobs() {
|
||||
const jobSelect = document.getElementById('jobSelect');
|
||||
@ -1316,12 +1352,28 @@
|
||||
|
||||
// Parsing parametri personalizzati
|
||||
const parameters = {};
|
||||
if (parametersText) {
|
||||
|
||||
// Gestione speciale per copiaDaSelectJob
|
||||
if (selectedJobName === 'copiaDaSelectJob') {
|
||||
const selectQuery = document.getElementById('selectQuery').value.trim();
|
||||
const outputTable = document.getElementById('outputTable').value.trim();
|
||||
|
||||
if (!selectQuery) {
|
||||
showLaunchStatus('Errore: Inserisci la query SQL SELECT', 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!outputTable) {
|
||||
showLaunchStatus('Errore: Inserisci la tabella di destinazione', 'error');
|
||||
return;
|
||||
}
|
||||
|
||||
parameters['selectQuery'] = selectQuery;
|
||||
parameters['outputTable'] = outputTable;
|
||||
|
||||
} else if (parametersText) {
|
||||
// Parsing parametri per altri job
|
||||
try {
|
||||
// Controlla se ci sono più parametri separati da virgole FUORI dalle query SQL
|
||||
// Cerca pattern come: param1=valore1,param2=valore2
|
||||
// Ma non spezzare se la virgola è dentro una query SQL
|
||||
|
||||
if (!parametersText.includes('=')) {
|
||||
showLaunchStatus('Errore: Formato parametri non valido. Usa: chiave=valore,chiave2=valore2', 'error');
|
||||
return;
|
||||
@ -1340,8 +1392,6 @@
|
||||
}
|
||||
} else {
|
||||
// Parametri multipli - usa parsing intelligente
|
||||
// Cerca pattern: parola=valore, dove il valore può contenere virgole
|
||||
// ma si ferma quando trova un nuovo pattern parola=
|
||||
const paramRegex = /(\w+)\s*=\s*(.*?)(?=\s*,\s*\w+\s*=|$)/g;
|
||||
let match;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user