Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

new cf form

  • Loading branch information...
commit 37bf60dafd98913af8a10409ca99fde73f0aa7bf 1 parent 9de6476
tomek authored
72 src/main/frontend/source/class/helenos/components/menu/KeyspaceContextMenu.js
View
@@ -27,6 +27,8 @@ qx.Class.define("helenos.components.menu.KeyspaceContextMenu",
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");
+ addCFButton.setUserData('KSNAME', ksName);
+ addCFButton.addListener("execute", this.__addColumnFamily);
this.add(addCFButton);
var dropButton = new qx.ui.menu.Button("Remove", "qx/icon/Oxygen/16/actions/edit-delete.png");
@@ -49,6 +51,76 @@ qx.Class.define("helenos.components.menu.KeyspaceContextMenu",
helenos.util.GuiObserver.refreshSchemaTree();
}
}, this);
+ },
+
+ __addColumnFamily : function(e) {
+ var ksName = e.getTarget().getUserData('KSNAME');
+ var formData = {
+ 'name' : {
+ 'type' : "TextField",
+ 'label' : "Name",
+ 'value' : "",
+ "validation" : {
+ "required" : true
+ }
+ },
+ 'column' : {
+ 'type' : "SelectBox",
+ 'label' : "Column",
+ 'value' : 1,
+ 'options' : helenos.util.CassandraTypes.columnTypes,
+ "validation" : {
+ "required" : true
+ }
+ },
+ 'comparator' : {
+ 'type' : "SelectBox",
+ 'label' : "Comparator",
+ 'value' : 1,
+ 'options' : helenos.util.CassandraTypes.comparatorTypes,
+ "validation" : {
+ "required" : true
+ }
+ },
+ 'subComparator' : {
+ 'type' : "SelectBox",
+ 'label' : "Subcomparator",
+ 'value' : 1,
+ 'options' : helenos.util.CassandraTypes.comparatorTypes,
+ "validation" : {
+ "required" : true
+ }
+ }
+ ,
+ 'keyValidationclass' : {
+ 'type' : "SelectBox",
+ 'label' : "Key validation class",
+ 'value' : 1,
+ 'options' : helenos.util.CassandraTypes.validationClasses,
+ "validation" : {
+ "required" : true
+ }
+ },
+ 'defaultValidationclass' : {
+ 'type' : "SelectBox",
+ 'label' : "Default validation class",
+ 'value' : 1,
+ 'options' : helenos.util.CassandraTypes.validationClasses,
+ "validation" : {
+ "required" : true
+ }
+ },
+ 'comment' :
+ {
+ 'type' : "TextArea",
+ 'label' : "Comment",
+ 'lines' : 4,
+ 'value' : ""
+ }
+ };
+ dialog.Dialog.form('<b>Create new column family</b>', formData, function(result) {
+
+ });
}
}
});
106 src/main/frontend/source/class/helenos/util/CassandraTypes.js.js
View
@@ -0,0 +1,106 @@
+/* ************************************************************************
+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.CassandraTypes', {
+
+ statics : {
+
+ comparatorTypes : [
+ {
+ 'label' : "Ascii",
+ 'value' : "org.apache.cassandra.db.marshal.AsciiType"
+ },
+ {
+ 'label' : "Bytes",
+ 'value' : "org.apache.cassandra.db.marshal.BytesType"
+ },
+ {
+ 'label' : "Integer",
+ 'value' : "org.apache.cassandra.db.marshal.IntegerType"
+ },
+ {
+ 'label' : "Lexical UUID",
+ 'value' : "org.apache.cassandra.db.marshal.LexicalUUIDType"
+ },
+ {
+ 'label' : "Local by partitioner",
+ 'value' : "org.apache.cassandra.db.marshal.LocalByPartionerType"
+ },
+ {
+ 'label' : "Long",
+ 'value' : "org.apache.cassandra.db.marshal.LongType"
+ },
+ {
+ 'label' : "Time UUID",
+ 'value' : "org.apache.cassandra.db.marshal.TimeUUIDType"
+ },
+ {
+ 'label' : "UTF-8",
+ 'value' : "org.apache.cassandra.db.marshal.UTF8Type"
+ },
+ {
+ 'label' : "Composite",
+ 'value' : "org.apache.cassandra.db.marshal.CompositeType"
+ },
+ {
+ 'label' : "Dynamic composite",
+ 'value' : "org.apache.cassandra.db.marshal.DynamicCompositeType"
+ },
+ {
+ 'label' : "UUID",
+ 'value' : "org.apache.cassandra.db.marshal.UUIDType"
+ },
+ {
+ 'label' : "Counter column",
+ 'value' : "org.apache.cassandra.db.marshal.CounterColumnType"
+ }
+ ],
+
+ columnTypes : [
+ {
+ 'label' : "Standard",
+ 'value' : "Standard"
+ },
+ {
+ 'label' : "Super",
+ 'value' : "Super"
+ }
+ ],
+
+ validationClasses : [
+ {
+ 'label' : "SuperColumns",
+ 'value' : "SuperColumns"
+ },
+ {
+ 'label' : "BytesType",
+ 'value' : "BytesType"
+ },
+ {
+ 'label' : "AsciiType",
+ 'value' : "AsciiType"
+ },
+ {
+ 'label' : "UTF8Type",
+ 'value' : "UTF8Type"
+ },
+ {
+ 'label' : "LongType",
+ 'value' : "LongType"
+ },
+ {
+ 'label' : "LexicalUUIDType",
+ 'value' : "LexicalUUIDType"
+ },
+ {
+ 'label' : "TimeUUIDType",
+ 'value' : "TimeUUIDType"
+ }
+ ]
+ }
+});
16 src/main/java/com/kuprowski/helenos/service/ClusterProviderImpl.java
View
@@ -18,12 +18,12 @@
*/
@Component("clusterProvider")
public class ClusterProviderImpl extends AbstractProvider implements ClusterProvider {
-
+
@Override
public String describeClusterName() {
return cluster.describeClusterName();
}
-
+
@Override
public List<JsonKeyspaceDefinition> describeKeyspaces() {
List<KeyspaceDefinition> x = cluster.describeKeyspaces();
@@ -33,33 +33,33 @@ public String describeClusterName() {
}
return y;
}
-
+
@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);
}
-
+
@Override
public JsonColumnFamilyDefinition describeColumnFamily(String keyspaceName, String columnFamilyName) {
KeyspaceDefinition def = cluster.describeKeyspace(keyspaceName);
JsonColumnFamilyDefinition jsonDef = null;
- for(ColumnFamilyDefinition thriftDef : def.getCfDefs()) {
+ for (ColumnFamilyDefinition thriftDef : def.getCfDefs()) {
if (thriftDef.getName().equals(columnFamilyName)) {
jsonDef = mapper.map(thriftDef, JsonColumnFamilyDefinition.class);
continue;
Please sign in to comment.
Something went wrong with that request. Please try again.