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
This commit is contained in:
Jeremy Benoist
2015-12-31 11:24:46 +01:00
parent b1d05721cf
commit 7019c7cf6c
25 changed files with 394 additions and 43 deletions

View File

@ -1,4 +1,7 @@
services:
wallabag_import.chain:
class: Wallabag\ImportBundle\Import\ImportChain
wallabag_import.pocket.client:
class: GuzzleHttp\Client
arguments:
@ -18,6 +21,8 @@ services:
calls:
- [ setClient, [ "@wallabag_import.pocket.client" ] ]
- [ setLogger, [ "@logger" ]]
tags:
- { name: wallabag_import.import, alias: pocket }
wallabag_import.wallabag_v1.import:
class: Wallabag\ImportBundle\Import\WallabagV1Import
@ -25,3 +30,5 @@ services:
- "@doctrine.orm.entity_manager"
calls:
- [ setLogger, [ "@logger" ]]
tags:
- { name: wallabag_import.import, alias: wallabag_v1 }

View File

@ -1,15 +1,19 @@
{% extends "WallabagCoreBundle::layout.html.twig" %}
{% block title %}{% trans %}import{% endtrans %}{% endblock %}
{% block title %}{% trans %}Import{% endtrans %}{% endblock %}
{% block content %}
<div class="row">
<div class="col s12">
<div class="card-panel settings">
{% trans %}Welcome on wallabag importer. Please select your previous service that you want to migrate.{% endtrans %}
<ul>
<li><a href="{{ path('import_pocket') }}">Pocket</a></li>
<li><a href="{{ path('import_wallabag_v1') }}">Wallabag v1</a></li>
{% for import in imports %}
<li>
<h5>{{ import.name }}</h5>
<blockquote>{{ import.description|raw }}</blockquote>
<p><a class="waves-effect waves-light btn" href="{{ path(import.url) }}">Import contents</a></p>
</li>
{% endfor %}
</ul>
</div>
</div>

View File

@ -1,14 +1,16 @@
{% extends "WallabagCoreBundle::layout.html.twig" %}
{% block title %}{% trans %}import{% endtrans %}{% endblock %}
{% block title %}{% trans %}Import > Pocket{% endtrans %}{% endblock %}
{% block content %}
<div class="row">
<div class="col s12">
<div class="card-panel settings">
{% 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 %}
<blockquote>{{ import.description|raw }}</blockquote>
<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>
<form method="post" action="{{ path('import_pocket_auth') }}">
<input type="submit" value="Connect to Pocket and import data" />
<button class="btn waves-effect waves-light" type="submit" name="action">
Connect to Pocket and import data
</button>
</form>
</div>
</div>

View File

@ -1,20 +1,26 @@
{% extends "WallabagCoreBundle::layout.html.twig" %}
{% block title %}{% trans %}import{% endtrans %}{% endblock %}
{% block title %}{% trans %}Import > Wallabag v1{% endtrans %}{% endblock %}
{% block content %}
<div class="row">
<div class="col s12">
<div class="card-panel settings">
<div class="row">
<blockquote>{{ import.description|raw }}</blockquote>
<p>{% trans %}Please select your wallabag export and click on the below button to upload and import it.{% endtrans %}</p>
<div class="col s12">
{{ form_start(form, {'method': 'POST'}) }}
{{ form_errors(form) }}
<div class="row">
<div class="input-field col s12">
<p>{% trans %}Please select your wallabag export and click on the below button to upload and import it.{% endtrans %}</p>
<div class="file-field input-field col s12">
{{ form_errors(form.file) }}
{{ form_widget(form.file) }}
<div class="btn">
<span>File</span>
{{ form_widget(form.file) }}
</div>
<div class="file-path-wrapper">
<input class="file-path validate" type="text">
</div>
</div>
</div>
<div class="hidden">{{ form_rest(form) }}</div>