Files
Phraseanet/templates/web/admin/worker-manager/index.html.twig
2020-05-19 17:45:16 +03:00

92 lines
3.9 KiB
Twig

<h1>Worker</h1>
{% if isConnected %}
<div>
<!-- Nav tabs -->
<ul class="nav nav-tabs" id="configurationTabs">
<li class="worker-configuration" role="presentation">
<a href="#worker-configuration" aria-controls="worker-configuration" role="tab" data-toggle="tab" data-url="/admin/worker-manager/configuration">
{{ "Configuration" | trans }}
</a>
</li>
<li class="worker-info active" role="presentation">
<a href="#worker-info" aria-controls="worker-info" role="tab" data-toggle="tab" data-url="/admin/worker-manager/info">
{{ "Working info" | trans }}
</a>
</li>
<li class="worker-searchengine" role="presentation">
<a href="#worker-searchengine" aria-controls="worker-searchengine" role="tab" data-toggle="tab" data-url="/admin/worker-manager/searchengine">
{{ "Searchengine" | trans }}
</a>
</li>
<li class="worker-pull-assets" role="presentation">
<a href="#worker-pull-assets" aria-controls="worker-pull-assets" role="tab" data-toggle="tab" data-url="/admin/worker-manager/pull-assets">
{{ "Pull Assets" | trans }}
</a>
</li>
<li class="worker-subview" role="presentation">
<a href="#worker-subview" aria-controls="worker-subview" role="tab" data-toggle="tab" data-url="/admin/worker-manager/subview">
{{ "Subview" | trans }}
</a>
</li>
<li class="worker-metadata" role="presentation">
<a href="#worker-metadata" aria-controls="worker-metadata" role="tab" data-toggle="tab" data-url="/admin/worker-manager/metadata">
{{ "Metadata" | trans }}
</a>
</li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div role="tabpanel" class="tab-pane fade" id="worker-configuration"></div>
<div role="tabpanel" class="tab-pane fade in active" id="worker-info">
{% include "admin/worker-manager/worker_info.html.twig" %}
</div>
<div role="tabpanel" class="tab-pane fade" id="worker-searchengine"></div>
<div role="tabpanel" class="tab-pane fade" id="worker-pull-assets"></div>
<div role="tabpanel" class="tab-pane fade" id="worker-subview"></div>
<div role="tabpanel" class="tab-pane fade" id="worker-metadata"></div>
</div>
</div>
<script type="text/javascript">
var contentsDownloaded = {};
var remoteContent = function(url) {
return $.get(url);
};
var tabs = $('#configurationTabs a[data-toggle="tab"]');
tabs.on('click', function(){
$(this).tab('show');
});
$('.nav-tabs li').on('show.bs.tab', function (e) {
if (contentsDownloaded[e.target.hash] === undefined) {
$(e.target.hash).empty().html('<img src="/assets/common/images/icons/main-loader.gif" alt="loading"/>');
}
});
$('.nav-tabs').on('shown.bs.tab', function (e) {
if (contentsDownloaded[e.target.hash] === undefined) {
var targetDiv = $(e.target.hash);
remoteContent($(e.target).attr('data-url')).then(function(response) {
targetDiv.empty().html(response);
contentsDownloaded[e.target.hash] = true;
}, function(error) {
console.log(error);
targetDiv.empty().html('<i class="icon-fire">{{ 'admin:worker Retrieve configuration error'|trans }}</i>');
});
}
});
</script>
{% else %}
<h1 class="alert alert-danger">
Error! can't load rabbit config. Check rabbit config to use worker.
</h1>
{% endif %}