You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by oc...@apache.org on 2020/10/29 18:18:02 UTC

[trafficcontrol] branch master updated: Servers Table - Single Click Navigation (#5217)

This is an automated email from the ASF dual-hosted git repository.

ocket8888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git


The following commit(s) were added to refs/heads/master by this push:
     new cfcf2b8  Servers Table - Single Click Navigation (#5217)
cfcf2b8 is described below

commit cfcf2b8d2789a10d3beea25fc56bfdc892229d96
Author: Steve Hamrick <sh...@users.noreply.github.com>
AuthorDate: Thu Oct 29 12:17:46 2020 -0600

    Servers Table - Single Click Navigation (#5217)
    
    * Remove double click, allow for copying
    
    * Use tabs
---
 .../modules/table/servers/TableServersController.js     | 17 +++++++++++++----
 traffic_portal/test/end_to_end/servers/servers-spec.js  |  2 +-
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/traffic_portal/app/src/common/modules/table/servers/TableServersController.js b/traffic_portal/app/src/common/modules/table/servers/TableServersController.js
index 9432bbf..18cad9f 100644
--- a/traffic_portal/app/src/common/modules/table/servers/TableServersController.js
+++ b/traffic_portal/app/src/common/modules/table/servers/TableServersController.js
@@ -299,6 +299,8 @@ var TableServersController = function(tableName, servers, filter, $scope, $state
 
 	$scope.pageSize = 100;
 
+	$scope.mouseDownSelectionText = "";
+
 	/** Options, configuration, data and callbacks for the ag-grid table. */
 	$scope.gridOptions = {
 		components: {
@@ -358,10 +360,17 @@ var TableServersController = function(tableName, servers, filter, $scope, $state
 			$scope.server = params.data;
 			$scope.$apply();
 		},
-		onRowDoubleClicked: function(params) {
-			locationUtils.navigateToPath('/servers/' + params.data.id);
-			// Event is outside the digest cycle, so we need to trigger one.
-			$scope.$apply();
+		onCellMouseDown: function() {
+			$scope.mouseDownSelectionText = window.getSelection().toString();
+		},
+		onRowClicked: function(params) {
+			const selection = window.getSelection().toString();
+			if(selection === "" || selection === $scope.mouseDownSelectionText) {
+				locationUtils.navigateToPath('/servers/' + params.data.id);
+				// Event is outside the digest cycle, so we need to trigger one.
+				$scope.$apply();
+			}
+			$scope.mouseDownSelectionText = "";
 		},
 		onColumnResized: function(params) {
 			localStorage.setItem(tableName + "_table_columns", JSON.stringify($scope.gridOptions.columnApi.getColumnState()));
diff --git a/traffic_portal/test/end_to_end/servers/servers-spec.js b/traffic_portal/test/end_to_end/servers/servers-spec.js
index 9953a3b..61319a0 100644
--- a/traffic_portal/test/end_to_end/servers/servers-spec.js
+++ b/traffic_portal/test/end_to_end/servers/servers-spec.js
@@ -105,7 +105,7 @@ describe('Traffic Portal Servers Test Suite', function() {
 		console.log('Verifying new server added and updating ' + mockVals.hostName);
 		browser.sleep(1000);
 		let row = element(by.cssContainingText('.ag-cell', mockVals.hostName));
-		browser.actions().doubleClick(row).perform();
+		browser.actions().click(row).perform();
 		browser.sleep(1000);
 		pageData.domainName.clear();
 		pageData.domainName.sendKeys('testupdated.com');