Add custom harvest source read page (provisional)
This commit is contained in:
parent
2dba7fbf78
commit
697933f8d0
|
@ -55,6 +55,9 @@ class Harvest(p.SingletonPlugin, DefaultDatasetForm):
|
|||
def search_template(self):
|
||||
return 'source/search.html'
|
||||
|
||||
def read_template(self):
|
||||
return 'source/read.html'
|
||||
|
||||
def new_template(self):
|
||||
return 'source/new.html'
|
||||
|
||||
|
|
|
@ -1,160 +1,118 @@
|
|||
{% extends "page.html" %}
|
||||
|
||||
{% block title %}{{ _('Harvest Source Details') }} - {{ super() }}{% endblock %}
|
||||
|
||||
{% block styles %}
|
||||
{{ super() }}
|
||||
<link type="text/css" rel="stylesheet" media="all" href="/ckanext/harvest/style.css" />
|
||||
{% endblock %}
|
||||
{% set pkg = c.pkg_dict %}
|
||||
|
||||
{% block subtitle %}{{ pkg.title or pkg.name }}{% endblock %}
|
||||
|
||||
{% block breadcrumb_content %}
|
||||
<li>{{ h.nav_named_link(_('Harvest Sources'), '{0}_search'.format(c.dataset_type)) }}</li>
|
||||
<li class="active">{{ h.nav_named_link(c.harvest_source.title|truncate(30), '{0}_read'.format(c.dataset_type), id=c.harvest_source.name) }}</li>
|
||||
{% endblock %}
|
||||
|
||||
{% block primary %}
|
||||
<article class="module">
|
||||
<div class="module-content">
|
||||
<div class="harvest-content">
|
||||
{% if c.source %}
|
||||
<h1>Harvest Source Details</h1>
|
||||
<div id="harvest-source-actions">
|
||||
<img src="/ckanext/harvest/images/icons/source_edit.png" alt="Edit" /><a href="/harvest/edit/{{ c.source.id }}">Edit source</a> |
|
||||
<img src="/ckanext/harvest/images/icons/source_refresh.png" alt="Refresh" /><a href="/harvest/refresh/{{ c.source.id }}">Refresh source</a> |
|
||||
<a href="/harvest">Sources list</a>
|
||||
</div>
|
||||
{% if not c.source.active %}
|
||||
<div class="alert alert-block">NB: This Harvest Source is Withdrawn. Therefore the Gemini XML will not be harvested again. However, any metadata that was previously harvested, remains in the catalogue.</div>
|
||||
{% block actions_content %}
|
||||
{% if h.check_access('package_update', {'id':pkg.id }) %}
|
||||
<li>{{ h.nav_named_link(_('Edit'), '{0}_edit'.format(c.dataset_type), id=c.harvest_source.name, class_='btn btn-primary', icon='wrench')}}</li>
|
||||
{% endif %}
|
||||
<li>{{ h.follow_button('dataset', pkg.id) }}</li>
|
||||
{% endblock %}
|
||||
|
||||
{% block primary_content %}
|
||||
{% block package_revision_info %}
|
||||
{% if c.pkg_revision_id %}
|
||||
<div class="module info">
|
||||
<p class="module-content">
|
||||
{% set timestamp = h.render_datetime(c.pkg_revision_timestamp, with_hours=True) %}
|
||||
{% set url = h.url(controller='package', action='read', id=pkg.name) %}
|
||||
|
||||
{% if c.pkg_revision_not_latest %}
|
||||
{% trans timestamp=timestamp, url=url %}This is an old revision of this dataset, as edited at {{ timestamp }}. It may differ significantly from the <a href="{{ url }}">current revision</a>.{% endtrans %}
|
||||
{% else %}
|
||||
{% trans timestamp=timestamp %}This is the current revision of this dataset, as edited at {{ timestamp }}.{% endtrans %}
|
||||
{% endif %}
|
||||
<table id="harvest-source-details" class="table table-bordered table-condensed">
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<td>{{ c.source.id }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>URL</th>
|
||||
<td>{{ c.source.url }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Type</th>
|
||||
<td>{{ c.source.type }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Withdrawn</th>
|
||||
<td>{{ not c.source.active }}</td>
|
||||
</tr>
|
||||
{% if c.source.title %}
|
||||
<tr>
|
||||
<th>Title</th>
|
||||
<td>{{ c.source.title }}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
<tr>
|
||||
<th>Description</th>
|
||||
<td>{{ c.source.description }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Configuration</th>
|
||||
{% if c.source.config %}
|
||||
<td>{{ c.source.config }}</td>
|
||||
{% else %}
|
||||
<td>-</td>
|
||||
{% endif %}
|
||||
</tr>
|
||||
{% if c.publisher_auth %}
|
||||
<tr>
|
||||
<th>User</th>
|
||||
<td>{{ c.source.user_id }}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% if c.publisher_auth %}
|
||||
<tr>
|
||||
<th>Publisher</th>
|
||||
{% if c.source.publisher_title %}
|
||||
<td>${c.source.publisher_title}</td>
|
||||
{% endif %}
|
||||
{% if not c.source.publisher_title %}
|
||||
<td>{{ c.source.publisher_id }}</td>
|
||||
{% endif %}
|
||||
</tr>
|
||||
{% endif %}
|
||||
<tr>
|
||||
<th>Created</th>
|
||||
<td>{{ c.source.created }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Total jobs</th>
|
||||
<td>{{ c.source.status.job_count }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Status</th>
|
||||
<td>
|
||||
<a name="errors"></a>Last Harvest Errors: {{ c.source.status.last_harvest_statistics.errors }}<br/>
|
||||
{% if c.source.status.last_harvest_errors.gather | length > 0 %}
|
||||
<i>Gathering errors</i>
|
||||
<ul>
|
||||
{% for error in c.source.status.last_harvest_errors.gather %}
|
||||
<li>
|
||||
{% set lines = error.split('\n') %}
|
||||
{% for line in lines %}
|
||||
<div>{{ line }}</div>
|
||||
{% endfor %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
{% if c.source.status.last_harvest_errors.object | length > 0 %}
|
||||
<i>Object errors</i>
|
||||
<ul>
|
||||
{% for error in c.source.status.last_harvest_errors.object %}
|
||||
<li>
|
||||
<div>GUID <a href="{{g.site_url}}/harvest/object/{{error.object_id}}">{{error.object_guid}}</a></div>
|
||||
{% set lines = error['message'].split('\n') %}
|
||||
{% for line in lines %}
|
||||
<div>{{ line }}</div>
|
||||
{% endfor %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
Last Harvest Added: {{ c.source.status.last_harvest_statistics.added }}<br/>
|
||||
Last Harvest Updated: {{ c.source.status.last_harvest_statistics.updated }}<br/>
|
||||
Last Harvest: {{ c.source.status.last_harvest_request }} <br/>
|
||||
Next Harvest: {{ c.source.status.next_harvest }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Total Errors</th>
|
||||
<td>{{ c.source.status.overall_statistics.errors }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Total Datasets</th>
|
||||
<td>{{ c.source.status.overall_statistics.added }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Datasets</th>
|
||||
<td>
|
||||
<a name="datasets"></a>
|
||||
<div>There could be a 10 minutes delay before these datasets (or changes to them) appear on
|
||||
the site or on search results.</div>
|
||||
|
||||
<p>There are <strong>{{ c.page.item_count }}</strong> datasets.</p>
|
||||
|
||||
{{ c.page.pager() }}
|
||||
{% for item in c.page.items %}
|
||||
<div>
|
||||
<a href="/dataset/{{ item }}">{{ item }}</a>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{{ c.page.pager() }}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
<article class="module prose">
|
||||
|
||||
{% block package_header %}
|
||||
<header class="module-content page-header">
|
||||
<ul class="nav nav-tabs">
|
||||
<li{% if c.action == 'read' %} class="active"{% endif %}>
|
||||
{% link_for _('Dataset'), controller='package', action='read', id=pkg.name, icon='sitemap' %}
|
||||
</li>
|
||||
<li{% if c.action == 'activity' %} class="active"{% endif %}>
|
||||
{% link_for _('Activity Stream'), controller='package', action='activity', id=pkg.name, icon='time' %}
|
||||
</li>
|
||||
<li{% if c.action == 'followers' %} class="active"{% endif %}>
|
||||
{% link_for _('Followers'), controller='package', action='followers', id=pkg.name, icon='group' %}
|
||||
</li>
|
||||
<li{% if c.action == 'related' %} class="active"{% endif %}>
|
||||
{% link_for _('Related'), controller='related', action='list', id=pkg.name, icon='picture' %}
|
||||
</li>
|
||||
</ul>
|
||||
</header>
|
||||
{% endblock %}
|
||||
|
||||
{% block package_content %}
|
||||
|
||||
{% block package_description %}
|
||||
<section class="module-content">
|
||||
<div style="color:red; font-weight:bold">CUSTOM HARVEST SOURCE TEMPLATE for {{ c.dataset_type}}</div>
|
||||
</section>
|
||||
|
||||
<section class="module-content">
|
||||
<h1>{{ pkg.title or pkg.name }}
|
||||
{% if pkg.state.startswith('draft') %}
|
||||
[{{ _('Draft') }}]
|
||||
{% endif %}
|
||||
</h1>
|
||||
{% if c.pkg_notes_formatted %}
|
||||
<div class="notes embedded-content">
|
||||
{{ c.pkg_notes_formatted }}
|
||||
</div>
|
||||
{% endif %}
|
||||
<span class="insert-comment-thread"></span>
|
||||
</section>
|
||||
{% endblock %}
|
||||
|
||||
{% block package_resources %}
|
||||
{% snippet "package/snippets/resources_list.html", pkg=pkg, resources=pkg.resources %}
|
||||
{% endblock %}
|
||||
|
||||
{% block package_tags %}
|
||||
{% snippet "package/snippets/tags.html", tags=pkg.tags %}
|
||||
{% endblock %}
|
||||
|
||||
{% block package_additional_info %}
|
||||
{% snippet "package/snippets/additional_info.html", pkg_dict=pkg %}
|
||||
{% endblock %}
|
||||
|
||||
{% endblock %}
|
||||
</article>
|
||||
{% endblock %}
|
||||
|
||||
{% block sidebar %}{% endblock %}
|
||||
{% block secondary_content %}
|
||||
|
||||
{% block secondary_help_content %}{% endblock %}
|
||||
|
||||
{% block package_groups %}
|
||||
{% for group in pkg.groups %}
|
||||
{% snippet "snippets/group.html", group=group, truncate=70 %}
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
|
||||
{% block package_social %}
|
||||
{% snippet "snippets/social.html" %}
|
||||
{% endblock %}
|
||||
|
||||
{% block package_related %}
|
||||
{% snippet "snippets/related.html", item=c.pkg.related|last, pkg_name=pkg.name %}
|
||||
{% endblock %}
|
||||
|
||||
{% block package_license %}
|
||||
{% snippet "snippets/license.html", pkg_dict=pkg %}
|
||||
{% endblock %}
|
||||
|
||||
{% endblock %}
|
||||
|
|
Loading…
Reference in New Issue