in broker-plugins/management-http/src/main/java/resources/js/qpid/management/connectionlimitprovider/rulebased/show.js [59:202]
function RuleBased(containerNode, conLimitModelObj, controller)
{
const that = this;
this.modelObj = conLimitModelObj;
this.management = controller.management;
this.category =
conLimitModelObj &&
(conLimitModelObj.type === "virtualhost" ||
conLimitModelObj.type === "virtualhostconnectionlimitprovider")
? "VirtualHostConnectionLimitProvider"
: "BrokerConnectionLimitProvider";
this._loadForm = loadForm;
this._ruleForm = ruleForm;
this._dataSore = new MemoryStore({data: [], idProperty: "id"});
const node = construct.create("div", {innerHTML: template}, containerNode, "last");
parser.parse(containerNode)
.then(function ()
{
that._frequencyPeriod = query(".defaultFrequencyPeriod", node)[0];
const addButton = registry.byNode(query(".addRule", node)[0]);
addButton.on("click", function (e)
{
event.stop(e);
that._ruleForm.show({
management: that.management,
modelObj: that.modelObj,
gridData: that.gridData,
type: that.type,
category: that.category
});
});
that._resetButton = registry.byNode(query(".resetCounters", node)[0]);
that._resetButton.on("click", function (e)
{
that._resetCounters(e)
});
that._clearButton = registry.byNode(query(".clearRules", node)[0]);
that._clearButton.on("click", function (e)
{
that._clear(e)
});
const loadButton = registry.byNode(query(".loadRules", node)[0]);
loadButton.on("click", function (e)
{
event.stop(e);
that._loadForm.show(that.management, that.modelObj);
});
const extractButton = registry.byNode(query(".extractRules", node)[0]);
extractButton.on("click", function (e)
{
event.stop(e);
that.management.downloadIntoFrame({
type: that.modelObj.type,
name: "extractRules",
parent: that.modelObj
});
});
const columnsDefinition = [
{
label: 'ID',
field: "id",
width: "30",
id: "ID",
hidden: true,
},
{
label: 'Identity',
field: "identity",
width: "150",
id: "identity",
hidden: false,
},
{
label: 'Port',
field: "port",
width: "100",
id: "port",
hidden: false,
},
{
label: 'Blocked',
field: "blocked",
width: "50",
id: "blocked",
hidden: false,
},
{
label: 'Count Limit',
field: "countLimit",
width: "100",
id: "count",
hidden: false,
},
{
label: 'Frequency Limit',
field: "frequencyLimit",
width: "100",
id: "frequency",
hidden: false,
},
{
label: 'Frequency period [ms]',
field: "frequencyPeriod",
width: "100",
id: "period",
hidden: false,
}
];
const gridFactory = declare([Grid, Selection, Pagination, ColumnResizer, ColumnHider]);
that._ruleGrid = gridFactory(
{
collection: that._dataSore,
rowsPerPage: 10,
pagingLinks: 1,
firstLastArrows: true,
selectionMode: 'single',
className: 'dgrid-autoheight',
pageSizeOptions: [10, 25, 50, 100],
columns: columnsDefinition,
noDataMessage: 'No connection limit rules.'
}, query(".rules", node)[0]);
that._ruleGrid.on('dgrid-select', function (evn) {
const theItem = evn.rows[0].data;
that._ruleForm.show({
management: that.management,
modelObj: that.modelObj,
gridData: that.gridData,
id: theItem.id,
type: that.type,
category: that.category
});
});
});
}