Repository: nifi Updated Branches: refs/heads/master e8771e59a -> 35f4f48f3
NIFI-3683: - Ensuring we use the appropriate action based on the previously displayed policy. Signed-off-by: Scott Aslan <[email protected]> This closes #1657 Project: http://git-wip-us.apache.org/repos/asf/nifi/repo Commit: http://git-wip-us.apache.org/repos/asf/nifi/commit/35f4f48f Tree: http://git-wip-us.apache.org/repos/asf/nifi/tree/35f4f48f Diff: http://git-wip-us.apache.org/repos/asf/nifi/diff/35f4f48f Branch: refs/heads/master Commit: 35f4f48f3778b7f358ac763fea1a8b7de4b354e4 Parents: e8771e5 Author: Matt Gilman <[email protected]> Authored: Fri Apr 7 11:11:37 2017 -0400 Committer: Scott Aslan <[email protected]> Committed: Fri Apr 7 13:03:01 2017 -0400 ---------------------------------------------------------------------- .../webapp/js/nf/canvas/nf-policy-management.js | 28 +++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/nifi/blob/35f4f48f/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-policy-management.js ---------------------------------------------------------------------- diff --git a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-policy-management.js b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-policy-management.js index 1fdf181..93cb920 100644 --- a/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-policy-management.js +++ b/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-policy-management.js @@ -327,6 +327,26 @@ }; /** + * Determines whether the specified global policy type supports read/write options. + * + * @param policyType global policy type + * @returns {boolean} whether the policy supports read/write options + */ + var globalPolicySupportsReadWrite = function (policyType) { + return policyType === 'controller' || policyType === 'counters' || policyType === 'policies' || policyType === 'tenants'; + }; + + /** + * Determines whether the specified global policy type only supports write. + * + * @param policyType global policy type + * @returns {boolean} whether the policy only supports write + */ + var globalPolicySupportsWrite = function (policyType) { + return policyType === 'proxy' || policyType === 'restricted-components'; + }; + + /** * Initializes the policy table. */ var initPolicyTable = function () { @@ -397,7 +417,7 @@ $('#selected-policy-type').text(option.value); // if the option is for a specific component - if (option.value === 'controller' || option.value === 'counters' || option.value === 'policies' || option.value === 'tenants') { + if (globalPolicySupportsReadWrite(option.value)) { // update the policy target and let it relaod the policy $('#controller-policy-target').combo('setSelectedOption', { 'value': 'read' @@ -406,7 +426,7 @@ $('#controller-policy-target').hide(); // record the action - if (option.value === 'proxy' || option.value === 'restricted-components') { + if (globalPolicySupportsWrite(option.value)) { $('#selected-policy-action').text('write'); } else { $('#selected-policy-action').text('read'); @@ -1458,9 +1478,9 @@ var policyType = $('#policy-type-list').combo('getSelectedOption').value; $('#selected-policy-type').text(policyType); - if (policyType === 'controller') { + if (globalPolicySupportsReadWrite(policyType)) { $('#selected-policy-action').text($('#controller-policy-target').combo('getSelectedOption').value); - } else if (policyType === 'proxy' || policyType === 'restricted-components') { + } else if (globalPolicySupportsWrite(policyType)) { $('#selected-policy-action').text('write'); } else { $('#selected-policy-action').text('read');
