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 +4 -4
- data/app/assets/stylesheets/flexite/application.css +5 -0
- data/app/jobs/show_diff_job.rb +2 -2
- data/app/services/flexite/diff/check_service.rb +2 -2
- data/app/services/flexite/diff/get_service.rb +15 -7
- data/app/views/flexite/application/index.html.haml +1 -0
- data/app/views/flexite/diffs/show.js.haml +3 -1
- data/app/views/flexite/shared/_progress_loader.html.haml +7 -0
- data/app/views/layouts/flexite/application.html.haml +1 -0
- data/lib/flexite/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 58858de76b1806f20ff56d96b34567d33fed5886
|
4
|
+
data.tar.gz: a11049597ba2d66a41b887539cc705e2ba4f0010
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9e9eae384d8f5e0b01af46c88549dd0c21830f520c42f7488a836f760479ba4c68a9986bd3774c1d4da9103e956bcab7f6fd481329abe5c47164547a3d9b8c3
|
7
|
+
data.tar.gz: 54c7663ffce26aeb29e6d1e434df975b1a1e114039093fb64e44596ba6ad9efdcf567c94fc4d5d9e9c8cf010a073b0db6b5df8b9ecd589ec4488615e41b1fa35
|
data/app/jobs/show_diff_job.rb
CHANGED
@@ -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 =
|
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
|
-
|
18
|
-
|
19
|
-
|
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
|
@@ -1,9 +1,11 @@
|
|
1
1
|
- data = @result.data.try(:[], :diffs)
|
2
|
-
-if data.
|
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 ...
|
data/lib/flexite/version.rb
CHANGED
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.
|
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-
|
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
|