[NIFI-6639] consistent ux for checkboxes and their correspoinding field

This closes #3706
This commit is contained in:
Scott Aslan 2019-09-06 13:29:48 -04:00 committed by Matt Gilman
parent 758035b964
commit 250e1b0297
No known key found for this signature in database
GPG Key ID: DF61EC19432AEE37
3 changed files with 59 additions and 11 deletions

View File

@ -171,7 +171,6 @@ ul.links span.header-link-over {
font-weight: bold !important;
}
.ellipsis {
white-space: nowrap;
overflow: hidden;
@ -261,6 +260,12 @@ textarea {
text-overflow: ellipsis;
}
textarea[disabled] {
background: #b2b8c1;
color: #dbdee2;
border: 1px solid #b2b8c1;
}
ul.property-info {
list-style-type: disc;
margin-left: 10px;

View File

@ -233,6 +233,7 @@
$('#parameter-sensitive-radio-button').prop('disabled', false);
$('#parameter-not-sensitive-radio-button').prop('disabled', false);
$('#parameter-set-empty-string-field').removeClass('checkbox-checked').addClass('checkbox-unchecked');
$('#parameter-value-field').prop('disabled', false);
};
/**
@ -1649,6 +1650,18 @@
$('#parameter-dialog').modal('refreshButtons');
};
$('#parameter-set-empty-string-field').off().on('change', function (event, args) {
// if we are setting as an empty string, disable the editor
if (args.isChecked) {
$('#parameter-value-field').prop('disabled', true).val('');
$('#parameter-dialog').modal('refreshButtons');
} else {
var value = parameter.sensitive ? '' : parameter.previousValue;
$('#parameter-value-field').prop('disabled', false).val(value);
$('#parameter-dialog').modal('refreshButtons');
}
});
$('#parameter-dialog')
.modal('setHeaderText', 'Edit Parameter')
.modal('setOpenHandler', openHandler)
@ -1875,6 +1888,17 @@
.modal('show');
});
$('#parameter-set-empty-string-field').off().on('change', function (event, args) {
// if we are setting as an empty string, disable the editor
if (args.isChecked) {
$('#parameter-value-field').prop('disabled', true).val('');
$('#parameter-dialog').modal('refreshButtons');
} else {
$('#parameter-value-field').prop('disabled', false);
$('#parameter-dialog').modal('refreshButtons');
}
});
$('#parameter-context-name').on('keyup', function (evt) {
// update the buttons to possibly trigger the disabled state
$('#parameter-context-dialog').modal('refreshButtons');
@ -1956,6 +1980,17 @@
}
}])
.modal('show');
$('#parameter-set-empty-string-field').off().on('change', function (event, args) {
// if we are setting as an empty string, disable the editor
if (args.isChecked) {
$('#parameter-value-field').prop('disabled', true).val('');
$('#parameter-dialog').modal('refreshButtons');
} else {
$('#parameter-value-field').prop('disabled', false);
$('#parameter-dialog').modal('refreshButtons');
}
});
};
/**

View File

@ -124,7 +124,15 @@
stringCheckPanel.appendTo(wrapper);
// build the custom checkbox
isEmpty = $('<div class="nf-checkbox string-check"/>').appendTo(stringCheckPanel);
isEmpty = $('<div class="nf-checkbox string-check"/>')
.on('change', function (event, args) {
// if we are setting as an empty string, disable the editor
if (args.isChecked) {
input.prop('disabled', true).val('');
} else {
input.prop('disabled', false).val(previousValue);
}
}).appendTo(stringCheckPanel);
$('<span class="string-check-label nf-checkbox-label">&nbsp;Set empty string</span>').appendTo(stringCheckPanel);
var ok = $('<div class="button">Ok</div>').css({