Permalink
Browse files

Sort the column families alpha-numericall on index and Keyspace displays

  • Loading branch information...
1 parent 0b12afa commit 44fe7da1d232210690e35a41e40f7c67ba58caa3 @rtconner rtconner committed Oct 19, 2012
Showing with 15 additions and 1 deletion.
  1. +5 −1 describe_keyspace.php
  2. +8 −0 helper/ColumnFamilyHelper.php
  3. +2 −0 include/conf.inc.php
View
@@ -24,7 +24,11 @@
}
else {
try {
- $describe_keyspace = $sys_manager->describe_keyspace($keyspace_name);
+ $describe_keyspace = $sys_manager->describe_keyspace($keyspace_name);
+
+ if(defined('CF_AUTOSORT') && CF_AUTOSORT) {
+ usort($describe_keyspace->cf_defs, array('ColumnFamilyHelper', 'sortCfDefsCallable'));
+ }
// CF created successfully
$vw_vars['added_cf'] = '';
@@ -57,6 +57,10 @@ public static function getKeyspacesAndColumnFamiliesDetails() {
$columnfamilies_name[] = $columnfamily->name;
}
+ if(defined('CF_AUTOSORT') && CF_AUTOSORT) {
+ sort($columnfamilies_name);
+ }
+
$keyspaces_details[] = array('columnfamilies_name' => $columnfamilies_name);
}
@@ -111,5 +115,9 @@ public static function displaySCFRow($row_key,$keyspace_name,$columnfamily_name,
return $output;
}
+
+ public static function sortCfDefsCallable($a, $b) {
+ return strcmp($a->name, $b->name);
+ }
}
?>
View
@@ -39,4 +39,6 @@
define('CCA_PASSWORD','');
define('MX4J_HTTP_ADAPTOR_PORT',8081);
+
+ define('CF_AUTOSORT', true); // column family autosort alpha-numerically
?>

0 comments on commit 44fe7da

Please sign in to comment.