Permalink
Browse files

implemented:

showing list of keyspaces
showing column families in tree
  • Loading branch information...
1 parent 4961b77 commit b63a0fe97f4533f8d8b64bab7a92e4a5eeb5cd56 tomek committed Jul 13, 2012
View
@@ -1,4 +1,5 @@
/target/
/src/main/webapp/helenos/build/
/src/main/webapp/helenos/source/script/
-/src/main/frontend/build/
+/src/main/frontend/build/
+/src/main/frontend/source/script/
View
@@ -1,4 +1,3 @@
-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
@@ -200,7 +199,6 @@
</executions>
</plugin>
-
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
@@ -229,7 +227,7 @@
</execution>
<execution>
<id>copy-frontend-resources</id>
- <phase>build-frontend</phase>
+ <phase>prepare-package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
@@ -0,0 +1,118 @@
+/* ************************************************************************
+Copyright:
+ 2012 Tomek Kuprowski
+License:
+ GPLv2: http://www.gnu.org/licences/gpl.html
+Authors:
+ Tomek Kuprowski (tomekkuprowski at gmail dot com)
+ ************************************************************************ */
+
+/*
+#asset(qx/icon/Tango/16/actions/view-refresh.png)
+#asset(qx/icon/Tango/16/devices/computer.png)
+#asset(helenos/keyspace.png)
+#asset(helenos/supercf.png)
+#asset(helenos/standardcf.png)
+*/
+
+qx.Class.define("helenos.components.ClusterPane",
+{
+ extend : qx.ui.container.Composite,
+
+ /*
+ *****************************************************************************
+ MEMBERS
+ *****************************************************************************
+ */
+
+ construct : function()
+ {
+ this.base(arguments);
+ this.set({
+ layout : new qx.ui.layout.VBox(),
+ width : 240
+ });
+
+ this.__createButtons();
+ this.__createClusterTree();
+
+ this.add(this.__btnToolbar);
+ this.add(this.__clusterTree, {
+ flex : 1
+ });
+ },
+
+ members :
+ {
+ __clusterTree : null,
+ __btnToolbar : null,
+
+ __createButtons : function() {
+ this.__btnToolbar = new qx.ui.toolbar.ToolBar();
+
+ var refreshButton = new qx.ui.toolbar.Button("", "qx/icon/Tango/16/actions/view-refresh.png");
+
+ this.__btnToolbar.add(refreshButton);
+ },
+
+ __createClusterTree : function() {
+ this.__clusterTree = new qx.ui.tree.Tree();
+
+ this.refreshClusterTree();
+ },
+
+ refreshClusterTree : function() {
+ this.__clusterTree.resetRoot(); // ?
+
+ var rpc = new helenos.util.Rpc('Cluster');
+
+ var clusterName = rpc.callSync('describeClusterName');
+ this.__setRootItem(clusterName);
+
+ var ksDefs = rpc.callSync('describeKeyspaces');
+ this.__renderKeyspaces(ksDefs);
+ },
+
+ __renderKeyspaces : function(ksDefs) {
+ for (var i = 0; i < ksDefs.length; i++) {
+ var def = ksDefs[i];
+
+ var ksItem = new qx.ui.tree.TreeFolder(def.name);
+ ksItem.set({
+ open: true,
+ icon : 'helenos/keyspace.png'
+ });
+ this.__clusterTree.getRoot().add(ksItem);
+
+ for (var j = 0; j < def.cfDefs.length; j++) {
+ var cf = def.cfDefs[j];
+ var cfItem = new qx.ui.tree.TreeFile(cf.name);
+ cfItem.setIcon(cf.columnType == 'Super' ? 'helenos/supercf.png' : 'helenos/standardcf.png');
+ cfItem.setToolTip(this.__createColumnFamilyToolTip(cf));
+ ksItem.add(cfItem);
+ }
+ }
+ },
+
+ __createColumnFamilyToolTip : function(cfDef) {
+ var ttt = 'Comparator: <b>' + cfDef.comparatorType.typeName + '</b><br/>';
+ if (cfDef.subComparatorType != null) {
+ ttt += 'Subcomparator: <b>' + cfDef.subComparatorType.typeName + '</b><br/>';
+ }
+ ttt += 'Key validator: <b>' + cfDef.keyValidationClass + '</b><br/>';
+ ttt += 'Default validator: <b>' + cfDef.defaultValidationClass + '</b><br/>';
+ var tooltip = new qx.ui.tooltip.ToolTip(ttt);
+ tooltip.setWidth(350);
+ tooltip.setRich(true);
+ tooltip.setShowTimeout(100);
+ return tooltip;
+ },
+
+ __setRootItem : function(clusterName) {
+ var rootItem = new qx.ui.tree.TreeFolder(clusterName);
+ rootItem.setOpen(true);
+ rootItem.setIcon("qx/icon/Tango/16/devices/computer.png");
+ this.__clusterTree.setRoot(rootItem);
+ }
+ }
+});
@@ -0,0 +1,66 @@
+/* ************************************************************************
+Copyright:
+ 2012 Tomek Kuprowski
+License:
+ GPLv2: http://www.gnu.org/licences/gpl.html
+Authors:
+ Tomek Kuprowski (tomekkuprowski at gmail dot com)
+ ************************************************************************ */
+
+/*
+#asset(qx/icon/Tango/32/status/dialog-warning.png)
+*/
+qx.Class.define('helenos.components.ExceptionWindow',
+{
+ extend: qx.ui.window.Window,
+
+ construct: function() {
+ this.base(arguments);
+ this.set({ allowMinimize: false, allowMaximize: false, resizable: false, padding: 1, width: 500,
+ caption: 'Error occured', modal: true});
+ this.setLayout(new qx.ui.layout.VBox(10, 'top'));
+
+ this._label = new qx.ui.basic.Atom('<b>Remote server returned an error!', 'qx/icon/Tango/32/status/dialog-warning.png');
+ this._textArea = new qx.ui.form.TextArea();
+ this._textArea.setMinHeight(200);
+
+ this.add(this._label);
+ this.add(this._textArea);
+ this.addListenerOnce('resize', this.center, this);
+ },
+
+ members:
+ {
+ _label: null,
+ _textArea: null,
+ _body: '',
+
+ showException: function(e) {
+ this._body = '';
+ //alert(qx.dev.Debug.debugObjectToString(e));
+
+ //if (e.message != undefined) {
+ // this._body += 'message: ' + e.message + '<br/>';
+ //}
+ //if (e.lineNumber != undefined) {
+ // this._body += 'lineNumber: ' + e.lineNumber + '<br/>';
+ //}
+ if (e.rpcdetails != undefined) {
+ //if (e.rpcdetails.origin != undefined) {
+ // this._body += 'origin: ' + e.rpcdetails.origin + '<br/>';
+ //}
+ //if (e.rpcdetails.code != undefined) {
+ // this._body += 'code: ' + e.rpcdetails.code + '<br/>';
+ //}
+ if (e.rpcdetails.message != undefined) {
+ this._body += 'Detale:' + e.rpcdetails.message + '\n';
+ }
+ if (e.rpcdetails.stackTrace != undefined) {
+ this._body += '\nStos: ' + e.rpcdetails.stackTrace + '<br/>';
+ }
+ }
+ this._textArea.setValue(this._body);
+ this.open();
+ }
+ }
+});
@@ -34,11 +34,11 @@ qx.Class.define("helenos.components.MainPane",
__contentPane : null,
__createLeftPane : function() {
- this.__treePane = new qx.ui.container.Composite();
+ this.__treePane = new helenos.components.ClusterPane();
},
__createRightPane : function() {
- this.__contentPane = new qx.ui.container.Composite();
+ this.__contentPane = new helenos.components.RightContentPane();
}
}
});
@@ -0,0 +1,31 @@
+/* ************************************************************************
+Copyright:
+ 2012 Tomek Kuprowski
+License:
+ GPLv2: http://www.gnu.org/licences/gpl.html
+Authors:
+ Tomek Kuprowski (tomekkuprowski at gmail dot com)
+ ************************************************************************ */
+
+qx.Class.define("helenos.components.RightContentPane",
+{
+ extend : qx.ui.tabview.TabView,
+
+ /*
+ *****************************************************************************
+ MEMBERS
+ *****************************************************************************
+ */
+
+ construct : function()
+ {
+ this.base(arguments);
+
+
+ },
+
+ members :
+ {
+
+ }
+});
@@ -0,0 +1,22 @@
+/* ************************************************************************
+Copyright:
+ 2012 Tomek Kuprowski
+License:
+ GPLv2: http://www.gnu.org/licences/gpl.html
+Authors:
+ Tomek Kuprowski (tomekkuprowski at gmail dot com)
+ ************************************************************************ */
+qx.Class.define('helenos.util.ExceptionReporter',
+{
+ statics :
+ {
+ __ewindow : null,
+
+ report : function(e) {
+ if (this.__ewindow == undefined) {
+ this.__ewindow = new helenos.components.ExceptionWindow();
+ }
+ this.__ewindow.showException(e);
+ }
+ }
+});
@@ -0,0 +1,34 @@
+/* ************************************************************************
+Copyright:
+ 2012 Tomek Kuprowski
+License:
+ GPLv2: http://www.gnu.org/licences/gpl.html
+Authors:
+ Tomek Kuprowski (tomekkuprowski at gmail dot com)
+ ************************************************************************ */
+qx.Class.define('helenos.util.Rpc',
+ {
+ extend : qx.io.remote.Rpc ,
+
+ construct : function(serviceName)
+ {
+ this.base(arguments);
+ this.setUrl(this.__getRemoteUri(serviceName));
+ this.setTimeout(30000);
+ },
+
+ members : {
+ __getRemoteUri : function(serviceName) {
+ return window.location.protocol + '//' + window.location.hostname + ':' + window.location.port + '/' + serviceName + '.json';
+ //return "http://localhost:8080/" + serviceName + ".json";
+ },
+
+ callSync : function(methodName) {
+ try {
+ return this.base(arguments, methodName);
+ } catch (e) {
+ helenos.util.ExceptionReporter.report(e);
+ }
+ }
+ }
+ });
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Deleted file not rendered
@@ -17,6 +17,8 @@
public JsonColumnFamilyDefinition() {
}
+
+ private String name;
private String keyspaceName;
private String comment;
private String columnType;
@@ -45,6 +47,14 @@ public JsonColumnFamilyDefinition() {
private String rowCacheProvider;
private int rowCacheKeysToSave;
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
public String getKeyspaceName() {
return keyspaceName;
}
@@ -35,6 +35,11 @@
<mapping type="one-way">
<class-a>me.prettyprint.cassandra.service.ThriftCfDef</class-a>
<class-b>com.kuprowski.helenos.types.JsonColumnFamilyDefinition</class-b>
+
+ <field>
+ <a>name</a>
+ <b>name</b>
+ </field>
<field>
<a>keyspaceName</a>
<b>keyspaceName</b>
@@ -1,11 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans default-autowire="byName" xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:aop="http://www.springframework.org/schema/aop" xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context"
+ xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context"
+ xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
+ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
+ http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd">
<bean name="/Cluster.json" class="com.googlecode.jsonrpc4j.spring.JsonServiceExporter">
<property name="service" ref="clusterProvider"/>
<property name="serviceInterface" value="com.kuprowski.helenos.service.ClusterProvider"/>
</bean>
+
+ <mvc:resources mapping="/helenos/**" location="/helenos/" />
</beans>

0 comments on commit b63a0fe

Please sign in to comment.