Host description
@@ -876,6 +886,16 @@ $(function() {
const hostId = agentActions.data('host-id');
const row = agentActions.closest('tr');
+ // Get form inputs
+ const agentUrl = row.find('input[name="url"]');
+
+ // Validate required fields
+ if (!agentUrl.val().trim()) {
+ showValidationTooltip(agentUrl, 'Please enter an endpoint URL');
+ agentUrl.focus();
+ return;
+ }
+
// Collect form data
const formData = new FormData();
formData.append('item', 'agent');
@@ -987,7 +1007,9 @@ $(function() {
agents.forEach(agent => {
const agentType = agent.querySelector('td:first-child span');
const agentName = agentType ? agentType.textContent.trim() : 'Unknown agent';
- warningText += `
Agent: ${agentName}`;
+ const agentUrl = agent.querySelector('td:nth-child(2) .agent-view-mode');
+ const url = agentUrl ? agentUrl.textContent.trim() : 'Unknown URL';
+ warningText += `
Agent ${agentName} at ${url}`;
});
warningText += '';
}
@@ -1029,10 +1051,13 @@ $(function() {
const agents = hostCard.querySelectorAll('.agent-details');
if (agents.length > 0) {
warningText += '
';
+
agents.forEach(agent => {
const agentType = agent.querySelector('td:first-child span');
const agentName = agentType ? agentType.textContent.trim() : 'Unknown agent';
- warningText += `- Agent: ${agentName}
`;
+ const agentUrl = agent.querySelector('td:nth-child(2) .agent-view-mode');
+ const url = agentUrl ? agentUrl.textContent.trim() : 'Unknown URL';
+ warningText += `- Agent ${agentName} at ${url}
`;
});
warningText += '
';
document.getElementById('deleteHostButton').disabled = true;
@@ -1086,6 +1111,28 @@ $(function() {
// Initialize tooltips
$('[data-toggle="tooltip"]').tooltip();
+
+ // Helper function to show validation tooltip
+ function showValidationTooltip(input, message) {
+ const tooltip = $(input)
+ .tooltip({
+ title: message,
+ placement: 'top',
+ trigger: 'manual',
+ template: '
'
+ })
+ .tooltip('show');
+
+ // Hide tooltip when input changes
+ input.one('input', function() {
+ $(this).tooltip('dispose');
+ });
+
+ // Hide tooltip after 3 seconds
+ setTimeout(() => {
+ $(input).tooltip('dispose');
+ }, 3000);
+ }
});
// Show add platform modal