Skip to content

Commit

Permalink
changed the log outut page to look more like the activity streams
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Hanke committed Mar 6, 2024
1 parent 7b5886c commit 389fee5
Show file tree
Hide file tree
Showing 3 changed files with 214 additions and 83 deletions.
132 changes: 127 additions & 5 deletions ckanext/csvwmapandtransform/public/csvwmaptransform.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added ckanext/csvwmapandtransform/public/dotted.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -6,106 +6,115 @@
{% block breadcrumb_content_selected %}{% endblock %}

{% block breadcrumb_content %}
{{ super() }}
{% if res %}
<li>{% link_for h.resource_display_name(res)|truncate(30), named_route=pkg.type ~ '_resource.read', id=pkg.name, resource_id=res.id %}</li>
<li{% block breadcrumb_edit_selected %} class="active"{% endblock %}><a href="">{{ _('Transform') }}</a></li>
{{ super() }}
{% if res %}
<li>{% link_for h.resource_display_name(res)|truncate(30), named_route=pkg.type ~ '_resource.read', id=pkg.name,
resource_id=res.id %}</li>
<li{% block breadcrumb_edit_selected %} class="active" {% endblock %}><a href="">{{ _('Transform') }}</a></li>
{% endif %}
{% endblock %}
{% endblock %}

