Projektsuche Implementiert mit anbindung an INFRA

This commit is contained in:
2026-03-13 16:49:38 +01:00
parent 91603f1617
commit 1d8ba6a955
10 changed files with 1965 additions and 27 deletions

View File

@@ -63,6 +63,9 @@ document.addEventListener('DOMContentLoaded', function() {
// Optionen laden
loadOptions();
// MSSQL-Konfiguration laden
loadMssqlConfig();
// Optionen-Formular
const optionsForm = document.getElementById('optionsForm');
if (optionsForm) {
@@ -151,6 +154,96 @@ document.addEventListener('DOMContentLoaded', function() {
});
}
// MSSQL-Konfigurationsformular
const mssqlConfigForm = document.getElementById('mssqlConfigForm');
if (mssqlConfigForm) {
mssqlConfigForm.addEventListener('submit', async function(e) {
e.preventDefault();
const server = document.getElementById('mssqlServer').value;
const database = document.getElementById('mssqlDatabase').value;
const username = document.getElementById('mssqlUsername').value;
const password = document.getElementById('mssqlPassword').value;
if (!server || !database || !username) {
alert('Bitte Server, Datenbankname und Benutzername ausfüllen.');
return;
}
const formData = { server, database, username, password };
try {
const response = await fetch('/admin/mssql-config', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(formData)
});
const result = await response.json();
if (result.success) {
alert('MSSQL-Konfiguration wurde erfolgreich gespeichert!');
// Passwort-Feld leeren nach dem Speichern
document.getElementById('mssqlPassword').value = '';
} else {
alert('Fehler: ' + (result.error || 'MSSQL-Konfiguration konnte nicht gespeichert werden'));
}
} catch (error) {
console.error('Fehler:', error);
alert('Fehler beim Speichern der MSSQL-Konfiguration');
}
});
}
// MSSQL Test-Verbindung
const mssqlTestBtn = document.getElementById('mssqlTestConnectionBtn');
if (mssqlTestBtn) {
mssqlTestBtn.addEventListener('click', async function() {
const statusEl = document.getElementById('mssqlTestStatus');
mssqlTestBtn.disabled = true;
if (statusEl) {
statusEl.textContent = 'Verbindung wird getestet...';
statusEl.style.color = 'blue';
}
try {
const response = await fetch('/admin/mssql-test-connection', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
}
});
const result = await response.json();
if (response.ok && result && result.success) {
if (statusEl) {
statusEl.textContent = 'Verbindung erfolgreich.';
statusEl.style.color = 'green';
}
} else {
const msg = (result && result.error) ? result.error : 'Testverbindung fehlgeschlagen.';
if (statusEl) {
statusEl.textContent = msg;
statusEl.style.color = 'red';
}
alert(msg);
}
} catch (error) {
console.error('Fehler bei MSSQL-Testverbindung:', error);
if (statusEl) {
statusEl.textContent = 'Fehler bei der Testverbindung.';
statusEl.style.color = 'red';
}
alert('Fehler bei der Testverbindung zur MSSQL-Datenbank.');
} finally {
mssqlTestBtn.disabled = false;
}
});
}
// Sync-Button
const syncNowBtn = document.getElementById('syncNowBtn');
if (syncNowBtn) {
@@ -271,6 +364,31 @@ async function loadLDAPConfig() {
}
}
// MSSQL-Konfiguration laden und Formular ausfüllen
async function loadMssqlConfig() {
try {
const response = await fetch('/admin/mssql-config');
const result = await response.json();
if (result.config) {
const config = result.config;
if (document.getElementById('mssqlServer')) {
document.getElementById('mssqlServer').value = config.server || '';
}
if (document.getElementById('mssqlDatabase')) {
document.getElementById('mssqlDatabase').value = config.database || '';
}
if (document.getElementById('mssqlUsername')) {
document.getElementById('mssqlUsername').value = config.username || '';
}
// Passwort wird aus Sicherheitsgründen nie vorausgefüllt
}
} catch (error) {
console.error('Fehler beim Laden der MSSQL-Konfiguration:', error);
}
}
async function deleteUser(userId, username) {
const confirmed = confirm(`Möchten Sie den Benutzer "${username}" wirklich löschen?`);