optimize screen

This commit is contained in:
Raven Scott 2024-11-30 05:03:52 -05:00
parent f3695c274b
commit e4aeb9d53f
2 changed files with 62 additions and 3 deletions

View File

@ -86,7 +86,6 @@
/* Leave space for the sidebar */
flex: 1;
/* Allow the content to grow */
padding: 30px;
overflow-y: auto;
/* Allow scrolling if content overflows */
position: relative;
@ -239,7 +238,7 @@
/* Ensure it uses all available space */
width: 100%;
/* Take up the full width of the content area */
padding: 0;
margin-top: 30px;
/* Remove extra padding */
overflow-y: auto;
/* Allow vertical scrolling if needed */
@ -352,7 +351,6 @@
<!-- <img src="https://via.placeholder.com/500x300" alt="Welcome Graphic" class="img-fluid mt-4"> -->
</div>
<div id="dashboard" class="hidden">
<h2>Containers</h2>
<div class="table-responsive">
<table class="table table-dark table-striped">
<thead>

61
libs/rdp.js Normal file
View File

@ -0,0 +1,61 @@
const rdp = require('node-rdp');
// Open the RDP Modal
function openRdpModal(containerId, containerName, ip) {
console.log(`[INFO] Opening RDP modal for container: ${containerId}`);
const rdpModal = document.getElementById('rdp-modal');
const rdpTitle = document.getElementById('rdp-title');
const rdpInputIP = document.getElementById('rdp-input-ip');
const rdpInputPort = document.getElementById('rdp-input-port');
rdpTitle.textContent = `RDP Session: ${containerName}`;
rdpInputIP.value = ip || '';
rdpInputPort.value = '3389'; // Default RDP port
rdpModal.style.display = 'flex';
// Save container details for later use
window.activeRdpSession = { containerId, containerName };
}
// Start the RDP session
function startRdpSession() {
const rdpInputIP = document.getElementById('rdp-input-ip').value.trim();
const rdpInputPort = document.getElementById('rdp-input-port').value.trim();
const rdpUsername = document.getElementById('rdp-username').value.trim();
const rdpPassword = document.getElementById('rdp-password').value.trim();
if (!rdpInputIP || !rdpUsername || !rdpPassword) {
alert('Please fill in all required fields (IP, Username, Password).');
return;
}
const address = `${rdpInputIP}:${rdpInputPort}`;
console.log(`[INFO] Starting RDP session to ${address}`);
rdp({
address,
username: rdpUsername,
password: rdpPassword,
fullscreen: true, // Default to fullscreen
})
.then(() => {
console.log('[INFO] RDP session terminated.');
alert('RDP session ended.');
})
.catch((err) => {
console.error('[ERROR] RDP session error:', err);
alert(`Failed to start RDP session: ${err.message}`);
});
}
// Close the RDP Modal
function closeRdpModal() {
console.log('[INFO] Closing RDP modal');
const rdpModal = document.getElementById('rdp-modal');
rdpModal.style.display = 'none';
window.activeRdpSession = null;
}
// Export functions
export { openRdpModal, startRdpSession, closeRdpModal };