diff --git a/pyproject.toml b/pyproject.toml index 38afaf5..7ef62a2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,7 +10,7 @@ authors = [ maintainers = [ {name = "Tim Holzheim", email = "tim.holzheim@rwth-aachen.de"}, ] -version = "0.0.16" +version = "0.0.17" readme = "README.md" license= "Apache-2.0" dependencies = [ diff --git a/src/wikibasemigrator/web/webserver.py b/src/wikibasemigrator/web/webserver.py index 8c5106a..e36caf7 100644 --- a/src/wikibasemigrator/web/webserver.py +++ b/src/wikibasemigrator/web/webserver.py @@ -65,11 +65,14 @@ async def login_via_wiki(request: Request): return response @ui.page("/") - async def main_page(client: Client) -> None: + async def main_page(client: Client, entities: str | None = None) -> None: await client.connected() profile = self.get_profile() user = await self.get_user() - WikibaseControllerPage(profile, self.get_icon_path(), user=user).setup_ui() + controller_page = WikibaseControllerPage(profile, self.get_icon_path(), user=user) + controller_page.setup_ui() + if entities is not None: + controller_page.select_entities(entities) @ui.page("/config") async def config_page(client: Client) -> None: diff --git a/src/wikibasemigrator/web/wikibase_controller_page.py b/src/wikibasemigrator/web/wikibase_controller_page.py index 21e4880..41ca7bf 100644 --- a/src/wikibasemigrator/web/wikibase_controller_page.py +++ b/src/wikibasemigrator/web/wikibase_controller_page.py @@ -8,6 +8,7 @@ from wikibasemigrator.model.migration_mark import MigrationMark from wikibasemigrator.model.profile import WikibaseMigrationProfile from wikibasemigrator.model.translations import EntitySetTranslationResult +from wikibasemigrator.web.item_selectors import ItemSelectorElement from wikibasemigrator.web.migration_view import MigrationView from wikibasemigrator.web.oauth import MediaWikiUserIdentity from wikibasemigrator.web.selection_view import SelectionView @@ -85,6 +86,18 @@ def setup_view_container(self) -> None: else: self.selection_view.setup_ui() + def select_entities(self, entities: str): + """ + Add given entities to the list of entities selected. + :param entities: + :return: + """ + selector_id = 1 + self.selection_view.switch_to_selector(selector_id) + selector = self.selection_view.selectors.get(selector_id) + if isinstance(selector, ItemSelectorElement): + selector.value = entities + def requires_login(self) -> bool: """ Check if user login is required