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,242 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>All Jobs - End of Year Statements</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
max-width: 1000px;
|
||||
margin: 0 auto;
|
||||
padding: 20px;
|
||||
background-color: #f5f5f5;
|
||||
}
|
||||
.header {
|
||||
text-align: center;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
.logo {
|
||||
max-width: 200px;
|
||||
height: auto;
|
||||
}
|
||||
.jobs-section {
|
||||
background: white;
|
||||
padding: 20px;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.job-item {
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 4px;
|
||||
padding: 15px;
|
||||
margin-bottom: 10px;
|
||||
background: #fafafa;
|
||||
}
|
||||
.job-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.job-info {
|
||||
flex-grow: 1;
|
||||
}
|
||||
.job-actions {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
}
|
||||
button {
|
||||
background-color: #007bff;
|
||||
color: white;
|
||||
padding: 8px 16px;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
}
|
||||
.delete-btn {
|
||||
background-color: #dc3545;
|
||||
}
|
||||
.download-btn {
|
||||
background-color: #28a745;
|
||||
}
|
||||
.view-btn {
|
||||
background-color: #17a2b8;
|
||||
}
|
||||
button:disabled {
|
||||
background-color: #ccc;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
.no-jobs {
|
||||
text-align: center;
|
||||
color: #666;
|
||||
font-style: italic;
|
||||
}
|
||||
.back-link {
|
||||
display: inline-block;
|
||||
margin-bottom: 20px;
|
||||
color: #007bff;
|
||||
text-decoration: none;
|
||||
}
|
||||
.back-link:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
.nav-links {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
gap: 20px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.nav-link {
|
||||
color: #007bff;
|
||||
text-decoration: none;
|
||||
font-weight: bold;
|
||||
padding: 8px 16px;
|
||||
border: 2px solid #007bff;
|
||||
border-radius: 4px;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
.nav-link:hover {
|
||||
background-color: #007bff;
|
||||
color: white;
|
||||
}
|
||||
.status-completed {
|
||||
color: #28a745;
|
||||
font-weight: bold;
|
||||
}
|
||||
.status-processing {
|
||||
color: #ffc107;
|
||||
font-weight: bold;
|
||||
}
|
||||
.status-failed {
|
||||
color: #dc3545;
|
||||
font-weight: bold;
|
||||
}
|
||||
.status-queued {
|
||||
color: #6c757d;
|
||||
font-weight: bold;
|
||||
}
|
||||
.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>All Jobs</h1>
|
||||
<p>View all your PDF processing jobs</p>
|
||||
|
||||
<!-- 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') }}" class="nav-link">📤 Upload Files</a>
|
||||
<a href="{{ url_for('results') }}" class="nav-link">📋 View Results</a>
|
||||
<a href="{{ url_for('jobs') }}" class="nav-link">📊 View All Jobs</a>
|
||||
</div>
|
||||
|
||||
<a href="{{ url_for('index') }}" class="back-link">← Back to Upload</a>
|
||||
<a href="{{ url_for('clear_and_upload') }}" class="back-link" style="margin-left: 20px;">🔄 Reprocess Files</a>
|
||||
|
||||
<div class="jobs-section">
|
||||
<h2>All Jobs</h2>
|
||||
{% if jobs %}
|
||||
{% for job in jobs %}
|
||||
<div class="job-item">
|
||||
<div class="job-header">
|
||||
<div class="job-info">
|
||||
<strong>Job Name:</strong> {{ job.id }}<br>
|
||||
<strong>Started:</strong> {{ job.timestamp.strftime('%Y-%m-%d %H:%M:%S') if job.timestamp else 'Unknown' }}<br>
|
||||
{% if job.file_count %}
|
||||
<strong>Files:</strong> {{ job.file_count }}<br>
|
||||
{% endif %}
|
||||
<strong>Status:</strong>
|
||||
{% if job.status == 'completed' %}
|
||||
<span class="status-completed">Completed</span>
|
||||
{% elif job.status == 'processing' %}
|
||||
<span class="status-processing">Processing</span>
|
||||
{% elif job.status == 'failed' %}
|
||||
<span class="status-failed">Failed</span>
|
||||
{% elif job.status == 'queued' %}
|
||||
<span class="status-queued">Queued</span>
|
||||
{% else %}
|
||||
<span>{{ job.status|title }}</span>
|
||||
{% endif %}
|
||||
{% if job.get('error') %}
|
||||
<br><strong>Error:</strong> {{ job.error }}
|
||||
{% endif %}
|
||||
{% if job.get('message') %}
|
||||
<br><strong>Message:</strong> {{ job.message }}
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="job-actions">
|
||||
<a href="{{ url_for('job_status', job_id=job.id) }}" class="view-btn" style="display: inline-block; padding: 8px 16px; text-decoration: none; color: white; background-color: #17a2b8; border-radius: 4px;">View Details</a>
|
||||
{% if job.status == 'completed' %}
|
||||
<form action="{{ url_for('download_job', job_id=job.id) }}" method="get" style="display: inline;">
|
||||
<button type="submit" class="download-btn">Download ZIP</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
<form action="{{ url_for('delete_job', job_id=job.id) }}" method="post" style="display: inline;" onsubmit="return confirm('Are you sure you want to delete this job?')">
|
||||
<button type="submit" class="delete-btn">Delete</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<p class="no-jobs">No jobs yet. <a href="{{ url_for('index') }}">Upload some files</a> to get started.</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% with messages = get_flashed_messages() %}
|
||||
{% if messages %}
|
||||
<div style="background: white; padding: 15px; border-radius: 8px; box-shadow: 0 2px 4px rgba(0,0,0,0.1); margin-top: 20px;">
|
||||
{% for message in messages %}
|
||||
<p style="margin: 0; color: #28a745;">{{ message }}</p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
</body>
|
||||
</html>
|
||||
Reference in new issue
Block a user