Complete PDF Sort and Merge Flask Application
- Full-featured web application for PDF processing - Microsoft Entra (Azure AD) authentication with PKCE - Parallel PDF sorting and merging capabilities - Job management system with real-time progress tracking - Modern web UI with responsive design - Comprehensive error handling and logging - Ubuntu installation script for easy deployment - Environment configuration for secure credential management
This commit is contained in:
1 parent
31c2d27a62
commit
144adf64c4
18 files changed
+2903
-2
No files matched your search
@@ -0,0 +1,227 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Job Status - End of Year Statements</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
padding: 20px;
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
.header {
|
||||
text-align: center;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
.logo {
|
||||
max-width: 200px;
|
||||
height: auto;
|
||||
}
|
||||
.job-section {
|
||||
background: white;
|
||||
padding: 20px;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.status-section {
|
||||
background: white;
|
||||
padding: 20px;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
progress {
|
||||
width: 100%;
|
||||
height: 20px;
|
||||
}
|
||||
.status-processing {
|
||||
color: #007bff;
|
||||
}
|
||||
.status-completed {
|
||||
color: #28a745;
|
||||
}
|
||||
.status-failed {
|
||||
color: #dc3545;
|
||||
}
|
||||
.nav-links {
|
||||
text-align: center;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.nav-links a {
|
||||
color: #007bff;
|
||||
text-decoration: none;
|
||||
margin: 0 15px;
|
||||
font-weight: bold;
|
||||
}
|
||||
.nav-links a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
button {
|
||||
background-color: #007bff;
|
||||
color: white;
|
||||
padding: 10px 20px;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
font-size: 16px;
|
||||
}
|
||||
button:disabled {
|
||||
background-color: #ccc;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
.download-btn {
|
||||
background-color: #28a745;
|
||||
}
|
||||
.back-btn {
|
||||
background-color: #6c757d;
|
||||
}
|
||||
.error {
|
||||
color: red;
|
||||
margin-top: 10px;
|
||||
}
|
||||
.job-info {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.job-info div {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
.auth-section {
|
||||
margin-top: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
.user-info {
|
||||
display: inline-block;
|
||||
background: white;
|
||||
padding: 10px 20px;
|
||||
border-radius: 6px;
|
||||
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
||||
}
|
||||
.user-info span {
|
||||
margin-right: 15px;
|
||||
font-weight: bold;
|
||||
}
|
||||
.logout-btn, .login-btn {
|
||||
background-color: #dc3545;
|
||||
color: white;
|
||||
padding: 6px 12px;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
text-decoration: none;
|
||||
font-size: 14px;
|
||||
display: inline-block;
|
||||
}
|
||||
.login-btn {
|
||||
background-color: #28a745;
|
||||
}
|
||||
.logout-btn:hover, .login-btn:hover {
|
||||
opacity: 0.8;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="header">
|
||||
<img src="{{ url_for('static', filename='trbc-logo-full.png') }}" alt="Logo" class="logo">
|
||||
<h1>Job Status</h1>
|
||||
|
||||
<!-- Authentication section -->
|
||||
<div class="auth-section">
|
||||
{% if session.oauth_token %}
|
||||
<div class="user-info">
|
||||
<span>Welcome, {{ user_info.displayName or user_info.givenName or 'User' }}!</span>
|
||||
<a href="{{ url_for('logout') }}" class="logout-btn">Logout</a>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="login-prompt">
|
||||
<a href="{{ url_for('login') }}" class="login-btn">Login with Microsoft</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="nav-links">
|
||||
<a href="{{ url_for('index') }}">Upload New Files</a> |
|
||||
<a href="{{ url_for('results') }}">View All Jobs & Downloads</a>
|
||||
</div>
|
||||
|
||||
<div class="job-section">
|
||||
<h2>Job Information</h2>
|
||||
<div class="job-info">
|
||||
<div><strong>Job Name:</strong> {{ job.id }}</div>
|
||||
<div><strong>Started:</strong> {{ job.timestamp.strftime('%Y-%m-%d %H:%M:%S') if job.timestamp else 'Unknown' }}</div>
|
||||
<div><strong>Files:</strong> {{ job.file_count if job.file_count else 'Processing...' }}</div>
|
||||
<div><strong>Status:</strong>
|
||||
<span class="status-{{ job.status }}">
|
||||
{{ job.status.title() }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if job.status == 'processing' %}
|
||||
<div class="status-section">
|
||||
<h3>Processing Progress</h3>
|
||||
<p id="statusMessage">{{ job.message }}</p>
|
||||
<progress id="progressBar" value="{{ job.progress }}" max="100"></progress>
|
||||
<div style="margin-top: 10px;">
|
||||
<strong>{{ job.progress }}% Complete</strong>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if job.status == 'completed' %}
|
||||
<div class="status-section">
|
||||
<h3>Processing Complete!</h3>
|
||||
<p>{{ job.message }}</p>
|
||||
<progress value="100" max="100"></progress>
|
||||
<div style="margin-top: 20px;">
|
||||
<a href="{{ url_for('download_job', job_id=job.id) }}" class="download-btn" style="color: white; text-decoration: none; padding: 10px 20px; border-radius: 4px; display: inline-block;">Download Results</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if job.status == 'failed' %}
|
||||
<div class="status-section">
|
||||
<h3>Processing Failed</h3>
|
||||
<p>{{ job.message }}</p>
|
||||
{% if job.error %}
|
||||
<div class="error">
|
||||
<strong>Error:</strong> {{ job.error }}
|
||||
</div>
|
||||
{% endif %}
|
||||
<progress value="0" max="100"></progress>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="nav-links">
|
||||
<a href="{{ url_for('index') }}" class="back-btn">Back to Upload</a>
|
||||
<a href="{{ url_for('results') }}">View All Jobs</a>
|
||||
</div>
|
||||
|
||||
{% if job.status == 'processing' %}
|
||||
<script>
|
||||
// Auto-refresh for processing jobs
|
||||
function updateStatus() {
|
||||
fetch('/api/job/{{ job.id }}/status')
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
document.getElementById('statusMessage').textContent = data.message;
|
||||
document.getElementById('progressBar').value = data.progress;
|
||||
|
||||
if (data.status === 'completed' || data.status === 'failed') {
|
||||
// Reload the page to show completion/failure state
|
||||
location.reload();
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
console.log('Status update error:', err);
|
||||
});
|
||||
}
|
||||
|
||||
// Update status every 2 seconds
|
||||
setInterval(updateStatus, 2000);
|
||||
</script>
|
||||
{% endif %}
|
||||
</body>
|
||||
</html>
|
||||
Reference in new issue
Block a user