From 79e6322ceec5161b621fb963403189671befdcfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Arranz?= Date: Fri, 17 May 2019 22:01:15 +0200 Subject: [PATCH 1/5] Fix reference to wirecloud.platform app in wirecloud/commons/migrations/001_initial.py --- src/wirecloud/commons/migrations/0001_initial.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wirecloud/commons/migrations/0001_initial.py b/src/wirecloud/commons/migrations/0001_initial.py index eb96f9bad2..f502b0a43a 100644 --- a/src/wirecloud/commons/migrations/0001_initial.py +++ b/src/wirecloud/commons/migrations/0001_initial.py @@ -16,7 +16,7 @@ class Migration(migrations.Migration): migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('auth', '0008_alter_user_username_max_length'), ] - if global_apps.is_installed('platform'): + if global_apps.is_installed('wirecloud.platform'): dependencies.append(('platform', '0015_remove_organization_models')) operations = [ From 9291ba8cc6c16a1c13fb324b14a51ee6a497e93e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Arranz?= Date: Fri, 17 May 2019 22:02:50 +0200 Subject: [PATCH 2/5] Fix history state for the catalogue details view --- .../ui/WirecloudCatalogue/ResourceDetailsView.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/wirecloud/catalogue/static/js/wirecloud/ui/WirecloudCatalogue/ResourceDetailsView.js b/src/wirecloud/catalogue/static/js/wirecloud/ui/WirecloudCatalogue/ResourceDetailsView.js index 6eda2a2a94..5d451967f3 100644 --- a/src/wirecloud/catalogue/static/js/wirecloud/ui/WirecloudCatalogue/ResourceDetailsView.js +++ b/src/wirecloud/catalogue/static/js/wirecloud/ui/WirecloudCatalogue/ResourceDetailsView.js @@ -1,5 +1,6 @@ /* * Copyright (c) 2012-2016 CoNWeT Lab., Universidad Politécnica de Madrid + * Copyright (c) 2019 Future Internet Consulting and Development Solutions S.L. * * This file is part of Wirecloud Platform. * @@ -40,7 +41,13 @@ details = new StyledElements.Notebook(); details.addEventListener('changed', function (notebook, oldTab, newTab, context) { if (context == null || context.init !== true) { - var new_status = this.mainview.buildStateData(); + let new_status; + if ('mainview' in this.mainview) { + new_status = this.mainview.mainview.buildStateData(); + } else { + new_status = this.mainview.buildStateData(); + } + Wirecloud.HistoryManager.pushState(new_status); } Wirecloud.dispatchEvent('viewcontextchanged'); From 20bb2628ae3f2fab0b8733f3f604d022fc9bd241 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Arranz?= Date: Fri, 17 May 2019 22:05:32 +0200 Subject: [PATCH 3/5] Remove id from the catalogue responses (not needed) --- src/wirecloud/catalogue/utils.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/wirecloud/catalogue/utils.py b/src/wirecloud/catalogue/utils.py index abe923df26..0b274cf920 100644 --- a/src/wirecloud/catalogue/utils.py +++ b/src/wirecloud/catalogue/utils.py @@ -283,7 +283,6 @@ def get_resource_data(resource, user, request=None): longdescription = resource_info['description'] return { - 'id': resource.pk, 'vendor': resource.vendor, 'name': resource.short_name, 'version': resource.version, From 5457e7076a47e085fe230fade20e396606b5c799 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Arranz?= Date: Sat, 18 May 2019 12:49:33 +0200 Subject: [PATCH 4/5] Fix some catalogue problems --- .../js/catalogue/CatalogueSearchView.js | 10 ++-- .../static/js/catalogue/CatalogueView.js | 49 ++----------------- 2 files changed, 10 insertions(+), 49 deletions(-) diff --git a/src/wirecloud/platform/static/js/catalogue/CatalogueSearchView.js b/src/wirecloud/platform/static/js/catalogue/CatalogueSearchView.js index a4b453fb0e..22204ca7cd 100644 --- a/src/wirecloud/platform/static/js/catalogue/CatalogueSearchView.js +++ b/src/wirecloud/platform/static/js/catalogue/CatalogueSearchView.js @@ -59,7 +59,7 @@ 'scope': 'all', 'requestFunc': this._search.bind(this), 'processFunc': function (elements, search_info) { - var i, msg; + var msg; this.resource_list.clear(); @@ -71,9 +71,11 @@ })); } - for (i = 0; i < elements.length; i += 1) { - this.resource_list.appendChild(this.resource_painter.paint(elements[i])); - } + elements.forEach((element) => { + element.version = new Wirecloud.Version(element.version); + element.group_id = element.vendor_name; + this.resource_list.appendChild(this.resource_painter.paint(element)); + }); }.bind(this) }); this.source.addEventListener('optionsChanged', function (source, options) { diff --git a/src/wirecloud/platform/static/js/catalogue/CatalogueView.js b/src/wirecloud/platform/static/js/catalogue/CatalogueView.js index d5fd683786..2757692085 100644 --- a/src/wirecloud/platform/static/js/catalogue/CatalogueView.js +++ b/src/wirecloud/platform/static/js/catalogue/CatalogueView.js @@ -41,7 +41,7 @@ this.appendChild(this.alternatives); resource_extra_context = { - 'mainbutton': function (options, context, resource) { + 'mainbutton': (options, context, resource) => { var button, local_catalogue_view; local_catalogue_view = Wirecloud.UserInterfaceManager.views.myresources; @@ -50,18 +50,18 @@ 'class': 'btn-danger', 'text': utils.gettext('Uninstall') }); - button.addEventListener('click', local_catalogue_view.createUserCommand('uninstall', resource, this.catalogue)); + button.addEventListener('click', local_catalogue_view.createUserCommand('uninstall', resource, this)); } else { button = new StyledElements.Button({ 'class': 'btn-success', 'text': utils.gettext('Install') }); - button.addEventListener('click', local_catalogue_view.createUserCommand('install', resource, this.catalogue)); + button.addEventListener('click', local_catalogue_view.createUserCommand('install', resource, this)); } button.addClassName('mainbutton'); return button; - }.bind(this) + } }; this.viewsByName = { @@ -155,22 +155,6 @@ CatalogueView.prototype.ui_commands = {}; - CatalogueView.prototype.ui_commands.install = function install(resource, catalogue_source) { - return function () { - Wirecloud.UserInterfaceManager.monitorTask( - this.catalogue.addComponent({url: resource.description_url}).then( - () => { - this.refresh_search_results(); - - catalogue_source.home(); - catalogue_source.refresh_search_results(); - }, - logerror - ) - ); - }.bind(this); - }; - CatalogueView.prototype.ui_commands.showDetails = function showDetails(resource, options) { options = utils.merge({ history: "push" @@ -209,31 +193,6 @@ }.bind(this); }; - CatalogueView.prototype.ui_commands.delete = function (resource) { - var doRequest, msg; - - doRequest = function () { - Wirecloud.UserInterfaceManager.monitorTask( - this.catalogue.deleteResource(resource).then( - () => { - this.home(); - this.refresh_search_results(); - }, - logerror - ) - ); - }; - - // First ask the user - msg = utils.gettext('Do you really want to remove the "%(name)s" (vendor: "%(vendor)s", version: "%(version)s") component?'); - msg = utils.interpolate(msg, resource, true); - return function () { - var dialog = new Wirecloud.ui.AlertWindowMenu(msg); - dialog.setHandler(doRequest.bind(this)); - dialog.show(); - }.bind(this); - }; - CatalogueView.prototype.refresh_if_needed = function refresh_if_needed() { if (this.alternatives.getCurrentAlternative() === this.viewsByName.search) { this.viewsByName.search.refresh_if_needed(); From e74219d3ac45af39bcbfad03906e70f50157ad88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Arranz?= Date: Tue, 21 May 2019 00:36:34 +0200 Subject: [PATCH 5/5] Fix some problems passing the integration tests --- src/wirecloud/commons/utils/remote.py | 6 +++--- .../responses/wcatalogue/catalogue/resource/Wirecloud/Test | 2 +- .../wcatalogue/catalogue/resource/Wirecloud/test-mashup | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/wirecloud/commons/utils/remote.py b/src/wirecloud/commons/utils/remote.py index f2298a94c4..7423d81459 100644 --- a/src/wirecloud/commons/utils/remote.py +++ b/src/wirecloud/commons/utils/remote.py @@ -936,7 +936,7 @@ def has_state(self, state): def change_version(self, version): super(WiringComponentTester, self).change_version(version) - WebDriverWait(self.testcase.driver, timeout=5).until(lambda driver: self.version == "v" + version) + WebDriverWait(self.testcase.driver, timeout=5).until(lambda driver: self.version == "v" + version) return self @@ -1138,7 +1138,7 @@ def title(self): def change_position(self, endpoint): new_index = endpoint.index - actions = ActionChains(self.testcase.driver).click_and_hold(self.element).move_to_element(endpoint.element).release().perform() + ActionChains(self.testcase.driver).click_and_hold(self.element).move_to_element(endpoint.element).release().perform() WebDriverWait(self.testcase.driver, 3).until(lambda driver: self.index == new_index) return self @@ -1677,7 +1677,7 @@ def delete(self, expect_error=False): if window_menus != 1: self.testcase.fail('Error: marketplace was not deleted') - self.testcase.assertNotEqual(self.get_current_marketplace_name(), market) + WebDriverWait(self.testcase.driver, 3).until(lambda driver: self.get_current_marketplace_name() != market) def search(self, keyword): catalogue_base_element = self.wait_catalogue_ready() diff --git a/src/wirecloud/platform/markets/test-data/responses/wcatalogue/catalogue/resource/Wirecloud/Test b/src/wirecloud/platform/markets/test-data/responses/wcatalogue/catalogue/resource/Wirecloud/Test index f9a439fdd4..5536a1ebda 100644 --- a/src/wirecloud/platform/markets/test-data/responses/wcatalogue/catalogue/resource/Wirecloud/Test +++ b/src/wirecloud/platform/markets/test-data/responses/wcatalogue/catalogue/resource/Wirecloud/Test @@ -1 +1 @@ -{"type": "widget", "vendor": "Wirecloud", "name": "Test", "versions": [{"license": "", "contributors": [], "title": "Test", "licenseurl": "", "homepage": "", "description": "This widget is used to test some of the features of the Wirecloud platform", "changelog": "CHANGELOG.md", "uriTemplate": "http://wcatalogue.example.com/catalogue/media/Wirecloud/Test/1.0/Wirecloud_Test_1.0.wgt", "longdescription": "

This widget is used for testing some of the features provided by Wirecloud

", "doc": "http://wcatalogue.example.com/catalogue/media/Wirecloud/Test/1.0/doc/index.md", "email": "aarranz@conwet.com", "version": "1.0", "image": "http://wcatalogue.example.com/catalogue/media/Wirecloud/Test/1.0/images/catalogue.png", "authors": [{"name": "aarranz"}], "date": 1417631958883.257, "size": 41384, "id": 18, "permissions": {"uninstall": true, "delete": true}}]} +{"type": "widget", "vendor": "Wirecloud", "name": "Test", "versions": [{"license": "", "contributors": [], "title": "Test", "licenseurl": "", "homepage": "", "description": "This widget is used to test some of the features of the Wirecloud platform", "changelog": "CHANGELOG.md", "uriTemplate": "http://wcatalogue.example.com/catalogue/media/Wirecloud/Test/1.0/Wirecloud_Test_1.0.wgt", "longdescription": "

This widget is used for testing some of the features provided by Wirecloud

", "doc": "http://wcatalogue.example.com/catalogue/media/Wirecloud/Test/1.0/doc/index.md", "email": "aarranz@conwet.com", "version": "1.0", "image": "http://wcatalogue.example.com/catalogue/media/Wirecloud/Test/1.0/images/catalogue.png", "authors": [{"name": "aarranz"}], "date": 1417631958883.257, "size": 41384, "id": 18, "permissions": {"uninstall": false, "delete": false}}]} diff --git a/src/wirecloud/platform/markets/test-data/responses/wcatalogue/catalogue/resource/Wirecloud/test-mashup b/src/wirecloud/platform/markets/test-data/responses/wcatalogue/catalogue/resource/Wirecloud/test-mashup index 9930ea9dec..6755cc3239 100644 --- a/src/wirecloud/platform/markets/test-data/responses/wcatalogue/catalogue/resource/Wirecloud/test-mashup +++ b/src/wirecloud/platform/markets/test-data/responses/wcatalogue/catalogue/resource/Wirecloud/test-mashup @@ -1 +1 @@ -{"type": "mashup", "vendor": "Wirecloud", "name": "test-mashup", "versions": [{"license": "", "contributors": [], "title": "Test Mashup", "licenseurl": "", "homepage": "", "description": "Wirecloud Mashup composed of: Test, Test", "changelog": "", "uriTemplate": "http://wcatalogue.example.com/catalogue/media/Wirecloud/test-mashup/1.0/Wirecloud_test-mashup_1.0.wgt", "longdescription": "Wirecloud Mashup composed of: Test, Test", "doc": "", "email": "wirecloud@conwet.com", "version": "1.0", "image": "http://wcatalogue.example.com/images/catalogue/widget_image.png", "authors": [{"name": "admin"}], "date": 1418139895196.074, "size": 747, "id": 22, "permissions": {"uninstall": true, "delete": true}}]} +{"type": "mashup", "vendor": "Wirecloud", "name": "test-mashup", "versions": [{"license": "", "contributors": [], "title": "Test Mashup", "licenseurl": "", "homepage": "", "description": "Wirecloud Mashup composed of: Test, Test", "changelog": "", "uriTemplate": "http://wcatalogue.example.com/catalogue/media/Wirecloud/test-mashup/1.0/Wirecloud_test-mashup_1.0.wgt", "longdescription": "Wirecloud Mashup composed of: Test, Test", "doc": "", "email": "wirecloud@conwet.com", "version": "1.0", "image": "http://wcatalogue.example.com/images/catalogue/widget_image.png", "authors": [{"name": "admin"}], "date": 1418139895196.074, "size": 747, "id": 22, "permissions": {"uninstall": false, "delete": false}}]}