iLO-manager first main commitgit status
This commit is contained in:
1 parent
e6f4cc04ca
commit
599d8da562
3271 files changed
+550655
No files matched your search
@@ -0,0 +1,55 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="styles.css">
|
||||
<title>HPE Server Manager</title>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>HPE Server Manager</h1>
|
||||
|
||||
<!-- Form to add a new server -->
|
||||
<h2>Add Server</h2>
|
||||
<form id="add-server-form">
|
||||
<input type="text" id="server-ip" placeholder="10.28.25.47" required>
|
||||
<input type="text" id="server-name" placeholder="f420" required>
|
||||
<button type="submit">Add Server</button>
|
||||
</form>
|
||||
|
||||
<!-- Form to add a new API endpoint -->
|
||||
<h2>Add API Call</h2>
|
||||
<form id="add-action-form">
|
||||
<input type="text" id="action-name" placeholder="Update Service" required>
|
||||
<input type="text" id="action-call" placeholder="/rest/v1/Managers/1/UpdateService" required>
|
||||
<select id="method-select">
|
||||
<option value="get-method">GET</option>
|
||||
<option value="post-method">POST</option>
|
||||
<option value="patch-method">PATCH</option>
|
||||
</select>
|
||||
<button type="submit">Add API Call</button>
|
||||
</form>
|
||||
|
||||
|
||||
<!-- Dropdown to select existing servers -->
|
||||
<h2>Select Server</h2>
|
||||
<select id="server-select"></select>
|
||||
<select id="action-select">
|
||||
<!--
|
||||
<option value="server-info">Server Info</option>
|
||||
<option value="snmp-info">Snmp Status</option>
|
||||
<option value="send-test-mail">Send Test</option>
|
||||
-->
|
||||
</select>
|
||||
<button id="confirmButton">Confirm</button>
|
||||
<!--
|
||||
<button id="fetch-info">Get Server Info</button>
|
||||
<button id="snmp-info">SNMP status</button>
|
||||
<button id="snmp-test">SNMP send</button>
|
||||
-->
|
||||
<pre id="server-info"></pre>
|
||||
</div>
|
||||
<script src="script.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,128 @@
|
||||
async function loadServers() {
|
||||
const serverSelect = document.getElementById('server-select');
|
||||
const actionSelect = document.getElementById('action-select');
|
||||
const response = await fetch('http://localhost:5000/api/servers');
|
||||
const responseAc = await fetch('http://localhost:5000/api/actions');
|
||||
const servers = await response.json();
|
||||
const actions = await responseAc.json();
|
||||
|
||||
// Clear existing options
|
||||
serverSelect.innerHTML = '';
|
||||
|
||||
servers.forEach(server => {
|
||||
const option = document.createElement('option');
|
||||
option.value = server[1]; // IP address
|
||||
option.textContent = server[2]; // Server name
|
||||
serverSelect.appendChild(option);
|
||||
});
|
||||
// Clear existing options
|
||||
actionSelect.innerHTML = '';
|
||||
|
||||
actions.forEach(action => {
|
||||
const optionAc = document.createElement('option');
|
||||
optionAc.textContent = action[2]; // Do not know
|
||||
optionAc.textContent = action[1];
|
||||
actionSelect.appendChild(optionAc);
|
||||
});
|
||||
}
|
||||
|
||||
//async function loadActions() {
|
||||
// const actionSelect = document.getElementById('action-select');
|
||||
// const responseAc = await fetch('http://localhost:5000/api/actions');
|
||||
// const actions = await responseAc.json();
|
||||
//
|
||||
// // Clear existing options
|
||||
// actionSelect.innerHTML = '';
|
||||
//
|
||||
// actions.forEach(action => {
|
||||
// const optionAc = document.createElement('option');
|
||||
// optionAc.textContent = action[2]; // Do not know
|
||||
// optionAc.textContent = action[1];
|
||||
// actionSelect.appendChild(optionAc);
|
||||
// });
|
||||
//}
|
||||
|
||||
|
||||
// Load servers and actions when the page loads
|
||||
window.onload = loadServers;
|
||||
|
||||
// Handle API call choice.
|
||||
document.getElementById('confirmButton').addEventListener('click', async () => {
|
||||
const ip = document.getElementById('server-select').value;
|
||||
const action = document.getElementById('action-select').value;
|
||||
const action_low = action.toLowerCase();
|
||||
const action_done = action_low.replace(/ /g, "-");
|
||||
|
||||
const response = await fetch(`http://localhost:5000/api/${action_done}?ip=${ip}`);
|
||||
const data = await response.json();
|
||||
document.getElementById('server-info').textContent = JSON.stringify(data, null, 2);
|
||||
});
|
||||
|
||||
//// Handle SNMP info fetch
|
||||
//document.getElementById('confirmButton').addEventListener('click', async () => {
|
||||
// const ip = document.getElementById('server-select').value;
|
||||
// const action = document.getElementById('action-select').value;
|
||||
//
|
||||
// const response = await fetch(`http://localhost:5000/api/${action}?ip=${ip}`);
|
||||
// const data = await response.json();
|
||||
// document.getElementById('server-info').textContent = JSON.stringify(data, null, 2);
|
||||
//});
|
||||
//
|
||||
//// SNMP send test message
|
||||
//document.getElementById('confirmButton').addEventListener('click', async () => {
|
||||
// const ip = document.getElementById('server-select').value;
|
||||
// const action = document.getElementById('action-select').value;
|
||||
//
|
||||
// const response = await fetch(`http://localhost:5000/api/${action}?ip=${ip}`);
|
||||
// const data = await response.json();
|
||||
// document.getElementById('server-info').textContent = JSON.stringify(data, null, 2);
|
||||
//});
|
||||
|
||||
// Handle form submission to add new server
|
||||
document.getElementById('add-server-form').addEventListener('submit', async (event) => {
|
||||
event.preventDefault(); // Prevent form from reloading the page
|
||||
|
||||
const ip = document.getElementById('server-ip').value;
|
||||
const name = document.getElementById('server-name').value;
|
||||
|
||||
const response = await fetch('http://localhost:5000/api/add-server', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({ ip: ip, name: name })
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
alert('Server added successfully!');
|
||||
// Reload server list
|
||||
loadServers();
|
||||
} else {
|
||||
alert('Error adding server');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// Handle form submission to add new API call
|
||||
document.getElementById('add-action-form').addEventListener('submit', async (event) => {
|
||||
event.preventDefault(); // Prevent form from reloading the page
|
||||
|
||||
const name = document.getElementById('action-name').value;
|
||||
const endpoint = document.getElementById('action-call').value;
|
||||
|
||||
const response = await fetch('http://localhost:5000/api/add-endpoint', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify({ name: name, endpoint: endpoint })
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
alert('API call added successfully!');
|
||||
// Reload server list
|
||||
loadServers();
|
||||
} else {
|
||||
alert('Error adding API call');
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,107 @@
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
background-color: #f4f4f4;
|
||||
margin: 0;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 800px;
|
||||
margin: auto;
|
||||
background: #fff;
|
||||
word-wrap: break-word;
|
||||
padding: 20px;
|
||||
border-radius: 5px;
|
||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
button {
|
||||
padding: 10px 15px;
|
||||
background-color: #007BFF;
|
||||
border: none;
|
||||
color: white;
|
||||
font-size: 16px;
|
||||
cursor: pointer;
|
||||
width: 150px;
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
#confirmButton {
|
||||
float: right;
|
||||
margin-right: 30px;
|
||||
background-color: #4CAF50;
|
||||
}
|
||||
|
||||
#confirmButton:hover {
|
||||
background-color: green;
|
||||
}
|
||||
|
||||
#server-select {
|
||||
padding: 10px 15px;
|
||||
background-color: #007BFF;
|
||||
border: none;
|
||||
color: white;
|
||||
font-size: 16px;
|
||||
cursor: pointer;
|
||||
width: 150px;
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
#action-select {
|
||||
padding: 10px 15px;
|
||||
background-color: #007BFF;
|
||||
border: none;
|
||||
color: white;
|
||||
font-size: 16px;
|
||||
cursor: pointer;
|
||||
width: 150px;
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
#action-select:hover {
|
||||
background-color: #0056b3;
|
||||
}
|
||||
|
||||
#server-select:hover {
|
||||
background-color: #0056b3;
|
||||
}
|
||||
|
||||
|
||||
|
||||
button:hover {
|
||||
background-color: #0056b3;
|
||||
}
|
||||
|
||||
|
||||
/* General input styling */
|
||||
input[type="text"],
|
||||
input[type="email"],
|
||||
textarea,
|
||||
select {
|
||||
width: 100%; /* Full width */
|
||||
padding: 10px; /* Inner spacing */
|
||||
margin: 8px 0; /* Vertical spacing */
|
||||
border: 1px solid #007BFF; /* Border */
|
||||
border-radius: 5px; /* Rounded corners */
|
||||
font-size: 16px; /* Font size */
|
||||
box-sizing: border-box; /* Include padding in width */
|
||||
transition: border-color 0.3s; /* Smooth transition */
|
||||
}
|
||||
|
||||
/* Focus effect */
|
||||
input[type="text"]:focus,
|
||||
textarea:focus,
|
||||
select:focus {
|
||||
border-color: #4CAF50; /* Green border on focus */
|
||||
outline: none; /* Remove default outline */
|
||||
}
|
||||
|
||||
/* Specific styles for the textarea */
|
||||
textarea {
|
||||
resize: vertical; /* Allow vertical resizing only */
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user