remove caching
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
<a href="{{ url_for('index') }}">Home</a> |
|
||||
<a href="{{ url_for('user_settings') }}">Preferences</a>
|
||||
{% if current_user and current_user.is_admin %} |
|
||||
<a href="{{ url_for('scrape_page') }}">Scrape Jobs</a> |
|
||||
<a href="{{ url_for('admin_taxonomy') }}">Taxonomy</a> |
|
||||
<a href="{{ url_for('admin_users') }}">Users</a> {% endif %} {% if
|
||||
session.get('username') %} |
|
||||
|
||||
@@ -23,13 +23,5 @@ styles %}{% endblock %} {% block content %}
|
||||
>{{ job.title }}</a
|
||||
>
|
||||
</p>
|
||||
{% if job.file_path_abs or job.file_path %}
|
||||
<p>
|
||||
<strong>Cached copy:</strong>
|
||||
<a href="{{ url_for('serve_cached', job_id=job.id) }}" target="_blank"
|
||||
>View cached copy</a
|
||||
>
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
67
web/templates/scrape.html
Normal file
67
web/templates/scrape.html
Normal file
@@ -0,0 +1,67 @@
|
||||
{% extends "base.html" %} {% block title %}Scrape Jobs{% endblock %} {% block
|
||||
content %}
|
||||
<div id="scrape-container">
|
||||
<h2>Job Scraping Progress</h2>
|
||||
<button id="start-scrape" onclick="startScrape()">Start Scraping</button>
|
||||
<div
|
||||
id="output"
|
||||
style="
|
||||
margin-top: 20px;
|
||||
padding: 10px;
|
||||
border: 1px solid #ccc;
|
||||
height: 400px;
|
||||
overflow-y: auto;
|
||||
background-color: #f9f9f9;
|
||||
font-family: monospace;
|
||||
white-space: pre-wrap;
|
||||
"
|
||||
></div>
|
||||
</div>
|
||||
{% endblock %} {% block scripts %}
|
||||
<script>
|
||||
function startScrape() {
|
||||
const output = document.getElementById("output");
|
||||
const startButton = document.getElementById("start-scrape");
|
||||
|
||||
output.textContent = "Starting scrape...\n";
|
||||
startButton.disabled = true;
|
||||
startButton.textContent = "Scraping...";
|
||||
|
||||
fetch("/scrape")
|
||||
.then((response) => {
|
||||
const reader = response.body.getReader();
|
||||
const decoder = new TextDecoder();
|
||||
|
||||
function readStream() {
|
||||
reader
|
||||
.read()
|
||||
.then(({ done, value }) => {
|
||||
if (done) {
|
||||
output.textContent += "\nScraping completed!";
|
||||
startButton.disabled = false;
|
||||
startButton.textContent = "Start Scraping";
|
||||
return;
|
||||
}
|
||||
|
||||
const chunk = decoder.decode(value, { stream: true });
|
||||
output.textContent += chunk;
|
||||
output.scrollTop = output.scrollHeight;
|
||||
readStream();
|
||||
})
|
||||
.catch((error) => {
|
||||
output.textContent += `\nError: ${error.message}`;
|
||||
startButton.disabled = false;
|
||||
startButton.textContent = "Start Scraping";
|
||||
});
|
||||
}
|
||||
|
||||
readStream();
|
||||
})
|
||||
.catch((error) => {
|
||||
output.textContent = `Error starting scrape: ${error.message}`;
|
||||
startButton.disabled = false;
|
||||
startButton.textContent = "Start Scraping";
|
||||
});
|
||||
}
|
||||
</script>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user