NIFI-3906 Added formatting to tables.

Signed-off-by: Andy LoPresto <alopresto@apache.org>
This commit is contained in:
Scott Aslan 2017-05-16 10:31:30 -07:00 committed by Andy LoPresto
parent 77a676bf92
commit f5f6cab646
No known key found for this signature in database
GPG Key ID: 6EC293152D90B61D
14 changed files with 328 additions and 96 deletions

View File

@ -1289,7 +1289,14 @@
return markup;
};
propertyColumns.push({id: "actions", name: "&nbsp;", minWidth: 20, width: 20, formatter: actionFormatter});
propertyColumns.push(
{
id: "actions",
name: "&nbsp;",
minWidth: 20,
width: 20,
formatter: actionFormatter
});
var propertyConfigurationOptions = {
forceFitColumns: true,

View File

@ -329,7 +329,8 @@
name: 'Tags',
field: 'tags',
sortable: true,
resizable: true
resizable: true,
formatter: nfCommon.genericValueFormatter
}
];

View File

@ -298,14 +298,16 @@
field: 'key',
name: 'Key',
sortable: true,
resizable: true
resizable: true,
formatter: nfCommon.genericValueFormatter
},
{
id: 'value',
field: 'value',
name: 'Value',
sortable: true,
resizable: true
resizable: true,
formatter: nfCommon.genericValueFormatter
}
];
@ -316,7 +318,8 @@
field: 'scope',
name: 'Scope',
sortable: true,
resizable: true
resizable: true,
formatter: nfCommon.genericValueFormatter
});
}

View File

