diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2015-12-31 11:24:46 +0100 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2016-01-02 23:27:41 +0100 |
commit | 7019c7cf6c6af39c0f458769e20c3f9306477943 (patch) | |
tree | 12acceaa458cdf6d24367eba85f690265acddcdb /src/Wallabag/ImportBundle/Resources | |
parent | b1d05721cf37ab94ec1a6837fe79cf19474dd0ff (diff) | |
download | wallabag-7019c7cf6c6af39c0f458769e20c3f9306477943.tar.gz wallabag-7019c7cf6c6af39c0f458769e20c3f9306477943.tar.zst wallabag-7019c7cf6c6af39c0f458769e20c3f9306477943.zip |
Add tagged services for import
- list services in /import
- add url to import service
- ImportBundle routing are now prefixed by /import
- optimize flush in each import (flushing each 20 contents)
- improve design of each import
- add more tests
Diffstat (limited to 'src/Wallabag/ImportBundle/Resources')
4 files changed, 32 insertions, 13 deletions
diff --git a/src/Wallabag/ImportBundle/Resources/config/services.yml b/src/Wallabag/ImportBundle/Resources/config/services.yml index e73ec0c8..e4dde100 100644 --- a/src/Wallabag/ImportBundle/Resources/config/services.yml +++ b/src/Wallabag/ImportBundle/Resources/config/services.yml | |||
@@ -1,4 +1,7 @@ | |||
1 | services: | 1 | services: |
2 | wallabag_import.chain: | ||
3 | class: Wallabag\ImportBundle\Import\ImportChain | ||
4 | |||
2 | wallabag_import.pocket.client: | 5 | wallabag_import.pocket.client: |
3 | class: GuzzleHttp\Client | 6 | class: GuzzleHttp\Client |
4 | arguments: | 7 | arguments: |
@@ -18,6 +21,8 @@ services: | |||
18 | calls: | 21 | calls: |
19 | - [ setClient, [ "@wallabag_import.pocket.client" ] ] | 22 | - [ setClient, [ "@wallabag_import.pocket.client" ] ] |
20 | - [ setLogger, [ "@logger" ]] | 23 | - [ setLogger, [ "@logger" ]] |
24 | tags: | ||
25 | - { name: wallabag_import.import, alias: pocket } | ||
21 | 26 | ||
22 | wallabag_import.wallabag_v1.import: | 27 | wallabag_import.wallabag_v1.import: |
23 | class: Wallabag\ImportBundle\Import\WallabagV1Import | 28 | class: Wallabag\ImportBundle\Import\WallabagV1Import |
@@ -25,3 +30,5 @@ services: | |||
25 | - "@doctrine.orm.entity_manager" | 30 | - "@doctrine.orm.entity_manager" |
26 | calls: | 31 | calls: |
27 | - [ setLogger, [ "@logger" ]] | 32 | - [ setLogger, [ "@logger" ]] |
33 | tags: | ||
34 | - { name: wallabag_import.import, alias: wallabag_v1 } | ||
diff --git a/src/Wallabag/ImportBundle/Resources/views/Import/index.html.twig b/src/Wallabag/ImportBundle/Resources/views/Import/index.html.twig index bd51f730..27baa1e3 100644 --- a/src/Wallabag/ImportBundle/Resources/views/Import/index.html.twig +++ b/src/Wallabag/ImportBundle/Resources/views/Import/index.html.twig | |||
@@ -1,15 +1,19 @@ | |||
1 | {% extends "WallabagCoreBundle::layout.html.twig" %} | 1 | {% extends "WallabagCoreBundle::layout.html.twig" %} |
2 | {% block title %}{% trans %}import{% endtrans %}{% endblock %} | 2 | {% block title %}{% trans %}Import{% endtrans %}{% endblock %} |
3 | 3 | ||
4 | {% block content %} | 4 | {% block content %} |
5 | |||
6 | <div class="row"> | 5 | <div class="row"> |
7 | <div class="col s12"> | 6 | <div class="col s12"> |
8 | <div class="card-panel settings"> | 7 | <div class="card-panel settings"> |
9 | {% trans %}Welcome on wallabag importer. Please select your previous service that you want to migrate.{% endtrans %} | 8 | {% trans %}Welcome on wallabag importer. Please select your previous service that you want to migrate.{% endtrans %} |
10 | <ul> | 9 | <ul> |
11 | <li><a href="{{ path('import_pocket') }}">Pocket</a></li> | 10 | {% for import in imports %} |
12 | <li><a href="{{ path('import_wallabag_v1') }}">Wallabag v1</a></li> | 11 | <li> |
12 | <h5>{{ import.name }}</h5> | ||
13 | <blockquote>{{ import.description|raw }}</blockquote> | ||
14 | <p><a class="waves-effect waves-light btn" href="{{ path(import.url) }}">Import contents</a></p> | ||
15 | </li> | ||
16 | {% endfor %} | ||
13 | </ul> | 17 | </ul> |
14 | </div> | 18 | </div> |
15 | </div> | 19 | </div> |
diff --git a/src/Wallabag/ImportBundle/Resources/views/Pocket/index.html.twig b/src/Wallabag/ImportBundle/Resources/views/Pocket/index.html.twig index 940fe4cc..9803896c 100644 --- a/src/Wallabag/ImportBundle/Resources/views/Pocket/index.html.twig +++ b/src/Wallabag/ImportBundle/Resources/views/Pocket/index.html.twig | |||
@@ -1,14 +1,16 @@ | |||
1 | {% extends "WallabagCoreBundle::layout.html.twig" %} | 1 | {% extends "WallabagCoreBundle::layout.html.twig" %} |
2 | {% block title %}{% trans %}import{% endtrans %}{% endblock %} | 2 | {% block title %}{% trans %}Import > Pocket{% endtrans %}{% endblock %} |
3 | 3 | ||
4 | {% block content %} | 4 | {% block content %} |
5 | |||
6 | <div class="row"> | 5 | <div class="row"> |
7 | <div class="col s12"> | 6 | <div class="col s12"> |
8 | <div class="card-panel settings"> | 7 | <div class="card-panel settings"> |
9 | {% trans %}You can import your data from your Pocket account. You just have to click on the below button and authorize the application to connect to getpocket.com.{% endtrans %} | 8 | <blockquote>{{ import.description|raw }}</blockquote> |
9 | <p>{% trans %}You can import your data from your Pocket account. You just have to click on the below button and authorize the application to connect to getpocket.com.{% endtrans %}</p> | ||
10 | <form method="post" action="{{ path('import_pocket_auth') }}"> | 10 | <form method="post" action="{{ path('import_pocket_auth') }}"> |
11 | <input type="submit" value="Connect to Pocket and import data" /> | 11 | <button class="btn waves-effect waves-light" type="submit" name="action"> |
12 | Connect to Pocket and import data | ||
13 | </button> | ||
12 | </form> | 14 | </form> |
13 | </div> | 15 | </div> |
14 | </div> | 16 | </div> |
diff --git a/src/Wallabag/ImportBundle/Resources/views/WallabagV1/index.html.twig b/src/Wallabag/ImportBundle/Resources/views/WallabagV1/index.html.twig index 328ab473..23d3e146 100644 --- a/src/Wallabag/ImportBundle/Resources/views/WallabagV1/index.html.twig +++ b/src/Wallabag/ImportBundle/Resources/views/WallabagV1/index.html.twig | |||
@@ -1,20 +1,26 @@ | |||
1 | {% extends "WallabagCoreBundle::layout.html.twig" %} | 1 | {% extends "WallabagCoreBundle::layout.html.twig" %} |
2 | {% block title %}{% trans %}import{% endtrans %}{% endblock %} | 2 | {% block title %}{% trans %}Import > Wallabag v1{% endtrans %}{% endblock %} |
3 | 3 | ||
4 | {% block content %} | 4 | {% block content %} |
5 | |||
6 | <div class="row"> | 5 | <div class="row"> |
7 | <div class="col s12"> | 6 | <div class="col s12"> |
8 | <div class="card-panel settings"> | 7 | <div class="card-panel settings"> |
9 | <div class="row"> | 8 | <div class="row"> |
9 | <blockquote>{{ import.description|raw }}</blockquote> | ||
10 | <p>{% trans %}Please select your wallabag export and click on the below button to upload and import it.{% endtrans %}</p> | ||
10 | <div class="col s12"> | 11 | <div class="col s12"> |
11 | {{ form_start(form, {'method': 'POST'}) }} | 12 | {{ form_start(form, {'method': 'POST'}) }} |
12 | {{ form_errors(form) }} | 13 | {{ form_errors(form) }} |
13 | <div class="row"> | 14 | <div class="row"> |
14 | <div class="input-field col s12"> | 15 | <div class="file-field input-field col s12"> |
15 | <p>{% trans %}Please select your wallabag export and click on the below button to upload and import it.{% endtrans %}</p> | ||
16 | {{ form_errors(form.file) }} | 16 | {{ form_errors(form.file) }} |
17 | {{ form_widget(form.file) }} | 17 | <div class="btn"> |
18 | <span>File</span> | ||
19 | {{ form_widget(form.file) }} | ||
20 | </div> | ||
21 | <div class="file-path-wrapper"> | ||
22 | <input class="file-path validate" type="text"> | ||
23 | </div> | ||
18 | </div> | 24 | </div> |
19 | </div> | 25 | </div> |
20 | <div class="hidden">{{ form_rest(form) }}</div> | 26 | <div class="hidden">{{ form_rest(form) }}</div> |