rjack-solr 4.0.0.0-java → 4.1.0.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. data/History.rdoc +5 -0
  2. data/Manifest.txt +5 -4
  3. data/README.rdoc +1 -1
  4. data/init/rjack-solr +1 -1
  5. data/lib/rjack-solr/base.rb +1 -1
  6. data/lib/rjack-solr/solr-core-4.1.0.jar +0 -0
  7. data/lib/rjack-solr/solr-solrj-4.1.0.jar +0 -0
  8. data/pom.xml +2 -2
  9. data/webapp/META-INF/MANIFEST.MF +3 -3
  10. data/webapp/META-INF/NOTICE.txt +2 -2
  11. data/webapp/admin.html +1 -0
  12. data/webapp/css/styles/cloud.css +8 -1
  13. data/webapp/css/styles/common.css +21 -0
  14. data/webapp/css/styles/dashboard.css +2 -2
  15. data/webapp/css/styles/dataimport.css +183 -21
  16. data/webapp/css/styles/menu.css +2 -0
  17. data/webapp/css/styles/query.css +9 -3
  18. data/webapp/css/styles/schema-browser.css +12 -0
  19. data/webapp/img/ico/cross-button.png +0 -0
  20. data/webapp/img/ico/hammer.png +0 -0
  21. data/webapp/js/lib/console.js +11 -9
  22. data/webapp/js/lib/highlight.js +1 -1
  23. data/webapp/js/lib/jquery.autogrow.js +132 -0
  24. data/webapp/js/main.js +1 -0
  25. data/webapp/js/require.js +3 -1
  26. data/webapp/js/scripts/analysis.js +2 -2
  27. data/webapp/js/scripts/app.js +183 -78
  28. data/webapp/js/scripts/cloud.js +41 -20
  29. data/webapp/js/scripts/cores.js +5 -2
  30. data/webapp/js/scripts/dashboard.js +2 -1
  31. data/webapp/js/scripts/dataimport.js +415 -162
  32. data/webapp/js/scripts/file.js +1 -1
  33. data/webapp/js/scripts/index.js +3 -5
  34. data/webapp/js/scripts/logging.js +8 -0
  35. data/webapp/js/scripts/plugins.js +47 -7
  36. data/webapp/js/scripts/query.js +75 -49
  37. data/webapp/js/scripts/replication.js +4 -47
  38. data/webapp/js/scripts/schema-browser.js +46 -23
  39. data/webapp/tpl/cores.html +5 -0
  40. data/webapp/tpl/dashboard.html +4 -1
  41. data/webapp/tpl/dataimport.html +72 -12
  42. data/webapp/tpl/query.html +38 -3
  43. data/webapp/tpl/schema-browser.html +6 -0
  44. metadata +15 -12
  45. data/lib/rjack-solr/solr-core-4.0.0.jar +0 -0
  46. data/lib/rjack-solr/solr-solrj-4.0.0.jar +0 -0
@@ -18,7 +18,7 @@
18
18
  // #/:core/schema, #/:core/config
19
19
  sammy.get
