sinatra-hexacta 0.8.0 → 0.8.1

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
  SHA256:
3
- metadata.gz: cf7bd04016342bd07385c0cf5563cedf741872fdc2a039bfff20fc79732b4c4a
4
- data.tar.gz: 49b06e855602b5adeb9388d70e68069b0e4224de01479fe90bb88c20589dde42
3
+ metadata.gz: 1ad5538fd84652a893cfd5558b33fe7c5ce61fb52847c6ab9368ca34ce22479b
4
+ data.tar.gz: a762b60ae1fc61b22ca12feeb8ea3badfab646e7fd9ee80624e12bfe97bd19fe
5
5
  SHA512:
6
- metadata.gz: 64fce926468323720435353eb1f08f95740a82fc38d277cd94a8b3e78e1099e110144a4c56140fea01a6daa05ef63cdd8752b5e586a469c62de93cb52eeeac17
7
- data.tar.gz: 48970007cb884898fa670d3e5ce984b2867570b0142c033df85e1919a850f9e0368bfe51d393d45e59a97f1bcc0e3c43193d51b7b3f35c55599727097f27435b
6
+ metadata.gz: bbac8da74bbd92c84af23a43c38969368b992199b23097259c1ad7ed5939f65391f17023dfdb2132fbea9e19a1895712580400eea08af344de8a21a34e6fc76c
7
+ data.tar.gz: 1c432e57128475e51fd688ebbb5c203cae28e6c9ec0fb2f7663c51868b7d1c299e243cfcf913bb0bd1f5f29e1e4d0f7a5516491521561790ef8494503d47203c
@@ -93,14 +93,14 @@ class ProcessManager
93
93
  end
94
94
 
95
95
  def clean(clazz)
96
- @handlers.select { |handler| !handler.running? }.each do |handler|
96
+ @handlers.select { |handler| handler.clazz == clazz }.each do |handler|
97
97
  handler.interrupt
98
98
  self.finish(handler)
99
99
  end
100
100
  end
101
101
 
102
102
  def running?(clazz)
103
- !@handlers.select { |handler| handler.clazz == clazz }.empty?;
103
+ !@handlers.select { |handler| handler.clazz == clazz }.empty?
104
104
  end
105
105
 
106
106
  end
@@ -12,8 +12,8 @@ module Sinatra
12
12
  return { "progress" => ProcessManager.instance.find(params[:class]).progress }.to_json
13
13
  end
14
14
 
15
- post '/processes/:id' do |id|
16
- ProcessManager.instance.interrupt(id)
15
+ post '/processes/:clazz' do |clazz|
16
+ ProcessManager.instance.clean(clazz)
17
17
  end
18
18
 
19
19
  post '/process' do
@@ -0,0 +1,127 @@
1
+ var pro_timeout = false;
2
+
3
+ class ProcessManager {
4
+
5
+ static start(clazz) {
6
+
7
+ }
8
+
9
+ static getProcesses(clazz) {
10
+ $.ajax({
11
+ url: "/processes",
12
+ type: 'GET',
13
+ data: { class : clazz },
14
+ success: function(result) {
15
+ if (result != "") {
16
+ $("#processes ." + clazz + " .progress-bar").css("width",result.progress + "%");
17
+ }
18
+ },
19
+ error: function(error) {
20
+ }
21
+ });
22
+ }
23
+
24
+ static cleanProcess() {
25
+
26
+ }
27
+
28
+ static monitor() {
29
+ this.#timeout = setTimeout(function() {
30
+ $.xhrPool.abortAll();
31
+ if (last_query != $.trim($('#header input').val())) {
32
+ last_query = $.trim($('#header input').val());
33
+ if (last_query.length > 2) {
34
+ Finder.find(last_query);
35
+ }
36
+ }
37
+ }, 5000);
38
+ }
39
+ }
40
+
41
+ static find(query){
42
+ $.ajax({
43
+ url: "/find",
44
+ type: 'GET',
45
+ data: { query: query }
46
+ }).done(function(result) {
47
+ $("#header .results").html(result);
48
+
49
+ $('#header .results *').click(function() {
50
+ clearTimeout(hide_results_timeout);
51
+ $("#header input").focus();
52
+ });
53
+ });
54
+ }
55
+
56
+ static do_find(url,query,html){
57
+ $.ajax({
58
+ url: url,
59
+ type: 'GET',
60
+ data: { query: query }
61
+ }).done(function(result) {
62
+ $(html).html(result);
63
+ });
64
+ }
65
+ }
66
+
67
+ var last_query = null;
68
+ var header_input_timeout = null;
69
+ $.xhrPool = [];
70
+
71
+ $.xhrPool.abortAll = function() {
72
+ $(this).each(function(idx, jqXHR) {
73
+ jqXHR.abort();
74
+ });
75
+ $(this).each(function(idx, jqXHR) {
76
+ var index = $.inArray(jqXHR, $.xhrPool);
77
+ if (index > -1) {
78
+ $.xhrPool.splice(index, 1);
79
+ }
80
+ });
81
+ };
82
+
83
+ $.ajaxSetup({
84
+ beforeSend: function(jqXHR) {
85
+ $.xhrPool.push(jqXHR);
86
+ },
87
+ complete: function(jqXHR) {
88
+ var index = $.inArray(jqXHR, $.xhrPool);
89
+ if (index > -1) {
90
+ $.xhrPool.splice(index, 1);
91
+ }
92
+ }
93
+ });
94
+
95
+ $(document).ready(function(){
96
+
97
+ $("#header input").focusin(function() {
98
+ $("#header .results").addClass("toggled");
99
+ })
100
+
101
+ $("#header input").focusout(function() {
102
+ hide_results_timeout = setTimeout(function() {
103
+ $("#header .results").removeClass("toggled");
104
+ },200);
105
+ });
106
+
107
+ $('#header .results *').click(function() {
108
+ clearTimeout(hide_results_timeout);
109
+ $("#header input").focus();
110
+ });
111
+
112
+ $('#header input').keyup(function() {
113
+ clearTimeout(header_input_timeout);
114
+
115
+ if($('#header input').val().length > 2 && $.trim($('#header input').val())) {
116
+ header_input_timeout = setTimeout(function() {
117
+ $.xhrPool.abortAll();
118
+ if (last_query != $.trim($('#header input').val())) {
119
+ last_query = $.trim($('#header input').val());
120
+ if (last_query.length > 2) {
121
+ Finder.find(last_query);
122
+ }
123
+ }
124
+ }, 1000);
125
+ }
126
+ });
127
+ });
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra-hexacta
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marco Zanger
@@ -129,6 +129,7 @@ files:
129
129
  - lib/sinatra/public/img/select@2x.png
130
130
  - lib/sinatra/public/js/app.js
131
131
  - lib/sinatra/public/js/finder.js
132
+ - lib/sinatra/public/js/process.js
132
133
  - lib/sinatra/public/vendors/animate.css/animate.min.css
133
134
  - lib/sinatra/public/vendors/bootstrap-validator/validator.js
134
135
  - lib/sinatra/public/vendors/bootstrap-year-calendar/bootstrap-year-calendar.es.js