-
Notifications
You must be signed in to change notification settings - Fork 355
Change rendering/behavior of ILO/Mgmt IPs in Traffic Portal Servers list #5332
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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"); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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).
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🤔 I'll dig into this one tomorrow |
||
| this.eGui.textContent = params.value; | ||
| this.data.cellHrefValue = "https://" + params.value; | ||
| }; | ||
| ILOCellRenderer.prototype.getGui = function() { return this.eGui;}; | ||
|
|
||
|
|
||
| function UpdateCellRenderer() {} | ||
| UpdateCellRenderer.prototype.init = function(params) { | ||
| this.eGui = document.createElement("I"); | ||
|
|
@@ -72,6 +81,10 @@ var TableServersController = function(tableName, servers, filter, $scope, $state | |
|
|
||
| /**** Constants, scope data, etc. ****/ | ||
|
|
||
| function openCellInNewWindow(event) { | ||
| window.open(event.cell.data.cellHrefValue, "_blank"); | ||
| } | ||
|
|
||
| /** The columns of the ag-grid table */ | ||
| const columns = [ | ||
| { | ||
|
|
@@ -115,15 +128,15 @@ var TableServersController = function(tableName, servers, filter, $scope, $state | |
| headerName: "ILO IP Address", | ||
| field: "iloIpAddress", | ||
| hide: true, | ||
| cellRenderer: "sshCellRenderer", | ||
| onCellClicked: null | ||
| cellRenderer: "iloCellRenderer", | ||
| onCellClicked: openCellInNewWindow | ||
| }, | ||
| { | ||
| headerName: "ILO IP Gateway", | ||
| field: "iloIpGateway", | ||
| hide: true, | ||
| cellRenderer: "sshCellRenderer", | ||
| onCellClicked: null | ||
| cellRenderer: "iloCellRenderer", | ||
| onCellClicked: openCellInNewWindow | ||
| }, | ||
| { | ||
| headerName: "ILO IP Netmask", | ||
|
|
@@ -168,31 +181,31 @@ var TableServersController = function(tableName, servers, filter, $scope, $state | |
| hide: true, | ||
| filter: true, | ||
| cellRenderer: "sshCellRenderer", | ||
| onCellClicked: null | ||
| onCellClicked: openCellInNewWindow | ||
| }, | ||
| { | ||
| headerName: "Mgmt IP Netmask", | ||
| field: "mgmtIpNetmask", | ||
| hide: true, | ||
| filter: true, | ||
| cellRenderer: "sshCellRenderer", | ||
| onCellClicked: null | ||
| onCellClicked: openCellInNewWindow | ||
| }, | ||
| { | ||
| headerName: "Network Gateway", | ||
| field: "ipGateway", | ||
| hide: true, | ||
| filter: true, | ||
| cellRenderer: "sshCellRenderer", | ||
| onCellClicked: null | ||
| onCellClicked: openCellInNewWindow | ||
| }, | ||
| { | ||
| headerName: "Network IP", | ||
| field: "ipAddress", | ||
| hide: false, | ||
| filter: true, | ||
| cellRenderer: "sshCellRenderer", | ||
| onCellClicked: null | ||
| onCellClicked: openCellInNewWindow | ||
| }, | ||
| { | ||
| headerName: "Network MTU", | ||
|
|
@@ -304,6 +317,7 @@ var TableServersController = function(tableName, servers, filter, $scope, $state | |
| /** Options, configuration, data and callbacks for the ag-grid table. */ | ||
| $scope.gridOptions = { | ||
| components: { | ||
| iloCellRenderer: ILOCellRenderer, | ||
| sshCellRenderer: SSHCellRenderer, | ||
| updateCellRenderer: UpdateCellRenderer | ||
| }, | ||
|
|
@@ -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 = [ | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd move this to a field on the controller since it never changes.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 10-4, this was added mostly last minute to ensure that the default behavior for the row wasn't applied |
||
| "iloIpAddress", | ||
| "iloIpGateway", | ||
| "mgmtIpGateway", | ||
| "mgmtIpNetmask", | ||
| "ipGateway", | ||
| "ipAddress" | ||
| ]; | ||
| let columnId = params.column.getColId(); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Getting |
||
| if(selection === "" || selection === $scope.mouseDownSelectionText && overrideCells.indexOf(columnId) === -1) { | ||
| locationUtils.navigateToPath('/servers/' + params.data.id); | ||
| // Event is outside the digest cycle, so we need to trigger one. | ||
| $scope.$apply(); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Getting
this.datais undefined on page loadThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This literally crossed my mind Saturday afternoon 🙃
I need to figure out where it's approps to stash this, the context presently isn't correct of course