20
20
  (
21
- /^#\/([\w\d-]+)\/(schema|config)$/,
21
+ new RegExp( app.core_regex_base + '\\/(schema|config)$' ),
22
22
  function( context )
23
23
  {
24
24
  var core_basepath = this.active_core.attr( 'data-basepath' );
@@ -36,15 +36,13 @@ var generate_bar = function( bar_container, bar_data, convert_label_values )
36
36
  $( '.bar-max.val', bar_holder ).text( bar_data['max'] );
37
37
 
38
38
  bar_level++;
39
- var total_width = Math.round( ( bar_data['total'] * max_width ) / bar_data['max'] );
40
- $( '.bar-total.bar', bar_holder ).width( Math.max( total_width, 1 ) );
39
+ $( '.bar-total.bar', bar_holder ).width( new String( (bar_data['total']/bar_data['max'])*100 ) + '%' );
41
40
  $( '.bar-total.val', bar_holder ).text( bar_data['total'] );
42
41
 
43
42
  if( bar_data['used'] )
44
43
  {
45
44
  bar_level++;
46
- var used_width = Math.round( ( bar_data['used'] * max_width ) / bar_data['max'] );
47
- $( '.bar-used.bar', bar_holder ).width( Math.min( used_width, total_width - 1 ) );
45
+ $( '.bar-used.bar', bar_holder ).width( new String( (bar_data['used']/bar_data['total'])*100 ) + '%' );
48
46
  $( '.bar-used.val', bar_holder ).text( bar_data['used'] );
49
47
  }
50
48
 
@@ -233,7 +231,7 @@ sammy.get
233
231
 
234
232
  var data = {
235
233
  'start_time' : app.dashboard_values['jvm']['jmx']['startTime'],
236
- 'host' : app.dashboard_values['core']['host'],
234
+ 'host' : app.dashboard_values['core']['host'] || '-',
237
235
  'dir_instance' : app.dashboard_values['core']['directory']['instance'],
238
236
  'dir_data' : app.dashboard_values['core']['directory']['data'],
239
237
  'dir_index' : app.dashboard_values['core']['directory']['index'],
@@ -318,6 +318,14 @@ var load_logging_viewer = function()
318
318
  {
319
319
  var doc = docs[i];
320
320
 
321
+ if( 1 === doc.time.length )
322
+ {
323
+ for( var key in doc )
324
+ {
325
+ doc[key] = doc[key][0];
326
+ }
327
+ }
328
+
321
329
  if( !doc.trace )
322
330
  {
323
331
  var lines = doc.message.split( "\n" );
@@ -206,7 +206,7 @@ var render_plugin_data = function( plugin_data, plugin_sort, types )
206
206
  }
207
207
 
208
208
  content += '<li class="' + classes.join( ' ' ) + '">' + "\n";
209
- content += '<a href="' + context_path + '?entry=' + bean.esc() + '">';
209
+ content += '<a href="' + context_path + '?entry=' + bean.esc() + '" data-bean="' + bean.esc() + '">';
210
210
  content += '<span>' + bean.esc() + '</span>';
211
211
  content += '</a>' + "\n";
212
212
  content += '<ul class="detail">' + "\n";
@@ -279,15 +279,55 @@ var render_plugin_data = function( plugin_data, plugin_sort, types )
279
279
  frame_element
280
280
  .html( content );
281
281
 
282
- $( 'a[href="' + decodeURIComponent( active_context.path ) + '"]', frame_element )
283
- .parent().addClass( 'expanded' );
282
+
283
+ var path = active_context.path.split( '?entry=' );
284
+ var entries = ( path[1] || '' ).split( ',' );
285
+
286
+ var entry_count = entries.length;
287
+ for( var i = 0; i < entry_count; i++ )
288
+ {
289
+ $( 'a[data-bean="' + entries[i] + '"]', frame_element )
290
+ .parent().addClass( 'expanded' );
291
+ }
292
+
293
+ $( 'a', frame_element )
294
+ .off( 'click' )
295
+ .on
296
+ (
297
+ 'click',
298
+ function( event )
299
+ {
300
+ var self = $( this );
301
+ var bean = self.data( 'bean' );
302
+
303
+ var split = '?entry=';
304
+ var path = active_context.path.split( split );
305
+ var entry = ( path[1] || '' );
306
+
307
+ var regex = new RegExp( bean.replace( /\//g, '\\/' ) + '(,|$)' );
308
+ var match = regex.test( entry );
309
+
310
+ var url = path[0] + split;
311
+
312
+ url += match
313
+ ? entry.replace( regex, '' )
314
+ : entry + ',' + bean;
315
+
316
+ url = url.replace( /=,/, '=' );
317
+ url = url.replace( /,$/, '' );
318
+ url = url.replace( /\?entry=$/, '' );
319
+
320
+ active_context.redirect( url );
321
+ return false;
322
+ }
323
+ );
284
324
 
285
325
  // Try to make links for anything with http (but leave the rest alone)
286
326
  $( '.detail dd' ).each(function(index) {
287
327
  var txt = $(this).html();
288
328
  if(txt.indexOf("http") >= 0) {
289
329
  $(this).linker({
290
- className : 'linker',
330
+ className : 'linker'
291
331
  });
292
332
  }
293
333
  });
@@ -382,7 +422,7 @@ sammy.bind
382
422
  // #/:core/plugins/$type
383
423
  sammy.get
384
424
  (
385
- /^#\/([\w\d-]+)\/(plugins)\/(\w+)$/,
425
+ new RegExp( app.core_regex_base + '\\/(plugins)\\/(\\w+)$' ),
386
426
  function( context )
387
427
  {
388
428
  core_basepath = this.active_core.attr( 'data-basepath' );
@@ -405,7 +445,7 @@ sammy.get
405
445
  // #/:core/plugins
406
446
  sammy.get
407
447
  (
408
- /^#\/([\w\d-]+)\/(plugins)$/,
448
+ new RegExp( app.core_regex_base + '\\/(plugins)$' ),
409
449
  function( context )
410
450
  {
411
451
  core_basepath = this.active_core.attr( 'data-basepath' );
@@ -423,4 +463,4 @@ sammy.get
423
463
  }
424
464
  );
425
465
  }
426
- );
466
+ );
@@ -18,7 +18,7 @@
18
18
  // #/:core/query
19
19
  sammy.get
20
20
  (
21
- /^#\/([\w\d-]+)\/(query)$/,
21
+ new RegExp( app.core_regex_base + '\\/(query)$' ),
22
22
  function( context )
23
23
  {
24
24
  var core_basepath = this.active_core.attr( 'data-basepath' );
@@ -36,7 +36,7 @@ sammy.get
36
36
  var query_form = $( '#form form', query_element );
37
37
  var url_element = $( '#url', query_element );
38
38
  var result_element = $( '#result', query_element );
39
- var response_element = $( '#response iframe', result_element );
39
+ var response_element = $( '#response', result_element );
40
40
 
41
41
  url_element
42
42
  .die( 'change' )
@@ -45,40 +45,49 @@ sammy.get
45
45
  'change',
46
46
  function( event )
47
47
  {
48
- var check_iframe_ready_state = function()
49
- {
50
- var iframe_element = response_element.get(0).contentWindow.document || response_element.get(0).document;
48
+ var wt = $( '[name="wt"]', query_form ).val();
51
49
 
52
- if( !iframe_element )
53
- {
54
- console.debug( 'no iframe_element found', response_element );
55
- return false;
56
- }
50
+ var content_generator = {
57
51
 
58
- url_element
59
- .addClass( 'loader' );
52
+ _default : function( xhr )
53
+ {
54
+ return xhr.responseText.esc();
55
+ },
60
56
 
61
- if( 'complete' === iframe_element.readyState )
57
+ json : function( xhr )
62
58
  {
63
- url_element
64
- .removeClass( 'loader' );
59
+ return app.format_json( xhr.responseText );
65
60
  }
66
- else
61
+
62
+ };
63
+
64
+ $.ajax
65
+ (
67
66
  {
68
- window.setTimeout( check_iframe_ready_state, 100 );
67
+ url : this.href,
68
+ dataType : wt,
69
+ context : response_element,
70
+ beforeSend : function( xhr, settings )
71
+ {
72
+ this
73
+ .html( '<div class="loader">Loading ...</div>' );
74
+ },
75
+ complete : function( xhr, text_status )
76
+ {
77
+ var code = $(
78
+ '<pre class="syntax language-' + wt + '"><code>' +
79
+ ( content_generator[wt] || content_generator['_default'] )( xhr ) +
80
+ '</code></pre>'
81
+ );
82
+ this.html( code );
83
+
84
+ if( 'success' === text_status )
85
+ {
86
+ hljs.highlightBlock( code.get(0) );
87
+ }
88
+ }
69
89
  }
70
- }
71
- check_iframe_ready_state();
72
-
73
- response_element
74
- .attr( 'src', this.href );
75
-
76
- if( !response_element.hasClass( 'resized' ) )
77
- {
78
- response_element
79
- .addClass( 'resized' )
80
- .css( 'height', $( '#main' ).height() - 60 );
81
- }
90
+ );
82
91
  }
83
92
  )
84
93
 
@@ -104,27 +113,38 @@ sammy.get
104
113
  'submit',
105
114
  function( event )
106
115
  {
107
- var form_map = {};
108
116
  var form_values = [];
109
- var all_form_values = query_form.formToArray();
110
-
111
- for( var i = 0; i < all_form_values.length; i++ )
117
+
118
+ var add_to_form_values = function add_to_form_values( fields )
112
119
  {
113
- if( !all_form_values[i].value || 0 === all_form_values[i].value.length )
114
- {
115
- continue;
116
- }
117
-
118
- var name_parts = all_form_values[i].name.split( '.' );
119
- if( 1 < name_parts.length && !form_map[name_parts[0]] )
120
- {
121
- console.debug( 'skip "' + all_form_values[i].name + '", parent missing' );
122
- continue;
123
- }
124
-
125
- form_map[all_form_values[i].name] = all_form_values[i].value;
126
- form_values.push( all_form_values[i] );
127
- }
120
+ for( var i in fields )
121
+ {
122
+ if( !fields[i].value || 0 === fields[i].value.length )
123
+ {
124
+ continue;
125
+ }
126
+
127
+ form_values.push( fields[i] );
128
+ }
129
+ };
130
+
131
+ var fieldsets = $( '> fieldset', query_form );
132
+
133
+ var fields = fieldsets.first().formToArray();
134
+ add_to_form_values( fields );
135
+
136
+ fieldsets.not( '.common' )
137
+ .each
138
+ (
139
+ function( i, set )
140
+ {
141
+ if( $( 'legend input', set ).is( ':checked' ) )
142
+ {
143
+ var fields = $( set ).formToArray();
144
+ add_to_form_values( fields );
145
+ }
146
+ }
147
+ );
128
148
 
129
149
  var handler_path = $( '#qt', query_form ).val();
130
150
  if( '/' !== handler_path[0] )
@@ -135,7 +155,13 @@ sammy.get
135
155
 
136
156
  var query_url = window.location.protocol + '//' + window.location.host
137
157
  + core_basepath + handler_path + '?' + $.param( form_values );
138
-
158
+
159
+ var custom_parameters = $( '#custom_parameters', query_form ).val();
160
+ if( custom_parameters && 0 !== custom_parameters.length )
161
+ {
162
+ query_url += '&' + custom_parameters.replace( /^&/, '' );
163
+ }
164
+
139
165
  url_element
140
166
  .attr( 'href', query_url )
141
167
  .text( query_url )
@@ -22,49 +22,6 @@ var core_basepath = null;
22
22
  var navigation_element = null;
23
23
  var replication_element = null;
24
24
 
25
- var convert_duration_to_seconds = function( str )
26
- {
27
- var ret = 0;
28
- var parts = new String( str ).split( ':' ).reverse();
29
- var parts_count = parts.length;
30
-
31
- for( var i = 0; i < parts_count; i++ )
32
- {
33
- ret += parseInt( parts[i], 10 ) * Math.pow( 60, i );
34
- }
35
-
36
- return ret;
37
- }
38
-
39
- var convert_seconds_to_readable_time = function( value )
40
- {
41
- var text = [];
42
- value = parseInt( value );
43
-
44
- var minutes = Math.floor( value / 60 );
45
- var hours = Math.floor( minutes / 60 );
46
-
47
- if( 0 !== hours )
48
- {
49
- text.push( hours + 'h' );
50
- value -= hours * 60 * 60;
51
- minutes -= hours * 60;
52
- }
53
-
54
- if( 0 !== minutes )
55
- {
56
- text.push( minutes + 'm' );
57
- value -= minutes * 60;
58
- }
59
-
60
- if( 0 !== value )
61
- {
62
- text.push( value + 's' );
63
- }
64
-
65
- return text.join( ' ' );
66
- }
67
-
68
25
  var init_timer = function( next_tick )
69
26
  {
70
27
  if( timer_timeout )
@@ -83,7 +40,7 @@ var update_timer = function( next_tick )
83
40
  }
84
41
 
85
42
  $( 'p .tick', timer_element )
86
- .text( convert_seconds_to_readable_time( next_tick ) );
43
+ .text( app.convert_seconds_to_readable_time( next_tick ) );
87
44
 
88
45
  timer_timeout = window.setTimeout
89
46
  (
@@ -151,7 +108,7 @@ var replication_fetch_status = function()
151
108
 
152
109
  var eta_element = $( '#eta', progress_element );
153
110
  $( 'span', eta_element )
154
- .text( convert_seconds_to_readable_time( data.slave.timeRemaining ) );
111
+ .text( app.convert_seconds_to_readable_time( data.slave.timeRemaining ) );
155
112
 
156
113
  var bar_element = $( '#bar', progress_element );
157
114
  $( '.files span', bar_element )
@@ -394,7 +351,7 @@ var replication_fetch_status = function()
394
351
  timer_element = $( '.timer', navigation_element );
395
352
  approx_element = $( '.approx', timer_element );
396
353
 
397
- var next_tick = convert_duration_to_seconds( data.slave.pollInterval );
354
+ var next_tick = app.convert_duration_to_seconds( data.slave.pollInterval );
398
355
  approx_element.show();
399
356
 
400
357
  if( data.slave.nextExecutionAt )
@@ -490,7 +447,7 @@ var replication_fetch_status = function()
490
447
  // #/:core/replication
491
448
  sammy.get
492
449
  (
493
- /^#\/([\w\d-]+)\/(replication)$/,
450
+ new RegExp( app.core_regex_base + '\\/(replication)$' ),
494
451
  function( context )
495
452
  {
496
453
  core_basepath = this.active_core.attr( 'data-basepath' );
@@ -115,7 +115,7 @@ var load_terminfo = function( trigger_element, core_basepath, field, data_elemen
115
115
  + '<ul>' + "\n";
116
116
  }
117
117
 
118
- var target = '#/' + current_core + '/query?q=' + field.esc() + ':' + encodeURIComponent( topterms[i] );
118
+ var target = '#/' + current_core + '/query?q=' + field.esc() + ':' + encodeURIComponent( '"' + topterms[i] + '"' );
119
119
  topterms_content += '<li><a href="' + target + '">' + topterms[i].esc() + '</a></li>' + "\n";
120
120
  }
121
121
 
@@ -267,19 +267,23 @@ sammy.bind
267
267
  if( 'field' === type )
268
268
  {
269
269
  navigation_data.fields.push( value );
270
- navigation_data.types.push( app.schema_browser_data.relations.f_t[value] );
270
+
271
+ if( app.schema_browser_data.relations.f_t[value] )
272
+ {
273
+ navigation_data.types.push( app.schema_browser_data.relations.f_t[value] );
274
+ }
271
275
 
272
276
  if( app.schema_browser_data.relations.f_df[value] )
273
277
  {
274
278
  navigation_data.dynamic_fields.push( app.schema_browser_data.relations.f_df[value] );
275
279
  }
276
280
 
277
- if( 0 !== app.schema_browser_data.fields[value].copySources.length )
281
+ if( app.schema_browser_data.fields[value].copySources && 0 !== app.schema_browser_data.fields[value].copySources.length )
278
282
  {
279
283
  navigation_data.copyfield_source = app.schema_browser_data.fields[value].copySources;
280
284
  }
281
285
 
282
- if( 0 !== app.schema_browser_data.fields[value].copyDests.length )
286
+ if( app.schema_browser_data.fields[value].copyDests && 0 !== app.schema_browser_data.fields[value].copyDests.length )
283
287
  {
284
288
  navigation_data.copyfield_dest = app.schema_browser_data.fields[value].copyDests;
285
289
  }
@@ -490,30 +494,39 @@ sammy.bind
490
494
 
491
495
  for( var field in app.schema_browser_data.fields )
492
496
  {
493
- app.schema_browser_data.fields[field].copySourcesRaw = null;
494
-
495
- if( app.schema_browser_data.fields[field].copySources &&
496
- 0 !== app.schema_browser_data.fields[field].copySources.length )
497
+ var copy_dests = app.schema_browser_data.fields[field].copyDests;
498
+ for( var i in copy_dests )
497
499
  {
498
- app.schema_browser_data.fields[field].copySourcesRaw =
499
- app.schema_browser_data.fields[field].copySources;
500
+ var copy_dest = copy_dests[i];
501
+ if( !app.schema_browser_data.fields[copy_dest] )
502
+ {
503
+ app.schema_browser_data.fields[copy_dest] = {
504
+ partial : true,
505
+ copySources : []
506
+ };
507
+ }
508
+
509
+ if( app.schema_browser_data.fields[copy_dest].partial )
510
+ {
511
+ app.schema_browser_data.fields[copy_dest].copySources.push( field );
512
+ }
500
513
  }
501
-
502
- app.schema_browser_data.fields[field].copyDests = [];
503
- app.schema_browser_data.fields[field].copySources = [];
504
- }
505
514
 
506
- for( var field in app.schema_browser_data.fields )
507
- {
508
- if( app.schema_browser_data.fields[field].copySourcesRaw )
515
+ var copy_sources = app.schema_browser_data.fields[field].copySources;
516
+ for( var i in copy_sources )
509
517
  {
510
- var copy_sources = app.schema_browser_data.fields[field].copySourcesRaw;
511
- for( var i in copy_sources )
518
+ var copy_source = copy_sources[i];
519
+ if( !app.schema_browser_data.fields[copy_source] )
512
520
  {
513
- var target = copy_sources[i].replace( /^.+:(.+)\{.+$/, '$1' );
521
+ app.schema_browser_data.fields[copy_source] = {
522
+ partial : true,
523
+ copyDests : []
524
+ };
525
+ }
514
526
 
515
- app.schema_browser_data.fields[field].copySources.push( target );
516
- app.schema_browser_data.fields[target].copyDests.push( field );
527
+ if( app.schema_browser_data.fields[copy_source].partial )
528
+ {
529
+ app.schema_browser_data.fields[copy_source].copyDests.push( field );
517
530
  }
518
531
  }
519
532
 
@@ -665,7 +678,7 @@ sammy.bind
665
678
  // #/:core/schema-browser
666
679
  sammy.get
667
680
  (
668
- /^#\/([\w\d-]+)\/(schema-browser)$/,
681
+ new RegExp( app.core_regex_base + '\\/(schema-browser)$' ),
669
682
  function( context )
670
683
  {
671
684
  var core_basepath = this.active_core.attr( 'data-basepath' );
@@ -763,6 +776,16 @@ sammy.get
763
776
  }
764
777
  $( '.name', head_element ).html( field.esc() );
765
778
 
779
+
780
+ var partial_state = false;
781
+ if( is_f )
782
+ {
783
+ partial_state = !!schema_browser_data.fields[field].partial;
784
+ }
785
+
786
+ $( '.partial', data_element )
787
+ .toggle( partial_state );
788
+
766
789
  // -- properties
767
790
  var properties_element = $( 'dt.properties', options_element );
768
791
  if( flags )