aeaversa commented on a change in pull request #3281: NIFI-5986 Adding "Stop &
Configure" button functionality to Processor…
URL: https://github.com/apache/nifi/pull/3281#discussion_r278694514
##########
File path:
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-processor-configuration.js
##########
@@ -885,8 +915,61 @@
});
}
+ //Synchronize the current component canvas attributes in
the status bar
+ if(config.supportsStatusBar){
+
+ //initialize the synchronization
+ var target = function() {
+
$('#processor-configuration').modal('refreshButtons');
+ return nfProcessor.get(processor.id);
+ };
+
$("#processor-configuration-status-bar").statusbar('observe',target);
+
+ //if there are active threads, add the terminate
button to the status bar
+ if(nfCommon.isDefinedAndNotNull(config.nfActions) &&
+
nfCommon.getKeyValue(processorResponse,ACTIVE_THREAD_COUNT_KEY) != 0){
+
+
$("#processor-configuration-status-bar").statusbar('buttons',[{
+ buttonText: 'Terminate',
+ clazz: 'fa fa-hourglass-end button-icon',
+ color: {
+ hover: '#C7D2D7',
+ base: 'transparent',
+ text: '#004849'
+ },
+ disabled : function() {
+ var selection =
nfCanvasUtils.getSelectionById(processor.id);
+ return
nfCanvasUtils.supportsModification(selection);
+ },
+ handler: {
+ click: function() {
+ var cb = function(){
+ var p =
nfProcessor.get(processor.id);
+
if(nfCommon.getKeyValue(p,ACTIVE_THREAD_COUNT_KEY) != 0){
+ nfDialog.showOkDialog({
+ dialogContent: 'Terminate
threads request was processed, but active threads still persist. Please try
again later.',
+ headerText: 'Unable to
Terminate'
+ });
+ }
+ else {
+ //refresh the dialog
+
$('#processor-configuration-status-bar').statusbar('refreshButtons');
+
$('#processor-configuration').modal('refreshButtons');
+ }
+
$('#processor-configuration-status-bar').statusbar('showButtons');
+ };
+
+ //execute the terminate call
+
$('#processor-configuration-status-bar').statusbar('hideButtons');
+ var selection =
nfCanvasUtils.getSelectionById(processor.id);
Review comment:
@mcgilman - Refactored to remove duplicated selection.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services