Skip to content

Commit

Permalink
some final refinements in about screen mainly
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikolaos Fountas committed Jun 12, 2015
1 parent daa6bf5 commit b260ede
Show file tree
Hide file tree
Showing 24 changed files with 319 additions and 133 deletions.
19 changes: 15 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ The easiest way to get etcd-viewer is to run a [docker][docker] container with t
```docker run -d -p 8080:8080 nikfoundas/etcd-viewer```

The docker container will deploy the etcd-viewer war file to a [jetty][jetty] servlet container.

The default port is built on top of the jetty:latest image by deploying the etcd-viewer war file to jetty.
The docker image is built on top of the jetty:latest image.


### Build etcd-viewer
Expand Down Expand Up @@ -58,7 +57,7 @@ Etcd browser supports the following actions via the [etcd rest API][etcd-api]:

* Get version
* Get node self statistics which contains the leader information
* Retrieve machines that participate in the etcd consensus.
* Retrieve machines that participate in the etcd cluster.
* Create directories and key-value pairs with optionally providing
time to live (TTL)
* Retrieve directories and key value nodes
Expand Down Expand Up @@ -96,17 +95,27 @@ status is reported by etcd.

### Responsive css

Etcd browser uses twitter [bootstrap][bootstrap] css framework to enable key-value
`etcd-viewer` uses [bootstrap][bootstrap] css framework to enable key-value
storage accessibility even from mobile devices or tablets.

## Next steps

* Provide feedback on communication or etcd api errors
* Provide log console to record modifications applied
* Extend functionality to view and modify [fleet][fleet] unit information
* Use thread safe CXF jax-rs api

## About

`etcd-viewer` uses the following open source libraries and frameworks:

* [Apache wicket 6.19.0][wicket]: Open source Java web framework
* [Apache CXF 3.0.1][cxf]: To handle the etcd rest API
* [FasterXML Jackson 2.5.3][jackson]: To marshal/unmarshal JSON objects to POJOs
* [Google Guice 3.0][guice]: For dependency injection
* [Bootstrap 3.3.4][bootstrap]: Responsive CSS framework
* [jQuery 1.11.2][jquery]: Open source JavaScript library
* [FontAwesome 4.3.0][fontawesome]: Iconic web font


## License
Expand All @@ -122,6 +131,8 @@ etcd-viewer is released under the Apache 2.0 license. See the [LICENSE](LICENSE)
[fontawesome]: http://fortawesome.github.io/Font-Awesome/
[cxf]: http://cxf.apache.org
[jackson]: https://github.com/FasterXML/jackson
[guice]: https://github.com/google/guice
[jetty]: http://www.eclipse.org/jetty/
[tomcat]: http://tomcat.apache.org
[fleet]: https://github.com/coreos/fleet
[jquery]: https://jquery.com/
26 changes: 25 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,18 @@
<slf4j.version>1.6.4</slf4j.version>
<log4j.version>1.2.16</log4j.version>
<junit.version>4.11</junit.version>

<bootstrap.version>3.3.4</bootstrap.version>
<fontawesome.version>4.3.0</fontawesome.version>
<guice.version>3.0</guice.version>
<jquery.version>1.11.2</jquery.version>

<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- allowed values: R7, 1.0, 1.5, 2.0 or none -->
<wtp.version>none</wtp.version>

<!-- default wicket configuration -->
<wicket.configuration>deployment</wicket.configuration>
</properties>

<dependencies>
Expand Down Expand Up @@ -126,14 +135,29 @@
</dependency>
</dependencies>

<profiles>
<profile>
<id>prod</id>
<properties>
<wicket.configuration>deployment</wicket.configuration>
</properties>
</profile>
<profile>
<id>dev</id>
<properties>
<wicket.configuration>development</wicket.configuration>
</properties>
</profile>
</profiles>

