You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rg...@apache.org on 2017/10/22 05:57:23 UTC
logging-log4j-audit git commit: Add save all button - Implemented by
Alfred Fox
Repository: logging-log4j-audit
Updated Branches:
refs/heads/master 1deb7ebaf -> 536f5dfc7
Add save all button - Implemented by Alfred Fox
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/536f5dfc
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/tree/536f5dfc
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/diff/536f5dfc
Branch: refs/heads/master
Commit: 536f5dfc7980cf8086f848e4885a7af13eb7ab04
Parents: 1deb7eb
Author: Ralph Goers <rg...@nextiva.com>
Authored: Sat Oct 21 22:57:11 2017 -0700
Committer: Ralph Goers <rg...@nextiva.com>
Committed: Sat Oct 21 22:57:11 2017 -0700
----------------------------------------------------------------------
.../log4j/catalog/git/dao/GitCatalogDao.java | 5 ++-
.../webapp/WEB-INF/templates/attributes.html | 2 +-
.../webapp/WEB-INF/templates/categories.html | 2 +-
.../main/webapp/WEB-INF/templates/events.html | 2 +-
.../main/webapp/WEB-INF/templates/products.html | 2 +-
.../main/webapp/WEB-INF/templates/template.html | 3 +-
.../src/main/webapp/css/app.css | 41 ++++++++++++++++++--
.../log4j-catalog-war/src/main/webapp/js/app.js | 22 +++++++++++
.../src/main/webapp/js/attributes.js | 20 +++++-----
.../src/main/webapp/js/categories.js | 8 ++--
.../src/main/webapp/js/events.js | 10 ++---
.../src/main/webapp/js/products.js | 8 ++--
12 files changed, 92 insertions(+), 33 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/536f5dfc/log4j-catalog/log4j-catalog-git/src/main/java/org/apache/logging/log4j/catalog/git/dao/GitCatalogDao.java
----------------------------------------------------------------------
diff --git a/log4j-catalog/log4j-catalog-git/src/main/java/org/apache/logging/log4j/catalog/git/dao/GitCatalogDao.java b/log4j-catalog/log4j-catalog-git/src/main/java/org/apache/logging/log4j/catalog/git/dao/GitCatalogDao.java
index edadb9d..601a93b 100644
--- a/log4j-catalog/log4j-catalog-git/src/main/java/org/apache/logging/log4j/catalog/git/dao/GitCatalogDao.java
+++ b/log4j-catalog/log4j-catalog-git/src/main/java/org/apache/logging/log4j/catalog/git/dao/GitCatalogDao.java
@@ -26,6 +26,7 @@ import java.time.ZoneId;
import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.catalog.api.CatalogData;
@@ -63,7 +64,7 @@ public class GitCatalogDao extends AbstractCatalogReader implements CatalogDao {
public GitCatalogDao() {
JsonFactory factory = new JsonFactory();
factory.enable(JsonParser.Feature.ALLOW_COMMENTS);
- mapper = new ObjectMapper(factory);
+ mapper = new ObjectMapper(factory).enable(SerializationFeature.INDENT_OUTPUT);
}
public CredentialsProvider getCredentialsProvider() {
@@ -148,7 +149,7 @@ public class GitCatalogDao extends AbstractCatalogReader implements CatalogDao {
try { if (writer != null) writer.close(); } catch(Exception exception) { }
}
- try (Git git = Git.open(catalogFile)) {
+ try (Git git = Git.open(localRepoFile)) {
git.add().addFilepattern(catalogPath).call();
git.commit().setMessage("Catalog updated").call();
updateRepo();
http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/536f5dfc/log4j-catalog/log4j-catalog-war/src/main/webapp/WEB-INF/templates/attributes.html
----------------------------------------------------------------------
diff --git a/log4j-catalog/log4j-catalog-war/src/main/webapp/WEB-INF/templates/attributes.html b/log4j-catalog/log4j-catalog-war/src/main/webapp/WEB-INF/templates/attributes.html
index 0d4c04f..8f775e9 100644
--- a/log4j-catalog/log4j-catalog-war/src/main/webapp/WEB-INF/templates/attributes.html
+++ b/log4j-catalog/log4j-catalog-war/src/main/webapp/WEB-INF/templates/attributes.html
@@ -20,7 +20,7 @@
<div th:insert="~{template :: hdr}"></div>
- <div id="AttributesTableContainer"></div>
+ <div id="AttributesTableContainer" class="log4j-table-container"></div>
<div th:insert="~{template :: ftr}"></div>
http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/536f5dfc/log4j-catalog/log4j-catalog-war/src/main/webapp/WEB-INF/templates/categories.html
----------------------------------------------------------------------
diff --git a/log4j-catalog/log4j-catalog-war/src/main/webapp/WEB-INF/templates/categories.html b/log4j-catalog/log4j-catalog-war/src/main/webapp/WEB-INF/templates/categories.html
index c565197..518e8e1 100644
--- a/log4j-catalog/log4j-catalog-war/src/main/webapp/WEB-INF/templates/categories.html
+++ b/log4j-catalog/log4j-catalog-war/src/main/webapp/WEB-INF/templates/categories.html
@@ -20,7 +20,7 @@
<div th:insert="~{template :: hdr}"></div>
- <div id="CategoriesTableContainer"></div>
+ <div id="CategoriesTableContainer" class="log4j-table-container"></div>
<div th:insert="~{template :: ftr}"></div>
</body>
http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/536f5dfc/log4j-catalog/log4j-catalog-war/src/main/webapp/WEB-INF/templates/events.html
----------------------------------------------------------------------
diff --git a/log4j-catalog/log4j-catalog-war/src/main/webapp/WEB-INF/templates/events.html b/log4j-catalog/log4j-catalog-war/src/main/webapp/WEB-INF/templates/events.html
index c00dcfd..2548fa7 100644
--- a/log4j-catalog/log4j-catalog-war/src/main/webapp/WEB-INF/templates/events.html
+++ b/log4j-catalog/log4j-catalog-war/src/main/webapp/WEB-INF/templates/events.html
@@ -20,7 +20,7 @@
<div th:insert="~{template :: hdr}"></div>
- <div id="EventsTableContainer"></div>
+ <div id="EventsTableContainer" class="log4j-table-container"></div>
<div th:insert="~{template :: ftr}"></div>
http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/536f5dfc/log4j-catalog/log4j-catalog-war/src/main/webapp/WEB-INF/templates/products.html
----------------------------------------------------------------------
diff --git a/log4j-catalog/log4j-catalog-war/src/main/webapp/WEB-INF/templates/products.html b/log4j-catalog/log4j-catalog-war/src/main/webapp/WEB-INF/templates/products.html
index ed555f1..62be813 100644
--- a/log4j-catalog/log4j-catalog-war/src/main/webapp/WEB-INF/templates/products.html
+++ b/log4j-catalog/log4j-catalog-war/src/main/webapp/WEB-INF/templates/products.html
@@ -20,7 +20,7 @@
<div th:insert="~{template :: hdr}"></div>
- <div id="ProductsTableContainer"></div>
+ <div id="ProductsTableContainer" class="log4j-table-container"></div>
<div th:insert="~{template :: ftr}"></div>
</body>
http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/536f5dfc/log4j-catalog/log4j-catalog-war/src/main/webapp/WEB-INF/templates/template.html
----------------------------------------------------------------------
diff --git a/log4j-catalog/log4j-catalog-war/src/main/webapp/WEB-INF/templates/template.html b/log4j-catalog/log4j-catalog-war/src/main/webapp/WEB-INF/templates/template.html
index 8178bad..3a0b972 100644
--- a/log4j-catalog/log4j-catalog-war/src/main/webapp/WEB-INF/templates/template.html
+++ b/log4j-catalog/log4j-catalog-war/src/main/webapp/WEB-INF/templates/template.html
@@ -5,11 +5,12 @@
<body>
<div th:fragment="hdr">
- <div id="nav">
+ <div id="nav">
<a href="products">Products</a>
<a href="categories">Categories</a>
<a href="events">Events</a>
<a href="attributes">Attributes</a>
+ <a id="save-all" href="#">Save All Changes</a>
</div>
</div>
http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/536f5dfc/log4j-catalog/log4j-catalog-war/src/main/webapp/css/app.css
----------------------------------------------------------------------
diff --git a/log4j-catalog/log4j-catalog-war/src/main/webapp/css/app.css b/log4j-catalog/log4j-catalog-war/src/main/webapp/css/app.css
index f3830e6..7614b09 100644
--- a/log4j-catalog/log4j-catalog-war/src/main/webapp/css/app.css
+++ b/log4j-catalog/log4j-catalog-war/src/main/webapp/css/app.css
@@ -1,10 +1,41 @@
+@import url('https://fonts.googleapis.com/css?family=Lato');
+
+body {
+ font-family: 'Lato', sans-serif;
+ margin: 0;
+ padding: 0;
+}
+
#nav {
- text-align: center;
- margin: 24px;
+ background-color: #f3f3f3;
+ border-bottom: 1px solid #e7e7e7;
+ display: flex;
+ height: 48px;
+ justify-content: space-between;
+ margin-bottom: 24px;
+ width: 100%;
}
#nav a {
- margin: 0 14px;
+ border-right: 1px solid #e7e7e7;
+ color: #666;
+ font-size: 16px;
+ line-height: 48px;
+ padding: 0 14px;
+ text-decoration: none;
+}
+
+#nav #save-all {
+ border-right: none;
+ border-left: 1px solid #e7e7e7;
+ margin-left: auto;
+}
+
+#nav a:hover,
+#nav #save-all:hover {
+ background-color: #0b67cd;
+ border-right: 1px solid #0b67cd;
+ color: #fff;
}
#ftr {
@@ -12,6 +43,10 @@
text-align: center;
}
+.log4j-table-container {
+ padding: 0 24px;
+}
+
.form-processing {
position: absolute;
width: 100%;
http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/536f5dfc/log4j-catalog/log4j-catalog-war/src/main/webapp/js/app.js
----------------------------------------------------------------------
diff --git a/log4j-catalog/log4j-catalog-war/src/main/webapp/js/app.js b/log4j-catalog/log4j-catalog-war/src/main/webapp/js/app.js
index 5fbb254..6eb6508 100644
--- a/log4j-catalog/log4j-catalog-war/src/main/webapp/js/app.js
+++ b/log4j-catalog/log4j-catalog-war/src/main/webapp/js/app.js
@@ -1,6 +1,11 @@
$(document).ready(function () {
// Clear localStorage
localStorage.clear();
+
+ $('#save-all').click(function(e) {
+ e.preventDefault();
+ saveAllChanges();
+ });
});
// Modal action handlers
@@ -41,3 +46,20 @@ function validateFormContent() {
if (errors) return false;
return true;
}
+
+function saveAllChanges() {
+ $.ajax({
+ type: 'POST',
+ contentType: 'application/json',
+ url: 'catalog',
+ data: null,
+ success:function(response) {
+ if (response.Result === 'OK') {
+ $('.log4j-table-container"').jtable('load');
+ }
+ },
+ error:function(jqXhr, textStatus, errorThrown) {
+ console.error(textStatus + ' - ' + errorThrown);
+ }
+ });
+}
http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/536f5dfc/log4j-catalog/log4j-catalog-war/src/main/webapp/js/attributes.js
----------------------------------------------------------------------
diff --git a/log4j-catalog/log4j-catalog-war/src/main/webapp/js/attributes.js b/log4j-catalog/log4j-catalog-war/src/main/webapp/js/attributes.js
index 3b99e1e..fd42a5a 100644
--- a/log4j-catalog/log4j-catalog-war/src/main/webapp/js/attributes.js
+++ b/log4j-catalog/log4j-catalog-war/src/main/webapp/js/attributes.js
@@ -40,28 +40,28 @@ $(document).ready(function () {
title: 'Indexed',
width: '5%',
display: function (attributeData) {
- return attributeData.record.indexed ? "true" : "false";
+ return attributeData.record.indexed ? 'true' : 'false';
}
},
sortable: {
title: 'Sortable',
width: '5%',
display: function (attributeData) {
- return attributeData.record.sortable ? "true" : "false";
+ return attributeData.record.sortable ? 'true' : 'false';
}
},
required: {
title: 'Required',
width: '5%',
display: function (attributeData) {
- return attributeData.record.required ? "true" : "false";
+ return attributeData.record.required ? 'true' : 'false';
}
},
requestContext: {
title: 'RequestContext',
width: '3%',
display: function (attributeData) {
- return attributeData.record.requestContext ? "true" : "false";
+ return attributeData.record.requestContext ? 'true' : 'false';
}
},
constraints: {
@@ -71,11 +71,11 @@ $(document).ready(function () {
edit: false,
create: false,
display: function (attributeData) {
- var constraintList = "";
+ var constraintList = '';
if (typeof(attributeData.record.constraints) != 'undefined' && attributeData.record.constraints != null) {
constraintList = attributeData.record.constraints.map(function (elem) {
return elem.constraintType.name + '("' + elem.value + '")'
- }).join(" | ");
+ }).join(' | ');
}
//Create a div that will be used to view associated attributes
var $divConstraints = $('<div class="constraints">' + constraintList + '</div>');
@@ -103,12 +103,12 @@ $(document).ready(function () {
});
$.ajax({
type: 'GET',
- url: "/CatalogService/api/constraints/types",
+ url: 'api/constraints/types',
success:function(response){
localStorage.setItem('allConstraints', response);
},
error:function(jqXhr, textStatus, errorThrown){
- console.error(textStatus + " - " + errorThrown);
+ console.error(textStatus + ' - ' + errorThrown);
}
});
//Load attributes list from server
@@ -131,7 +131,7 @@ function deleteAttributeItem(attributeId) {
}
},
error:function(jqXhr, textStatus, errorThrown) {
- console.error(textStatus + " - " + errorThrown);
+ console.error(textStatus + ' - ' + errorThrown);
}
});
}
@@ -176,7 +176,7 @@ function addEditattributeItemHandler() {
}
},
error:function(jqXhr, textStatus, errorThrown) {
- console.error(textStatus + " - " + errorThrown);
+ console.error(textStatus + ' - ' + errorThrown);
}
});
}
http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/536f5dfc/log4j-catalog/log4j-catalog-war/src/main/webapp/js/categories.js
----------------------------------------------------------------------
diff --git a/log4j-catalog/log4j-catalog-war/src/main/webapp/js/categories.js b/log4j-catalog/log4j-catalog-war/src/main/webapp/js/categories.js
index c4c314e..368bc85 100644
--- a/log4j-catalog/log4j-catalog-war/src/main/webapp/js/categories.js
+++ b/log4j-catalog/log4j-catalog-war/src/main/webapp/js/categories.js
@@ -53,7 +53,7 @@ $(document).ready(function () {
});
$.ajax({
type: 'POST',
- url: "api/events/list",
+ url: 'api/events/list',
success:function(response){
if (response.Result === 'OK') {
var allEvents = response.Records.map((item) => {
@@ -63,7 +63,7 @@ $(document).ready(function () {
}
},
error:function(jqXhr, textStatus, errorThrown){
- console.error(textStatus + " - " + errorThrown);
+ console.error(textStatus + ' - ' + errorThrown);
}
});
//Load categories list from server
@@ -86,7 +86,7 @@ function deleteCategoryItem(categoryId) {
}
},
error:function(jqXhr, textStatus, errorThrown) {
- console.error(textStatus + " - " + errorThrown);
+ console.error(textStatus + ' - ' + errorThrown);
}
});
}
@@ -122,7 +122,7 @@ function addEditCategoryItemHandler() {
}
},
error:function(jqXhr, textStatus, errorThrown) {
- console.error(textStatus + " - " + errorThrown);
+ console.error(textStatus + ' - ' + errorThrown);
}
});
}
http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/536f5dfc/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 dc68a73..d2881db 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
@@ -39,7 +39,7 @@ $(document).ready(function () {
edit: false,
create: false,
display: function (eventData) {
- var attributeList = eventData.record.attributes.map(function(elem){return elem.name + (elem.required ? " (required)" : "")}).join(" | ");
+ var attributeList = eventData.record.attributes.map(function(elem){return elem.name + (elem.required ? ' (required)' : '')}).join(' | ');
//Create a div that will be used to view associated attributes
var $divAttributes = $('<div class="event-attributes">' + attributeList + '</div>');
return $divAttributes;
@@ -66,14 +66,14 @@ $(document).ready(function () {
});
$.ajax({
type: 'GET',
- url: "/CatalogService/api/attributes",
+ url: 'api/attributes',
success:function(response){
if (response.result === 'OK') {
localStorage.setItem('allAttributes', response.data);
}
},
error:function(jqXhr, textStatus, errorThrown){
- console.error(textStatus + " - " + errorThrown);
+ console.error(textStatus + ' - ' + errorThrown);
}
});
$('#EventsTableContainer').jtable('load');
@@ -95,7 +95,7 @@ function deleteEventItem(eventId) {
}
},
error:function(jqXhr, textStatus, errorThrown) {
- console.error(textStatus + " - " + errorThrown);
+ console.error(textStatus + ' - ' + errorThrown);
}
});
}
@@ -135,7 +135,7 @@ function addEditEventItemHandler() {
}
},
error:function(jqXhr, textStatus, errorThrown) {
- console.error(textStatus + " - " + errorThrown);
+ console.error(textStatus + ' - ' + errorThrown);
}
});
}
http://git-wip-us.apache.org/repos/asf/logging-log4j-audit/blob/536f5dfc/log4j-catalog/log4j-catalog-war/src/main/webapp/js/products.js
----------------------------------------------------------------------
diff --git a/log4j-catalog/log4j-catalog-war/src/main/webapp/js/products.js b/log4j-catalog/log4j-catalog-war/src/main/webapp/js/products.js
index 0b91055..9bb2eb7 100644
--- a/log4j-catalog/log4j-catalog-war/src/main/webapp/js/products.js
+++ b/log4j-catalog/log4j-catalog-war/src/main/webapp/js/products.js
@@ -53,7 +53,7 @@ $(document).ready(function () {
});
$.ajax({
type: 'POST',
- url: "api/events/list",
+ url: 'api/events/list',
success:function(response){
if (response.Result === 'OK') {
var allEvents = response.Records.map((item) => {
@@ -63,7 +63,7 @@ $(document).ready(function () {
}
},
error:function(jqXhr, textStatus, errorThrown){
- console.error(textStatus + " - " + errorThrown);
+ console.error(textStatus + ' - ' + errorThrown);
}
});
//Load products list from server
@@ -86,7 +86,7 @@ function deleteProductItem(productId) {
}
},
error:function(jqXhr, textStatus, errorThrown) {
- console.error(textStatus + " - " + errorThrown);
+ console.error(textStatus + ' - ' + errorThrown);
}
});
}
@@ -122,7 +122,7 @@ function addEditProductItemHandler() {
}
},
error:function(jqXhr, textStatus, errorThrown) {
- console.error(textStatus + " - " + errorThrown);
+ console.error(textStatus + ' - ' + errorThrown);
}
});
}