@ -361,7 +361,8 @@
name: 'Tags',
field: 'tags',
sortable: true,
resizable: true
resizable: true,
formatter: nfCommon.genericValueFormatter
}
];
@ -624,10 +625,10 @@
*/
var nameFormatter = function (row, cell, value, columnDef, dataContext) {
if (!dataContext.permissions.canRead) {
return '<span class="blank">' + dataContext.id + '</span>';
return '<span class="blank">' + nfCommon.escapeHtml(dataContext.id) + '</span>';
}
return dataContext.component.name;
return nfCommon.escapeHtml(dataContext.component.name);
};
/**
@ -652,9 +653,9 @@
var selectedData = selection.datum();
if (selectedData.id === dataContext.component.parentGroupId) {
if (selectedData.permissions.canRead) {
return selectedData.component.name;
return nfCommon.escapeHtml(selectedData.component.name);
} else {
return selectedData.id;
return nfCommon.escapeHtml(selectedData.id);
}
}
}
@ -670,7 +671,7 @@
}
});
return processGroupLabel;
return nfCommon.escapeHtml(processGroupLabel);
} else {
return 'Controller';
}
@ -938,7 +939,16 @@
];
// action column should always be last
controllerServicesColumns.push({id: 'actions', name: '&nbsp;', resizable: false, formatter: controllerServiceActionFormatter, sortable: false, width: 90, maxWidth: 90});
controllerServicesColumns.push(
{
id: 'actions',
name: '&nbsp;',
resizable: false,
formatter: controllerServiceActionFormatter,
sortable: false,
width: 90,
maxWidth: 90
});
// initialize the dataview
var controllerServicesData = new Slick.Data.DataView({

View File

@ -540,7 +540,7 @@
markup += '<div class="fa fa-users" style="margin-right: 5px;"></div>';
}
markup += dataContext.component.identity;
markup += nfCommon.escapeHtml(dataContext.component.identity);
return markup;
};

View File

@ -534,21 +534,24 @@
sortable: false,
resizable: false,
width: 75,
maxWidth: 75
maxWidth: 75,
formatter: nfCommon.genericValueFormatter
},
{
id: 'uuid',
name: 'UUID',
field: 'uuid',
sortable: false,
resizable: true
resizable: true,
formatter: nfCommon.genericValueFormatter
},
{
id: 'filename',
name: 'Filename',
field: 'filename',
sortable: false,
resizable: true
resizable: true,
formatter: nfCommon.genericValueFormatter
},
{
id: 'size',
@ -594,7 +597,8 @@
name: 'Node',
field: 'clusterNodeAddress',
sortable: false,
resizable: true
resizable: true,
formatter: nfCommon.genericValueFormatter
});
}

View File

@ -229,10 +229,10 @@
*/
var nameFormatter = function (row, cell, value, columnDef, dataContext) {
if (!dataContext.permissions.canRead) {
return '<span class="blank">' + dataContext.id + '</span>';
return '<span class="blank">' + nfCommon.escapeHtml(dataContext.id) + '</span>';
}
return dataContext.component.name;
return nfCommon.escapeHtml(dataContext.component.name);
};
/**
@ -508,7 +508,8 @@
name: 'Tags',
field: 'tags',
sortable: true,
resizable: true
resizable: true,
formatter: nfCommon.genericValueFormatter
}
];

View File

@ -134,7 +134,14 @@
tabContentId: 'cluster-system-tab-content',
tableId: 'cluster-system-table',
tableColumnModel: [
{id: 'node', field: 'node', name: 'Node Address', sortable: true, resizable: true},
{
id: 'node',
field: 'node',
name: 'Node Address',
sortable: true,
resizable: true,
formatter: nfCommon.genericValueFormatter
},
{
id: 'processors',
field: 'processors',
@ -142,7 +149,8 @@
sortable: true,
resizable: true,
cssClass: 'cell-right',
headerCssClass: 'header-right'
headerCssClass: 'header-right',
formatter: nfCommon.genericValueFormatter
},
{
id: 'processorLoadAverage',
@ -151,7 +159,8 @@
sortable: true,
resizable: true,
cssClass: 'cell-right',
headerCssClass: 'header-right'
headerCssClass: 'header-right',
formatter: nfCommon.genericValueFormatter
},
{
id: 'totalThreads',
@ -160,7 +169,8 @@
sortable: true,
resizable: true,
cssClass: 'cell-right',
headerCssClass: 'header-right'
headerCssClass: 'header-right',
formatter: nfCommon.genericValueFormatter
},
{
id: 'daemonThreads',
@ -169,7 +179,8 @@
sortable: true,
resizable: true,
cssClass: 'cell-right',
headerCssClass: 'header-right'
headerCssClass: 'header-right',
formatter: nfCommon.genericValueFormatter
}
],
tableIdColumn: 'id',
@ -195,7 +206,14 @@
tabContentId: 'cluster-flowfile-tab-content',
tableId: 'cluster-flowfile-table',
tableColumnModel: [
{id: 'node', field: 'node', name: 'Node Address', sortable: true, resizable: true},
{
id: 'node',
field: 'node',
name: 'Node Address',
sortable: true,
resizable: true,
formatter: nfCommon.genericValueFormatter
},
{
id: 'ffRepoTotal',
field: 'ffRepoTotal',
@ -203,7 +221,8 @@
sortable: true,
resizable: true,
cssClass: 'cell-right',
headerCssClass: 'header-right'
headerCssClass: 'header-right',
formatter: nfCommon.genericValueFormatter
},
{
id: 'ffRepoUsed',
@ -212,7 +231,8 @@
sortable: true,
resizable: true,
cssClass: 'cell-right',
headerCssClass: 'header-right'
headerCssClass: 'header-right',
formatter: nfCommon.genericValueFormatter
},
{
id: 'ffRepoFree',
@ -221,7 +241,8 @@
sortable: true,
resizable: true,
cssClass: 'cell-right',
headerCssClass: 'header-right'
headerCssClass: 'header-right',
formatter: nfCommon.genericValueFormatter
},
{
id: 'ffStoreUtil',
@ -230,7 +251,8 @@
sortable: true,
resizable: true,
cssClass: 'cell-right',
headerCssClass: 'header-right'
headerCssClass: 'header-right',
formatter: nfCommon.genericValueFormatter
}
],
tableIdColumn: 'id',
@ -256,8 +278,22 @@
tabContentId: 'cluster-content-tab-content',
tableId: 'cluster-content-table',
tableColumnModel: [
{id: 'node', field: 'node', name: 'Node Address', sortable: true, resizable: true},
{id: 'contentRepoId', field: 'contentRepoId', name: 'Content Repository', sortable: true, resizable: true},
{
id: 'node',
field: 'node',
name: 'Node Address',
sortable: true,
resizable: true,
formatter: nfCommon.genericValueFormatter
},
{
id: 'contentRepoId',
field: 'contentRepoId',
name: 'Content Repository',
sortable: true,
resizable: true,
formatter: nfCommon.genericValueFormatter
},
{
id: 'contentRepoTotal',
field: 'contentRepoTotal',
@ -265,7 +301,8 @@
sortable: true,
resizable: true,
cssClass: 'cell-right',
headerCssClass: 'header-right'
headerCssClass: 'header-right',
formatter: nfCommon.genericValueFormatter
},
{
id: 'contentRepoUsed',
@ -274,7 +311,8 @@
sortable: true,
resizable: true,
cssClass: 'cell-right',
headerCssClass: 'header-right'
headerCssClass: 'header-right',
formatter: nfCommon.genericValueFormatter
},
{
id: 'contentRepoFree',
@ -283,7 +321,8 @@
sortable: true,
resizable: true,
cssClass: 'cell-right',
headerCssClass: 'header-right'
headerCssClass: 'header-right',
formatter: nfCommon.genericValueFormatter
},
{
id: 'contentRepoUtil',
@ -292,7 +331,8 @@
sortable: true,
resizable: true,
cssClass: 'cell-right',
headerCssClass: 'header-right'
headerCssClass: 'header-right',
formatter: nfCommon.genericValueFormatter
}
],
tableIdColumn: 'id',
@ -321,13 +361,62 @@
tabContentId: 'cluster-version-tab-content',
tableId: 'cluster-version-table',
tableColumnModel: [
{id: 'node', field: 'node', name: 'Node Address', sortable: true, resizable: true},
{id: 'version', field: 'version', name: 'NiFi Version', sortable: true, resizable: true},
{id: 'javavendor', field: 'javaVendor', name: 'Java Vendor', sortable: true, resizable: true},
{id: 'javaversion', field: 'javaVersion', name: 'Java Version', sortable: true, resizable: true},
{id: 'osname', field: 'osName', name: 'OS Name', sortable: true, resizable: true},
{id: 'osversion', field: 'osVersion', name: 'OS Version', sortable: true, resizable: true},
{id: 'osarch', field: 'osArchitecture', name: 'OS Architecture', sortable: true, resizable: true}
{
id: 'node',
field: 'node',
name: 'Node Address',
sortable: true,
resizable: true,
formatter: nfCommon.genericValueFormatter
},
{
id: 'version',
field: 'version',
name: 'NiFi Version',
sortable: true,
resizable: true,
formatter: nfCommon.genericValueFormatter
},
{
id: 'javavendor',
field: 'javaVendor',
name: 'Java Vendor',
sortable: true,
resizable: true,
formatter: nfCommon.genericValueFormatter
},
{
id: 'javaversion',
field: 'javaVersion',
name: 'Java Version',
sortable: true,
resizable: true,
formatter: nfCommon.genericValueFormatter
},
{
id: 'osname',
field: 'osName',
name: 'OS Name',
sortable: true,
resizable: true,
formatter: nfCommon.genericValueFormatter
},
{
id: 'osversion',
field: 'osVersion',
name: 'OS Version',
sortable: true,
resizable: true,
formatter: nfCommon.genericValueFormatter
},
{
id: 'osarch',
field: 'osArchitecture',
name: 'OS Architecture',
sortable: true,
resizable: true,
formatter: nfCommon.genericValueFormatter
}
],
tableIdColumn: 'id',
tableOptions: commonTableOptions,
@ -413,7 +502,8 @@
name: 'Active Thread Count',
resizable: true,
sortable: true,
defaultSortAsc: false
defaultSortAsc: false,
formatter: nfCommon.genericValueFormatter
},
{
id: 'queued',
@ -421,7 +511,8 @@
name: '<span class="queued-title">Queue</span>&nbsp;/&nbsp;<span class="queued-size-title">Size</span>',
resizable: true,
sortable: true,
defaultSortAsc: false
defaultSortAsc: false,
formatter: nfCommon.genericValueFormatter
},
{
id: 'status',
@ -540,7 +631,8 @@
field: 'node',
name: 'Node Address',
sortable: true,
resizable: true
resizable: true,
formatter: nfCommon.genericValueFormatter
},
{
id: 'heapMax',
@ -549,7 +641,8 @@
sortable: true,
resizable: true,
cssClass: 'cell-right',
headerCssClass: 'header-right'
headerCssClass: 'header-right',
formatter: nfCommon.genericValueFormatter
},
{
id: 'heapTotal',
@ -558,7 +651,8 @@
sortable: true,
resizable: true,
cssClass: 'cell-right',
headerCssClass: 'header-right'
headerCssClass: 'header-right',
formatter: nfCommon.genericValueFormatter
},
{
id: 'heapUsed',
@ -567,7 +661,8 @@
sortable: true,
resizable: true,
cssClass: 'cell-right',
headerCssClass: 'header-right'
headerCssClass: 'header-right',
formatter: nfCommon.genericValueFormatter
},
{
id: 'heapUtilPct',
@ -576,7 +671,8 @@
sortable: true,
resizable: true,
cssClass: 'cell-right',
headerCssClass: 'header-right'
headerCssClass: 'header-right',
formatter: nfCommon.genericValueFormatter
},
{
id: 'nonHeapTotal',
@ -594,7 +690,8 @@
sortable: true,
resizable: true,
cssClass: 'cell-right',
headerCssClass: 'header-right'
headerCssClass: 'header-right',
formatter: nfCommon.genericValueFormatter
},
{
id: 'gc',
@ -612,7 +709,8 @@
sortable: true,
resizable: true,
cssClass: 'cell-right',
headerCssClass: 'header-right'
headerCssClass: 'header-right',
formatter: nfCommon.genericValueFormatter
}
];
}
@ -717,7 +815,7 @@
if (node.roles.includes(config.clusterCoordinator)) {
markup += ', COORDINATOR';
}
return markup;
return nfCommon.escapeHtml(markup);
}
/**

View File

@ -178,14 +178,16 @@
name: 'Context',
field: 'context',
sortable: true,
resizable: true
resizable: true,
formatter: nfCommon.genericValueFormatter
},
{
id: 'name',
name: 'Name',
field: 'name',
sortable: true,
resizable: true
resizable: true,
formatter: nfCommon.genericValueFormatter
},
{
id: 'value',
@ -193,7 +195,8 @@
field: 'value',
sortable: true,
resizable: true,
defaultSortAsc: false
defaultSortAsc: false,
formatter: nfCommon.genericValueFormatter
}
];

View File

@ -328,6 +328,20 @@
return markup;
},
/**
* Escapes any malicious HTML characters from the value.
*
* @param row
* @param cell
* @param value
* @param columnDef
* @param dataContext
* @returns {string}
*/
genericValueFormatter: function (row, cell, value, columnDef, dataContext) {
return nfCommon.escapeHtml(value);
},
/**
* Formats the bundle of a component type for the new instance dialog.
*
@ -1184,11 +1198,11 @@
while (regex.test(string)) {
string = string.replace(regex, '$1' + ',' + '$2');
}
return string;
return nfCommon.escapeHtml(string);
},
/**
* Formats the specified float using two demical places.
* Formats the specified float using two decimal places.
*
* @param {float} f
*/

