Repository: logging-log4j-audit Updated Branches: refs/heads/master acd58e6d7 -> 6cf96b628
Added ajax loader image Updated event attributes to allow for null values Project: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/commit/e40f30d7 Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/tree/e40f30d7 Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/diff/e40f30d7 Branch: refs/heads/master Commit: e40f30d7ea18aa69cfd8f48993ae6bffa63a3fe8 Parents: 3438386 Author: Alfred Fox <[email protected]> Authored: Wed Jan 17 13:21:11 2018 -0700 Committer: Alfred Fox <[email protected]> Committed: Wed Jan 17 13:21:11 2018 -0700 ---------------------------------------------------------------------- .../src/main/webapp/images/ajax-loader.gif | Bin 0 -> 3208 bytes .../src/main/webapp/js/events.js | 30 ++++++++++++++++--- 2 files changed, 26 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/e40f30d7/log4j-catalog/log4j-catalog-war/src/main/webapp/images/ajax-loader.gif ---------------------------------------------------------------------- diff --git a/log4j-catalog/log4j-catalog-war/src/main/webapp/images/ajax-loader.gif b/log4j-catalog/log4j-catalog-war/src/main/webapp/images/ajax-loader.gif new file mode 100644 index 0000000..bd6dd97 Binary files /dev/null and b/log4j-catalog/log4j-catalog-war/src/main/webapp/images/ajax-loader.gif differ http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/e40f30d7/log4j-catalog/log4j-catalog-war/src/main/webapp/js/events.js ---------------------------------------------------------------------- diff --git a/log4j-catalog/log4j-catalog-war/src/main/webapp/js/events.js b/log4j-catalog/log4j-catalog-war/src/main/webapp/js/events.js index d2881db..1074b76 100644 --- a/log4j-catalog/log4j-catalog-war/src/main/webapp/js/events.js +++ b/log4j-catalog/log4j-catalog-war/src/main/webapp/js/events.js @@ -112,9 +112,15 @@ function addEditEventItemHandler() { postData['displayName'] = $('#eventDisplayName').val(); postData['description'] = $('#eventDescription').val(); $('#eventAttributes .event-attribute-row').each(function() { + var required = null; + $(this).children('[type="checkbox"]').each(function(i, e) { + if ($(e).prop('checked')) { + required = ($(e).attr('rel') == 'true'); + } + }); var eventAttributeItem = { name: $(this).find('input')[0].value, - required: $(this).find('input')[1].checked, + required: required, }; eventAttributes.push(eventAttributeItem); }); @@ -205,12 +211,21 @@ function populateEventAttributes(assignedAttributes, eventId) { if (eventId) { assignedAttributes.map((item) => { selectedAttributes.push(item.name); - var attributeRequired = item.required ? 'checked' : ''; + var attributeRequiredTrue = ''; + var attributeRequiredFalse = ''; + var attributeRequired = item.required; + if (attributeRequired === true) { + attributeRequiredTrue = 'checked'; + } else if (attributeRequired === false) { + attributeRequiredFalse = 'checked'; + } $('#eventAttributes').append(' \ <span class="event-attribute-row"> \ <input type="text" name="attributes[]" value="' + item.name + '" disabled /> \ - <input type="checkbox" ' + attributeRequired + ' /> \ - <span class="event-attribute-item-required">required</span> \ + <input type="checkbox" name="attribute-required_' + item.name + '" rel="true" ' + attributeRequiredTrue + ' /> \ + <span class="event-attribute-item-required">YES</span> \ + <input type="checkbox" name="attribute-required_' + item.name + '" rel="false" ' + attributeRequiredFalse + ' /> \ + <span class="event-attribute-item-required">NO</span> \ <button class="remove-event-attribute-button" alt="' + eventId + '" rel="' + item.name + '">-</button> \ </span> \ '); @@ -250,4 +265,11 @@ function assignEventAttributeListeners(eventId) { localStorage.setItem('eventItem' + eventId, JSON.stringify(eventData)); populateEventAttributes(eventData.attributes, eventId); }); + + $('input[name^="attribute-required_"]').change(function() { + if ($(this).is(":checked")) { + $(this).siblings('input').prop('checked', false); + $(this).prop('checked', true); + } + }); }
