You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2020/11/24 23:09:08 UTC

[GitHub] [trafficcontrol] MylesBock opened a new pull request #5332: Change rendering/behavior of ILO/Mgmt IPs in Traffic Portal Servers list

MylesBock opened a new pull request #5332:
URL: https://github.com/apache/trafficcontrol/pull/5332


   <!--
   ************ STOP!! ************
   If this Pull Request is intended to fix a security vulnerability, DO NOT submit it! Instead, contact
   the Apache Software Foundation Security Team at security@trafficcontrol.apache.org and follow the
   guidelines at https://www.apache.org/security/ regarding vulnerability disclosure.
   -->
   ## What does this PR (Pull Request) do?
   Updates `TableServersController` to change the behavior for the ag-grid.
   A new renderer is introduced and the previous SSHCellRenderer has been updated to use a `div` instead of an `a` tag
   The corresponding `onRowClick` behavior was also updated to ignore navigation when these columns are clicked
   
   - [x] This PR fixes #5317 is not related to any Issue
   
   ## Which Traffic Control components are affected by this PR?
   
   - Traffic Portal
   
   
   ## What is the best way to verify this PR?
   <!-- Please include here ALL the steps necessary to test your Pull Request. If
   it includes tests (and most should), outline here the steps needed to run the
   tests. If not, lay out the manual testing procedure and please explain why
   tests are unnecessary for this Pull Request. -->
   Fire up TP with this branch, ensure ILO columns open to the iLO interface via HTTPS and the 'normal' mgmt IPs open a tab with an SSH target. Also ensure that when either of these are clicked the page remains the same.
   
   ## If this is a bug fix, what versions of Traffic Control are affected?
   - master (1df853c8)
   - 5.0.0
   
   
   
   ## The following criteria are ALL met by this PR
   
   
   - [ ] This PR includes tests OR I have explained why tests are unnecessary
   - [ ] This PR includes documentation OR I have explained why documentation is unnecessary
   - [ ] This PR includes an update to CHANGELOG.md OR such an update is not necessary
   - [x] This PR includes any and all required license headers
   - [x] This PR **DOES NOT FIX A SERIOUS SECURITY VULNERABILITY** (see [the Apache Software Foundation's security guidelines](https://www.apache.org/security/) for details)
   
   <!--
   Licensed to the Apache Software Foundation (ASF) under one
   or more contributor license agreements.  See the NOTICE file
   distributed with this work for additional information
   regarding copyright ownership.  The ASF licenses this file
   to you under the Apache License, Version 2.0 (the
   "License"); you may not use this file except in compliance
   with the License.  You may obtain a copy of the License at
   
       http://www.apache.org/licenses/LICENSE-2.0
   
   Unless required by applicable law or agreed to in writing,
   software distributed under the License is distributed on an
   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
   KIND, either express or implied.  See the License for the
   specific language governing permissions and limitations
   under the License.
   -->
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficcontrol] MylesBock commented on a change in pull request #5332: Change rendering/behavior of ILO/Mgmt IPs in Traffic Portal Servers list

Posted by GitBox <gi...@apache.org>.
MylesBock commented on a change in pull request #5332:
URL: https://github.com/apache/trafficcontrol/pull/5332#discussion_r533877853



##########
File path: traffic_portal/app/src/common/modules/table/servers/TableServersController.js
##########
@@ -365,7 +379,16 @@ var TableServersController = function(tableName, servers, filter, $scope, $state
 		},
 		onRowClicked: function(params) {
 			const selection = window.getSelection().toString();
-			if(selection === "" || selection === $scope.mouseDownSelectionText) {
+			const overrideCells = [

Review comment:
       10-4, this was added mostly last minute to ensure that the default behavior for the row wasn't applied




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficcontrol] MylesBock commented on a change in pull request #5332: Change rendering/behavior of ILO/Mgmt IPs in Traffic Portal Servers list

Posted by GitBox <gi...@apache.org>.
MylesBock commented on a change in pull request #5332:
URL: https://github.com/apache/trafficcontrol/pull/5332#discussion_r533878377



##########
File path: traffic_portal/app/src/common/modules/table/servers/TableServersController.js
##########
@@ -23,13 +23,22 @@ var TableServersController = function(tableName, servers, filter, $scope, $state
 	// browserify can't handle classes...
 	function SSHCellRenderer() {}
 	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 = document.createElement("div");
 		this.eGui.textContent = params.value;
+		this.data.cellHrefValue = "ssh://" + userModel.user.username + "@" + params.value;
+
 	};
 	SSHCellRenderer.prototype.getGui = function() {return this.eGui;};
 
+	function ILOCellRenderer() {}
+	ILOCellRenderer.prototype.init = function(params) {
+		this.eGui = document.createElement("div");

Review comment:
       :thinking: I'll dig into this one tomorrow




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficcontrol] mitchell852 commented on pull request #5332: Change rendering/behavior of ILO/Mgmt IPs in Traffic Portal Servers list

Posted by GitBox <gi...@apache.org>.
mitchell852 commented on pull request #5332:
URL: https://github.com/apache/trafficcontrol/pull/5332#issuecomment-733288828


   thanks @MylesBock - maybe @shamrickus can review?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficcontrol] shamrickus commented on a change in pull request #5332: Change rendering/behavior of ILO/Mgmt IPs in Traffic Portal Servers list

Posted by GitBox <gi...@apache.org>.
shamrickus commented on a change in pull request #5332:
URL: https://github.com/apache/trafficcontrol/pull/5332#discussion_r533835819



##########
File path: traffic_portal/app/src/common/modules/table/servers/TableServersController.js
##########
@@ -23,13 +23,22 @@ var TableServersController = function(tableName, servers, filter, $scope, $state
 	// browserify can't handle classes...
 	function SSHCellRenderer() {}
 	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 = document.createElement("div");
 		this.eGui.textContent = params.value;
+		this.data.cellHrefValue = "ssh://" + userModel.user.username + "@" + params.value;

Review comment:
       Getting `this.data` is undefined on page load
   ```
   Uncaught TypeError: this.data is undefined
       init https://localhost/resources/assets/js/app.js?built=1606856003402:24254
       initComponent https://localhost/resources/assets/js/ag-grid-community/dist/ag-grid-community.min.js:8
       createAndInitUserComponent https://localhost/resources/assets/js/ag-grid-community/dist/ag-grid-community.min.js:8
       newCellRenderer https://localhost/resources/assets/js/ag-grid-community/dist/ag-grid-community.min.js:8
       createCellRendererFunc https://localhost/resources/assets/js/ag-grid-community/dist/ag-grid-community.min.js:8
       executeFrame https://localhost/resources/assets/js/ag-grid-community/dist/ag-grid-community.min.js:8
       requestFrame https://localhost/resources/assets/js/ag-grid-community/dist/ag-grid-community.min.js:8
   app.js:24254:3```

##########
File path: traffic_portal/app/src/common/modules/table/servers/TableServersController.js
##########
@@ -365,7 +379,16 @@ var TableServersController = function(tableName, servers, filter, $scope, $state
 		},
 		onRowClicked: function(params) {
 			const selection = window.getSelection().toString();
-			if(selection === "" || selection === $scope.mouseDownSelectionText) {
+			const overrideCells = [

Review comment:
       I'd move this to a field on the controller since it never changes.

##########
File path: traffic_portal/app/src/common/modules/table/servers/TableServersController.js
##########
@@ -365,7 +379,16 @@ var TableServersController = function(tableName, servers, filter, $scope, $state
 		},
 		onRowClicked: function(params) {
 			const selection = window.getSelection().toString();
-			if(selection === "" || selection === $scope.mouseDownSelectionText) {
+			const overrideCells = [
+				"iloIpAddress",
+				"iloIpGateway",
+				"mgmtIpGateway",
+				"mgmtIpNetmask",
+				"ipGateway",
+				"ipAddress"
+			];
+			let columnId = params.column.getColId();

Review comment:
       Getting `params.column` is undefined

##########
File path: traffic_portal/app/src/common/modules/table/servers/TableServersController.js
##########
@@ -23,13 +23,22 @@ var TableServersController = function(tableName, servers, filter, $scope, $state
 	// browserify can't handle classes...
 	function SSHCellRenderer() {}
 	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 = document.createElement("div");
 		this.eGui.textContent = params.value;
+		this.data.cellHrefValue = "ssh://" + userModel.user.username + "@" + params.value;
+
 	};
 	SSHCellRenderer.prototype.getGui = function() {return this.eGui;};
 
+	function ILOCellRenderer() {}
+	ILOCellRenderer.prototype.init = function(params) {
+		this.eGui = document.createElement("div");

Review comment:
       ILOCellRenderer never gets initialized. I believe it's because all of the columns it's on are hidden by default (the SSHCellRenderer has one that is not, so it does get initialized). 




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficcontrol] MylesBock commented on a change in pull request #5332: Change rendering/behavior of ILO/Mgmt IPs in Traffic Portal Servers list

Posted by GitBox <gi...@apache.org>.
MylesBock commented on a change in pull request #5332:
URL: https://github.com/apache/trafficcontrol/pull/5332#discussion_r533878162



##########
File path: traffic_portal/app/src/common/modules/table/servers/TableServersController.js
##########
@@ -23,13 +23,22 @@ var TableServersController = function(tableName, servers, filter, $scope, $state
 	// browserify can't handle classes...
 	function SSHCellRenderer() {}
 	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 = document.createElement("div");
 		this.eGui.textContent = params.value;
+		this.data.cellHrefValue = "ssh://" + userModel.user.username + "@" + params.value;

Review comment:
       This literally crossed my mind Saturday afternoon :upside_down_face: 
   
   I need to figure out where it's approps to stash this, the context presently isn't correct of course




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficcontrol] MylesBock removed a comment on pull request #5332: Change rendering/behavior of ILO/Mgmt IPs in Traffic Portal Servers list

Posted by GitBox <gi...@apache.org>.
MylesBock removed a comment on pull request #5332:
URL: https://github.com/apache/trafficcontrol/pull/5332#issuecomment-748575341


   Drafting.
   
   https://github.com/MylesBock/trafficcontrol/tree/experimental/restructure
   
   Will return when this project is more conducive of outside help, cya


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficcontrol] MylesBock commented on pull request #5332: Change rendering/behavior of ILO/Mgmt IPs in Traffic Portal Servers list

Posted by GitBox <gi...@apache.org>.
MylesBock commented on pull request #5332:
URL: https://github.com/apache/trafficcontrol/pull/5332#issuecomment-733295354


   no problem, I would say so ag-grid is not my forte for sure


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [trafficcontrol] MylesBock commented on pull request #5332: Change rendering/behavior of ILO/Mgmt IPs in Traffic Portal Servers list

Posted by GitBox <gi...@apache.org>.
MylesBock commented on pull request #5332:
URL: https://github.com/apache/trafficcontrol/pull/5332#issuecomment-748575341


   Drafting.
   
   https://github.com/MylesBock/trafficcontrol/tree/experimental/restructure
   
   Will return when this project is more conducive of outside help, cya


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org