Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
145 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
<!DOCTYPE html> | ||
<html lang="en" ng-app="app"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>Scrapyd</title> | ||
|
||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<meta name="description" content="Scrapy server"> | ||
<meta name="author" content="Jordi Llonch <llonchj@gmail.com>"> | ||
|
||
<!-- Le styles --> | ||
<style> | ||
body { | ||
padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */ | ||
} | ||
</style> | ||
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/css/bootstrap-combined.min.css" rel="stylesheet"> | ||
|
||
<!-- HTML5 shim, for IE6-8 support of HTML5 elements --> | ||
<!--[if lt IE 9]> | ||
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> | ||
<![endif]--> | ||
|
||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script> | ||
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.0.4/angular.min.js"></script> | ||
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.0.4/angular-resource.min.js"></script> | ||
<script src="//netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/js/bootstrap.min.js"></script> | ||
|
||
<script src="/js/scrapyd.js"></script> | ||
|
||
<!-- Fav and touch icons --> | ||
<link rel="shortcut icon" href="/ico/favicon.png"> | ||
</head> | ||
|
||
<body ng-controller="AppCtrl"> | ||
<div class="navbar navbar-inverse navbar-fixed-top"> | ||
<div class="navbar-inner"> | ||
<div class="container"> | ||
<a class="brand" href="/">Scrapyd</a> | ||
<ul class="nav"> | ||
<li class="dropdown"> | ||
<a class="dropdown-toggle" data-toggle="dropdown" href="#"> | ||
Project | ||
<span class="caret"></span> | ||
</a> | ||
<ul class="dropdown-menu"> | ||
<li ng-repeat="project in projects"><a href="#" id="id_[[project]]">[[project]]</a></li> | ||
</ul> | ||
</li> | ||
|
||
<li class="dropdown"> | ||
<a class="dropdown-toggle" data-toggle="dropdown" href="#"> | ||
Spider | ||
<span class="caret"></span> | ||
</a> | ||
<ul class="dropdown-menu"> | ||
<li ng-repeat="spider in spiders"><a href="#" id="id_[[spider]]">[[spider]]</a></li> | ||
</ul> | ||
</li> | ||
|
||
<li><a href="http://doc.scrapy.org/en/latest/topics/scrapyd.html" target="_new">Documentation</a></li> | ||
</ul> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div class="container"> | ||
|
||
<div class="modal hide" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> | ||
<div class="modal-header"> | ||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> | ||
<h3 id="myModalLabel">Start crawler [[spider]]</h3> | ||
</div> | ||
<div class="modal-body"> | ||
<h4>Settings</h4> | ||
<textarea ></textarea> | ||
<h4>Arguments</h4> | ||
<textarea></textarea> | ||
</div> | ||
<div class="modal-footer"> | ||
<button class="btn" data-dismiss="modal" aria-hidden="true">Cancel</button> | ||
<button class="btn btn-primary">Schedule</button> | ||
</div> | ||
</div> | ||
|
||
|
||
<a href="#myModal" role="button" class="btn" data-toggle="modal">Schedule</a> | ||
|
||
<button ng-click="refresh()">refresh</button> | ||
|
||
<table class="table table-bordered"> | ||
<th>Project</th><th>Spider</th><th>Job</th><th>Status</th><th>Time</th> | ||
<tr ng-repeat="task in tasks"> | ||
<td>[[task.project]]</td> | ||
<td>[[task.spider]]</td> | ||
<td> | ||
<span ng:hide="task.status == 'pending'" > | ||
<a class="icon-book" title="Log" href="/logs/[[task.project]]/[[task.spider]]/[[task.job]].log"></a> | ||
<a class="icon-file" title="Items" href="/items/[[task.project]]/[[task.spider]]/[[task.job]].jl"></a> | ||
</span> | ||
[[task.job]]</td> | ||
<td>[[task.status]]</td> | ||
<td>[[task.elapsed]]</td> | ||
</tr> | ||
</table> | ||
</div> <!-- /container --> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
Scrapyd Javascript | ||
*/ | ||
|
||
var app = angular.module('app', ['ngResource']); | ||
|
||
app.config(function($interpolateProvider) { | ||
$interpolateProvider.startSymbol('[['); | ||
$interpolateProvider.endSymbol(']]'); | ||
}); | ||
|
||
|
||
var AppCtrl = function($scope, $http) { | ||
|
||
$http.get('/status.json') | ||
.success(function(data) { | ||
$scope.projects = data.projects; | ||
}); | ||
|
||
$http.get('/listspiders.json?project=*') | ||
.success(function(data) { | ||
$scope.spiders = data.spiders; | ||
}); | ||
|
||
$scope.refresh = function() { | ||
$http.get('/d') | ||
.success(function(data) { | ||
$scope.tasks = data; | ||
}); | ||
}; | ||
|
||
$scope.refresh(); | ||
} | ||
|
||
app.controller('AppCtrl', AppCtrl); |