[ui] Cleanup sources list and details page

This commit is contained in:
amercader 2012-01-24 16:55:47 +00:00
parent 0f8c607187
commit 3a489bbb82
4 changed files with 72 additions and 20 deletions

View File

@ -34,7 +34,7 @@ def _get_source_status(source, detailed=True):
# Get next scheduled job # Get next scheduled job
next_job = HarvestJob.filter(source=source,status=u'New').first() next_job = HarvestJob.filter(source=source,status=u'New').first()
if next_job: if next_job:
out['next_harvest'] = 'Within 15 minutes' out['next_harvest'] = 'Scheduled'
else: else:
out['next_harvest'] = 'Not yet scheduled' out['next_harvest'] = 'Not yet scheduled'

View File

@ -1,4 +1,16 @@
/* Harvest styles */ /* Harvest styles */
body.index.ViewController #minornavigation {
display: none;
}
body.index.ViewController #content {
width: 100% !important;
border: 0 !important;
}
#new-harvest-source { #new-harvest-source {
background: transparent url("images/icons/source_new.png") no-repeat 0px 0px; background: transparent url("images/icons/source_new.png") no-repeat 0px 0px;
padding-left: 20px; padding-left: 20px;
@ -6,10 +18,34 @@
font-weight: bold; font-weight: bold;
} }
#show-inactive-sources-content{
float: right;
width: 150px;
}
#show-inactive-sources-content input{
float: left;
}
#show-inactive-sources-content label{
float: left;
font-weight: normal;
margin-top: -4px;
margin-left: 5px;
}
#harvest-sources th.action{ #harvest-sources th.action{
font-style: italic; font-style: italic;
} }
#harvest-sources .inactive{
display:none;
}
#harvest-sources .inactive .state{
color: red;
}
.harvester-title{ .harvester-title{
font-weight: bold; font-weight: bold;
} }

View File

@ -8,14 +8,21 @@
<py:def function="optional_head"> <py:def function="optional_head">
<link type="text/css" rel="stylesheet" media="all" href="/ckanext/harvest/style.css" /> <link type="text/css" rel="stylesheet" media="all" href="/ckanext/harvest/style.css" />
</py:def> </py:def>
<py:def function="optional_footer">
<script>$("#show-inactive-sources").click(function(){$("#harvest-sources .inactive").toggle()});</script>
</py:def>
<div py:match="content"> <div py:match="content">
<div class="harvest-content"> <div class="harvest-content">
<h1>Harvesting Sources</h1> <h1>Harvesting Sources</h1>
<div id="new-harvest-source"><a href="harvest/new">Add a harvesting source</a></div>
<py:choose>
<py:when test="c.sources">
<div id="new-harvest-source"><a href="harvest/new">Add a harvesting source</a></div>
<py:choose>
<py:when test="c.sources">
<div id="show-inactive-sources-content">
<input type="checkbox" id="show-inactive-sources" />
<label for="show-inactive-sources"> Show inactive sources</label>
</div>
<table id="harvest-sources"> <table id="harvest-sources">
<tr> <tr>
@ -30,25 +37,33 @@
<th>Created</th> <th>Created</th>
</tr> </tr>
<tr py:for="source in c.sources"> <tr py:for="source in c.sources" class="${'active' if source.active else 'inactive'}">
<td><a href="harvest/${source.id}"><img src="ckanext/harvest/images/icons/source_view.png" alt="View" title="View" /></a></td> <td><a href="harvest/${source.id}"><img src="ckanext/harvest/images/icons/source_view.png" alt="View" title="View" /></a></td>
<td><a href="harvest/edit/${source.id}"><img src="ckanext/harvest/images/icons/source_edit.png" alt="Edit" title="Edit" /></a></td> <td><a href="harvest/edit/${source.id}"><img src="ckanext/harvest/images/icons/source_edit.png" alt="Edit" title="Edit" /></a></td>
<td><a href="harvest/refresh/${source.id}"><img src="ckanext/harvest/images/icons/source_refresh.png" alt="Refresh" title="Refresh" /></a></td> <td><a href="harvest/refresh/${source.id}"><img src="ckanext/harvest/images/icons/source_refresh.png" alt="Refresh" title="Refresh" /></a></td>
<td>${source.url}</td> <py:choose>
<py:when test="source.url and len(source.url)>50">
<td>${source.url[:50]}<span title="${source.url}">...</span></td>
</py:when>
<py:otherwise>
<td>${source.url}</td>
</py:otherwise>
</py:choose>
<td>${source.type}</td> <td>${source.type}</td>
<td>${source.active}</td> <td class="state">${source.active}</td>
<py:choose> <py:choose>
<py:when test="'msg' in source.status"> <py:when test="'msg' in source.status">
<td>${source.status.msg}</td> <td>${source.status.msg}</td>
<td>${source.status.msg}</td> <td>${source.status.msg}</td>
</py:when> </py:when>
<py:otherwise> <py:otherwise>
<td>${source.status.overall_statistics.added} pkgs ${source.status.overall_statistics.errors} errors</td> <td>Datasets: <a href="harvest/${source.id}#datasets">${source.status.overall_statistics.added}</a> <br/>
Last errors: <a href="harvest/${source.id}#errors">${source.status.last_harvest_statistics.errors}</a></td>
<td>${source.status.next_harvest}</td> <td>${source.status.next_harvest}</td>
</py:otherwise> </py:otherwise>
</py:choose> </py:choose>
<td>${source.created}</td> <td>${h.render_datetime(source.created)}</td>
</tr> </tr>
</table> </table>
</py:when> </py:when>

View File

@ -65,7 +65,7 @@
<tr> <tr>
<th>Status</th> <th>Status</th>
<td> <td>
Last Harvest Errors: ${c.source.status.last_harvest_statistics.errors}<br/> <a name="errors"/>Last Harvest Errors: ${c.source.status.last_harvest_statistics.errors}<br/>
<py:choose> <py:choose>
<py:when test="len(c.source.status.last_harvest_errors.gather)>0"> <py:when test="len(c.source.status.last_harvest_errors.gather)>0">
<i>Gathering errors</i> <i>Gathering errors</i>
@ -105,21 +105,22 @@
<td>${c.source.status.overall_statistics.errors}</td> <td>${c.source.status.overall_statistics.errors}</td>
</tr> </tr>
<tr> <tr>
<th>Total Packages</th> <th>Total Datasets</th>
<td>${c.source.status.overall_statistics.added}</td> <td>${c.source.status.overall_statistics.added}</td>
</tr> </tr>
<tr> <tr>
<th>Packages</th> <th>Datasets</th>
<td> <td>
<div>There could be a 10 minutes delay before these packages (or changes to them) appear on <a name="datasets"/>
<div>There could be a 10 minutes delay before these datasets (or changes to them) appear on
the site or on search results.</div> the site or on search results.</div>
<p i18n:msg="item_count">There are <strong>${c.page.item_count}</strong> packages.</p> <p i18n:msg="item_count">There are <strong>${c.page.item_count}</strong> datasets.</p>
${c.page.pager()} ${c.page.pager()}
<py:for each="item in c.page.items"> <py:for each="item in c.page.items">
<div> <div>
<a href="/package/${item}">${item}</a> <a href="/dataset/${item}">${item}</a>
</div> </div>
</py:for> </py:for>
${c.page.pager()} ${c.page.pager()}