diff options
Diffstat (limited to 'src/Wallabag/ImportBundle/Resources')
8 files changed, 143 insertions, 8 deletions
diff --git a/src/Wallabag/ImportBundle/Resources/config/rabbit.yml b/src/Wallabag/ImportBundle/Resources/config/rabbit.yml new file mode 100644 index 00000000..aa049749 --- /dev/null +++ b/src/Wallabag/ImportBundle/Resources/config/rabbit.yml | |||
@@ -0,0 +1,30 @@ | |||
1 | # RabbitMQ stuff | ||
2 | services: | ||
3 | wallabag_import.consumer.amqp.pocket: | ||
4 | class: Wallabag\ImportBundle\Consumer\AMQPEntryConsumer | ||
5 | arguments: | ||
6 | - "@doctrine.orm.entity_manager" | ||
7 | - "@wallabag_user.user_repository" | ||
8 | - "@wallabag_import.pocket.import" | ||
9 | - "@logger" | ||
10 | wallabag_import.consumer.amqp.readability: | ||
11 | class: Wallabag\ImportBundle\Consumer\AMQPEntryConsumer | ||
12 | arguments: | ||
13 | - "@doctrine.orm.entity_manager" | ||
14 | - "@wallabag_user.user_repository" | ||
15 | - "@wallabag_import.readability.import" | ||
16 | - "@logger" | ||
17 | wallabag_import.consumer.amqp.wallabag_v1: | ||
18 | class: Wallabag\ImportBundle\Consumer\AMQPEntryConsumer | ||
19 | arguments: | ||
20 | - "@doctrine.orm.entity_manager" | ||
21 | - "@wallabag_user.user_repository" | ||
22 | - "@wallabag_import.wallabag_v1.import" | ||
23 | - "@logger" | ||
24 | wallabag_import.consumer.amqp.wallabag_v2: | ||
25 | class: Wallabag\ImportBundle\Consumer\AMQPEntryConsumer | ||
26 | arguments: | ||
27 | - "@doctrine.orm.entity_manager" | ||
28 | - "@wallabag_user.user_repository" | ||
29 | - "@wallabag_import.wallabag_v2.import" | ||
30 | - "@logger" | ||
diff --git a/src/Wallabag/ImportBundle/Resources/config/redis.yml b/src/Wallabag/ImportBundle/Resources/config/redis.yml new file mode 100644 index 00000000..7d3248e5 --- /dev/null +++ b/src/Wallabag/ImportBundle/Resources/config/redis.yml | |||
@@ -0,0 +1,81 @@ | |||
1 | # Redis stuff | ||
2 | services: | ||
3 | # readability | ||
4 | wallabag_import.queue.redis.readability: | ||
5 | class: Simpleue\Queue\RedisQueue | ||
6 | arguments: | ||
7 | - "@wallabag_core.redis.client" | ||
8 | - "wallabag.import.readability" | ||
9 | |||
10 | wallabag_import.producer.redis.readability: | ||
11 | class: Wallabag\ImportBundle\Redis\Producer | ||
12 | arguments: | ||
13 | - "@wallabag_import.queue.redis.readability" | ||
14 | |||
15 | wallabag_import.consumer.redis.readability: | ||
16 | class: Wallabag\ImportBundle\Consumer\RedisEntryConsumer | ||
17 | arguments: | ||
18 | - "@doctrine.orm.entity_manager" | ||
19 | - "@wallabag_user.user_repository" | ||
20 | - "@wallabag_import.readability.import" | ||
21 | - "@logger" | ||
22 | |||
23 | |||
24 | wallabag_import.queue.redis.pocket: | ||
25 | class: Simpleue\Queue\RedisQueue | ||
26 | arguments: | ||
27 | - "@wallabag_core.redis.client" | ||
28 | - "wallabag.import.pocket" | ||
29 | |||
30 | wallabag_import.producer.redis.pocket: | ||
31 | class: Wallabag\ImportBundle\Redis\Producer | ||
32 | arguments: | ||
33 | - "@wallabag_import.queue.redis.pocket" | ||
34 | |||
35 | wallabag_import.consumer.redis.pocket: | ||
36 | class: Wallabag\ImportBundle\Consumer\RedisEntryConsumer | ||
37 | arguments: | ||
38 | - "@doctrine.orm.entity_manager" | ||
39 | - "@wallabag_user.user_repository" | ||
40 | - "@wallabag_import.pocket.import" | ||
41 | - "@logger" | ||
42 | |||
43 | # wallabag v1 | ||
44 | wallabag_import.queue.redis.wallabag_v1: | ||
45 | class: Simpleue\Queue\RedisQueue | ||
46 | arguments: | ||
47 | - "@wallabag_core.redis.client" | ||
48 | - "wallabag.import.wallabag_v1" | ||
49 | |||
50 | wallabag_import.producer.redis.wallabag_v1: | ||
51 | class: Wallabag\ImportBundle\Redis\Producer | ||
52 | arguments: | ||
53 | - "@wallabag_import.queue.redis.wallabag_v1" | ||
54 | |||
55 | wallabag_import.consumer.redis.wallabag_v1: | ||
56 | class: Wallabag\ImportBundle\Consumer\RedisEntryConsumer | ||
57 | arguments: | ||
58 | - "@doctrine.orm.entity_manager" | ||
59 | - "@wallabag_user.user_repository" | ||
60 | - "@wallabag_import.wallabag_v1.import" | ||
61 | - "@logger" | ||
62 | |||
63 | # wallabag v2 | ||
64 | wallabag_import.queue.redis.wallabag_v2: | ||
65 | class: Simpleue\Queue\RedisQueue | ||
66 | arguments: | ||
67 | - "@wallabag_core.redis.client" | ||
68 | - "wallabag.import.wallabag_v2" | ||
69 | |||
70 | wallabag_import.producer.redis.wallabag_v2: | ||
71 | class: Wallabag\ImportBundle\Redis\Producer | ||
72 | arguments: | ||
73 | - "@wallabag_import.queue.redis.wallabag_v2" | ||
74 | |||
75 | wallabag_import.consumer.redis.wallabag_v2: | ||
76 | class: Wallabag\ImportBundle\Consumer\RedisEntryConsumer | ||
77 | arguments: | ||
78 | - "@doctrine.orm.entity_manager" | ||
79 | - "@wallabag_user.user_repository" | ||
80 | - "@wallabag_import.wallabag_v2.import" | ||
81 | - "@logger" | ||
diff --git a/src/Wallabag/ImportBundle/Resources/config/services.yml b/src/Wallabag/ImportBundle/Resources/config/services.yml index 520d43af..f03404ae 100644 --- a/src/Wallabag/ImportBundle/Resources/config/services.yml +++ b/src/Wallabag/ImportBundle/Resources/config/services.yml | |||
@@ -1,3 +1,7 @@ | |||
1 | imports: | ||
2 | - { resource: rabbit.yml } | ||
3 | - { resource: redis.yml } | ||
4 | |||
1 | services: | 5 | services: |
2 | wallabag_import.chain: | 6 | wallabag_import.chain: |
3 | class: Wallabag\ImportBundle\Import\ImportChain | 7 | class: Wallabag\ImportBundle\Import\ImportChain |
@@ -14,7 +18,6 @@ services: | |||
14 | wallabag_import.pocket.import: | 18 | wallabag_import.pocket.import: |
15 | class: Wallabag\ImportBundle\Import\PocketImport | 19 | class: Wallabag\ImportBundle\Import\PocketImport |
16 | arguments: | 20 | arguments: |
17 | - "@security.token_storage" | ||
18 | - "@doctrine.orm.entity_manager" | 21 | - "@doctrine.orm.entity_manager" |
19 | - "@wallabag_core.content_proxy" | 22 | - "@wallabag_core.content_proxy" |
20 | - "@craue_config" | 23 | - "@craue_config" |
diff --git a/src/Wallabag/ImportBundle/Resources/views/Import/_workerEnabled.html.twig b/src/Wallabag/ImportBundle/Resources/views/Import/_workerEnabled.html.twig new file mode 100644 index 00000000..2390a41f --- /dev/null +++ b/src/Wallabag/ImportBundle/Resources/views/Import/_workerEnabled.html.twig | |||
@@ -0,0 +1,8 @@ | |||
1 | {% set redis = craue_setting('import_with_redis') %} | ||
2 | {% set rabbit = craue_setting('import_with_rabbitmq') %} | ||
3 | |||
4 | {% if redis or rabbit %} | ||
5 | <div class="card-panel yellow darken-1 black-text"> | ||
6 | {{ 'import.worker.enabled'|trans }} <strong>{% if rabbit %}RabbitMQ{% elseif redis %}Redis{% endif %}</strong> | ||
7 | </div> | ||
8 | {% endif %} | ||
diff --git a/src/Wallabag/ImportBundle/Resources/views/Import/check_queue.html.twig b/src/Wallabag/ImportBundle/Resources/views/Import/check_queue.html.twig new file mode 100644 index 00000000..7168ea35 --- /dev/null +++ b/src/Wallabag/ImportBundle/Resources/views/Import/check_queue.html.twig | |||
@@ -0,0 +1,11 @@ | |||
1 | {% if nbRedisMessages > 0 %} | ||
2 | <script> | ||
3 | Materialize.toast('Messages in queue: {{ nbRedisMessages }}', 4000); | ||
4 | </script> | ||
5 | {% endif %} | ||
6 | |||
7 | {% if nbRabbitMessages > 0 %} | ||
8 | <script> | ||
9 | Materialize.toast('Messages in queue: {{ nbRabbitMessages }}', 4000); | ||
10 | </script> | ||
11 | {% endif %} | ||
diff --git a/src/Wallabag/ImportBundle/Resources/views/Pocket/index.html.twig b/src/Wallabag/ImportBundle/Resources/views/Pocket/index.html.twig index 401dbd33..6195fa07 100644 --- a/src/Wallabag/ImportBundle/Resources/views/Pocket/index.html.twig +++ b/src/Wallabag/ImportBundle/Resources/views/Pocket/index.html.twig | |||
@@ -6,15 +6,13 @@ | |||
6 | <div class="row"> | 6 | <div class="row"> |
7 | <div class="col s12"> | 7 | <div class="col s12"> |
8 | <div class="card-panel settings"> | 8 | <div class="card-panel settings"> |
9 | {% include 'WallabagImportBundle:Import:_workerEnabled.html.twig' %} | ||
10 | |||
9 | {% if not has_consumer_key %} | 11 | {% if not has_consumer_key %} |
10 | <div class="card-panel red darken-1"> | 12 | <div class="card-panel red white-text"> |
11 | {{ 'import.pocket.config_missing.description'|trans }} | 13 | {{ 'import.pocket.config_missing.description'|trans }} |
12 | 14 | ||
13 | {% if is_granted('ROLE_SUPER_ADMIN') %} | 15 | {{ 'import.pocket.config_missing.admin_message'|trans({'%keyurls%': '<a href="' ~ path('config') ~ '">', '%keyurle%':'</a>'})|raw }} |
14 | {{ 'import.pocket.config_missing.admin_message'|trans({'%keyurls%': '<a href="' ~ path('craue_config_settings_modify') ~ '#set-import">', '%keyurle%':'</a>'})|raw }} | ||
15 | {% else %} | ||
16 | {{ 'import.pocket.config_missing.user_message'|trans }} | ||
17 | {% endif %} | ||
18 | </div> | 16 | </div> |
19 | {% endif %} | 17 | {% endif %} |
20 | 18 | ||
@@ -29,7 +27,7 @@ | |||
29 | {{ form_label(form.mark_as_read) }} | 27 | {{ form_label(form.mark_as_read) }} |
30 | </div> | 28 | </div> |
31 | </div> | 29 | </div> |
32 | <button class="btn waves-effect waves-light" type="submit" name="action"> | 30 | <button class="btn waves-effect waves-light" type="submit" name="action" {% if not has_consumer_key %}disabled="disabled"{% endif %}> |
33 | {{ 'import.pocket.connect_to_pocket'|trans }} | 31 | {{ 'import.pocket.connect_to_pocket'|trans }} |
34 | </button> | 32 | </button> |
35 | </form> | 33 | </form> |
diff --git a/src/Wallabag/ImportBundle/Resources/views/Readability/index.html.twig b/src/Wallabag/ImportBundle/Resources/views/Readability/index.html.twig index f527d309..74653b0f 100644 --- a/src/Wallabag/ImportBundle/Resources/views/Readability/index.html.twig +++ b/src/Wallabag/ImportBundle/Resources/views/Readability/index.html.twig | |||
@@ -6,6 +6,8 @@ | |||
6 | <div class="row"> | 6 | <div class="row"> |
7 | <div class="col s12"> | 7 | <div class="col s12"> |
8 | <div class="card-panel settings"> | 8 | <div class="card-panel settings"> |
9 | {% include 'WallabagImportBundle:Import:_workerEnabled.html.twig' %} | ||
10 | |||
9 | <div class="row"> | 11 | <div class="row"> |
10 | <blockquote>{{ import.description|trans }}</blockquote> | 12 | <blockquote>{{ import.description|trans }}</blockquote> |
11 | <p>{{ 'import.readability.how_to'|trans }}</p> | 13 | <p>{{ 'import.readability.how_to'|trans }}</p> |
diff --git a/src/Wallabag/ImportBundle/Resources/views/WallabagV1/index.html.twig b/src/Wallabag/ImportBundle/Resources/views/WallabagV1/index.html.twig index 13e24c8c..0b19bc34 100644 --- a/src/Wallabag/ImportBundle/Resources/views/WallabagV1/index.html.twig +++ b/src/Wallabag/ImportBundle/Resources/views/WallabagV1/index.html.twig | |||
@@ -6,6 +6,8 @@ | |||
6 | <div class="row"> | 6 | <div class="row"> |
7 | <div class="col s12"> | 7 | <div class="col s12"> |
8 | <div class="card-panel settings"> | 8 | <div class="card-panel settings"> |
9 | {% include 'WallabagImportBundle:Import:_workerEnabled.html.twig' %} | ||
10 | |||
9 | <div class="row"> | 11 | <div class="row"> |
10 | <blockquote>{{ import.description|trans }}</blockquote> | 12 | <blockquote>{{ import.description|trans }}</blockquote> |
11 | <p>{{ 'import.wallabag_v1.how_to'|trans }}</p> | 13 | <p>{{ 'import.wallabag_v1.how_to'|trans }}</p> |