NIFI-10715: improve tooltips in parameter providers (#6598)

* NIFI-10715: clean up tooltips in parameter providers

* more clean up

This closes #6598
This commit is contained in:
M Tien 2022-10-28 13:23:18 -07:00 committed by GitHub
parent 557a1a7869
commit e862a02df6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 47 additions and 36 deletions

View File

@ -98,9 +98,6 @@
// load the controller services // load the controller services
var controllerServicesUri = config.urls.api + '/flow/controller/controller-services'; var controllerServicesUri = config.urls.api + '/flow/controller/controller-services';
var groupCount = 0;
var parameterCount = 0;
var SENSITIVE = 'SENSITIVE'; var SENSITIVE = 'SENSITIVE';
var NON_SENSITIVE = 'NON_SENSITIVE'; var NON_SENSITIVE = 'NON_SENSITIVE';
@ -629,9 +626,6 @@
var updatedParameterProviderEntity = _.cloneDeep(response); var updatedParameterProviderEntity = _.cloneDeep(response);
currentParameterProviderEntity = response; currentParameterProviderEntity = response;
groupCount = 0;
parameterCount = 0;
// populate the fetch parameters dialog // populate the fetch parameters dialog
$('#fetch-parameters-id').text(updatedParameterProviderEntity.id); $('#fetch-parameters-id').text(updatedParameterProviderEntity.id);
$('#fetch-parameters-name').text(nfCommon.getComponentName(updatedParameterProviderEntity)); $('#fetch-parameters-name').text(nfCommon.getComponentName(updatedParameterProviderEntity));
@ -860,6 +854,7 @@
var loadParameterGroups = function (parameterProviderGroupEntity) { var loadParameterGroups = function (parameterProviderGroupEntity) {
// providedGroups will be an array of groups // providedGroups will be an array of groups
if (nfCommon.isDefinedAndNotNull(parameterProviderGroupEntity)) { if (nfCommon.isDefinedAndNotNull(parameterProviderGroupEntity)) {
var groupCount = 0;
var groupsGrid = $('#parameter-groups-table').data('gridInstance'); var groupsGrid = $('#parameter-groups-table').data('gridInstance');
var groupsData = groupsGrid.getData(); var groupsData = groupsGrid.getData();
@ -2501,6 +2496,10 @@
selectableParametersGrid.setSortColumn('name', true); selectableParametersGrid.setSortColumn('name', true);
selectableParametersGrid.onSort.subscribe(function (e, args) { selectableParametersGrid.onSort.subscribe(function (e, args) {
// clean up tooltips
nfCommon.cleanUpTooltips($('#selectable-parameters-table'), 'div.fa-asterisk');
nfCommon.cleanUpTooltips($('#selectable-parameters-table'), 'div.fa-hashtag');
sortParameters({ sortParameters({
columnId: args.sortCol.id, columnId: args.sortCol.id,
sortAsc: args.sortAsc sortAsc: args.sortAsc
@ -2601,7 +2600,9 @@
selectableParametersTable.data('gridInstance', selectableParametersGrid).on('mouseenter', 'div.slick-cell', function (e) { selectableParametersTable.data('gridInstance', selectableParametersGrid).on('mouseenter', 'div.slick-cell', function (e) {
var asteriskIconElement = $(this).find('div.fa-asterisk'); var asteriskIconElement = $(this).find('div.fa-asterisk');
if (asteriskIconElement.length && !asteriskIconElement.data('qtip')) {
var asteriskTooltipContent = ''; var asteriskTooltipContent = '';
if (asteriskIconElement.hasClass('new')) { if (asteriskIconElement.hasClass('new')) {
asteriskTooltipContent = nfCommon.escapeHtml('Newly discovered parameter.'); asteriskTooltipContent = nfCommon.escapeHtml('Newly discovered parameter.');
} else if (asteriskIconElement.hasClass('changed')) { } else if (asteriskIconElement.hasClass('changed')) {
@ -2618,8 +2619,10 @@
{ {
content: asteriskTooltipContent content: asteriskTooltipContent
})); }));
}
var hashtagIconElement = $(this).find('div.fa-hashtag'); var hashtagIconElement = $(this).find('div.fa-hashtag');
if (hashtagIconElement.length && !hashtagIconElement.data('qtip')) {
var hashtagTooltipContent = nfCommon.escapeHtml('This parameter is currently referenced by a property. The sensitivity cannot be changed.'); var hashtagTooltipContent = nfCommon.escapeHtml('This parameter is currently referenced by a property. The sensitivity cannot be changed.');
// initialize tooltip // initialize tooltip
@ -2628,6 +2631,7 @@
{ {
content: hashtagTooltipContent content: hashtagTooltipContent
})); }));
}
}); });
/** /**
@ -2748,6 +2752,9 @@
groupsGrid.registerPlugin(new Slick.AutoTooltips()); groupsGrid.registerPlugin(new Slick.AutoTooltips());
groupsGrid.setSortColumn('name', true); groupsGrid.setSortColumn('name', true);
groupsGrid.onSort.subscribe(function (e, args) { groupsGrid.onSort.subscribe(function (e, args) {
// clean up tooltips
nfCommon.cleanUpTooltips($('#parameter-groups-table'), 'div.fa-star');
sortParameters({ sortParameters({
columnId: args.sortCol.id, columnId: args.sortCol.id,
sortAsc: args.sortAsc sortAsc: args.sortAsc
@ -2809,6 +2816,7 @@
// hold onto an instance of the grid and create parameter context tooltip // hold onto an instance of the grid and create parameter context tooltip
parameterGroupsTable.data('gridInstance', groupsGrid).on('mouseenter', 'div.slick-cell', function (e) { parameterGroupsTable.data('gridInstance', groupsGrid).on('mouseenter', 'div.slick-cell', function (e) {
var starIconElement = $(this).find('div.fa-star'); var starIconElement = $(this).find('div.fa-star');
if (starIconElement.length && !starIconElement.data('qtip')) {
var tooltipContent = nfCommon.escapeHtml('Synced to a parameter context.'); var tooltipContent = nfCommon.escapeHtml('Synced to a parameter context.');
// initialize tooltip // initialize tooltip
@ -2817,6 +2825,7 @@
{ {
content: tooltipContent content: tooltipContent
})); }));
}
}); });
}; };
// end initParameterGroupTable // end initParameterGroupTable
@ -2967,6 +2976,8 @@
// clean up tooltips // clean up tooltips
nfCommon.cleanUpTooltips($('#parameter-groups-table'), 'div.fa-star'); nfCommon.cleanUpTooltips($('#parameter-groups-table'), 'div.fa-star');
nfCommon.cleanUpTooltips($('#selectable-parameters-table'), 'div.fa-asterisk');
nfCommon.cleanUpTooltips($('#selectable-parameters-table'), 'div.fa-hashtag');
// reset progress // reset progress
$('div.parameter-contexts-to-update').removeClass('ajax-loading ajax-complete ajax-error'); $('div.parameter-contexts-to-update').removeClass('ajax-loading ajax-complete ajax-error');