sinatra-hexacta 0.8.3 → 0.8.8

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: ede22a821385a22e70895f2e4983779a24b40018bcae60a04bb0041be745fda1
4
- data.tar.gz: f3e1be8a928f82adc9b053e86625e7f525c84ca752992ebdf557b050a2da1c36
3
+ metadata.gz: b0dd060b73a298d6478e00bcbb9bdc8d756941ea0f8bd4722f6fc1b5391d81e0
4
+ data.tar.gz: 3a52a4a4698b47f2f6f7fa5fcfced960744dba7e92c6e25e1d330986a89ed68a
5
5
  SHA512:
6
- metadata.gz: 4e7be98dc8b45776c71eab44679cd6f86e6fea7b59d8d905f8957c5370e0f9758a6ceb407501d56702c4185e9b33957d0c4c0266c91bf383e9be724a9284e5cb
7
- data.tar.gz: 8d6eaaae0a76bed3ddc5431f1c592ad9a68407ae9bd9ecd1b52302ea68feaf89198c6ed38691e8a5b93ab4aa374cfe742cc8b15ced4d724410c263f949aa68bd
6
+ metadata.gz: 030ceff7353e3653f0077dd2c0176fb6200c8a38db4d29a5f62f892c188f2a7165aff6e2949fb12cd864911dce32a51ccf59df6d5b2b9ca132372932cb213d08
7
+ data.tar.gz: a487d657ce41bf225bf1681bfb4948e328340b60482d4f8eca570dbf861bfbd09c8ba12e31422f026c6877ae1ca3ef8e8653a996ed2e1f086acd57548a9ae22c
@@ -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
@@ -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,133 @@
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) {
12
+ static update(progress) {
13
+ if ($("#processes .progress").hasClass("active")) {
14
+ $("#processes .progress-bar").css("width",progress + "%");
15
+ }
16
+ }
17
+
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
+ }
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.");
36
+ }
37
+
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.");
46
+ }
47
+
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
+ }
56
+
57
+ static start(clazz) {
58
+ ProcessManager.show(clazz);
10
59
  $.ajax({
11
- url: "/processes",
12
- type: 'GET',
60
+ url: "/process",
61
+ type: 'POST',
13
62
  data: { class : clazz },
14
63
  success: function(result) {
15
- if (result != "") {
16
- $("#processes ." + clazz + " .progress-bar").css("width",result.progress + "%");
17
- }
64
+ ProcessManager.init();
18
65
  },
19
66
  error: function(error) {
67
+ ProcessManager.error();
20
68
  }
21
69
  });
22
70
  }
23
71
 
24
- static cleanProcess() {
25
-
72
+ static start_with_map(clazz,map) {
73
+ ProcessManager.show(clazz);
74
+ map['class'] = clazz;
75
+ $.ajax({
76
+ url: "/process",
77
+ type: 'POST',
78
+ data: map,
79
+ success: function(result) {
80
+ ProcessManager.init();
81
+ },
82
+ error: function(error) {
83
+ ProcessManager.error();
84
+ }
85
+ });
26
86
  }
27
87
 
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);
88
+ static getProcesses(clazz) {
89
+ $.ajax({
90
+ url: "/processes",
91
+ type: 'GET',
92
+ data: { class : clazz },
93
+ success: function(result) {
94
+ if (result != "") {
95
+ ProcessManager.show(result.name);
96
+ if (result.progress >= 100.0) {
97
+ ProcessManager.completeProcess(clazz);
98
+ }
99
+ ProcessManager.update(result.progress);
35
100
  }
101
+ },
102
+ error: function(error) {
103
+ ProcessManager.error();
36
104
  }
37
- }, 5000);
105
+ });
38
106
  }
39
- }
40
107
 
41
- static find(query){
108
+ static completeProcess(clazz) {
42
109
  $.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
- });
110
+ url: "/processes/" + clazz,
111
+ type: 'POST',
112
+ success: function(result) {
113
+ ProcessManager.complete()
114
+ },
115
+ error: function(error) {
116
+ ProcessManager.error();
117
+ }
53
118
  });
54
119
  }
55
120
 
56
- static do_find(url,query,html){
121
+ static cleanProcess(clazz) {
57
122
  $.ajax({
58
- url: url,
59
- type: 'GET',
60
- data: { query: query }
61
- }).done(function(result) {
62
- $(html).html(result);
123
+ url: "/processes/" + clazz,
124
+ type: 'POST',
125
+ success: function(result) {
126
+ ProcessManager.cancel();
127
+ },
128
+ error: function(error) {
129
+ ProcessManager.error();
130
+ }
63
131
  });
64
132
  }
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
- });
133
+ }
@@ -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'
@@ -1,7 +1,7 @@
1
1
  a.lv-item style="padding:10px 15px;#{notification.pending?? 'background-color: #ECF9FF;' : ''}" role="button" onclick="#{notification.pending?? "read_notify(#{notification.id},'#{notification.link}');this.onclick=\'\'" : ''}" href="#{notification.pending?? '#' : notification.link}"
2
2
  .media
3
3
  .pull-left.text-center.p-r-15
4
- img.lv-img-sm alt="" src="#{Configuration::USER_PHOTO_URL}#{notification.creator.hxt_id}" title="#{notification.creator.full_name}"
4
+ img.lv-img-sm alt="" src="#{Configuration::USER_PHOTO_URL}#{notification.creator.hxt_id}" title="#{notification.creator.full_name}" onError="this.onerror=null;this.src='/sinatra-hexacta/img/noimage.jpg';"
5
5
  br
6
6
  -if notification.label == 'error'
7
7
  .btn.btn-link.bgm-red.btn-xs style="font-size:6pt" #{notification.label}
@@ -5,7 +5,7 @@
5
5
  .card-header
6
6
  .media
7
7
  .pull-left
8
- img.lv-img alt="" src="#{Configuration::USER_PHOTO_URL}#{notification.creator.hxt_id}" title="#{notification.creator.full_name}"
8
+ img.lv-img alt="" src="#{Configuration::USER_PHOTO_URL}#{notification.creator.hxt_id}" title="#{notification.creator.full_name}" onError="this.onerror=null;this.src='/sinatra-hexacta/img/noimage.jpg';"
9
9
  .media-body.m-t-5
10
10
  h2
11
11
  | #{notification.title}
@@ -10,7 +10,7 @@
10
10
  .col-xs-2
11
11
  .card.profile-view
12
12
  .pv-header.bgm-teal style="height:70px;"
13
- img.pv-main style="width: 100px;height: 100px;bottom: -50px;margin-left: -50px;" alt="" src="#{Configuration::USER_PHOTO_URL}#{user.hxt_id}"
13
+ img.pv-main style="width: 100px;height: 100px;bottom: -50px;margin-left: -50px;" alt="" src="#{Configuration::USER_PHOTO_URL}#{user.hxt_id}" onError="this.onerror=null;this.src='/sinatra-hexacta/img/noimage.jpg';"
14
14
  .pv-body style="padding: 0 20px 10px;"
15
15
  h2 style="font-size:14px;font-weight: 500;"
16
16
  | #{user.first_name}
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.3
4
+ version: 0.8.8
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