sql-jarvis 2.1.6 → 2.1.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: 91f27080fce44b6ea0ee444d2b790dddcaa7a9ee8b600f85e020622d2c83e455
4
- data.tar.gz: 6dd4fcbd656d5d3e8c664173d788c5e79f61087079682560578f13a95eaa0c6f
3
+ metadata.gz: 2099c512441aaa437cc3a4738bfac47cae88945ac4005db3008f15631eab70aa
4
+ data.tar.gz: 9732a29ee98755ccb4ece4699ffd5a236b3ddf75179d5bbaf14a83e51c1c073d
5
5
  SHA512:
6
- metadata.gz: 57be82558a33daf54f8b2c869d287fb6ef77c3a6260723a585321dc66b9b1e1681704186d257b5143a7b6e91e255821bd35a851dac8518d1205c73837a5389d9
7
- data.tar.gz: 24fbb87c6b50ee64309e0e4b02db2dcdb01c64df7ddfa71855116289265732bf07c02c04df3a50ca586c8523718cdc97e44c5b1bf885fb31d95456c90eabb5d6
6
+ metadata.gz: 28b166c53f77a1f2ac56b8c2395523514615dad78e24a49b6ea63c4a358244bbbdcf2410f617f47b5c1803bbbfca0f12b5688c26a11bf491e73d3cde4028b552
7
+ data.tar.gz: 4bdb175e0dd852dfb3f6b35e731f5f9e9fded27236fdccde4b0db15888983b58789577b332c74d1e7fd5492df067a818b55e56dc913f7b64c3de522f8c51cf2a
@@ -1,7 +1,7 @@
1
1
  module Blazer
2
2
  class ChecksController < BaseController
3
3
  before_action :set_check, only: [:edit, :update, :destroy, :run]
4
- before_action :set_accessible, only: [:new, :edit]
4
+ before_action :set_new_check, only: [:new]
5
5
 
6
6
  def index
7
7
  state_order = [nil, "disabled", "error", "timed out", "failing", "passing"]
@@ -10,7 +10,6 @@ module Blazer
10
10
  end
11
11
 
12
12
  def new
13
- @check = Blazer::Check.new(query_id: params[:query_id])
14
13
  end
15
14
 
16
15
  def create
@@ -54,15 +53,21 @@ module Blazer
54
53
  @check = Blazer::Check.find(params[:id])
55
54
  end
56
55
 
57
- def set_accessible
58
- @slack_mentions ||= get_slack_mentions + @check.slack_members.each_with_object([]) { |m, list| list << [m, m] if m.present? }
56
+ def set_new_check
57
+ @check = Blazer::Check.new(query_id: params[:query_id])
58
+ end
59
+
60
+ helper_method :slack_mentions
61
+ def slack_mentions
62
+ existed_members = @check&.slack_members.presence || []
63
+ @slack_mentions ||= get_slack_mentions + existed_members.each_with_object([]) { |m, list| list << [m, m] if m.present? }
59
64
  ensure
60
65
  @slack_mentions ||= []
61
66
  end
62
67
 
63
68
  def get_slack_mentions
64
69
  return [] unless Blazer.settings.key?('slack_mentions')
65
- Blazer::RunStatement.new.perform(Blazer.data_sources[@check.query.data_source], Blazer.settings['slack_mentions'], {}).rows.map do |row|
70
+ Blazer::RunStatement.new.perform(Blazer.data_sources[@check.query&.data_source], Blazer.settings['slack_mentions'], {}).rows.map do |row|
66
71
  [row.last, "[#{row.first}] #{row.second} - ##{row.last}"]
67
72
  end
68
73
  rescue
@@ -42,9 +42,10 @@
42
42
  .form-group
43
43
  = f.label :slack_channels
44
44
  = f.text_field :slack_channels, placeholder: "Optional, comma separated", class: "form-control"
45
+ - if slack_mentions.present?
45
46
  .form-group
46
47
  = f.label :slack_members
47
- = f.collection_select :slack_members, @slack_mentions, :first, :last, {}, { placeholder: "User, Users group Slack ID", class: "form-control", multiple: true }
48
+ = f.collection_select :slack_members, slack_mentions, :first, :last, {}, { placeholder: "User, Users group Slack ID", class: "form-control", multiple: true }
48
49
  %p.text-muted Slack members: can select or enter new user/user_group Slack ID. It also supports special mentions: channel, everyone, here.
49
50
  %p.text-muted
50
51
  Emails #{Blazer.slack? ? "and Slack notifications " : nil}are sent when a check starts failing, and when it starts passing again.
@@ -1,3 +1,3 @@
1
1
  module Blazer
2
- VERSION = '2.1.6'
2
+ VERSION = '2.1.8'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sql-jarvis
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.6
4
+ version: 2.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-22 00:00:00.000000000 Z
11
+ date: 2023-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties