NIFI-4423 - Add a confirmation of a Counter reset action. This closes #2178

This commit is contained in:
yuri1969 2017-09-26 20:18:39 +02:00 committed by Matt Gilman
parent c29ee4a6fa
commit 5e2fb8cff1
No known key found for this signature in database
GPG Key ID: DF61EC19432AEE37
2 changed files with 28 additions and 17 deletions

View File

@ -58,6 +58,7 @@
<jsp:include page="/WEB-INF/partials/message-pane.jsp"/>
<jsp:include page="/WEB-INF/partials/banners-utility.jsp"/>
<jsp:include page="/WEB-INF/partials/ok-dialog.jsp"/>
<jsp:include page="/WEB-INF/partials/yes-no-dialog.jsp"/>
<jsp:include page="/WEB-INF/partials/counters/counters-content.jsp"/>
</body>
</html>

View File

@ -22,23 +22,26 @@
define(['jquery',
'Slick',
'nf.Common',
'nf.ErrorHandler'],
function ($, Slick, nfCommon, nfErrorHandler) {
return (nf.CountersTable = factory($, Slick, nfCommon, nfErrorHandler));
'nf.ErrorHandler',
'nf.Dialog'],
function ($, Slick, nfCommon, nfErrorHandler, nfDialog) {
return (nf.CountersTable = factory($, Slick, nfCommon, nfErrorHandler, nfDialog));
});
} else if (typeof exports === 'object' && typeof module === 'object') {
module.exports = (nf.CountersTable =
factory(require('jquery'),
require('Slick'),
require('nf.Common'),
require('nf.ErrorHandler')));
require('nf.ErrorHandler'),
require('nf.Dialog')));
} else {
nf.CountersTable = factory(root.$,
root.Slick,
root.nf.Common,
root.nf.ErrorHandler);
root.nf.ErrorHandler,
root.nf.Dialog);
}
}(this, function ($, Slick, nfCommon, nfErrorHandler) {
}(this, function ($, Slick, nfCommon, nfErrorHandler, nfDialog) {
'use strict';
/**
@ -133,6 +136,11 @@
* @argument {object} item The counter item
*/
var resetCounter = function (item) {
// prompt reset confirmation
nfDialog.showYesNoDialog({
headerText: 'Reset Counter',
dialogContent: 'Reset counter \'' + nfCommon.escapeHtml(item.name) + '\' to default value?',
yesHandler: function () {
$.ajax({
type: 'PUT',
url: config.urls.counters + '/' + encodeURIComponent(item.id),
@ -145,6 +153,8 @@
var countersData = countersGrid.getData();
countersData.updateItem(counter.id, counter);
}).fail(nfErrorHandler.handleAjaxError);
}
});
};
return {