logster 1.0.0.1.pre → 1.0.0.2.pre

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 61f47abbc311aa0681ec797bd82093f4c67c08f2
4
- data.tar.gz: 4187197be685df588db99d9486ce8b21f99980fa
3
+ metadata.gz: ca080e050a25ec3db7b60dfeef4ce6c8213913f4
4
+ data.tar.gz: 38163a53a02569490d915c61268e66ac0da57aa5
5
5
  SHA512:
6
- metadata.gz: 7823771d0780a663fffd5aa00983989e92acfba73413bc302b1f5b5cd7f5ba5bdd93803b3b556290328a28ddc177df825d2daafd228434c5ae682ac7e2e6dc81
7
- data.tar.gz: f3122989520139c52289b6bc1ff715462bcb75aa8b052f705b5c425cf08d04709015a6be7b05d1f49c930006afa7180c6cd3b346f9724cc114a596b5e63a2f4e
6
+ metadata.gz: 9a4e97530243f27b597072caeaab8fb3d9fbb7457fc43bea46c05861ab0d0c97e7ee3345583a460aa4afab18e1dc56f4f637fb124b65f242ac634f62313661a3
7
+ data.tar.gz: 800b158cf5d0af6568a2af1bcf9305b5bd8c06ddf19bea251cf74467dea1c6be874caa48d47c425b67b3bd1af3e5ed452a9716075c3a18120e6982020349c1b4
Binary file
@@ -231,7 +231,13 @@ App.MessageCollection = Em.Object.extend({
231
231
  message.set('selected', true);
232
232
  this.set('currentMessage', message);
233
233
  } else {
234
- this.set('currentMessage', null);
234
+ if (this.get('total') > 0) {
235
+ message = messages[0];
236
+ message.set('selected', true);
237
+ this.set('currentMessage', message);
238
+ } else {
239
+ this.reload();
240
+ }
235
241
  }
236
242
 
237
243
  },
@@ -283,6 +289,9 @@ App.MessageCollection = Em.Object.extend({
283
289
  });
284
290
  });
285
291
  messages.addObjects(newRows);
292
+ if (newRows.length > 0) {
293
+ App.increaseTitleCount(newRows.length);
294
+ }
286
295
  }
287
296
  }
288
297
  self.set("total", data.total);
@@ -351,12 +360,20 @@ App.MessageCollection = Em.Object.extend({
351
360
  }
352
361
  });
353
362
 
363
+ App.resetTitleCount = function() {
364
+ App.titleCount = 0;
365
+ document.title = App.title || document.title;
366
+ };
354
367
 
355
368
  (function(){
369
+ var hiddenProperty;
370
+ var visibilitychange;
371
+
356
372
  $.each(["","webkit","ms","moz","ms"], function(index, prefix){
357
373
  var check = prefix + (prefix === "" ? "hidden" : "Hidden");
358
- if(document[check] !== undefined ){
374
+ if(document[check] !== undefined && !hiddenProperty ){
359
375
  hiddenProperty = check;
376
+ visibilitychange = prefix + "visibilitychange";
360
377
  }
361
378
  });
362
379
 
@@ -367,8 +384,27 @@ App.MessageCollection = Em.Object.extend({
367
384
  return !document.hasFocus;
368
385
  }
369
386
  };
387
+
388
+ console.log(visibilitychange);
389
+ document.addEventListener(visibilitychange, function(){
390
+ console.log("BLA +" + App.isHidden());
391
+ if (!App.isHidden()) {
392
+ App.resetTitleCount();
393
+ }
394
+ }, false);
370
395
  })();
371
396
 
397
+
398
+ App.increaseTitleCount = function(increment){
399
+ if (!App.isHidden()){
400
+ return;
401
+ }
402
+ App.title = App.title || document.title;
403
+ App.titleCount = App.titleCount || 0;
404
+ App.titleCount += increment;
405
+ document.title = App.title + " (" + App.titleCount + ")";
406
+ };
407
+
372
408
  App.IndexRoute = Em.Route.extend({
373
409
  model: function(){
374
410
  // TODO from preload json?
@@ -389,12 +425,27 @@ App.IndexRoute = Em.Route.extend({
389
425
  model.reload();
390
426
 
391
427
  var times = 0;
428
+ var backoff = 1;
429
+
392
430
  this.refreshInterval = setInterval(function(){
393
431
  times += 1;
432
+ var hidden = App.isHidden();
433
+ var load = !hidden;
434
+
435
+ if (hidden) {
436
+ if (times % backoff === 0) {
437
+ load = true;
438
+ if (backoff<20) { backoff++; }
439
+ }
440
+ }
394
441
  // refresh a lot less aggressively in background
395
- if (!App.isHidden() || (times % 20 === 0)) {
442
+ if (load) {
396
443
  model.loadMore();
444
+ if (!hidden) {
445
+ backoff = 1;
446
+ }
397
447
  }
448
+
398
449
  }, 3000);
399
450
  },
400
451
 
@@ -1,6 +1,6 @@
1
1
  module Logster
2
2
  class Configuration
3
- attr_accessor :current_context, :allow_grouping, :environments, :application_version
3
+ attr_accessor :current_context, :allow_grouping, :environments, :application_version, :web_title
4
4
  attr_writer :subdirectory
5
5
 
6
6
  def initialize
@@ -29,7 +29,7 @@ module Logster
29
29
 
30
30
  if resource = resolve_path(path)
31
31
 
32
- if resource =~ /\.js$|\.handlebars$|\.css$|\.woff$|\.ttf$|\.woff2$|\.svg$|\.otf$|\.eot$/
32
+ if resource =~ /\.ico$|\.js$|\.handlebars$|\.css$|\.woff$|\.ttf$|\.woff2$|\.svg$|\.otf$|\.eot$/
33
33
  env[PATH_INFO] = resource
34
34
  # accl redirect is going to be trouble, ensure its bypassed
35
35
  env['sendfile.type'] = ''
@@ -202,6 +202,8 @@ JS
202
202
  <!doctype html>
203
203
  <html>
204
204
  <head>
205
+ <link rel="shortcut icon" href="#{@logs_path}/images/favicon.ico">
206
+ <title>#{Logster.config.web_title || "Logs"}</title>
205
207
  <link href='//fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'>
206
208
  <link href='//fonts.googleapis.com/css?family=Roboto+Mono' rel='stylesheet' type='text/css'>
207
209
  #{css("app.css")}
@@ -1,3 +1,3 @@
1
1
  module Logster
2
- VERSION = "1.0.0.1.pre"
2
+ VERSION = "1.0.0.2.pre"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logster
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.1.pre
4
+ version: 1.0.0.2.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - UI for viewing logs in Rack
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-18 00:00:00.000000000 Z
11
+ date: 2015-08-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -113,6 +113,7 @@ files:
113
113
  - assets/fonts/fontawesome-webfont.ttf
114
114
  - assets/fonts/fontawesome-webfont.woff
115
115
  - assets/fonts/fontawesome-webfont.woff2
116
+ - assets/images/favicon.ico
116
117
  - assets/images/logster-apple-touch.png
117
118
  - assets/images/logster-favicon.png
118
119
  - assets/images/logster-logo.png