mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-13 21:13:26 +00:00
PHRAS-3239 purge queue in admin
#time 6h
This commit is contained in:
@@ -141,6 +141,22 @@ class AdminConfigurationController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function purgeQueueAction(PhraseaApplication $app, Request $request)
|
||||||
|
{
|
||||||
|
$queueName = $request->request->get('queueName');
|
||||||
|
|
||||||
|
if (empty($queueName)) {
|
||||||
|
return $this->app->json(['success' => false]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @var AMQPConnection $serverConnection */
|
||||||
|
$serverConnection = $this->app['alchemy_worker.amqp.connection'];
|
||||||
|
|
||||||
|
$serverConnection->reinitializeQueue([$queueName]);
|
||||||
|
|
||||||
|
return $this->app->json(['success' => true]);
|
||||||
|
}
|
||||||
|
|
||||||
public function truncateTableAction(PhraseaApplication $app)
|
public function truncateTableAction(PhraseaApplication $app)
|
||||||
{
|
{
|
||||||
/** @var WorkerRunningJobRepository $repoWorker */
|
/** @var WorkerRunningJobRepository $repoWorker */
|
||||||
|
@@ -88,6 +88,10 @@ class ControllerServiceProvider implements ControllerProviderInterface, ServiceP
|
|||||||
->method('GET')
|
->method('GET')
|
||||||
->bind('worker_admin_queue_monitor');
|
->bind('worker_admin_queue_monitor');
|
||||||
|
|
||||||
|
$controllers->match('/purge-queue', 'controller.worker.admin.configuration:purgeQueueAction')
|
||||||
|
->method('POST')
|
||||||
|
->bind('worker_admin_purge_queue');
|
||||||
|
|
||||||
$controllers->match('/{workerId}/change-status', 'controller.worker.admin.configuration:changeStatusAction')
|
$controllers->match('/{workerId}/change-status', 'controller.worker.admin.configuration:changeStatusAction')
|
||||||
->method('POST')
|
->method('POST')
|
||||||
->assert('workerId', '\d+')
|
->assert('workerId', '\d+')
|
||||||
|
@@ -11,6 +11,7 @@
|
|||||||
<th></th>
|
<th></th>
|
||||||
<th>{{ 'admin::workermanager:tab:queueMonitor: Message count' |trans }}</th>
|
<th>{{ 'admin::workermanager:tab:queueMonitor: Message count' |trans }}</th>
|
||||||
<th>{{ 'admin::workermanager:tab:queueMonitor: Consumer count' |trans }}</th>
|
<th>{{ 'admin::workermanager:tab:queueMonitor: Consumer count' |trans }}</th>
|
||||||
|
<th></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody class="queue-list">
|
<tbody class="queue-list">
|
||||||
@@ -21,6 +22,9 @@
|
|||||||
<th>{{ queueStatus.queueName }}</th>
|
<th>{{ queueStatus.queueName }}</th>
|
||||||
<td>{{ queueStatus.messageCount }}</td>
|
<td>{{ queueStatus.messageCount }}</td>
|
||||||
<td>{{ queueStatus.consumerCount }}</td>
|
<td>{{ queueStatus.consumerCount }}</td>
|
||||||
|
<td>
|
||||||
|
<buton class="btn btn-danger btn-mini purge-queue" data-queue-name="{{ queueStatus.queueName }}">{{ 'admin::workermanager:tab:queueMonitor: Purge Queue' | trans }}</buton>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
@@ -38,5 +42,23 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$("#worker-queue-monitor").on('click', '.purge-queue', function() {
|
||||||
|
if (confirm("Warning! Are you sure? Messages cannot be recovered after purging.")) {
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: "/admin/worker-manager/purge-queue",
|
||||||
|
dataType: 'json',
|
||||||
|
data : {
|
||||||
|
queueName : $(this).attr("data-queue-name")
|
||||||
|
},
|
||||||
|
success: function (data) {
|
||||||
|
console.log(data);
|
||||||
|
$("#refresh-monitor").trigger("click");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
Reference in New Issue
Block a user