diff --git a/src/wirecloud/commons/utils/remote.py b/src/wirecloud/commons/utils/remote.py index 01e57990e7..1c8ef067f5 100644 --- a/src/wirecloud/commons/utils/remote.py +++ b/src/wirecloud/commons/utils/remote.py @@ -1075,6 +1075,10 @@ def name(self): def title(self): return self.find_element(".endpoint-title").text + @property + def btn_preferences(self): + return ButtonTester(self.testcase, self.find_element(".we-prefs-btn")) + def change_position(self, endpoint): new_index = endpoint.index actions = ActionChains(self.testcase.driver).click_and_hold(self.element) @@ -1117,6 +1121,10 @@ def mouse_over(self, must_recommend=()): self.testcase.assertTrue(endpoint.is_active) return self + def show_preferences(self): + button = self.btn_preferences.click() + return PopupMenuTester(self.testcase, self.testcase.wait_element_visible(".se-popup-menu"), button) + class WiringBehaviourTester(WebElementTester): diff --git a/src/wirecloud/defaulttheme/static/css/wiring/components.scss b/src/wirecloud/defaulttheme/static/css/wiring/components.scss index 73d50b027f..7610b07c2e 100644 --- a/src/wirecloud/defaulttheme/static/css/wiring/components.scss +++ b/src/wirecloud/defaulttheme/static/css/wiring/components.scss @@ -264,6 +264,24 @@ padding: ($endpoint-text-height / 2) ($endpoint-anchor-width / 2); } + .endpoint-actions { + position: absolute; + top: -1px; + + .se-btn { + padding: 0; + height: 20px; + width: 20px; + line-height: 20px; + font-size: 12px; + margin: 0; + background-image: none; + box-shadow: none; + border-color: rgba(0, 0, 0, 0); + background-color: transparent; + } + } + &:first-child { margin-top: $endpoint-margin-vertical; } @@ -275,6 +293,17 @@ left, $source-endpoint-anchor-bg ); + + .endpoint { + + .endpoint-title { + padding-left: 20px; + } + + .endpoint-actions { + left: 0; + } + } } &.target-endpoints { @@ -283,6 +312,17 @@ right, $target-endpoint-anchor-bg ); + + .endpoint { + + .endpoint-title { + padding-right: 20px; + } + + .endpoint-actions { + right: 0; + } + } } &:empty { @@ -302,6 +342,15 @@ .endpoint-anchor { background-color: $endpoint-active-bg; } + + .endpoint-actions > .se-btn { + color: rgb(255, 255 ,255); + + &:hover, + &:focus { + background-color: darken($endpoint-active-bg, 10%); + } + } } .endpoint.missing .endpoint-anchor { diff --git a/src/wirecloud/platform/static/js/wirecloud/ui/WiringEditor.js b/src/wirecloud/platform/static/js/wirecloud/ui/WiringEditor.js index 059eee9319..a9fedceb4a 100644 --- a/src/wirecloud/platform/static/js/wirecloud/ui/WiringEditor.js +++ b/src/wirecloud/platform/static/js/wirecloud/ui/WiringEditor.js @@ -262,6 +262,18 @@ Wirecloud.ui = Wirecloud.ui || {}; this.connectionEngine.appendEndpoint(endpoint); this.suggestionManager.appendEndpoint(endpoint); + var menuItem = new se.MenuItem(utils.gettext("Search components"), function () { + + if (!this.btnFindComponents.active) { + this.btnFindComponents.click(); + } + + this.componentManager.searchComponents.search((endpoint.type === "source" ? "input" : "output") + "_friendcodes:(" + endpoint.keywords.join(" OR ") + ") NOT (vendor:" + endpoint.component._component.meta.vendor + " AND name:" + endpoint.component._component.meta.name + ")"); + }.bind(this)); + menuItem.addIconClass("fa fa-search"); + + endpoint.btnPrefs.popup_menu.append(menuItem); + endpoint .addEventListener('mouseenter', function () { if (!this.connectionEngine.temporalConnection) { diff --git a/src/wirecloud/platform/static/js/wirecloud/ui/WiringEditor/Endpoint.js b/src/wirecloud/platform/static/js/wirecloud/ui/WiringEditor/Endpoint.js index 9ac102d925..996164988f 100644 --- a/src/wirecloud/platform/static/js/wirecloud/ui/WiringEditor/Endpoint.js +++ b/src/wirecloud/platform/static/js/wirecloud/ui/WiringEditor/Endpoint.js @@ -59,6 +59,17 @@ this.anchorElement.className = "endpoint-anchor"; this.wrapperElement.appendChild(this.anchorElement); + this.optionsElement = document.createElement('span'); + this.optionsElement.className = "endpoint-actions"; + this.wrapperElement.appendChild(this.optionsElement); + + this.btnPrefs = new se.PopupButton({ + title: utils.gettext("More options"), + class: "we-prefs-btn", + iconClass: "fa fa-ellipsis-v" + }); + this.btnPrefs.appendTo(this.optionsElement); + this._endpoint = wiringEndpoint; this.component = component; diff --git a/src/wirecloud/platform/wiring/tests.py b/src/wirecloud/platform/wiring/tests.py index 7c8977c2be..941d1c1b4f 100644 --- a/src/wirecloud/platform/wiring/tests.py +++ b/src/wirecloud/platform/wiring/tests.py @@ -1814,6 +1814,34 @@ def test_search_components_by_component_output_endpoints(self): self.assertEqual(len(sidebar.find_component_groups('operator')), 0) self.assertEqual(len(sidebar.find_component_groups('widget')), 1) + @uses_extra_resources(('Wirecloud_TestOperator_FriendcodeList_2.1.zip','Wirecloud_Test_FriendcodeList_3.1.wgt'), shared=True) + def test_search_components_by_component_specific_input_endpoint(self): + self.login(username='user_with_workspaces', next='/user_with_workspaces/ExistingWorkspace') + + with self.wiring_view as wiring: + with wiring.component_sidebar as sidebar: + operator = sidebar.add_component('operator', "Wirecloud/TestOperator") + + operator.find_endpoint('target', name="input").show_preferences().click_entry("Search components") + + with wiring.component_sidebar as sidebar: + self.assertEqual(len(sidebar.find_component_groups('operator')), 0) + self.assertEqual(len(sidebar.find_component_groups('widget')), 1) + + @uses_extra_resources(('Wirecloud_TestOperator_FriendcodeList_2.1.zip','Wirecloud_Test_FriendcodeList_3.1.wgt'), shared=True) + def test_search_components_by_component_specific_output_endpoint(self): + self.login(username='user_with_workspaces', next='/user_with_workspaces/ExistingWorkspace') + + with self.wiring_view as wiring: + with wiring.component_sidebar as sidebar: + operator = sidebar.add_component('operator', "Wirecloud/TestOperator") + + operator.find_endpoint('source', name="output-test").show_preferences().click_entry("Search components") + + with wiring.component_sidebar as sidebar: + self.assertEqual(len(sidebar.find_component_groups('operator')), 0) + self.assertEqual(len(sidebar.find_component_groups('widget')), 1) + @wirecloud_selenium_test_case class BehaviourManagementTestCase(WirecloudSeleniumTestCase):