<build>
<resources>
<resource>
<filtering>false</filtering>
<directory>src/main/resources</directory>
</resource>
<resource>
<filtering>false</filtering>
<filtering>true</filtering>
<directory>src/main/java</directory>
<includes>
<include>**</include>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/github/etcd/service/RestModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public static class EtcdResourceProvider implements Provider<EtcdApiResource> {

@Override
public EtcdApiResource get() {
System.out.println("RestModule.EtcdKeyValueStoreProvider.get() " + selectedCluster.getObject());
// System.out.println("RestModule.EtcdKeyValueStoreProvider.get() " + selectedCluster.getObject());

if (selectedCluster.getObject() != null) {
return factory.createProxy(clusterManager.getCluster(selectedCluster.getObject()).getAddress(), EtcdApiResource.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ public CachingResourceProxyFactory() {
@SuppressWarnings("unchecked")
@Override
public <T> T createProxy(String baseAddress, Class<T> serviceType) {
System.out.println("CachingWebClientProxyFactory.createProxy() " + baseAddress);
// System.out.println("CachingWebClientProxyFactory.createProxy() " + baseAddress);

CacheKey key = new CacheKey(baseAddress, serviceType);

if (clientCache.containsKey(key)) {
return (T) clientCache.get(key);
} else {
System.out.println("$$$$$$$$$$$$$$$$$$$$$$$$$$ CREATING PROXY FOR: " + baseAddress);
// System.out.println("$$$$$$$$$$$$$$$$$$$$$$$$$$ CREATING PROXY FOR: " + baseAddress);
T proxy = JAXRSClientFactory.create(baseAddress, serviceType, providers);
clientCache.putIfAbsent(key, proxy);
return proxy;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ public int compare(EtcdPeer o1, EtcdPeer o2) {

public ClusterManagerImpl() {
addCluster("local", "http://localhost:4001/");
addCluster("local-kvm", "http://192.168.122.101:4001/");
// addCluster("ena", "http://10.0.0.1:4001/");
// addCluster("dyo", "http://10.0.0.2:4001/");
// addCluster("tria", "http://10.0.0.3:4001/");
// addCluster("tessera", "http://10.0.0.4:4001/");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">Add cluster</h4>
<h4 class="modal-title">Add registry</h4>
</div>
<div class="modal-body">
<form wicket:id="form">
<div class="form-group" wicket:id="nameGroup">
<input wicket:id="name" type="text" class="form-control" placeholder="cluster name" />
<input wicket:id="name" type="text" class="form-control" placeholder="registry name" />
</div>
<div class="form-group" wicket:id="addressGroup">
<input wicket:id="address" type="text" class="form-control" placeholder="peer address" />
Expand All @@ -21,7 +21,7 @@ <h4 class="modal-title">Add cluster</h4>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-primary" wicket:id="addCluster">Add cluster</button>
<button type="button" class="btn btn-primary" wicket:id="addCluster">Add registry</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@
<div class="row">
<div class="col-xs-8 col-sm-9">
<div class="input-group input-group-lg" wicket:id="selectInputGroup">
<input type="text" wicket:id="selectedCluster" class="form-control" placeholder="select cluster" readonly>
<input type="text" wicket:id="selectedCluster" class="form-control" placeholder="select etcd registry" readonly>
<div class="input-group-btn">
<button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown" aria-expanded="false"><span class="fa fa-caret-down"></span></button>
<ul class="dropdown-menu dropdown-menu-right" role="menu">
<li wicket:id="clusters"><a wicket:id="select"><span wicket:id="name"></span> @ <span wicket:id="address"></span></a></li>
<li class="divider"></li>
<li><a wicket:id="addCluster" data-toggle="modal"><span class="fa fa-plus"></span> Add another cluster</a></li>
<li><a wicket:id="addCluster" data-toggle="modal"><span class="fa fa-plus"></span> Add another registry</a></li>
</ul>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ <h4 class="modal-title">Confirm delete</h4>
</div>
<div class="modal-body">
<p>
You are about to delete cluster: <strong wicket:id="name"></strong><br>
You are about to delete registry: <strong wicket:id="name"></strong><br>
Are you sure you want to proceed?
</p>
<p>
<em>The contents of the cluster registry will not be affected!</em>
<em>The contents of the etcd registry will not be affected!</em>
</p>
</div>
<div class="modal-footer">
Expand Down
26 changes: 24 additions & 2 deletions src/main/java/org/github/etcd/viewer/html/node/EtcdNodePanel.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,17 @@
width: 25%;
}

.etcd-nodes .value-wrapper {
display: block;
display: -webkit-box;
width: 100%;
height: 1.2em;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
}

.etcd-nodes .created, .etcd-nodes .modified, .etcd-nodes .ttl {
width: 10%;
}
Expand All @@ -32,7 +43,6 @@

.etcd-nodes .expiration {
width: 200px;
/* background-color: red; */
}

.breadcrumb li:first-child span.fa.breadcrumb-icon:before {
Expand Down Expand Up @@ -108,7 +118,7 @@ <h4><span wicket:id="icon"></span> <span wicket:id="key"></span></h4>
<a wicket:id="delete" class="action"><span class="fa fa-fw fa-remove"></span></a>
</div>
</td>
<td><span wicket:id="value"></span></td>
<td class="popover-value"><span wicket:id="value" class="value-wrapper"></span></td>
<td class="hidden-sm hidden-xs"><span wicket:id="createdIndex"></span></td>
<td class="hidden-sm hidden-xs"><span wicket:id="modifiedIndex"></span></td>
<td class="hidden-sm hidden-xs"><span wicket:id="ttl"></span></td>
Expand All @@ -120,6 +130,18 @@ <h4><span wicket:id="icon"></span> <span wicket:id="key"></span></h4>

</div><!-- end of panel -->

<!-- TODO: Popover to show the complete value is not working property
<script>
$(document).ready(function() {
$(".popover-value").popover({
html: true,
trigger: 'hover',
//placement: 'bottom',
title: function() { return $(this).prev('td').text(); },
content: function() { return $(this).find('.value-wrapper').html(); }
});
});
</script> -->

<div wicket:id="editNodeModal"></div>
<div wicket:id="deleteNodeModal"></div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,11 @@ public EtcdNodePanel(String id, IModel<String> keyModel) {
@Override
protected EtcdNode load() {
try {

System.out.println("-------- LOADING: " + key.getObject());

// System.out.println("-------- LOADING: " + key.getObject());
return etcdManager.get().getNode(key.getObject()).getNode();
} catch (Exception e) {
// e.printStackTrace();
// TODO: handle this exception and show some alert on page
return null;
}
}
Expand Down
83 changes: 67 additions & 16 deletions src/main/java/org/github/etcd/viewer/html/pages/AboutPage.html
Original file line number Diff line number Diff line change
@@ -1,26 +1,77 @@
<!DOCTYPE html>
<html xmlns:wicket="http://wicket.apache.org">
<html xmlns:wicket="http://wicket.apache.org">\
<head>
<wicket:head>
<style>

img.tool-logo {
max-width: 200px;
max-height: 70px;
}

</style>
</wicket:head>
</head>
<body>
<wicket:extend>

<h1>About</h1>
<div class="page-header">
<h1>About <small><span class="fa fa-angle-double-right"></span> etcd viewer</small></h1>
</div>

<div class="row">
<div class="col-sm-12">
<p>
Etcd viewer is open source licensed under Apache 2.0 license and it is hosted on
<a href="https://github.com/nikfoundas/etcd-viewer"><span class="fa fa-github"></span> github</a>.
</p>
<p>
Please feel free to <a href="https://github.com/nikfoundas/etcd-viewer/issues/new"><span class="fa fa-bug"></span> report an issue</a> or share your ideas.
</p>
<p>
<a href="https://github.com/nikfoundas/etcd-viewer/blob/master/README.md">View documentation</a> on <span class="fa fa-github"></span> github
</p>
<p>
Contributions are always welcomed.
</p>
</div><!-- ./col-sm-12 -->
</div><!-- ./row -->

<hr>

<h3>Features</h3>

<ul class="fa-ul">
<li><i class="fa-li fa fa-check"></i>Etcd v2.0 rest API</li>
<li><i class="fa-li fa fa-check"></i>Filesystem like key-value store navigation</li>
<li><i class="fa-li fa fa-check"></i>Add/delete directories</li>
<li><i class="fa-li fa fa-check"></i>Add/delete/update key-value pairs</li>
<li><i class="fa-li fa fa-check"></i>Enable Time To Live on directories and values</li>
<li><i class="fa-li fa fa-check"></i>Multi-registry support</li>
<li><i class="fa-li fa fa-check"></i>Etcd cluster monitor</li>
<li><i class="fa-li fa fa-check"></i>Leader auto detection</li>
</ul>

<hr>

<h3>References</h3>

<div class="row">

<div class="col-sm-4 col-xs-6" wicket:id="references">
<div class="well well-sm text-center">

<img wicket:id="image" data-src="holder.js/70x70" class="img-rounded tool-logo center-block" alt="broken logo" data-holder-rendered="true">

<span wicket:id="icon"></span>

<p>Demo about content</p>
<h4><a wicket:id="url" class="clearfix"><span wicket:id="label">[label]</span></a></h4>

<p>ETCD Viewer uses the ETCD v2.0 Rest API to communicate.</p>
<p wicket:id="description" class="text-muted">[description]</p>
</div><!-- ./well -->
</div><!-- ./col-sm-4 -->

<p>The application is built on top of the following:</p>
<ul>
<li>Apache Wicket 6.19.0</li>
<li>Google Guice 3.0</li>
<li>Apache CXF 3.0.1</li>
<li>Jackson JSON 2.5.3</li>
<li>JAX RS API 2.0</li>
<li>JAVAX Inject 1.0</li>
<li>Twitter bootstrap v3.3.4</li>
<li>Font Awesome 4.3.0</li>
<li>JQuery 1.11.2</li>
</ul>
</div><!-- ./row -->

</wicket:extend>
</body>
Expand Down
Loading

0 comments on commit b260ede

Please sign in to comment.