-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Continued PortalSync class. - Limited clearing functionality on the PortalSync type. - Added some flag fields to packages to store last sync time.
- Loading branch information
1 parent
adc641f
commit dc787f8
Showing
10 changed files
with
518 additions
and
92 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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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,127 @@ | ||
{# | ||
NOTE: copied from ckanext-harvest for lack of blocks. | ||
Adds expansion to show what was modified. TODO: upstream contrib?? | ||
|
||
Displays information for a particular harvest job, including: | ||
|
||
* counts for added, updated, deleted or errored datasets | ||
* table with general details | ||
* table with a summary of the most common errors on this job | ||
|
||
job - dictized harvest job object | ||
|
||
Example: | ||
|
||
{% snippet 'snippets/job_details.html', job=job %} | ||
|
||
#} | ||
|
||
{% set stats = job.stats %} | ||
|
||
{% if job.status == 'Finished' %} | ||
<p> | ||
{# Add link to custom view to show what was modified #} | ||
{% if 'errored' in stats and stats['errored'] > 0 %} | ||
<a href="javascript:void(0);" class="harvest-state-button errored" data-toggle="collapse" data-target="#info-errored" aria-controlls="info-errored"> | ||
{% endif %} | ||
<span class="label label-important" data-diff="error"> | ||
{% if 'errored' in stats and stats['errored'] > 0 %} | ||
{{ stats['errored'] }} | ||
{% else %} | ||
0 | ||
{% endif %} | ||
{{ _('errors') }} | ||
</span> | ||
{% if 'errored' in stats and stats['errored'] > 0 %} | ||
</a> | ||
{% endif %} | ||
{% for action in ['added', 'updated', 'deleted', 'not modified'] %} | ||
{# Add link to custom view to show what was modified #} | ||
{% if action in stats and stats[action] > 0 %} | ||
<a href="javascript:void(0);" class="harvest-state-button {{ action.replace(' ', '-') }}" data-toggle="collapse" data-target="#info-{{ action.replace(' ', '-') }}" aria-controlls="info-{{ action.replace(' ', '-') }}"> | ||
{% endif %} | ||
<span class="label" data-diff="{{ action }}"> | ||
{% if action in stats and stats[action] > 0 %} | ||
{{ stats[action] }} | ||
{% else %} | ||
0 | ||
{% endif %} | ||
{{ _(action) }} | ||
</span> | ||
{% if action in stats and stats[action] > 0 %} | ||
</a> | ||
{% endif %} | ||
{% endfor %} | ||
</p> | ||
{# Add expand sections for above buttons #} | ||
{% if 'errored' in stats and stats['errored'] > 0 %} | ||
<div class="panel panel-primary collapse harvest-state-details" id="info-errored" aria-labelledby="info-errored"> | ||
<div class="panel-heading"> | ||
<div class="panel-title">{{ stats['errored'] }} {{ _('errors') }}</div> | ||
</div> | ||
{% set _packages = h.get_packages_from_harvest_job(job, 'errored') %} | ||
<ul class="list-group"> | ||
<li class="list-group-item"></li> | ||
</ul> | ||
</div> | ||
{% endif %} | ||
{% for action in ['added', 'updated', 'deleted', 'not modified'] %} | ||
{% if action in stats and stats[action] > 0 %} | ||
<div class="panel panel-primary collapse harvest-state-details" id="info-{{ action.replace(' ', '-') }}" aria-labelledby="info-{{ action.replace(' ', '-') }}"> | ||
<div class="panel-heading"> | ||
<div class="panel-title">{{ stats[action] }} {{ _(action) }}</div> | ||
</div> | ||
{% set _packages = h.get_packages_from_harvest_job(job, action) %} | ||
<ul class="list-group"> | ||
{% for _package in _packages %} | ||
<li class="list-group-item"> | ||
<strong>{% link_for h.get_translated(_package, 'title'), named_route=_package.type + '.read', id=_package.id %}</strong><br /> | ||
<small><i class="fa fa-building-o" aria-hidden="true"></i> {{ h.split_piped_bilingual_field(_package.organization.title, h.lang()) }}</small><br /> | ||
<small><i class="fa fa-file-code-o" aria-hidden="true"></i> {% link_for _package.id, named_route='api.action', logic_function='package_show', id=_package.id %}</small> | ||
</li> | ||
{% endfor %} | ||
</ul> | ||
</div> | ||
{% endif %} | ||
{% endfor %} | ||
{% endif %} | ||
|
||
<h3 class="hide-heading">{{ _('Details') }}</h3> | ||
<table class="table table-striped table-bordered table-condensed"> | ||
<colgroup> | ||
<col width="15"> | ||
<col width="85"> | ||
</colgroup> | ||
<tr> | ||
<th>{{ _('Id') }}</th> | ||
<td>{{ job.id }}</td> | ||
</tr> | ||
<tr> | ||
<th>{{ _('Created') }}</th> | ||
<td> | ||
<span class="automatic-local-datetime" data-datetime="{{ h.render_datetime(job.created, date_format='%Y-%m-%dT%H:%M:%S%z') }}"> | ||
{{ h.render_datetime(job.created, with_hours=True) }} | ||
</span> | ||
</td> | ||
</tr> | ||
<tr> | ||
<th>{{ _('Started') }}</th> | ||
<td> | ||
<span class="automatic-local-datetime" data-datetime="{{ h.render_datetime(job.gather_started, date_format='%Y-%m-%dT%H:%M:%S%z') }}"> | ||
{{ h.render_datetime(job.gather_started, with_hours=True) }} | ||
</span> | ||
</td> | ||
</tr> | ||
<tr> | ||
<th>{{ _('Finished') }}</th> | ||
<td> | ||
<span class="automatic-local-datetime" data-datetime="{{ h.render_datetime(job.finished, date_format='%Y-%m-%dT%H:%M:%S%z') }}"> | ||
{{ h.render_datetime(job.finished, with_hours=True) }} | ||
</span> | ||
</td> | ||
</tr> | ||
<tr> | ||
<th>{{ _('Status') }}</th> | ||
<td>{{ _(job.status) }}</td> | ||
</tr> | ||
</table> |
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,37 @@ | ||
{% ckan_extends %} | ||
|
||
{% block content_action %} | ||
<div class="content_action btn-group"> | ||
{% if harvest_source.status and harvest_source.status.last_job and (harvest_source.status.last_job.status == 'New' or harvest_source.status.last_job.status == 'Running') %} | ||
<a class="btn btn-default disabled" rel="tooltip" title="There already is an unrun job for this source"><i class="fa fa-lg fa-refresh icon-refresh icon-large"></i> Reharvest</a> | ||
{% else %} | ||
{% set locale = h.dump_json({'content': _('This will re-run the harvesting for this source. Any updates at the source will overwrite the local datasets. Sources with a large number of datasets may take a significant amount of time to finish harvesting. Please confirm you would like us to start reharvesting.')}) %} | ||
<a href="{{ h.url_for('harvester.refresh', id=harvest_source.id) }}" class="btn btn-default" data-module="confirm-action" data-module-i18n="{{ locale }}" | ||
title="{{ _('Start a new harvesting job for this harvest source now') }}"> | ||
<i class="fa fa-refresh icon-refresh"></i> | ||
{{ _('Reharvest') }} | ||
</a> | ||
{% endif %} | ||
{% if harvest_source.status and harvest_source.status.last_job and (harvest_source.status.last_job.status == 'Running') %} | ||
<a href="{{ h.url_for('harvester.job_abort', source=harvest_source.name, id=harvest_source.status.last_job.id) }}" class="btn btn-default" title="Stop this Job"> | ||
<i class="fa fa-ban icon-ban-circle"></i> | ||
{{ _('Stop') }} | ||
</a> | ||
{% endif %} | ||
{% if harvest_source.source_type == 'portal_sync' %} | ||
{% set locale = h.dump_json({'content': _('Warning: This will remove all previous job reports for this source. Are you sure you want to continue?')}) %} | ||
{% set _title = _('Delete all harvest jobs and reports from this source') %} | ||
{% else %} | ||
{% set locale = h.dump_json({'content': _('Warning: This will remove all datasets for this source, as well as all previous job reports. Are you sure you want to continue?')}) %} | ||
{% set _title = _('Delete all harvest jobs and existing datasets from this source') %} | ||
{% endif %} | ||
<a href="{{ h.url_for('harvester.clear', id=harvest_source.id) }}" class="btn btn-default" data-module="confirm-action" data-module-i18n="{{ locale }}" | ||
title="{{ _title }}"> | ||
{{ _('Clear') }} | ||
</a> | ||
<a href="{{ h.url_for('{0}.read'.format(c.dataset_type), id=harvest_source.id) }}" class="btn btn-default"> | ||
<i class="fa fa-eye eye-open"></i> | ||
{{ _('View harvest source') }} | ||
</a> | ||
</div> | ||
{% endblock %} |