- Flask web application for querying Oliver metafile server - Replicates Make.com workflow for job data retrieval - Two-stage process: XML client extraction → JSON data retrieval - Clean HTML interface with responsive design - Comprehensive error handling and SSL fixes - Complete documentation and installation guides 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
272 lines
No EOL
7.5 KiB
HTML
272 lines
No EOL
7.5 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Meta File Server Query</title>
|
|
<style>
|
|
body {
|
|
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
|
max-width: 1200px;
|
|
margin: 0 auto;
|
|
padding: 20px;
|
|
background-color: #f5f5f5;
|
|
}
|
|
|
|
.container {
|
|
background: white;
|
|
padding: 30px;
|
|
border-radius: 8px;
|
|
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
|
|
}
|
|
|
|
h1 {
|
|
color: #333;
|
|
text-align: center;
|
|
margin-bottom: 30px;
|
|
border-bottom: 3px solid #007bff;
|
|
padding-bottom: 10px;
|
|
}
|
|
|
|
.form-group {
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
label {
|
|
display: block;
|
|
margin-bottom: 5px;
|
|
font-weight: bold;
|
|
color: #555;
|
|
}
|
|
|
|
input[type="text"] {
|
|
width: 100%;
|
|
padding: 12px;
|
|
border: 2px solid #ddd;
|
|
border-radius: 4px;
|
|
font-size: 16px;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
input[type="text"]:focus {
|
|
border-color: #007bff;
|
|
outline: none;
|
|
}
|
|
|
|
button {
|
|
background-color: #007bff;
|
|
color: white;
|
|
padding: 12px 24px;
|
|
border: none;
|
|
border-radius: 4px;
|
|
font-size: 16px;
|
|
cursor: pointer;
|
|
margin-right: 10px;
|
|
}
|
|
|
|
button:hover {
|
|
background-color: #0056b3;
|
|
}
|
|
|
|
button:disabled {
|
|
background-color: #ccc;
|
|
cursor: not-allowed;
|
|
}
|
|
|
|
.loading {
|
|
display: none;
|
|
margin: 20px 0;
|
|
text-align: center;
|
|
color: #666;
|
|
}
|
|
|
|
.result {
|
|
margin-top: 20px;
|
|
padding: 20px;
|
|
border-radius: 4px;
|
|
display: none;
|
|
}
|
|
|
|
.result.success {
|
|
background-color: #d4edda;
|
|
border: 1px solid #c3e6cb;
|
|
color: #155724;
|
|
}
|
|
|
|
.result.error {
|
|
background-color: #f8d7da;
|
|
border: 1px solid #f5c6cb;
|
|
color: #721c24;
|
|
}
|
|
|
|
.json-data {
|
|
background-color: #f8f9fa;
|
|
border: 1px solid #e9ecef;
|
|
border-radius: 4px;
|
|
padding: 15px;
|
|
margin-top: 10px;
|
|
font-family: 'Courier New', monospace;
|
|
white-space: pre-wrap;
|
|
overflow-x: auto;
|
|
max-height: 400px;
|
|
overflow-y: auto;
|
|
}
|
|
|
|
.client-info {
|
|
background-color: #e7f3ff;
|
|
border: 1px solid #b8daff;
|
|
border-radius: 4px;
|
|
padding: 10px;
|
|
margin: 10px 0;
|
|
color: #004085;
|
|
}
|
|
|
|
.buttons {
|
|
display: flex;
|
|
gap: 10px;
|
|
}
|
|
|
|
@media (max-width: 768px) {
|
|
body {
|
|
padding: 10px;
|
|
}
|
|
|
|
.container {
|
|
padding: 20px;
|
|
}
|
|
|
|
.buttons {
|
|
flex-direction: column;
|
|
}
|
|
|
|
button {
|
|
margin-right: 0;
|
|
margin-bottom: 10px;
|
|
}
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<h1>Meta File Server Query</h1>
|
|
|
|
<form id="queryForm">
|
|
<div class="form-group">
|
|
<label for="jobNumber">Job Number / Deliverable Number:</label>
|
|
<input type="text" id="jobNumber" name="jobNumber" placeholder="Enter job number (e.g., 12345)" required>
|
|
</div>
|
|
|
|
<div class="buttons">
|
|
<button type="submit">Query Job Information</button>
|
|
<button type="button" onclick="clearResults()">Clear</button>
|
|
</div>
|
|
</form>
|
|
|
|
<div class="loading" id="loading">
|
|
<p>🔍 Querying meta file server...</p>
|
|
</div>
|
|
|
|
<div class="result" id="result">
|
|
<div id="resultContent"></div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
const form = document.getElementById('queryForm');
|
|
const loading = document.getElementById('loading');
|
|
const result = document.getElementById('result');
|
|
const resultContent = document.getElementById('resultContent');
|
|
const jobNumberInput = document.getElementById('jobNumber');
|
|
|
|
form.addEventListener('submit', async (e) => {
|
|
e.preventDefault();
|
|
|
|
const jobNumber = jobNumberInput.value.trim();
|
|
|
|
if (!jobNumber) {
|
|
showError('Please enter a job number');
|
|
return;
|
|
}
|
|
|
|
// Show loading state
|
|
loading.style.display = 'block';
|
|
result.style.display = 'none';
|
|
|
|
try {
|
|
const response = await fetch(`/api/job/${encodeURIComponent(jobNumber)}`);
|
|
const data = await response.json();
|
|
|
|
loading.style.display = 'none';
|
|
|
|
if (data.success) {
|
|
showSuccess(data);
|
|
} else {
|
|
showError(data.error || 'Unknown error occurred');
|
|
}
|
|
|
|
} catch (error) {
|
|
loading.style.display = 'none';
|
|
showError('Network error: ' + error.message);
|
|
}
|
|
});
|
|
|
|
function showSuccess(data) {
|
|
result.className = 'result success';
|
|
result.style.display = 'block';
|
|
|
|
let html = `
|
|
<h3>✅ Job Information Retrieved</h3>
|
|
<p><strong>Job Number:</strong> ${escapeHtml(data.job_number)}</p>
|
|
`;
|
|
|
|
if (data.client) {
|
|
html += `
|
|
<div class="client-info">
|
|
<strong>Client:</strong> ${escapeHtml(data.client)}
|
|
</div>
|
|
`;
|
|
}
|
|
|
|
if (data.data) {
|
|
html += `
|
|
<p><strong>Data:</strong></p>
|
|
<div class="json-data">${escapeHtml(JSON.stringify(data.data, null, 2))}</div>
|
|
`;
|
|
}
|
|
|
|
resultContent.innerHTML = html;
|
|
}
|
|
|
|
function showError(error) {
|
|
result.className = 'result error';
|
|
result.style.display = 'block';
|
|
resultContent.innerHTML = `
|
|
<h3>❌ Error</h3>
|
|
<p>${escapeHtml(error)}</p>
|
|
`;
|
|
}
|
|
|
|
function clearResults() {
|
|
jobNumberInput.value = '';
|
|
result.style.display = 'none';
|
|
loading.style.display = 'none';
|
|
}
|
|
|
|
function escapeHtml(text) {
|
|
const div = document.createElement('div');
|
|
div.textContent = text;
|
|
return div.innerHTML;
|
|
}
|
|
|
|
// Auto-focus on job number input
|
|
jobNumberInput.focus();
|
|
|
|
// Allow Enter key to submit
|
|
jobNumberInput.addEventListener('keypress', (e) => {
|
|
if (e.key === 'Enter') {
|
|
form.dispatchEvent(new Event('submit'));
|
|
}
|
|
});
|
|
</script>
|
|
</body>
|
|
</html> |