sinatra-hexacta 0.7.2 → 0.8.5

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: 115ee19675f4a6656e5cc4ccfc255843554df41d75ed555ccfabb995db36c881
4
- data.tar.gz: 7806d95f9d62eee4aac7d9d0ee4126967949034de13249991eff6e251c8f03ab
3
+ metadata.gz: 6d6be02726f449dec366288a8e986cf950a350412e36138a0081faae3de4d85f
4
+ data.tar.gz: 4f7dcaeb8123ec8154b38a668cfb02205f44809583dd4d0eb39ee7dabcd447e7
5
5
  SHA512:
6
- metadata.gz: 2d563c5d7667db660e12dd701fc1f4d4e5d1eea5601bb24aad493e0f4d68d4f1f31a2ac821a445353c5e3973c062db63169b9a101c0b85414cc3b8ae82e10ef1
7
- data.tar.gz: c80381ecdc7dd61517190c4681a3783d5780da3789d80dae322b8faa707204fdcc6314eb912e9ae816cb80dd680efe78c48f90bba20e650e643c6ec3cddea68b
6
+ metadata.gz: f343d242e5d4683f1ef4a6e218024125b2095bb12f3245e18ec0f4d2288497b6b686bfa4815dca14ddeef452733e76339b214e61c78dd13ec8a7755cea896667
7
+ data.tar.gz: 856b37635174175a17585071b60b5ac3151db247327afd8a44720876319cf0e2b5653209e1574756bbe25d1ae8a9659ab38074dc5330e2c4bd25618d107764b6
@@ -6,4 +6,4 @@ require_relative 'mailsender'
6
6
  require_relative 'mail'
7
7
  require_relative 'generalmail'
8
8
  require_relative 'mailbuilder'
9
- #require_relative 'processmanager'
9
+ require_relative 'processmanager'
@@ -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
@@ -3,4 +3,4 @@ require_relative 'errors'
3
3
  require_relative 'notifications'
4
4
  require_relative 'params'
5
5
  require_relative 'reports'
6
- #require_relative 'processes'
6
+ require_relative 'processes'
@@ -9,15 +9,17 @@ module Sinatra
9
9
  get '/processes' do
10
10
  return "" if ProcessManager.instance.find(params[:class]).nil?
11
11
  content_type :json
