mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-12 04:23:19 +00:00
add and display interrupt status
This commit is contained in:
@@ -14,6 +14,8 @@ class WorkerRunningJob
|
|||||||
const FINISHED = 'finished';
|
const FINISHED = 'finished';
|
||||||
const RUNNING = 'running';
|
const RUNNING = 'running';
|
||||||
const ERROR = 'error';
|
const ERROR = 'error';
|
||||||
|
const INTERRUPT = 'interrupt manually';
|
||||||
|
|
||||||
const ATTEMPT = 'attempt ';
|
const ATTEMPT = 'attempt ';
|
||||||
|
|
||||||
const TYPE_PULL = 'uploader pull';
|
const TYPE_PULL = 'uploader pull';
|
||||||
|
@@ -92,6 +92,19 @@ class WorkerRunningJobRepository extends EntityRepository
|
|||||||
return count($qb->getQuery()->getResult());
|
return count($qb->getQuery()->getResult());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function findByStatus(array $status, $start = 0, $limit = WorkerRunningJob::MAX_RESULT)
|
||||||
|
{
|
||||||
|
$qb = $this->createQueryBuilder('w');
|
||||||
|
$qb
|
||||||
|
->where($qb->expr()->in('w.status', $status))
|
||||||
|
->setFirstResult($start)
|
||||||
|
->setMaxResults($limit)
|
||||||
|
->orderBy('w.id', 'DESC')
|
||||||
|
;
|
||||||
|
|
||||||
|
return $qb->getQuery()->getResult();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $commitId
|
* @param $commitId
|
||||||
* @return bool
|
* @return bool
|
||||||
|
@@ -73,16 +73,25 @@ class AdminConfigurationController extends Controller
|
|||||||
/** @var WorkerRunningJobRepository $repoWorker */
|
/** @var WorkerRunningJobRepository $repoWorker */
|
||||||
$repoWorker = $app['repo.worker-running-job'];
|
$repoWorker = $app['repo.worker-running-job'];
|
||||||
|
|
||||||
$workerRunningJob = [];
|
|
||||||
|
|
||||||
$reload = ($request->query->get('reload')) == 1 ? true : false ;
|
$reload = ($request->query->get('reload')) == 1 ? true : false ;
|
||||||
|
|
||||||
if ($request->query->get('running') == 1 && $request->query->get('finished') == 1) {
|
$workerRunningJob = [];
|
||||||
$workerRunningJob = $repoWorker->findBy([], ['id' => 'DESC'], WorkerRunningJob::MAX_RESULT);
|
$filterStatus = [];
|
||||||
} elseif ($request->query->get('running') == 1) {
|
if ($request->query->get('running') == 1) {
|
||||||
$workerRunningJob = $repoWorker->findBy(['status' => WorkerRunningJob::RUNNING], ['id' => 'DESC'], WorkerRunningJob::MAX_RESULT);
|
$filterStatus[] = WorkerRunningJob::RUNNING;
|
||||||
} elseif ($request->query->get('finished') == 1) {
|
}
|
||||||
$workerRunningJob = $repoWorker->findBy(['status' => WorkerRunningJob::FINISHED], ['id' => 'DESC'], WorkerRunningJob::MAX_RESULT);
|
if ($request->query->get('finished') == 1) {
|
||||||
|
$filterStatus[] = WorkerRunningJob::FINISHED;
|
||||||
|
}
|
||||||
|
if ($request->query->get('error') == 1) {
|
||||||
|
$filterStatus[] = WorkerRunningJob::ERROR;
|
||||||
|
}
|
||||||
|
if ($request->query->get('interrupt') == 1) {
|
||||||
|
$filterStatus[] = WorkerRunningJob::INTERRUPT;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count($filterStatus) > 0) {
|
||||||
|
$workerRunningJob = $repoWorker->findByStatus($filterStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->render('admin/worker-manager/worker_info.html.twig', [
|
return $this->render('admin/worker-manager/worker_info.html.twig', [
|
||||||
@@ -91,6 +100,31 @@ class AdminConfigurationController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Request $request
|
||||||
|
* @param integer $workerId
|
||||||
|
*/
|
||||||
|
public function changeStatusAction(Request $request, $workerId)
|
||||||
|
{
|
||||||
|
/** @var WorkerRunningJobRepository $repoWorker */
|
||||||
|
$repoWorker = $this->app['repo.worker-running-job'];
|
||||||
|
|
||||||
|
/** @var WorkerRunningJob $workerRunningJob */
|
||||||
|
$workerRunningJob = $repoWorker->find($workerId);
|
||||||
|
|
||||||
|
$workerRunningJob
|
||||||
|
->setStatus($request->request->get('status'))
|
||||||
|
->setFinished(new \DateTime('now'))
|
||||||
|
;
|
||||||
|
|
||||||
|
$em = $repoWorker->getEntityManager();
|
||||||
|
$em->persist($workerRunningJob);
|
||||||
|
|
||||||
|
$em->flush();
|
||||||
|
|
||||||
|
return $this->app->json(['success' => true]);
|
||||||
|
}
|
||||||
|
|
||||||
public function queueMonitorAction(PhraseaApplication $app, Request $request)
|
public function queueMonitorAction(PhraseaApplication $app, Request $request)
|
||||||
{
|
{
|
||||||
$reload = ($request->query->get('reload')) == 1 ? true : false ;
|
$reload = ($request->query->get('reload')) == 1 ? true : false ;
|
||||||
|
@@ -88,6 +88,11 @@ class ControllerServiceProvider implements ControllerProviderInterface, ServiceP
|
|||||||
->method('GET')
|
->method('GET')
|
||||||
->bind('worker_admin_queue_monitor');
|
->bind('worker_admin_queue_monitor');
|
||||||
|
|
||||||
|
$controllers->match('/{workerId}/change-status', 'controller.worker.admin.configuration:changeStatusAction')
|
||||||
|
->method('POST')
|
||||||
|
->assert('workerId', '\d+')
|
||||||
|
->bind('worker_admin_change_status');
|
||||||
|
|
||||||
return $controllers;
|
return $controllers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:jms="urn:jms:translation" version="1.2">
|
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:jms="urn:jms:translation" version="1.2">
|
||||||
<file date="2020-08-05T13:43:22Z" source-language="en" target-language="de" datatype="plaintext" original="not.available">
|
<file date="2020-08-06T12:08:51Z" source-language="en" target-language="de" datatype="plaintext" original="not.available">
|
||||||
<header>
|
<header>
|
||||||
<tool tool-id="JMSTranslationBundle" tool-name="JMSTranslationBundle" tool-version="1.1.0-DEV"/>
|
<tool tool-id="JMSTranslationBundle" tool-name="JMSTranslationBundle" tool-version="1.1.0-DEV"/>
|
||||||
<note>The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.</note>
|
<note>The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.</note>
|
||||||
@@ -9,9 +9,9 @@
|
|||||||
<trans-unit id="96f0767cb7ea65a7f86c8c9432e80d16cf9d8680" resname="Please provide the same passwords." approved="yes">
|
<trans-unit id="96f0767cb7ea65a7f86c8c9432e80d16cf9d8680" resname="Please provide the same passwords." approved="yes">
|
||||||
<source>Please provide the same passwords.</source>
|
<source>Please provide the same passwords.</source>
|
||||||
<target state="translated">Bitte geben Sie diesselbe Passwörter ein.</target>
|
<target state="translated">Bitte geben Sie diesselbe Passwörter ein.</target>
|
||||||
|
<jms:reference-file line="36">Form/Login/PhraseaRenewPasswordForm.php</jms:reference-file>
|
||||||
<jms:reference-file line="44">Form/Login/PhraseaRecoverPasswordForm.php</jms:reference-file>
|
<jms:reference-file line="44">Form/Login/PhraseaRecoverPasswordForm.php</jms:reference-file>
|
||||||
<jms:reference-file line="49">Form/Login/PhraseaRegisterForm.php</jms:reference-file>
|
<jms:reference-file line="49">Form/Login/PhraseaRegisterForm.php</jms:reference-file>
|
||||||
<jms:reference-file line="36">Form/Login/PhraseaRenewPasswordForm.php</jms:reference-file>
|
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="90b8c9717bb7ed061dbf20fe1986c8b8593d43d4" resname="The token provided is not valid anymore" approved="yes">
|
<trans-unit id="90b8c9717bb7ed061dbf20fe1986c8b8593d43d4" resname="The token provided is not valid anymore" approved="yes">
|
||||||
<source>The token provided is not valid anymore</source>
|
<source>The token provided is not valid anymore</source>
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:jms="urn:jms:translation" version="1.2">
|
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:jms="urn:jms:translation" version="1.2">
|
||||||
<file date="2020-08-05T13:43:45Z" source-language="en" target-language="en" datatype="plaintext" original="not.available">
|
<file date="2020-08-06T12:10:11Z" source-language="en" target-language="en" datatype="plaintext" original="not.available">
|
||||||
<header>
|
<header>
|
||||||
<tool tool-id="JMSTranslationBundle" tool-name="JMSTranslationBundle" tool-version="1.1.0-DEV"/>
|
<tool tool-id="JMSTranslationBundle" tool-name="JMSTranslationBundle" tool-version="1.1.0-DEV"/>
|
||||||
<note>The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.</note>
|
<note>The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.</note>
|
||||||
@@ -9,9 +9,9 @@
|
|||||||
<trans-unit id="96f0767cb7ea65a7f86c8c9432e80d16cf9d8680" resname="Please provide the same passwords." approved="yes">
|
<trans-unit id="96f0767cb7ea65a7f86c8c9432e80d16cf9d8680" resname="Please provide the same passwords." approved="yes">
|
||||||
<source>Please provide the same passwords.</source>
|
<source>Please provide the same passwords.</source>
|
||||||
<target state="translated">Please provide the same passwords.</target>
|
<target state="translated">Please provide the same passwords.</target>
|
||||||
|
<jms:reference-file line="36">Form/Login/PhraseaRenewPasswordForm.php</jms:reference-file>
|
||||||
<jms:reference-file line="44">Form/Login/PhraseaRecoverPasswordForm.php</jms:reference-file>
|
<jms:reference-file line="44">Form/Login/PhraseaRecoverPasswordForm.php</jms:reference-file>
|
||||||
<jms:reference-file line="49">Form/Login/PhraseaRegisterForm.php</jms:reference-file>
|
<jms:reference-file line="49">Form/Login/PhraseaRegisterForm.php</jms:reference-file>
|
||||||
<jms:reference-file line="36">Form/Login/PhraseaRenewPasswordForm.php</jms:reference-file>
|
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="90b8c9717bb7ed061dbf20fe1986c8b8593d43d4" resname="The token provided is not valid anymore" approved="yes">
|
<trans-unit id="90b8c9717bb7ed061dbf20fe1986c8b8593d43d4" resname="The token provided is not valid anymore" approved="yes">
|
||||||
<source>The token provided is not valid anymore</source>
|
<source>The token provided is not valid anymore</source>
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:jms="urn:jms:translation" version="1.2">
|
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:jms="urn:jms:translation" version="1.2">
|
||||||
<file date="2020-08-05T13:44:10Z" source-language="en" target-language="fr" datatype="plaintext" original="not.available">
|
<file date="2020-08-06T12:11:23Z" source-language="en" target-language="fr" datatype="plaintext" original="not.available">
|
||||||
<header>
|
<header>
|
||||||
<tool tool-id="JMSTranslationBundle" tool-name="JMSTranslationBundle" tool-version="1.1.0-DEV"/>
|
<tool tool-id="JMSTranslationBundle" tool-name="JMSTranslationBundle" tool-version="1.1.0-DEV"/>
|
||||||
<note>The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.</note>
|
<note>The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.</note>
|
||||||
@@ -9,9 +9,9 @@
|
|||||||
<trans-unit id="96f0767cb7ea65a7f86c8c9432e80d16cf9d8680" resname="Please provide the same passwords." approved="yes">
|
<trans-unit id="96f0767cb7ea65a7f86c8c9432e80d16cf9d8680" resname="Please provide the same passwords." approved="yes">
|
||||||
<source>Please provide the same passwords.</source>
|
<source>Please provide the same passwords.</source>
|
||||||
<target state="translated">Veuillez indiquer des mots de passe identiques.</target>
|
<target state="translated">Veuillez indiquer des mots de passe identiques.</target>
|
||||||
|
<jms:reference-file line="36">Form/Login/PhraseaRenewPasswordForm.php</jms:reference-file>
|
||||||
<jms:reference-file line="44">Form/Login/PhraseaRecoverPasswordForm.php</jms:reference-file>
|
<jms:reference-file line="44">Form/Login/PhraseaRecoverPasswordForm.php</jms:reference-file>
|
||||||
<jms:reference-file line="49">Form/Login/PhraseaRegisterForm.php</jms:reference-file>
|
<jms:reference-file line="49">Form/Login/PhraseaRegisterForm.php</jms:reference-file>
|
||||||
<jms:reference-file line="36">Form/Login/PhraseaRenewPasswordForm.php</jms:reference-file>
|
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="90b8c9717bb7ed061dbf20fe1986c8b8593d43d4" resname="The token provided is not valid anymore" approved="yes">
|
<trans-unit id="90b8c9717bb7ed061dbf20fe1986c8b8593d43d4" resname="The token provided is not valid anymore" approved="yes">
|
||||||
<source>The token provided is not valid anymore</source>
|
<source>The token provided is not valid anymore</source>
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:jms="urn:jms:translation" version="1.2">
|
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:jms="urn:jms:translation" version="1.2">
|
||||||
<file date="2020-08-05T13:44:37Z" source-language="en" target-language="nl" datatype="plaintext" original="not.available">
|
<file date="2020-08-06T12:12:43Z" source-language="en" target-language="nl" datatype="plaintext" original="not.available">
|
||||||
<header>
|
<header>
|
||||||
<tool tool-id="JMSTranslationBundle" tool-name="JMSTranslationBundle" tool-version="1.1.0-DEV"/>
|
<tool tool-id="JMSTranslationBundle" tool-name="JMSTranslationBundle" tool-version="1.1.0-DEV"/>
|
||||||
<note>The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.</note>
|
<note>The source node in most cases contains the sample message as written by the developer. If it looks like a dot-delimitted string such as "form.label.firstname", then the developer has not provided a default message.</note>
|
||||||
@@ -9,9 +9,9 @@
|
|||||||
<trans-unit id="96f0767cb7ea65a7f86c8c9432e80d16cf9d8680" resname="Please provide the same passwords.">
|
<trans-unit id="96f0767cb7ea65a7f86c8c9432e80d16cf9d8680" resname="Please provide the same passwords.">
|
||||||
<source>Please provide the same passwords.</source>
|
<source>Please provide the same passwords.</source>
|
||||||
<target state="new">Please provide the same passwords.</target>
|
<target state="new">Please provide the same passwords.</target>
|
||||||
|
<jms:reference-file line="36">Form/Login/PhraseaRenewPasswordForm.php</jms:reference-file>
|
||||||
<jms:reference-file line="44">Form/Login/PhraseaRecoverPasswordForm.php</jms:reference-file>
|
<jms:reference-file line="44">Form/Login/PhraseaRecoverPasswordForm.php</jms:reference-file>
|
||||||
<jms:reference-file line="49">Form/Login/PhraseaRegisterForm.php</jms:reference-file>
|
<jms:reference-file line="49">Form/Login/PhraseaRegisterForm.php</jms:reference-file>
|
||||||
<jms:reference-file line="36">Form/Login/PhraseaRenewPasswordForm.php</jms:reference-file>
|
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
<trans-unit id="90b8c9717bb7ed061dbf20fe1986c8b8593d43d4" resname="The token provided is not valid anymore">
|
<trans-unit id="90b8c9717bb7ed061dbf20fe1986c8b8593d43d4" resname="The token provided is not valid anymore">
|
||||||
<source>The token provided is not valid anymore</source>
|
<source>The token provided is not valid anymore</source>
|
||||||
|
@@ -36,6 +36,12 @@
|
|||||||
<label class="checkbox inline">
|
<label class="checkbox inline">
|
||||||
<input class="finished-work refresh-list-checkbox" type="checkbox" value="1" checked> {{ 'admin::workermanager:tab:workerinfo: Display finished work' | trans }}
|
<input class="finished-work refresh-list-checkbox" type="checkbox" value="1" checked> {{ 'admin::workermanager:tab:workerinfo: Display finished work' | trans }}
|
||||||
</label>
|
</label>
|
||||||
|
<label class="checkbox inline">
|
||||||
|
<input class="error-work refresh-list-checkbox" type="checkbox" value="1" checked> {{ 'admin::workermanager:tab:workerinfo: Display error work' | trans }}
|
||||||
|
</label>
|
||||||
|
<label class="checkbox inline">
|
||||||
|
<input class="interrupt-work refresh-list-checkbox" type="checkbox" value="1" checked> {{ 'admin::workermanager:tab:workerinfo: Display manually interrupt work' | trans }}
|
||||||
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -51,6 +57,7 @@
|
|||||||
<th class="sortable">{{ 'admin::workermanager:tab:workerinfo: finished' | trans }}</th>
|
<th class="sortable">{{ 'admin::workermanager:tab:workerinfo: finished' | trans }}</th>
|
||||||
<th class="sortable">{{ 'admin::workermanager:tab:workerinfo: duration' | trans }}</th>
|
<th class="sortable">{{ 'admin::workermanager:tab:workerinfo: duration' | trans }}</th>
|
||||||
<th class="sortable">{{ 'admin::workermanager:tab:workerinfo: status' | trans }}</th>
|
<th class="sortable">{{ 'admin::workermanager:tab:workerinfo: status' | trans }}</th>
|
||||||
|
<th></th>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@@ -81,6 +88,11 @@
|
|||||||
{{ duration.format("%H:%I:%S") }}
|
{{ duration.format("%H:%I:%S") }}
|
||||||
</td>
|
</td>
|
||||||
<td>{{ workerRow.status }}</td>
|
<td>{{ workerRow.status }}</td>
|
||||||
|
<td>
|
||||||
|
{% if workerRow.status == 'running' %}
|
||||||
|
<buton class="btn btn-danger btn-mini change-status-interrupt" data-id="{{ workerRow.id }}">{{ 'admin::workermanager:tab:workerinfo: Manually interrupt' | trans }}</buton>
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
@@ -92,6 +104,9 @@
|
|||||||
function refreshJobList () {
|
function refreshJobList () {
|
||||||
var running = 1;
|
var running = 1;
|
||||||
var finished = 1;
|
var finished = 1;
|
||||||
|
var error = 1;
|
||||||
|
var interrupt = 1;
|
||||||
|
|
||||||
if (!$(".running-work").is(":checked"))
|
if (!$(".running-work").is(":checked"))
|
||||||
{
|
{
|
||||||
running = 0;
|
running = 0;
|
||||||
@@ -100,10 +115,18 @@
|
|||||||
{
|
{
|
||||||
finished = 0;
|
finished = 0;
|
||||||
}
|
}
|
||||||
|
if (!$(".error-work").is(":checked"))
|
||||||
|
{
|
||||||
|
error = 0;
|
||||||
|
}
|
||||||
|
if (!$(".interrupt-work").is(":checked"))
|
||||||
|
{
|
||||||
|
interrupt = 0;
|
||||||
|
}
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "GET",
|
type: "GET",
|
||||||
url: "/admin/worker-manager/info?reload=1&running="+running+"&finished="+finished,
|
url: "/admin/worker-manager/info?reload=1&running="+running+"&finished="+finished+"&error="+error+"&interrupt="+interrupt,
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
$(".work-list").empty().html(data);
|
$(".work-list").empty().html(data);
|
||||||
}
|
}
|
||||||
@@ -115,6 +138,24 @@
|
|||||||
$(".refresh-list-checkbox").on('change', function () {
|
$(".refresh-list-checkbox").on('change', function () {
|
||||||
refreshJobList();
|
refreshJobList();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$(".admintable").on('click', '.change-status-interrupt', function () {
|
||||||
|
var workerId = $(this).attr('data-id');
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
dataType: 'json',
|
||||||
|
data: {
|
||||||
|
status: '{{ constant("\\Alchemy\\Phrasea\\Model\\Entities\\WorkerRunningJob::INTERRUPT") }}'
|
||||||
|
},
|
||||||
|
url: "/admin/worker-manager/"+ workerId +"/change-status",
|
||||||
|
success: function (data) {
|
||||||
|
refreshJobList();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user