Skip to content

Commit

Permalink
管理画面の追加
Browse files Browse the repository at this point in the history
  • Loading branch information
polidog committed Mar 14, 2016
1 parent 4274fd1 commit 4a6074a
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 1 deletion.
25 changes: 25 additions & 0 deletions Controller/DefaultController.php
Expand Up @@ -10,8 +10,14 @@
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Tavii\SQSJobQueueBundle\Storage\DoctrineStorage;

/**
* Class DefaultController
*/
class DefaultController extends Controller
{
/**
* @return \Symfony\Component\HttpFoundation\Response
*/
public function indexAction()
{
/** @var DoctrineStorage $storage */
Expand All @@ -24,4 +30,23 @@ public function indexAction()
'workers' => $workers
]);
}

/**
* @return \Symfony\Component\HttpFoundation\Response
*/
public function sqslistAction()
{
$prefix = $this->getParameter('sqs_job_queue.prefix');
$client = $this->get('sqs_job_queue.client');
$results = $client->listQueues(array(
'QueueNamePrefix' => $prefix,
));

return $this->render('TaviiSQSJobQueueBundle:Default:sqslist.html.twig', [
'queueUrls' => $results['QueueUrls'],
'prefix' => $prefix
]);


}
}
6 changes: 5 additions & 1 deletion Resources/config/routing.yml
@@ -1,3 +1,7 @@
tavii_sqs_job_queue_homepage:
tavii_sqs_job_queue_index:
path: /
defaults: { _controller: TaviiSQSJobQueueBundle:Default:index }

tavii_sqs_job_queue_sqslist:
path: /sqslist
defaults: { _controller: TaviiSQSJobQueueBundle:Default:sqslist }
24 changes: 24 additions & 0 deletions Resources/views/Default/sqslist.html.twig
@@ -0,0 +1,24 @@
{% extends 'TaviiSQSJobQueueBundle::base.html.twig' %}

{% block content %}
<h2 class="page-header">Queue list</h2>

<p>prefix: {{ prefix }}</p>

<table class="table table-hover">
<thead>
<tr>
<th>QueueUrl</th>
</tr>
</thead>
<tbody>
{% for queueUrl in queueUrls %}
<tr>
<td>{{ queueUrl }}</td>
</tr>
{% endfor %}
</tbody>

</table>

{% endblock %}
8 changes: 8 additions & 0 deletions Resources/views/base.html.twig
Expand Up @@ -26,7 +26,15 @@
<a class="navbar-brand" href="#">SQSJobQueueAdmin</a>

</div>

<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="{{ path("tavii_sqs_job_queue_index") }}" target="_blank">Worker List</a></li>
<li><a href="{{ path("tavii_sqs_job_queue_sqslist") }}" target="_blank">Queue List</a></li>
</ul>
</div>
</div>

</nav>
{% endblock %}

Expand Down

0 comments on commit 4a6074a

Please sign in to comment.