View File

@ -664,21 +664,24 @@
field: 'eventTime',
sortable: true,
defaultSortAsc: false,
resizable: true
resizable: true,
formatter: nfCommon.genericValueFormatter
},
{
id: 'eventType',
name: 'Type',
field: 'eventType',
sortable: true,
resizable: true
resizable: true,
formatter: nfCommon.genericValueFormatter
},
{
id: 'flowFileUuid',
name: 'FlowFile Uuid',
field: 'flowFileUuid',
sortable: true,
resizable: true
resizable: true,
formatter: nfCommon.genericValueFormatter
},
{
id: 'fileSize',
@ -686,7 +689,8 @@
field: 'fileSize',
sortable: true,
defaultSortAsc: false,
resizable: true
resizable: true,
formatter: nfCommon.genericValueFormatter
},
{
id: 'componentName',
@ -701,7 +705,8 @@
name: 'Component Type',
field: 'componentType',
sortable: true,
resizable: true
resizable: true,
formatter: nfCommon.genericValueFormatter
}
];
@ -712,7 +717,8 @@
name: 'Node',
field: 'clusterNodeAddress',
sortable: true,
resizable: true
resizable: true,
formatter: nfCommon.genericValueFormatter
});
}

View File

@ -278,12 +278,12 @@
// formatter for io
var ioFormatter = function (row, cell, value, columnDef, dataContext) {
return dataContext.read + ' / ' + dataContext.written;
return nfCommon.escapeHtml(dataContext.read) + ' / ' + nfCommon.escapeHtml(dataContext.written);
};
// formatter for tasks
var taskTimeFormatter = function (row, cell, value, columnDef, dataContext) {
return nfCommon.formatInteger(dataContext.tasks) + ' / ' + dataContext.tasksDuration;
return nfCommon.formatInteger(dataContext.tasks) + ' / ' + nfCommon.escapeHtml(dataContext.tasksDuration);
};
// function for formatting the last accessed time
@ -295,7 +295,7 @@
var runStatusFormatter = function (row, cell, value, columnDef, dataContext) {
var activeThreadCount = '';
if (nfCommon.isDefinedAndNotNull(dataContext.activeThreadCount) && dataContext.activeThreadCount > 0) {
activeThreadCount = '(' + dataContext.activeThreadCount + ')';
activeThreadCount = '(' + nfCommon.escapeHtml(dataContext.activeThreadCount) + ')';
}
var classes = nfCommon.escapeHtml(value.toLowerCase());
switch (nfCommon.escapeHtml(value.toLowerCase())) {
@ -322,7 +322,14 @@
};
// define the input, read, written, and output columns (reused between both tables)
var nameColumn = {id: 'name', field: 'name', name: 'Name', sortable: true, resizable: true};
var nameColumn = {
id: 'name',
field: 'name',
name: 'Name',
sortable: true,
resizable: true,
formatter: nfCommon.genericValueFormatter
};
var runStatusColumn = {
id: 'runStatus',
field: 'runStatus',
@ -337,7 +344,8 @@
toolTip: 'Count / data size in the last 5 min',
sortable: true,
defaultSortAsc: false,
resizable: true
resizable: true,
formatter: nfCommon.genericValueFormatter
};
var ioColumn = {
id: 'io',
@ -356,7 +364,8 @@
toolTip: 'Count / data size in the last 5 min',
sortable: true,
defaultSortAsc: false,
resizable: true
resizable: true,
formatter: nfCommon.genericValueFormatter
};
var tasksTimeColumn = {
id: 'tasks',
@ -383,7 +392,14 @@
toolTip: 'Sorts based on presence of bulletins'
},
nameColumn,
{id: 'type', field: 'type', name: 'Type', sortable: true, resizable: true},
{
id: 'type',
field: 'type',
name: 'Type',
sortable: true,
resizable: true,
formatter: nfCommon.genericValueFormatter
},
runStatusColumn,
inputColumn,
ioColumn,
@ -583,7 +599,14 @@
// initialize the cluster processor column model
var clusterProcessorsColumnModel = [
{id: 'node', field: 'node', name: 'Node', sortable: true, resizable: true},
{
id: 'node',
field: 'node',
name: 'Node',
sortable: true,
resizable: true,
formatter: nfCommon.genericValueFormatter
},
runStatusColumn,
inputColumn,
ioColumn,
@ -653,7 +676,7 @@
if (nfCommon.isDefinedAndNotNull(dataContext.percentUseBytes)) {
percentUseBytes = dataContext.percentUseBytes + '%';
}
return percentUseCount + ' / ' + percentUseBytes;
return nfCommon.escapeHtml(percentUseCount) + ' / ' + nfCommon.escapeHtml(percentUseBytes);
};
// define the input, read, written, and output columns (reused between both tables)
@ -663,7 +686,8 @@
name: '<span class="queued-title">Queue</span>&nbsp;/&nbsp;<span class="queued-size-title">Size</span>',
sortable: true,
defaultSortAsc: false,
resize: true
resize: true,
formatter: nfCommon.genericValueFormatter
};
// define the backpressure column (reused between both tables)
@ -688,14 +712,29 @@
width: 50,
maxWidth: 50
},
{id: 'sourceName', field: 'sourceName', name: 'Source Name', sortable: true, resizable: true},
{id: 'name', field: 'name', name: 'Name', sortable: true, resizable: true, formatter: valueFormatter},
{
id: 'sourceName',
field: 'sourceName',
name: 'Source Name',
sortable: true,
resizable: true,
formatter: nfCommon.genericValueFormatter
},
{
id: 'name',
field: 'name',
name: 'Name',
sortable: true,
resizable: true,
formatter: valueFormatter
},
{
id: 'destinationName',
field: 'destinationName',
name: 'Destination Name',
sortable: true,
resizable: true
resizable: true,
formatter: nfCommon.genericValueFormatter
},
inputColumn,
queueColumn,
@ -864,7 +903,14 @@
// initialize the cluster processor column model
var clusterConnectionsColumnModel = [
{id: 'node', field: 'node', name: 'Node', sortable: true, resizable: true},
{
id: 'node',
field: 'node',
name: 'Node',
sortable: true,
resizable: true,
formatter: nfCommon.genericValueFormatter
},
inputColumn,
queueColumn,
backpressureColumn,
@ -949,7 +995,8 @@
toolTip: 'Count / data size transferred to and from connections in the last 5 min',
resizable: true,
defaultSortAsc: false,
sortable: true
sortable: true,
formatter: nfCommon.genericValueFormatter
};
var sentColumn = {
id: 'sent',
@ -958,7 +1005,8 @@
toolTip: 'Count / data size in the last 5 min',
sortable: true,
defaultSortAsc: false,
resizable: true
resizable: true,
formatter: nfCommon.genericValueFormatter
};
var receivedColumn = {
id: 'received',
@ -967,13 +1015,21 @@
toolTip: 'Count / data size in the last 5 min',
sortable: true,
defaultSortAsc: false,
resizable: true
resizable: true,
formatter: nfCommon.genericValueFormatter
};
// define the column model for the summary table
var processGroupsColumnModel = [
moreDetailsColumn,
{id: 'name', field: 'name', name: 'Name', sortable: true, resizable: true, formatter: valueFormatter},
{
id: 'name',
field: 'name',
name: 'Name',
sortable: true,
resizable: true,
formatter: valueFormatter
},
transferredColumn,
inputColumn,
ioColumn,
@ -1170,7 +1226,14 @@
// initialize the cluster process groups column model
var clusterProcessGroupsColumnModel = [
{id: 'node', field: 'node', name: 'Node', sortable: true, resizable: true},
{
id: 'node',
field: 'node',
name: 'Node',
sortable: true,
resizable: true,
formatter: nfCommon.genericValueFormatter
},
transferredColumn,
inputColumn,
ioColumn,
@ -1414,7 +1477,14 @@
// initialize the cluster input port column model
var clusterInputPortsColumnModel = [
{id: 'node', field: 'node', name: 'Node', sortable: true, resizable: true},
{
id: 'node',
field: 'node',
name: 'Node',
sortable: true,
resizable: true,
formatter: nfCommon.genericValueFormatter
},
runStatusColumn,
outputColumn
];
@ -1654,7 +1724,14 @@
// initialize the cluster output port column model
var clusterOutputPortsColumnModel = [
{id: 'node', field: 'node', name: 'Node', sortable: true, resizable: true},
{
id: 'node',
field: 'node',
name: 'Node',
sortable: true,
resizable: true,
formatter: nfCommon.genericValueFormatter
},
runStatusColumn,
inputColumn
];
@ -1711,7 +1788,7 @@
var transmissionStatusFormatter = function (row, cell, value, columnDef, dataContext) {
var activeThreadCount = '';
if (nfCommon.isDefinedAndNotNull(dataContext.activeThreadCount) && dataContext.activeThreadCount > 0) {
activeThreadCount = '(' + dataContext.activeThreadCount + ')';
activeThreadCount = '(' + nfCommon.escapeHtml(dataContext.activeThreadCount) + ')';
}
// determine what to put in the mark up
@ -1743,7 +1820,8 @@
field: 'targetUri',
name: 'Target URI',
sortable: true,
resizable: true
resizable: true,
formatter: nfCommon.genericValueFormatter
};
// define the column model for the summary table
@ -1951,7 +2029,14 @@
// initialize the cluster remote process group column model
var clusterRemoteProcessGroupsColumnModel = [
{id: 'node', field: 'node', name: 'Node', sortable: true, resizable: true},
{
id: 'node',
field: 'node',
name: 'Node',
sortable: true,
resizable: true,
formatter: nfCommon.genericValueFormatter
},
targetUriColumn,
transmissionStatusColumn,
sentColumn,

View File

@ -251,15 +251,15 @@
return '';
}
return dataContext.template.timestamp;
return nfCommon.escapeHtml(dataContext.template.timestamp);
};
var nameFormatter = function (row, cell, value, columnDef, dataContext) {
if (!dataContext.permissions.canRead) {
return '<span class="blank">' + dataContext.id + '</span>';
return '<span class="blank">' + nfCommon.escapeHtml(dataContext.id) + '</span>';
}
return dataContext.template.name;
return nfCommon.escapeHtml(dataContext.template.name);
};
var descriptionFormatter = function (row, cell, value, columnDef, dataContext) {
@ -275,7 +275,7 @@
return '';
}
return dataContext.template.groupId;
return nfCommon.escapeHtml(dataContext.template.groupId);
};
// function for formatting the actions column

View File

@ -598,7 +598,7 @@
// not a global policy... check if user has access to the component reference
return componentResourceParser(dataContext);
} else {
return '<span class="unset">' + dataContext.id + '</span>';
return '<span class="unset">' + nfCommon.escapeHtml(dataContext.id) + '</span>';
}
};
@ -774,7 +774,7 @@
markup += '<div class="fa fa-users" style="margin-right: 5px;"></div>';
}
markup += dataContext.component.identity;
markup += nfCommon.escapeHtml(dataContext.component.identity);
return markup;
};
@ -783,11 +783,11 @@
var membersGroupsFormatter = function (row, cell, value, columnDef, dataContext) {
if (dataContext.type === 'group') {
return 'Members: <b>' + dataContext.component.users.map(function (user) {
return user.component.identity;
return nfCommon.escapeHtml(user.component.identity);
}).join('</b>, <b>') + '</b>';
} else {
return 'Member of: <b>' + dataContext.component.userGroups.map(function (group) {
return group.component.identity;
return nfCommon.escapeHtml(group.component.identity);
}).join('</b>, <b>') + '</b>';
}
};