sinatra-hexacta 0.8.1 → 0.8.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1ad5538fd84652a893cfd5558b33fe7c5ce61fb52847c6ab9368ca34ce22479b
4
- data.tar.gz: a762b60ae1fc61b22ca12feeb8ea3badfab646e7fd9ee80624e12bfe97bd19fe
3
+ metadata.gz: ad4cb12cd628024ed6e4e738e18c9f436d6ad725ce069f0cf9711a2ff8dcadcb
4
+ data.tar.gz: 682a9a782840a2a23f265a93a8417240d3fab31a8fbffb20cb53260966545412
5
5
  SHA512:
6
- metadata.gz: bbac8da74bbd92c84af23a43c38969368b992199b23097259c1ad7ed5939f65391f17023dfdb2132fbea9e19a1895712580400eea08af344de8a21a34e6fc76c
7
- data.tar.gz: 1c432e57128475e51fd688ebbb5c203cae28e6c9ec0fb2f7663c51868b7d1c299e243cfcf913bb0bd1f5f29e1e4d0f7a5516491521561790ef8494503d47203c
6
+ metadata.gz: fc836bea599b405ff3107e60050be60af7be679d267060795e9e62631b4a5770a58ee073b69e3e5e35ba6274cc26d1ecfd2cee46b8b2f967d9346996ab04dfea
7
+ data.tar.gz: 4b04d40911507e384c655b0a21f89f87bbe02c48ae7a71c9fd15dd27a7a0ecb93b6cdaf60f360d50b6e5dec048cf4b78c5afc362bf0f8c3273cbc6f976e3ec27
@@ -56,6 +56,10 @@ class ProcessHandler
56
56
  @interrupted = true
57
57
  end
58
58
 
59
+ def interrupted?
60
+ @interrupted
61
+ end
62
+
59
63
  def running?
60
64
  @total != @performed
61
65
  end
@@ -9,16 +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
15
  post '/processes/:clazz' do |clazz|
16
16
  ProcessManager.instance.clean(clazz)
17
+ 200
17
18
  end
18
19
 
19
20
  post '/process' do
20
21
  klass = Object.const_get("#{params[:class]}")
21
- a_handler = ProcessManager.instance.run(klass)
22
+ a_handler = ProcessManager.instance.run(klass,params)
22
23
  a_handler.to_json
23
24
  end
24
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
+ }
@@ -1,127 +1,120 @@
1
- var pro_timeout = false;
2
-
3
1
  class ProcessManager {
4
2
 
5
- static start(clazz) {
3
+ static show(clazz) {
4
+ $("#processes").css("height","80px");
5
+ $("#processes .title").html(clazz);
6
+ }
6
7
 
8
+ static hide() {
9
+ $("#processes").css("height","0px");
7
10
  }
8
11
 
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
- });
12
+ static update(progress) {
13
+ if ($("#processes .progress").hasClass("active")) {
14
+ $("#processes .progress-bar").css("width",progress + "%");
15
+ }
22
16
  }
23
17
 
24
- static cleanProcess() {
18
+ static init() {
19
+ $("#processes .progress-bar").css("width","0%");
20
+ $("#processes .icon").addClass("rotating");
21
+ $("#processes .icon").removeClass("zmdi-check-circle").addClass("zmdi-settings");
22
+ $("#processes .progress").addClass("active");
23
+ $("#processes a").removeClass("hidden");
24
+ $("#processes .progress-bar").removeClass("progress-bar-success").removeClass("progress-bar-warning").removeClass("progress-bar-danger");
25
+ $("#processes .detail").html("Cargando...");
26
+ }
25
27
 
28
+ static complete() {
29
+ $("#processes .progress-bar").css("width","100%");
30
+ $("#processes .icon").removeClass("rotating");
31
+ $("#processes .icon").removeClass("zmdi-settings").addClass("zmdi-check-circle");
32
+ $("#processes a").addClass("hidden");
33
+ $("#processes .progress").removeClass("active");
34
+ $("#processes .progress-bar").addClass("progress-bar-success");
35
+ $("#processes .detail").html("Completado. Refresca la pantalla para actualizar la información.");
26
36
  }
27
37
 
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
+ static error() {
39
+ $("#processes .progress-bar").css("width","100%");
40
+ $("#processes .icon").removeClass("rotating");
41
+ $("#processes .icon").removeClass("zmdi-settings").addClass("zmdi-check-circle");
42
+ $("#processes a").addClass("hidden");
43
+ $("#processes .progress").removeClass("active");
44
+ $("#processes .progress-bar").addClass("progress-bar-danger");
45
+ $("#processes .detail").html("Ha ocurrido un error.");
38
46
  }
39
- }
40
47
 
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
+ static cancel() {
49
+ $("#processes .progress-bar").css("width","100%");
50
+ $("#processes .icon").removeClass("rotating");
51
+ $("#processes a").addClass("hidden");
52
+ $("#processes .progress").removeClass("active");
53
+ $("#processes .progress-bar").addClass("progress-bar-warning");
54
+ $("#processes .detail").html("Proceso cancelado. Refresca la pantalla para actualizar la información.");
55
+ }
48
56
 
