pg_rails 7.0.8.pre.alpha.65 → 7.0.8.pre.alpha.66

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: c1b7d742107efb7bfdd00d458d0df8b298395702ae8aacaa1cf1ffe9083ca09e
4
- data.tar.gz: 2592e3ec5a153c28314bab3c754c86dfee514fe5cf308380bae1324e14167565
3
+ metadata.gz: 22e075226a1a3f478fb957532cf0a66735c0939bbc28d90ea8460efd97834b04
4
+ data.tar.gz: 663f0f7daca3e65246799a307347d6da6f41a4359d44f69a2dbd4946e74cbfee
5
5
  SHA512:
6
- metadata.gz: 1022d09e2a8fad3a7bca4cf92038ed521951daca564ecbca33c52c440cf565bd71758edbc7445f68e023c1eea4292647f50350f378675063912d1c3556a26030
7
- data.tar.gz: 10910645b466eeb4bcbaae5610977f4ed61fe4c5886e9562ac25d3a4970f3b9a3c2f3153843d0be3f3d69e2c829683f5b1178e1ed8bb2d56f770aae3b6a8724c
6
+ metadata.gz: e49655fe8d4c9ef567248726306857dafed3c77904f2ca618db39893d65000216b123501733159a417e7b90aee26f5a290de7462337f2506ad6d8526ad421c37
7
+ data.tar.gz: 58be8026d80ad0e6c16c357649847e62beb4ecf1432c974d57c12d1118b0dc063c884dfb7c47afd124905ac60dfb3a8270ce3bb1b64f54c1111ede038c41d335
@@ -34,6 +34,8 @@ module PgEngine
34
34
  obj
35
35
  end
36
36
  notify(mensaje, :error)
37
+ rescue StandardError => e
38
+ Rails.logger.error("ERROR al loguear error: #{e}")
37
39
  end
38
40
 
39
41
  def warn(obj, type = :error)
@@ -43,6 +45,8 @@ module PgEngine
43
45
  obj
44
46
  end
45
47
  notify(mensaje, type)
48
+ rescue StandardError => e
49
+ Rails.logger.error("ERROR al loguear error: #{e}")
46
50
  end
47
51
 
48
52
  private
@@ -1,10 +1,12 @@
1
1
  import consumer from '../channels/consumer'
2
2
  import CableReady from 'cable_ready'
3
+ import Rollbar from 'rollbar'
3
4
 
4
5
  const anycable = consumer.cable
5
6
 
6
7
  if (anycable) {
7
8
  anycable.on('connect', ev => {
9
+ document.head.dataset.cableConnected = true
8
10
  if (ev.reconnect) {
9
11
  console.log('Welcome back!')
10
12
  } else {
@@ -13,10 +15,14 @@ if (anycable) {
13
15
  })
14
16
 
15
17
  anycable.on('disconnect', ev => {
18
+ document.head.dataset.cableConnected = false
19
+ // document.head.dataset.cableDisconnectedEvent = ev
16
20
  if (ev.reason) {
21
+ Rollbar.warning(`Disconnected because: ${ev.reason}`)
17
22
  console.log(`Disconnected because: ${ev.reason}`)
18
23
  } else {
19
- console.log('Disconnected')
24
+ Rollbar.warning('Disconnected for unknown reason')
25
+ console.log('Disconnected for unknown reason')
20
26
  }
21
27
  })
22
28
  }
@@ -18,6 +18,46 @@ export function numberWithDots (x) {
18
18
  return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, '.')
19
19
  }
20
20
 
21
+ export function flashMessage (message, flashType = 'warning', toast = false) {
22
+ const el = document.createElement('div')
23
+ const toastClasses = toast ? 'position-absolute pg-toast' : ''
24
+ let iconClasses
25
+ let alertClassSuffix
26
+ switch (flashType) {
27
+ case 'critical':
28
+ iconClasses = 'bi bi-exclamation-triangle-fill me-3 fs-2'
29
+ alertClassSuffix = 'danger'
30
+ break
31
+ case 'alert':
32
+ iconClasses = 'bi bi-exclamation-triangle-fill me-2'
33
+ alertClassSuffix = 'danger'
34
+ break
35
+ case 'warning':
36
+ iconClasses = 'bi bi-exclamation-circle me-2'
37
+ alertClassSuffix = 'warning'
38
+ break
39
+ case 'success':
40
+ iconClasses = 'bi bi-check-lg me-2'
41
+ alertClassSuffix = 'success'
42
+ break
43
+ case 'notice':
44
+ default:
45
+ iconClasses = 'bi bi-info-circle me-2'
46
+ alertClassSuffix = 'info'
47
+ break
48
+ }
49
+
50
+ el.innerHTML = `
51
+ <div class="alert alert-dismissible mt-2 d-flex align-items-center alert-${alertClassSuffix} ${toastClasses}"
52
+ data-turbo-temporary="true" data-bs-autohide="false" aria-live="assertive" aria-atomic="true" role="alert">
53
+
54
+ <span class="${iconClasses}"></span>
55
+ ${message}
56
+ <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
57
+ </div>`
58
+ document.querySelector('#flash').appendChild(el.children[0])
59
+ }
60
+
21
61
  export function fadeOut (e) {
22
62
  if (window.getComputedStyle(e).visibility !== 'hidden') {
23
63
  e.classList.add('fade-out')
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PgRails
4
- VERSION = '7.0.8-alpha.65'
4
+ VERSION = '7.0.8-alpha.66'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.0.8.pre.alpha.65
4
+ version: 7.0.8.pre.alpha.66
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martín Rosso