Skip to content
This repository was archived by the owner on Nov 24, 2025. It is now read-only.
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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```

Copy link
Contributor Author

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


};
SSHCellRenderer.prototype.getGui = function() {return this.eGui;};

function ILOCellRenderer() {}
ILOCellRenderer.prototype.init = function(params) {
this.eGui = document.createElement("div");
Copy link
Member

Choose a reason for hiding this comment

The 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).

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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");
Expand Down Expand Up @@ -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 = [
{
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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
},
Expand Down Expand Up @@ -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 = [
Copy link
Member

Choose a reason for hiding this comment

The 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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting params.column is undefined

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();
Expand Down