Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added RpcActionsProvider - aggregate class for all rpc calls

implemented truncate / drop actions
gui enhancements
  • Loading branch information...
commit 194aee6a3fcbc1178614129af16e12320f129794 1 parent badd53a
tomek authored
View
4 src/main/frontend/source/class/helenos/components/ClusterPane.js
@@ -64,10 +64,10 @@ qx.Class.define("helenos.components.ClusterPane",
var rpc = new helenos.util.Rpc('Cluster');
- var clusterName = rpc.callSync('describeClusterName');
+ var clusterName = helenos.util.RpcActionsProvider.describeClusterName();
this.__setRootItem(clusterName);
- var ksDefs = rpc.callSync('describeKeyspaces');
+ var ksDefs = helenos.util.RpcActionsProvider.describeKeyspaces();
this.__renderKeyspaces(ksDefs);
},
View
12 src/main/frontend/source/class/helenos/components/menu/ColumnFamilyContextMenu.js
@@ -8,7 +8,8 @@ Authors:
************************************************************************ */
/*
#asset(qx/icon/${qx.icontheme}/16/status/dialog-information.png)
-#asset(qx/icon/${qx.icontheme}/16/places/user-trash.png)
+#asset(qx/icon/${qx.icontheme}/16/actions/edit-delete.png)
+#asset(qx/icon/${qx.icontheme}/16/actions/edit-clear.png)
#asset(qx/icon/${qx.icontheme}/16/apps/office-spreadsheet.png)
*/
qx.Class.define("helenos.components.menu.ColumnFamilyContextMenu",
@@ -30,10 +31,17 @@ qx.Class.define("helenos.components.menu.ColumnFamilyContextMenu",
viewDataButton.setUserData('CFNAME', cfName);
this.add(viewDataButton);
- var removeButton = new qx.ui.menu.Button("Remove column family", "qx/icon/Oxygen/16/places/user-trash.png");
+ this.add(new qx.ui.menu.Separator());
+
+ var removeButton = new qx.ui.menu.Button("Remove", "qx/icon/Oxygen/16/actions/edit-delete.png");
removeButton.setUserData('KSNAME', ksName);
removeButton.setUserData('CFNAME', cfName);
this.add(removeButton);
+
+ var truncateButton = new qx.ui.menu.Button("Truncate", "qx/icon/Oxygen/16/actions/edit-clear.png");
+ truncateButton.setUserData('KSNAME', ksName);
+ truncateButton.setUserData('CFNAME', cfName);
+ this.add(truncateButton);
},
members : {
View
14 src/main/frontend/source/class/helenos/components/menu/KeyspaceContextMenu.js
@@ -9,6 +9,7 @@ Authors:
/*
#asset(qx/icon/${qx.icontheme}/16/status/dialog-information.png)
#asset(qx/icon/${qx.icontheme}/16/actions/list-add.png)
+#asset(qx/icon/${qx.icontheme}/16/actions/edit-delete.png)
*/
qx.Class.define("helenos.components.menu.KeyspaceContextMenu",
{
@@ -23,14 +24,27 @@ qx.Class.define("helenos.components.menu.KeyspaceContextMenu",
propsButton.addListener("execute", this.__showProperties);
this.add(propsButton);
+ this.add(new qx.ui.menu.Separator());
+
var addCFButton = new qx.ui.menu.Button("Add column family", "qx/icon/Oxygen/16/actions/list-add.png");
this.add(addCFButton);
+
+ var dropButton = new qx.ui.menu.Button("Remove", "qx/icon/Oxygen/16/actions/edit-delete.png");
+ dropButton.setUserData('KSNAME', ksName);
+ dropButton.addListener("execute", this.__dropKeyspace);
+ this.add(dropButton);
},
members : {
__showProperties : function(e) {
var ksName = e.getTarget().getUserData('KSNAME');
helenos.util.GuiObserver.showKeyspaceInfoTab(ksName);
+ },
+
+ __dropKeyspace : function(e) {
+ var ksName = e.getTarget().getUserData('KSNAME');
+ helenos.util.RpcActionsProvider.dropKeyspace(ksName);
+ //TODO odswiez tree pane
}
}
});
View
3  src/main/frontend/source/class/helenos/components/tab/ColumnFamilyInfoPage.js
@@ -23,8 +23,7 @@ qx.Class.define("helenos.components.tab.ColumnFamilyInfoPage",
layout: new qx.ui.layout.VBox(3, 'top')
});
- var rpc = new helenos.util.Rpc('Cluster');
- var cfDef = rpc.callSync('describeColumnFamily', ksName, cfName);
+ var cfDef = helenos.util.RpcActionsProvider.describeColumnFamily(ksName, cfName);
//this.__addNameAtom(ksDef);
//this.__addBasicInfoGroup(ksDef);
View
33 src/main/frontend/source/class/helenos/util/RpcActionsProvider.js
@@ -0,0 +1,33 @@
+/* ************************************************************************
+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.RpcActionsProvider', {
+
+ statics : {
+ dropKeyspace : function(keyspaceName) {
+ var rpc = new helenos.util.Rpc('Cluster');
+ rpc.callSync('dropKeyspace', keyspaceName);
+ },
+
+ describeClusterName : function() {
+ var rpc = new helenos.util.Rpc('Cluster');
+ return rpc.callSync('describeClusterName');
+ },
+
+ describeKeyspaces : function() {
+ var rpc = new helenos.util.Rpc('Cluster');
+ return rpc.callSync('describeKeyspaces');
+ },
+
+ describeColumnFamily : function(keyspaceName, columnFamily) {
+ var rpc = new helenos.util.Rpc('Cluster');
+ return rpc.callSync('describeColumnFamily', keyspaceName, columnFamily);
+ }
+
+ }
+});
View
7 src/main/java/com/kuprowski/helenos/service/ClusterProvider.java
@@ -6,7 +6,6 @@
import com.kuprowski.helenos.types.JsonColumnFamilyDefinition;
import com.kuprowski.helenos.types.JsonKeyspaceDefinition;
-import java.util.ArrayList;
import java.util.List;
/**
@@ -17,6 +16,12 @@
String describeClusterName();
+ void dropKeyspace(String keyspaceName);
+
+ void truncateColumnFamily(String keyspaceName, String columnFamily);
+
+ void dropColumnFamily(String keyspaceName, String columnFamily);
+
List<JsonKeyspaceDefinition> describeKeyspaces();
JsonKeyspaceDefinition describeKeyspace(String keyspaceName);
View
15 src/main/java/com/kuprowski/helenos/service/ClusterProviderImpl.java
@@ -35,6 +35,21 @@ public String describeClusterName() {
}
@Override
+ public void dropKeyspace(String keyspaceName) {
+ cluster.dropKeyspace(keyspaceName, true);
+ }
+
+ @Override
+ public void dropColumnFamily(String keyspaceName, String columnFamily) {
+ cluster.dropColumnFamily(keyspaceName, columnFamily, true);
+ }
+
+ @Override
+ public void truncateColumnFamily(String keyspaceName, String columnFamily) {
+ cluster.truncate(keyspaceName, columnFamily);
+ }
+
+ @Override
public JsonKeyspaceDefinition describeKeyspace(String keyspaceName) {
KeyspaceDefinition def = cluster.describeKeyspace(keyspaceName);
return mapper.map(def, JsonKeyspaceDefinition.class);
Please sign in to comment.
Something went wrong with that request. Please try again.