12
- return { "progress" => ProcessManager.instance.find(params[:class]).progress }.to_json
12
+ return { 'name' => ProcessManager.instance.find(params[:class]).name, '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
+ 200
17
18
  end
18
19
 
19
20
  post '/process' do
20
- a_handler = ProcessManager.instance.run(params)
21
+ klass = Object.const_get("#{params[:class]}")
22
+ a_handler = ProcessManager.instance.run(klass,params)
21
23
  a_handler.to_json
22
24
  end
23
25
  end
@@ -23,6 +23,10 @@ module Sinatra
23
23
  slim "#{Hexacta::GEM_FILE_DIR}/alerts/error".to_sym, locals: option_hash
24
24
  end
25
25
 
26
+ def process_alert(option_hash)
27
+ slim "#{Hexacta::GEM_FILE_DIR}/alerts/process".to_sym, locals: option_hash
28
+ end
29
+
26
30
  setup_dir("/app/views/#{Hexacta::GEM_FILE_DIR}/alerts")
27
31
  copy_all_files("/lib/sinatra/views/alerts","/app/views/#{Hexacta::GEM_FILE_DIR}/alerts")
28
32
  end
@@ -16387,3 +16387,39 @@ svg.ct-chart-bar, svg.ct-chart-line{
16387
16387
  0% { width: 0; }
16388
16388
  100% { width: 100%; }
16389
16389
  }
16390
+
16391
+ @-webkit-keyframes rotating /* Safari and Chrome */ {
16392
+ from {
16393
+ -webkit-transform: rotate(0deg);
16394
+ -o-transform: rotate(0deg);
16395
+ transform: rotate(0deg);
16396
+ }
16397
+ to {
16398
+ -webkit-transform: rotate(360deg);
16399
+ -o-transform: rotate(360deg);
16400
+ transform: rotate(360deg);
16401
+ }
16402
+ }
16403
+ @keyframes rotating {
16404
+ from {
16405
+ -ms-transform: rotate(0deg);
16406
+ -moz-transform: rotate(0deg);
16407
+ -webkit-transform: rotate(0deg);
16408
+ -o-transform: rotate(0deg);
16409
+ transform: rotate(0deg);
16410
+ }
16411
+ to {
16412
+ -ms-transform: rotate(360deg);
16413
+ -moz-transform: rotate(360deg);
16414
+ -webkit-transform: rotate(360deg);
16415
+ -o-transform: rotate(360deg);
16416
+ transform: rotate(360deg);
16417
+ }
16418
+ }
16419
+ .rotating {
16420
+ -webkit-animation: rotating 2s linear infinite;
16421
+ -moz-animation: rotating 2s linear infinite;
16422
+ -ms-animation: rotating 2s linear infinite;
16423
+ -o-animation: rotating 2s linear infinite;
16424
+ animation: rotating 2s linear infinite;
16425
+ }
@@ -0,0 +1,87 @@
1
+ class ProcessManager {
2
+
3
+ static show(clazz) {
4
+ $("#processes").css("height","80px");
5
+ $("#processes .title").html(clazz);
6
+ }
7
+
8
+ static hide() {
9
+ $("#processes").css("height","0px");
10
+ }
11
+
12
+ static update(progress) {
13
+ $("#processes .progress-bar").css("width",progress + "%");
14
+ }
15
+
16
+ static complete() {
17
+ $("#processes .progress-bar").css("width","100%");
18
+ $("#processes .rotating").removeClass("rotating");
19
+ $("#processes .zmdi").removeClass("zmdi-settings").addClass("zmdi-check-circle");
20
+ $("#processes .progress").removeClass("active");
21
+ $("#processes .progress-bar").addClass("progress-bar-success");
22
+ $("#processes .detail").html("Completado. Refresca la pantalla para actualizar la información.");
23
+ }
24
+
25
+ static start(clazz) {
26
+ $.ajax({
27
+ url: "/process",
28
+ type: 'POST',
29
+ data: { class : clazz },
30
+ success: function(result) {
31
+ ProcessManager.show('Cargando...');
32
+ ProcessManager.update(0);
33
+ },
34
+ error: function(error) {
35
+ }
36
+ });
37
+ }
38
+
39
+ static start_with_map(clazz,map) {
40
+ map['class'] = clazz;
41
+ $.ajax({
42
+ url: "/process",
43
+ type: 'POST',
44
+ data: map,
45
+ success: function(result) {
46
+ ProcessManager.show('Cargando...');
47
+ ProcessManager.update(0);
48
+ },
49
+ error: function(error) {
50
+ }
51
+ });
52
+ }
53
+
54
+ static getProcesses(clazz) {
55
+ $.ajax({
56
+ url: "/processes",
57
+ type: 'GET',
58
+ data: { class : clazz },
59
+ success: function(result) {
60
+ if (result != "") {
61
+ if (result.progress >= 100.0) {
62
+ //ProcessManager.hide();
63
+ ProcessManager.complete()
64
+ ProcessManager.cleanProcess(clazz);
65
+ } else {
66
+ ProcessManager.show(result.name);
67
+ }
68
+ ProcessManager.update(result.progress);
69
+
70
+ }
71
+ },
72
+ error: function(error) {
73
+ }
74
+ });
75
+ }
76
+
77
+ static cleanProcess(clazz) {
78
+ $.ajax({
79
+ url: "/processes/" + clazz,
80
+ type: 'POST',
81
+ success: function(result) {
82
+ },
83
+ error: function(error) {
84
+ }
85
+ });
86
+ }
87
+ }
@@ -0,0 +1,11 @@
1
+ .row#processes style="height:0px;overflow: hidden;-webkit-transition: all 0.5s ease-in-out;-o-transition: all 0.5s ease-in-out;transition: all 0.5s ease-in-out;"
2
+ .col-xs-12
3
+ .progress.progress-striped.active style="height:80px;"
4
+ .progress-bar aria-valuemax="100" aria-valuemin="0" aria-valuenow="0" role="progressbar" style="width: 0%;text-align:left;"
5
+ .lv-item.p-20.p-fixed
6
+ .media
7
+ .pull-left
8
+ i.zmdi.zmdi-hc-3x.zmdi-settings.c-white.rotating
9
+ .media-body
10
+ .lv-title.c-white.title
11
+ small.lv-small.c-white.detail Espera por favor...
@@ -8,3 +8,4 @@ script src="/sinatra-hexacta/vendors/chartist/chartist-plugin-legend.js"
8
8
 
9
9
  script src="/sinatra-hexacta/js/app.js?ver=#{settings.version}" type='text/javascript'
10
10
  script src="/sinatra-hexacta/js/finder.js?ver=#{settings.version}" type='text/javascript'
11
+ script src="/sinatra-hexacta/js/process.js?ver=#{settings.version}" type='text/javascript'
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.7.2
4
+ version: 0.8.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marco Zanger
@@ -125,10 +125,12 @@ files:
125
125
  - lib/sinatra/public/fonts/roboto/Roboto-Thin-webfont.ttf
126
126
  - lib/sinatra/public/fonts/roboto/Roboto-Thin-webfont.woff
127
127
  - lib/sinatra/public/img/finder.jpg
128
+ - lib/sinatra/public/img/noimage.jpg
128
129
  - lib/sinatra/public/img/select.png
129
130
  - lib/sinatra/public/img/select@2x.png
130
131
  - lib/sinatra/public/js/app.js
131
132
  - lib/sinatra/public/js/finder.js
133
+ - lib/sinatra/public/js/process.js
132
134
  - lib/sinatra/public/vendors/animate.css/animate.min.css
133
135
  - lib/sinatra/public/vendors/bootstrap-validator/validator.js
134
136
  - lib/sinatra/public/vendors/bootstrap-year-calendar/bootstrap-year-calendar.es.js
@@ -174,6 +176,7 @@ files:
174
176
  - lib/sinatra/views/alerts/empty.slim
175
177
  - lib/sinatra/views/alerts/error.slim
176
178
  - lib/sinatra/views/alerts/info.slim
179
+ - lib/sinatra/views/alerts/process.slim
177
180
  - lib/sinatra/views/alerts/success.slim
178
181
  - lib/sinatra/views/alerts/warning.slim
179
182
  - lib/sinatra/views/charts/bar.slim