[NIFI-2189] Update open/close handlers for dialogs

[NIFI-2190] About Dialog fixed text overlayed on image
[NIFI-2187] Update iconResize.png
[NIFI-2166] When adding Processor to canvas, previously selected tags is no longer selected
This closes #615
This commit is contained in:
Scott Aslan 2016-07-07 11:46:22 -04:00 committed by Matt Gilman
parent fa351a61ab
commit 22f72c3d2e
7 changed files with 62 additions and 28 deletions

View File

@ -16,8 +16,8 @@
*/ */
#nf-about { #nf-about {
overflow: hidden; overflow: hidden;
width: 450px; width: 500px;
height: 450px; height: 500px;
max-height: 450px; max-height: 450px;
} }
@ -33,10 +33,6 @@
background: #000000; background: #000000;
} }
#nf-about-content {
margin: 10px 0px 0px 0px;
}
#nf-version { #nf-version {
font-weight:500; font-weight:500;
font-size: 13px; font-size: 13px;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 142 B

After

Width:  |  Height:  |  Size: 117 B

View File

@ -47,7 +47,8 @@
* }], * }],
* handler: { * handler: {
* close: closeHandler, * close: closeHandler,
* open: openHandler * open: openHandler,
* resize: resizeHandler
* } * }
* } * }
* *
@ -177,6 +178,13 @@
} }
} }
// save the open handler
if (isDefinedAndNotNull(options.handler)) {
if (isDefinedAndNotNull(options.handler.resize)) {
nfDialog.resize = options.handler.resize;
}
}
// save the scrollable class name // save the scrollable class name
if (isDefinedAndNotNull(options.scrollableContentStyle)) { if (isDefinedAndNotNull(options.scrollableContentStyle)) {
nfDialog.scrollableContentStyle = options.scrollableContentStyle; nfDialog.scrollableContentStyle = options.scrollableContentStyle;
@ -232,6 +240,25 @@
}); });
}, },
/**
* Sets the handler that is used when the dialog is resized.
*
* @argument {function} handler The function to call when resizing the dialog
*/
setResizeHandler: function (handler) {
return this.each(function (index, dialog) {
var nfDialog = {};
if (isDefinedAndNotNull($(this).data('nf-dialog'))) {
nfDialog = $(dialog).data('nf-dialog');
}
nfDialog.resize = handler;
//persist data attribute
$(dialog).data('nfDialog', nfDialog);
});
},
/** /**
* Updates the button model for the selected dialog. * Updates the button model for the selected dialog.
* *
@ -417,6 +444,12 @@
dialogContent.removeClass(nfDialog.scrollableContentStyle); dialogContent.removeClass(nfDialog.scrollableContentStyle);
} }
} }
// invoke the handler
var handler = dialog.data('nf-dialog').resize;
if (isDefinedAndNotNull(handler) && typeof handler === 'function') {
handler.call(dialog);
}
}, },
/** /**

View File

@ -78,7 +78,7 @@
if (!tagFilterExists) { if (!tagFilterExists) {
// create the list item content // create the list item content
var tagText = $('<div class="selected-tag-text"></div>').text(tag); var tagText = $('<div class="selected-tag-text"></div>').text(tag);
var removeTagIcon = $('<div class="fa fa-close pointer"></div>').click(function () { var removeTagIcon = $('<div class="fa fa-close remove-selected-tag pointer"></div>').click(function () {
// remove this tag // remove this tag
$(this).closest('li').remove(); $(this).closest('li').remove();

View File

@ -289,9 +289,18 @@ nf.ng.Canvas.GlobalMenuCtrl = function (serviceProvider) {
init: function () { init: function () {
var self = this; var self = this;
var resizeAbout = function(){
var dialog = $(this);
var top = $('#nf-about-pic-container').height() + $('.dialog-header').height() + 10; //10 for padding-top
dialog.find('.dialog-content').css('top', top);
};
this.getElement().modal({ this.getElement().modal({
scrollableContentStyle: 'scrollable', scrollableContentStyle: 'scrollable',
headerText: 'About Apache NiFi', headerText: 'About Apache NiFi',
handler: {
resize: resizeAbout
},
buttons: [{ buttons: [{
buttonText: 'Ok', buttonText: 'Ok',
color: { color: {

View File

@ -566,14 +566,12 @@ nf.ng.ProcessorComponent = function (serviceProvider) {
}]); }]);
// set a new handler for closing the the dialog // set a new handler for closing the the dialog
this.modal.update('setCloseHandler', { this.modal.update('setCloseHandler', function () {
close: function () { // remove the handler
// remove the handler grid.onDblClick.unsubscribe(gridDoubleClick);
grid.onDblClick.unsubscribe(gridDoubleClick);
// clear the current filters // clear the current filters
resetProcessorDialog(); resetProcessorDialog();
}
}); });
// show the dialog // show the dialog

View File

@ -94,13 +94,13 @@ nf.Shell = (function () {
shell.empty(); shell.empty();
// register a new close handler // register a new close handler
$('#shell-dialog').modal('setCloseHandler', { $('#shell-dialog').modal('setCloseHandler', function () {
close: function () { deferred.resolve();
deferred.resolve(); });
},
open: function () { // register a new open handler
nf.Common.toggleScrollable($('#' + this.find('.tab-container').attr('id') + '-content').get(0)); $('#shell-dialog').modal('setOpenHandler', function () {
} nf.Common.toggleScrollable($('#' + this.find('.tab-container').attr('id') + '-content').get(0));
}); });
// show the custom processor ui // show the custom processor ui
@ -150,13 +150,11 @@ nf.Shell = (function () {
content.detach(); content.detach();
// register a new close handler // register a new close handler
$('#shell-dialog').modal('setCloseHandler', { $('#shell-dialog').modal('setCloseHandler', function () {
close: function () { deferred.resolve();
deferred.resolve();
// detach the content and add it back to the parent // detach the content and add it back to the parent
content.hide().detach().appendTo(parent); content.hide().detach().appendTo(parent);
}
}); });
// hide the undock button // hide the undock button