Skip to content

Commit

Permalink
Change 4 spaces to 2 spaces in static HTML files
Browse files Browse the repository at this point in the history
  • Loading branch information
my8100 committed Jul 25, 2019
1 parent 3bc81aa commit bafb4ab
Show file tree
Hide file tree
Showing 27 changed files with 5,212 additions and 5,212 deletions.
1,076 changes: 538 additions & 538 deletions scrapydweb/templates/scrapydweb/deploy.html

Large diffs are not rendered by default.

208 changes: 104 additions & 104 deletions scrapydweb/templates/scrapydweb/deploy_results.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,79 +3,79 @@
{% block title %}deploy results{% endblock %}

{% block head %}
<link rel="stylesheet" type="text/css" href="{{ static_css_multinode }}">
<script type="text/javascript" src="{{ static_js_multinode }}"></script>
<link rel="stylesheet" type="text/css" href="{{ static_css_multinode }}">
<script type="text/javascript" src="{{ static_js_multinode }}"></script>
{% endblock %}


{% block body %}
<h2>Deploy Project</h2>
<div class="table wrap">
<table>
<thead>
<tr>
<th>
<input type="checkbox" id="checkAll" />
<a class="state warning" href="javascript:;" onclick="invertSelection();">invert selection</a>
</th>
<th>Index</th>
<th>Projects</th>
<th>Node Name</th>
<th>Status</th>
<th>Project</th>
<th>Version</th>
<th>Spiders</th>
</tr>
</thead>
<form method="post" enctype="multipart/form-data">
<input type="text" name="project" value="{{ project }}" hidden />
<input type="text" name="version" value="{{ version }}" hidden />

<tbody>
<tr>
<td><input type="checkbox" id="checkbox_{{ first_selected_node }}" name="{{ first_selected_node }}" checked /></td>
<td>{{ first_selected_node }}</td>
<td>
<a
class={% if first_selected_node == node %}"state safe"{% else %}"state normal"{% endif %}
href="{{ url_projects_first_selected_node }}"
target={% if selected_nodes|length > 1 %}"_blank"{% else %}"_self"{% endif %}
>{{ SCRAPYD_SERVERS[first_selected_node-1] }}</a>
</td>
<td>{{ js['node_name'] }}</td>
<td><em class="pass">{{ js['status'] }}</em></td>
<td>{{ js['project'] }}</td>
<td>{{ js['version'] }}</td>
<td>{{ js['spiders'] }}</td>
</tr>
{% for SCRAPYD_SERVER in SCRAPYD_SERVERS %}
{% if loop.index in selected_nodes and loop.index != first_selected_node %}
<tr>
<td><input type="checkbox" id="checkbox_{{ loop.index }}" name="{{ loop.index }}" /></td>
<td >{{ loop.index }}</td>
<td>
<a
class={% if loop.index == node %}"state safe"{% else %}"state normal"{% endif %}
href="{{ url_projects_list[loop.index-1] }}"
target={% if selected_nodes|length > 1 %}"_blank"{% else %}"_self"{% endif %}
>{{ SCRAPYD_SERVERS[loop.index-1] }}</a>
</td>
<td id="node_name_{{ loop.index }}"></td>
<td id="status_{{ loop.index }}"></td>
<td id="project_{{ loop.index }}"></td>
<td id="version_{{ loop.index }}"></td>
<td id="spiders_{{ loop.index }}"></td>
</tr>
{% endif %}
{% endfor %}
</tbody>
</form>
</table>

<div class="action">
<a class="button safe big" href="javascript:;" onclick="multinodeRunSpider();">{% if selected_nodes|length > 1 %}Multinode {% endif %}Run Spider</a>
<a class="button normal big" href="javascript:;" onclick="passToServers();">Servers &raquo; Run Spider</a>
</div>
<table>
<thead>
<tr>
<th>
<input type="checkbox" id="checkAll" />
<a class="state warning" href="javascript:;" onclick="invertSelection();">invert selection</a>
</th>
<th>Index</th>
<th>Projects</th>
<th>Node Name</th>
<th>Status</th>
<th>Project</th>
<th>Version</th>
<th>Spiders</th>
</tr>
</thead>
<form method="post" enctype="multipart/form-data">
<input type="text" name="project" value="{{ project }}" hidden />
<input type="text" name="version" value="{{ version }}" hidden />

