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 2021/02/18 21:05:18 UTC

[trafficcontrol] branch 5.1.x updated: Fixes click functions on server ip addresses in the server table (#5519)

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

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


The following commit(s) were added to refs/heads/5.1.x by this push:
     new 70b0e7e  Fixes click functions on server ip addresses in the server table (#5519)
70b0e7e is described below

commit 70b0e7e6b127047819d74c3309bcf38e57e3945b
Author: Jeremy Mitchell <mi...@users.noreply.github.com>
AuthorDate: Tue Feb 16 13:25:03 2021 -0700

    Fixes click functions on server ip addresses in the server table (#5519)
    
    * on server ip click do not navigate to server detail page
    
    * adds SSHCellRenderer to the appropriate server fields
    
    * changes ilo ip to use https rather than ssh
    
    * fixes case
    
    * adds changelog entry
    
    (cherry picked from commit 6b02ba8a77e7a38c609d7b9bd2fdb12551c296b2)
---
 CHANGELOG.md                                       |  1 +
 .../table/servers/TableServersController.js        | 43 ++++++++++++++--------
 2 files changed, 28 insertions(+), 16 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index e7e50f6..61725aa 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
 ## [5.1.0] - 2021-02-21
 ### Added
 - Traffic Portal: [#5394](https://github.com/apache/trafficcontrol/issues/5394) - Converts the tenant table to a tenant tree for usability
+- Traffic Portal: [#5317](https://github.com/apache/trafficcontrol/issues/5317) - Clicking IP addresses in the servers table no longer navigates to server details page.
 - Traffic Portal: upgraded delivery service UI tables to use more powerful/performant ag-grid component
 - Traffic Ops: added a feature so that the user can specify `maxRequestHeaderBytes` on a per delivery service basis
 - Traffic Router: log warnings when requests to Traffic Monitor return a 503 status code
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 21246e7..d5da9ee 100644
--- a/traffic_portal/app/src/common/modules/table/servers/TableServersController.js
+++ b/traffic_portal/app/src/common/modules/table/servers/TableServersController.js
@@ -25,11 +25,21 @@ var TableServersController = function(tableName, servers, filter, $scope, $state
 	SSHCellRenderer.prototype.init = function(params) {
 		this.eGui = document.createElement("A");
 		this.eGui.href = "ssh://" + userModel.user.username + "@" + params.value;
-		this.eGui.setAttribute("target", "_blank");
+		this.eGui.setAttribute("class", "link");
 		this.eGui.textContent = params.value;
 	};
 	SSHCellRenderer.prototype.getGui = function() {return this.eGui;};
 
+	function HTTPSCellRenderer() {}
+	HTTPSCellRenderer.prototype.init = function(params) {
+		this.eGui = document.createElement("A");
+		this.eGui.href = "https://" + params.value;
+		this.eGui.setAttribute("class", "link");
+		this.eGui.setAttribute("target", "_blank");
+		this.eGui.textContent = params.value;
+	};
+	HTTPSCellRenderer.prototype.getGui = function() {return this.eGui;};
+
 	function UpdateCellRenderer() {}
 	UpdateCellRenderer.prototype.init = function(params) {
 		this.eGui = document.createElement("I");
@@ -96,15 +106,13 @@ var TableServersController = function(tableName, servers, filter, $scope, $state
 			headerName: "ILO IP Address",
 			field: "iloIpAddress",
 			hide: true,
-			cellRenderer: "sshCellRenderer",
+			cellRenderer: "httpsCellRenderer",
 			onCellClicked: null
 		},
 		{
 			headerName: "ILO IP Gateway",
 			field: "iloIpGateway",
-			hide: true,
-			cellRenderer: "sshCellRenderer",
-			onCellClicked: null
+			hide: true
 		},
 		{
 			headerName: "ILO IP Netmask",
@@ -124,7 +132,9 @@ var TableServersController = function(tableName, servers, filter, $scope, $state
 		{
 			headerName: "IPv6 Address",
 			field: "ip6Address",
-			hide: false
+			hide: false,
+			cellRenderer: "sshCellRenderer",
+			onCellClicked: null
 		},
 		{
 			headerName: "IPv6 Gateway",
@@ -141,31 +151,27 @@ var TableServersController = function(tableName, servers, filter, $scope, $state
 		{
 			headerName: "Mgmt IP Address",
 			field: "mgmtIpAddress",
-			hide: true
+			hide: true,
+			cellRenderer: "sshCellRenderer",
+			onCellClicked: null
 		},
 		{
 			headerName: "Mgmt IP Gateway",
 			field: "mgmtIpGateway",
 			hide: true,
-			filter: true,
-			cellRenderer: "sshCellRenderer",
-			onCellClicked: null
+			filter: true
 		},
 		{
 			headerName: "Mgmt IP Netmask",
 			field: "mgmtIpNetmask",
 			hide: true,
-			filter: true,
-			cellRenderer: "sshCellRenderer",
-			onCellClicked: null
+			filter: true
 		},
 		{
 			headerName: "Network Gateway",
 			field: "ipGateway",
 			hide: true,
-			filter: true,
-			cellRenderer: "sshCellRenderer",
-			onCellClicked: null
+			filter: true
 		},
 		{
 			headerName: "Network IP",
@@ -290,6 +296,7 @@ var TableServersController = function(tableName, servers, filter, $scope, $state
 	/** Options, configuration, data and callbacks for the ag-grid table. */
 	$scope.gridOptions = {
 		components: {
+			httpsCellRenderer: HTTPSCellRenderer,
 			sshCellRenderer: SSHCellRenderer,
 			updateCellRenderer: UpdateCellRenderer
 		},
@@ -352,6 +359,10 @@ var TableServersController = function(tableName, servers, filter, $scope, $state
 			$scope.mouseDownSelectionText = window.getSelection().toString();
 		},
 		onRowClicked: function(params) {
+			if (params.event.target.classList.contains('link')) {
+				// no need to navigate to server detail page
+				return;
+			}
 			const selection = window.getSelection().toString();
 			if(selection === "" || selection === $scope.mouseDownSelectionText) {
 				locationUtils.navigateToPath('/servers/' + params.data.id);