{% block content_action %}
{% if res %}
{% link_for _('View resource'), named_route=pkg.type ~ '_resource.read', id=pkg.name, resource_id=res.id, class_='btn btn-default', icon='eye' %}
{% block content_action %}
{% if res %}
{% link_for _('View resource'), named_route=pkg.type ~ '_resource.read', id=pkg.name, resource_id=res.id, class_='btn
btn-default', icon='eye' %}
{% endif %}
{% endblock %}
{% endblock %}

{% block content_primary_nav %}
{% block content_primary_nav %}
<!-- {{ h.build_nav_icon(pkg.type ~ '_resource.edit', _('Edit resource'), id=pkg.name, resource_id=res.id, icon='pencil') }}
{% block inner_primary_nav %}{% endblock %}
{{ h.build_nav_icon(pkg.type ~ '_resource.views', _('Views'), id=pkg.name, resource_id=res.id, icon='chart-bar') }} -->
{% endblock %}
{% endblock %}

{% block primary_content_inner %}
<h1 >{% block form_title %}{{ _('Transform Status') }}{% endblock %}</h1>
{% block primary_content_inner %}
<h1>{% block form_title %}{{ _('Transform Status') }}{% endblock %}</h1>
{% block form %}
<form method="post" action="{{ action }}" class="csvwmapandtransform-form">
{{ h.csrf_input() }}
{{ h.csrf_input() }}
<button class="btn btn-primary" name="save" type="submit">
<i class="fa fa-play"></i> {{ _('Run Transformation') }}
</button>
</form>
{% endblock %}
{% if status %}
{% if status.error and status.error.message %}
{% set show_table = false %}
<div class="alert alert-error">
<strong>{{ _('Upload error:') }}</strong> {{ status.error.message }}
</div>
{% elif status.task_info and status.task_info.error %}
<div class="alert alert-error">
{% if status.task_info.error is string %}
{# DataPusher < 0.0.3 #}
<strong>{{ _('Error:') }}</strong> {{ status.task_info.error }}
{% elif status.task_info.error is mapping %}
<strong>{{ _('Error:') }}</strong> {{ status.task_info.error.message }}
{% for error_key, error_value in status.task_info.error.items() %}
{% if error_key != "message" and error_value %}
<br>
<strong>{{ error_key }}</strong>:
{{ error_value }}
{% endif %}
{% endfor %}
{% elif status.task_info.error is iterable %}
<strong>{{ _('Error traceback:') }}</strong>
<pre>{{ ''.join(status.task_info.error) }}</pre>
{% endif %}
</div>
{% endif %}


<table class="table table-bordered">
<colgroup>
<col width="150">
<col>
</colgroup>
<tr>
<th>{{ _('Status') }}</th>
<td>{{ h.csvwmapandtransform__status_description(status) }}</td>
</tr>
<tr>
<th>{{ _('Last updated') }}</th>
{% if status.status %}
<td><span class="date" title="{{ h.render_datetime(status.last_updated, with_hours=True) }}">{{ h.time_ago_from_timestamp(status.last_updated) }}</span></td>
{% else %}
<td>{{ _('Never') }}</td>
{% endif %}
</tr>
</table>

{% if status and status.logs %}
<h3>{{ _('Transformation Log') }}</h3>
{% for item in status.logs|sort(attribute='timestamp') %}
{% set level = 'info' if item.level == 'DEBUG' else item.level %}
{% set popover_content = 'test' %}
<div class="alert alert-{{level |lower }} mb-0 mt-3" role="alert">
{% for line in item.message.strip().split('\n') %}
{{ line | urlize }}<br />
{% endfor %}
</div>
<span class="date" title="{{ h.render_datetime(item.timestamp, with_hours=True) }}">
{{ h.time_ago_from_timestamp(item.timestamp) }}
</span>
{% if status.error and status.error.message %}
{% set show_table = false %}
<div class="alert alert-error">
<strong>{{ _('Upload error:') }}</strong> {{ status.error.message }}
</div>
{% elif status.task_info and status.task_info.error %}
<div class="alert alert-error">
{% if status.task_info.error is string %}
{# DataPusher < 0.0.3 #} <strong>{{ _('Error:') }}</strong> {{ status.task_info.error }}
{% elif status.task_info.error is mapping %}
<strong>{{ _('Error:') }}</strong> {{ status.task_info.error.message }}
{% for error_key, error_value in status.task_info.error.items() %}
{% if error_key != "message" and error_value %}
<br>
<strong>{{ error_key }}</strong>:
{{ error_value }}
{% endif %}
{% endfor %}
{% elif status.task_info.error is iterable %}
<strong>{{ _('Error traceback:') }}</strong>
<pre>{{ ''.join(status.task_info.error) }}</pre>
{% endif %}
</div>
{% endif %}
{% endblock %}

{% block secondary_content %}

<table class="table table-bordered">
<colgroup>
<col width="150">
<col>
</colgroup>
<tr>
<th>{{ _('Status') }}</th>
<td>{{ h.csvwmapandtransform__status_description(status) }}</td>
</tr>
<tr>
<th>{{ _('Last updated') }}</th>
{% if status.status %}
<td><span class="date" title="{{ h.render_datetime(status.last_updated, with_hours=True) }}">{{
h.time_ago_from_timestamp(status.last_updated) }}</span></td>
{% else %}
<td>{{ _('Never') }}</td>
{% endif %}
</tr>
</table>

{% if status and status.logs %}
<h3>{{ _('Transformation Log') }}</h3>
<ul class="activity">
{% for item in status.logs|sort(attribute='timestamp') %}
{% set level = 'info' if item.level == 'DEBUG' else item.level %}
{% set icon = 'check' if item.level == 'INFO' else 'exclamation' %}
{% set class = ' failure' if icon == 'exclamation' else ' success' %}
{% set popover_content = 'test' %}
<li class="item {{ class }}">
<i class="fa icon fa-{{icon}}"></i>
<div class="alert alert-{{level |lower }} mb-0 mt-3" role="alert">
{% for line in item.message.strip().split('\n') %}
{{ line | urlize }}<br />
{% endfor %}
</div>
<span class="date" title="{{ h.render_datetime(item.timestamp, with_hours=True) }}">
{{ h.time_ago_from_timestamp(item.timestamp) }}
</span>
</li>
{% endfor %}
</ul>
{% endif %}
{% endif %}
{% endblock %}

{% block secondary_content %}
{% snippet 'package/snippets/resource_info.html', res=res %}
{% snippet 'package/snippets/resources.html', pkg=pkg, active=res.id %}
{% endblock %}
{% endblock %}

{% block scripts %}
{% block scripts %}
{{ super() }}
{% asset 'vendor/fileupload' %}
{% endblock %}
{% endblock %}

0 comments on commit 389fee5

Please sign in to comment.