<tbody>
<tr>
<td><input type="checkbox" id="checkbox_{{ first_selected_node }}" name="{{ first_selected_node }}" checked /></td>
<td>{{ first_selected_node }}</td>
<td>
<a
class={% if first_selected_node == node %}"state safe"{% else %}"state normal"{% endif %}
href="{{ url_projects_first_selected_node }}"
target={% if selected_nodes|length > 1 %}"_blank"{% else %}"_self"{% endif %}
>{{ SCRAPYD_SERVERS[first_selected_node-1] }}</a>
</td>
<td>{{ js['node_name'] }}</td>
<td><em class="pass">{{ js['status'] }}</em></td>
<td>{{ js['project'] }}</td>
<td>{{ js['version'] }}</td>
<td>{{ js['spiders'] }}</td>
</tr>
{% for SCRAPYD_SERVER in SCRAPYD_SERVERS %}
{% if loop.index in selected_nodes and loop.index != first_selected_node %}
<tr>
<td><input type="checkbox" id="checkbox_{{ loop.index }}" name="{{ loop.index }}" /></td>
<td >{{ loop.index }}</td>
<td>
<a
class={% if loop.index == node %}"state safe"{% else %}"state normal"{% endif %}
href="{{ url_projects_list[loop.index-1] }}"
target={% if selected_nodes|length > 1 %}"_blank"{% else %}"_self"{% endif %}
>{{ SCRAPYD_SERVERS[loop.index-1] }}</a>
</td>
<td id="node_name_{{ loop.index }}"></td>
<td id="status_{{ loop.index }}"></td>
<td id="project_{{ loop.index }}"></td>
<td id="version_{{ loop.index }}"></td>
<td id="spiders_{{ loop.index }}"></td>
</tr>
{% endif %}
{% endfor %}
</tbody>
</form>
</table>

<div class="action">
<a class="button safe big" href="javascript:;" onclick="multinodeRunSpider();">{% if selected_nodes|length > 1 %}Multinode {% endif %}Run Spider</a>
<a class="button normal big" href="javascript:;" onclick="passToServers();">Servers &raquo; Run Spider</a>
</div>
</div>


Expand All @@ -89,57 +89,57 @@ <h2>Deploy Project</h2>


window.onload = function(){
$('#checkAll').click(function () {
$('table input:checkbox').not(this).prop('checked', this.checked);
});
$('#checkAll').click(function () {
$('table input:checkbox').not(this).prop('checked', this.checked);
});

{% if selected_nodes|length > 1 %}
setTimeout("fireXHR();", 500);
setTimeout("fireXHR();", 500);
{% endif %}
}