49
- $('#header .results *').click(function() {
50
- clearTimeout(hide_results_timeout);
51
- $("#header input").focus();
52
- });
57
+ static start(clazz) {
58
+ $.ajax({
59
+ url: "/process",
60
+ type: 'POST',
61
+ data: { class : clazz },
62
+ success: function(result) {
63
+ ProcessManager.init();
64
+ },
65
+ error: function(error) {
66
+ ProcessManager.error();
67
+ }
53
68
  });
54
69
  }
55
70
 
56
- static do_find(url,query,html){
71
+ static start_with_map(clazz,map) {
72
+ map['class'] = clazz;
57
73
  $.ajax({
58
- url: url,
59
- type: 'GET',
60
- data: { query: query }
61
- }).done(function(result) {
62
- $(html).html(result);
74
+ url: "/process",
75
+ type: 'POST',
76
+ data: map,
77
+ success: function(result) {
78
+ ProcessManager.init();
79
+ },
80
+ error: function(error) {
81
+ ProcessManager.error();
82
+ }
63
83
  });
64
84
  }
65
- }
66
-
67
- var last_query = null;
68
- var header_input_timeout = null;
69
- $.xhrPool = [];
70
85
 
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);
86
+ static getProcesses(clazz) {
87
+ $.ajax({
88
+ url: "/processes",
89
+ type: 'GET',
90
+ data: { class : clazz },
91
+ success: function(result) {
92
+ if (result != "") {
93
+ if (result.progress >= 100.0) {
94
+ ProcessManager.complete()
95
+ ProcessManager.cleanProcess(clazz);
96
+ } else {
97
+ ProcessManager.show(result.name);
98
+ }
99
+ ProcessManager.update(result.progress);
79
100
  }
101
+ },
102
+ error: function(error) {
103
+ ProcessManager.error();
104
+ }
80
105
  });
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);
106
+ }
114
107
 
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);
108
+ static cleanProcess(clazz) {
109
+ $.ajax({
110
+ url: "/processes/" + clazz,
111
+ type: 'POST',
112
+ success: function(result) {
113
+ ProcessManager.cancel();
114
+ },
115
+ error: function(error) {
116
+ ProcessManager.error();
125
117
  }
126
- });
127
- });
118
+ });
119
+ }
120
+ }
@@ -0,0 +1,21 @@
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
+ a.lv-item.p-20.p-absolute style="right: 1%;z-index: 10;" role="button" onclick="clean_process();"
5
+ .media
6
+ .pull-right
7
+ i.zmdi.zmdi-hc-3x.zmdi-close-circle.c-white
8
+ .progress-bar aria-valuemax="100" aria-valuemin="0" aria-valuenow="0" role="progressbar" style="width: 0%;text-align:left;"
9
+ .lv-item.p-20.p-absolute
10
+ .media
11
+ .pull-left
12
+ i.zmdi.zmdi-hc-3x.zmdi-settings.c-white.rotating.icon
13
+ .media-body
14
+ .lv-title.c-white.title
15
+ small.lv-small.c-white.detail Espera por favor...
16
+
17
+
18
+ javascript:
19
+ function clean_process() {
20
+ console.log("Override 'clean_process' function");
21
+ }
@@ -29,7 +29,7 @@ link href="/sinatra-hexacta/vendors/daterangepicker/daterangepicker.css" rel="st
29
29
  link href="/sinatra-hexacta/vendors/fullcalendar/main.min.css" rel="stylesheet"
30
30
 
31
31
  /year calendar
32
- link href="/vendors/bootstrap-year-calendar/bootstrap-year-calendar.min.css" rel="stylesheet"
32
+ link href="/sinatra-hexacta/vendors/bootstrap-year-calendar/bootstrap-year-calendar.min.css" rel="stylesheet"
33
33
 
34
34
  /general app
35
35
  link href="/sinatra-hexacta/css/app.min.1.css?version=#{settings.version}" rel="stylesheet"
@@ -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.8.1
4
+ version: 0.8.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marco Zanger
@@ -125,6 +125,7 @@ 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
@@ -175,6 +176,7 @@ files:
175
176
  - lib/sinatra/views/alerts/empty.slim
176
177
  - lib/sinatra/views/alerts/error.slim
177
178
  - lib/sinatra/views/alerts/info.slim
179
+ - lib/sinatra/views/alerts/process.slim
178
180
  - lib/sinatra/views/alerts/success.slim
179
181
  - lib/sinatra/views/alerts/warning.slim
180
182
  - lib/sinatra/views/charts/bar.slim