flexite 0.0.24 → 0.0.25

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
  SHA1:
3
- metadata.gz: e032838d9d874df9e0acc442083e551c8e0d760a
4
- data.tar.gz: 9ae676c5872e54b2b9e902221a52b117cc78b77f
3
+ metadata.gz: 58858de76b1806f20ff56d96b34567d33fed5886
4
+ data.tar.gz: a11049597ba2d66a41b887539cc705e2ba4f0010
5
5
  SHA512:
6
- metadata.gz: bc06b67c75a5af494f6878078a4501ea879f2552f710a9b7a9bdd476573d2bcb6a854fa448b5d3ed650bc2df9a75d0d8ee104d92c28286ebcfd54ed95486d763
7
- data.tar.gz: 628fba6f9199cfd136972b0ca4266308b574898f7b546e2f3064f55afea3a6ad332f6a8e7885d8b8a27bf22c57d3c91efe28cdbb868decfd24534d798e6784a7
6
+ metadata.gz: e9e9eae384d8f5e0b01af46c88549dd0c21830f520c42f7488a836f760479ba4c68a9986bd3774c1d4da9103e956bcab7f6fd481329abe5c47164547a3d9b8c3
7
+ data.tar.gz: 54c7663ffce26aeb29e6d1e434df975b1a1e114039093fb64e44596ba6ad9efdcf567c94fc4d5d9e9c8cf010a073b0db6b5df8b9ecd589ec4488615e41b1fa35
@@ -31,3 +31,8 @@ button.close {
31
31
  .flex {
32
32
  display: flex;
33
33
  }
34
+
35
+ .progress-loader {
36
+ position: absolute;
37
+ top: 50%;
38
+ }
@@ -1,10 +1,10 @@
1
- ShowDiffJob = Struct.new(:other_tree, :file_name ) do
1
+ ShowDiffJob = Struct.new(:current_tree, :other_tree, :file_name ) do
2
2
  def before
3
3
  Flexite::JobReport.create(file_name: file_name, status: Flexite::JobReport::STATUS[:in_progress])
4
4
  end
5
5
 
6
6
  def perform
7
- Flexite::Diff::CheckService.new(other_tree, file_name).call
7
+ Flexite::Diff::CheckService.new(current_tree, other_tree, file_name).call
8
8
  end
9
9
 
10
10
  def success
@@ -1,9 +1,9 @@
1
1
  module Flexite
2
2
  class Diff
3
3
  class CheckService
4
- def initialize(other_tree, file_name)
4
+ def initialize(current_tree, other_tree, file_name)
5
5
  @other_tree = other_tree
6
- @current_tree = Config.t_nodes
6
+ @current_tree = current_tree
7
7
  @file_name = file_name
8
8
  end
9
9
 
@@ -7,16 +7,16 @@ module Flexite
7
7
  @stage = stage
8
8
  @token = Flexite.config.migration_token
9
9
  @endpoint = endpoint + api_configs_path(token: @token)
10
- @timestamps = Time.now.strftime("%Y%m%d%H%M%S")
11
- @file_name = "#{@timestamps}_#{@stage}.yml"
12
- @result = ActionService::Result.new
13
10
  end
14
11
 
15
12
  def call
16
13
  get_configs
17
- calculate_diff
18
-
19
- Flexite::ActionService::Result.new(data: { file_name: @file_name })
14
+ if File.exists?("#{Rails.root}/config/diffs/#{@file_name}")
15
+ Diff::ShowService.new(@file_name).call
16
+ else
17
+ calculate_diff
18
+ ActionService::Result.new(data: { file_name: @file_name })
19
+ end
20
20
  end
21
21
 
22
22
  private
@@ -25,10 +25,18 @@ module Flexite
25
25
  uri = URI(@endpoint)
26
26
  response = Net::HTTP.get(uri)
27
27
  @other_tree = JSON.parse(response)
28
+ @current_tree = Config.t_nodes
29
+ @file_name = "#{checksum}_#{@stage}.yml"
28
30
  end
29
31
 
30
32
  def calculate_diff
31
- Delayed::Job.enqueue(ShowDiffJob.new(@other_tree, @file_name))
33
+ Delayed::Job.enqueue(ShowDiffJob.new(@current_tree, @other_tree, @file_name))
34
+ end
35
+
36
+ def checksum
37
+ @other_checksum = Digest::MD5.hexdigest(@other_tree.to_json)
38
+ @current_checksum = Digest::MD5.hexdigest(@current_tree.to_json)
39
+ @checksum = Digest::MD5.hexdigest("#{@other_checksum}#{@current_checksum}")
32
40
  end
33
41
  end
34
42
  end
@@ -16,3 +16,4 @@
16
16
  .col-md-4
17
17
  #section-3.pos-fixed
18
18
  #diff-timer
19
+
@@ -1,9 +1,11 @@
1
1
  - data = @result.data.try(:[], :diffs)
2
- -if data.blank?
2
+ -if data.nil?
3
3
  $flexite('#diff-timer').html("#{j render 'timer'}");
4
+ $flexite('#progress-loader').modal({ backdrop: 'static', keyboard: false });
4
5
  -else
5
6
  $flexite("#modal-body").html("#{j render 'diff', data: data}");
6
7
  // $flexite("#submit-btn").html("#{j link_to 'Push', push_diff_path(stage: @stage, url: @url), remote: true, class: 'btn btn-success' }");
7
8
  $flexite("#modal").modal("show");
9
+ $flexite('#progress-loader').modal('hide');
8
10
 
9
11
 
@@ -0,0 +1,7 @@
1
+ .progress-loader.modal.fade#progress-loader{ role: :dialog, backdrop: 'static', keyboard: false }
2
+ .modal-dialog
3
+ .modal-content
4
+ .modal-body
5
+ .progress
6
+ .progress-bar.progress-bar-striped.active{ role: 'progressbar', aria: { valuenow: 100, valuemin: 0, valuemax: 100 }, style: 'width: 100%'}
7
+ Loading diff ...
@@ -7,6 +7,7 @@
7
7
  %body
8
8
  #flash
9
9
  = render 'flexite/shared/messages'
10
+ = render 'flexite/shared/progress_loader'
10
11
  = render 'flexite/shared/popup'
11
12
  .container-fluid#main-container
12
13
  = yield
@@ -1,3 +1,3 @@
1
1
  module Flexite
2
- VERSION = '0.0.24'
2
+ VERSION = '0.0.25'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flexite
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.24
4
+ version: 0.0.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maksim Rusakovich
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-30 00:00:00.000000000 Z
11
+ date: 2018-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: delayed_job_active_record
@@ -289,6 +289,7 @@ files:
289
289
  - app/views/flexite/histories/restore.js.haml
290
290
  - app/views/flexite/shared/_messages.html.haml
291
291
  - app/views/flexite/shared/_popup.html.haml
292
+ - app/views/flexite/shared/_progress_loader.html.haml
292
293
  - app/views/flexite/shared/_show_flash.js.haml
293
294
  - app/views/layouts/flexite/application.html.haml
294
295
  - config/initializers/simple_form.rb