{% if selected_nodes|length > 1 %}
function fireXHR(){
//var r = confirm("Start to deploy project on remaining nodes?");
//if(r == false) {
// return;
//}

for (var idx in selected_nodes) {
if (selected_nodes[idx] != first_selected_node) {
var url = url_xhr.replace(/\/\d+/, '/'+selected_nodes[idx]);
execXHR(selected_nodes[idx], url);
}
//var r = confirm("Start to deploy project on remaining nodes?");
//if(r == false) {
// return;
//}

for (var idx in selected_nodes) {
if (selected_nodes[idx] != first_selected_node) {
var url = url_xhr.replace(/\/\d+/, '/'+selected_nodes[idx]);
execXHR(selected_nodes[idx], url);
}
}
}


function execXHR(idx, url){
my$('#'+'status_'+idx).innerHTML = '<em class="normal">loading...</em>';
var req = new XMLHttpRequest();
req.onreadystatechange = function() {
if (this.readyState == 4) {
if (this.status == 200) {
var obj = JSON.parse(this.responseText);
if (obj.status == 'ok') {
console.log('#'+'node_name_'+idx, obj.node_name);
my$('#'+'node_name_'+idx).innerHTML = obj.node_name;
my$('#'+'status_'+idx).innerHTML = '<em class="pass">'+obj.status+'</em>';
my$('#'+'project_'+idx).innerHTML = obj.project;
my$('#'+'version_'+idx).innerHTML = obj.version;
my$('#'+'spiders_'+idx).innerHTML = obj.spiders;
my$('#'+'checkbox_'+idx).checked = true;
} else {
my$('#'+'status_'+idx).innerHTML = getRequestFailHtml(url, 'status', obj.status);
}
} else {
my$('#'+'status_'+idx).innerHTML = getRequestFailHtml(url, 'code', this.status);
}
my$('#'+'status_'+idx).innerHTML = '<em class="normal">loading...</em>';
var req = new XMLHttpRequest();
req.onreadystatechange = function() {
if (this.readyState == 4) {
if (this.status == 200) {
var obj = JSON.parse(this.responseText);
if (obj.status == 'ok') {
console.log('#'+'node_name_'+idx, obj.node_name);
my$('#'+'node_name_'+idx).innerHTML = obj.node_name;
my$('#'+'status_'+idx).innerHTML = '<em class="pass">'+obj.status+'</em>';
my$('#'+'project_'+idx).innerHTML = obj.project;
my$('#'+'version_'+idx).innerHTML = obj.version;
my$('#'+'spiders_'+idx).innerHTML = obj.spiders;
my$('#'+'checkbox_'+idx).checked = true;
} else {
my$('#'+'status_'+idx).innerHTML = getRequestFailHtml(url, 'status', obj.status);
}
};
req.open("post", url, Async=true);
req.send();
} else {
my$('#'+'status_'+idx).innerHTML = getRequestFailHtml(url, 'code', this.status);
}
}
};
req.open("post", url, Async=true);
req.send();
}
{% endif %}
</script>
Expand Down
90 changes: 45 additions & 45 deletions scrapydweb/templates/scrapydweb/fail.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
{% block title %}fail{% endblock %}

{% block head %}
<style>
h2 {color: red;}
h3 a {word-break: break-all;}
</style>
<style>
h2 {color: red;}
h3 a {word-break: break-all;}
</style>

{% if jump_url %}
<meta http-equiv="refresh" content="3; url='{{ jump_url }}'">
Expand All @@ -18,53 +18,53 @@
<h2>Oops! Something went wrong.</h2>

<div class="wrap">
{% if url %}
<h3><a class="link" target="_blank" href="{{ url }}">{{ url }}</a></h3>
{% endif %}

{% if alert %}
<h3>{{ alert }}</h3>
{% endif %}

{% if status_code %}
<h3>status_code: {{ status_code }}</h3>
{% endif %}

<pre>{{ text }}</pre>

<div id="tip_wrapper" {% if not tip %}style="display: none;"{% endif %}>
<h3>Tip</h3>
<div id="tip">{{ tip|safe }}</div>
</div>

{% if message %}
<h3>Details</h3>
<pre>{{ message }}</pre>
{% endif %}

{% if jump_url %}
<h4>Redirecting to <a class="link" href="{{ jump_url }}">{{ jump_url }}</a> in 3 seconds...</h4>
{% endif %}

{% if url %}
<br>
<iframe src="{{ url }}" style="width: 100%; height: 600px;">{{ url }}</iframe>
{% endif %}
{% if url %}
<h3><a class="link" target="_blank" href="{{ url }}">{{ url }}</a></h3>
{% endif %}

{% if alert %}
<h3>{{ alert }}</h3>
{% endif %}

{% if status_code %}
<h3>status_code: {{ status_code }}</h3>
{% endif %}

<pre>{{ text }}</pre>

<div id="tip_wrapper" {% if not tip %}style="display: none;"{% endif %}>
<h3>Tip</h3>
<div id="tip">{{ tip|safe }}</div>
</div>

{% if message %}
<h3>Details</h3>
<pre>{{ message }}</pre>
{% endif %}

{% if jump_url %}
<h4>Redirecting to <a class="link" href="{{ jump_url }}">{{ jump_url }}</a> in 3 seconds...</h4>
{% endif %}

{% if url %}
<br>
<iframe src="{{ url }}" style="width: 100%; height: 600px;">{{ url }}</iframe>
{% endif %}
</div>


{% if text and not tip %}
<script>
window.onload = function(){
// https://stackoverflow.com/questions/7381974/which-characters-need-to-be-escaped-in-html
try {
var text = '{{ text|replace("&", "&amp;")|replace("<", "&lt;")|replace(">", "&gt;")|replace("\\", "/")|replace("'", "\\'")|replace("\r", " ")|replace("\n", " ")|safe }}';
var obj = JSON.parse(text);
if (obj.tip) {
my$('#tip_wrapper').style.display = 'block';
my$('#tip').innerHTML = obj.tip;
}
} catch(err) {console.log(err);}
// https://stackoverflow.com/questions/7381974/which-characters-need-to-be-escaped-in-html
try {
var text = '{{ text|replace("&", "&amp;")|replace("<", "&lt;")|replace(">", "&gt;")|replace("\\", "/")|replace("'", "\\'")|replace("\r", " ")|replace("\n", " ")|safe }}';
var obj = JSON.parse(text);
if (obj.tip) {
my$('#tip_wrapper').style.display = 'block';
my$('#tip').innerHTML = obj.tip;
}
} catch(err) {console.log(err);}
};
</script>
{% endif %}
Expand Down
26 changes: 13 additions & 13 deletions scrapydweb/templates/scrapydweb/fail_mobileui.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@

{% block body %}
<div style="margin: 0 12px;">
{% if url %}
<h3 style="word-break: break-all;"><a class="link" target="_blank" href="{{ url }}">{{ url }}</a></h3>
{% endif %}
{% if url %}
<h3 style="word-break: break-all;"><a class="link" target="_blank" href="{{ url }}">{{ url }}</a></h3>
{% endif %}

{% if status_code %}
<h3>status_code: {{ status_code }}</h3>
{% endif %}
{% if status_code %}
<h3>status_code: {{ status_code }}</h3>
{% endif %}

<pre>
{{ text }}
{{ message }}
</pre>
<pre>
{{ text }}
{{ message }}
</pre>

{% if url %}
<!-- <iframe src="{{ url }}" style="width: 100%; height: 100%;">{{ url }}</iframe> -->
{% endif %}
{% if url %}
<!-- <iframe src="{{ url }}" style="width: 100%; height: 100%;">{{ url }}</iframe> -->
{% endif %}
</div>
{% endblock %}
Loading

0 comments on commit bafb4ab

Please sign in to comment.