ductwork 0.17.0 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '08a25902c240e59967cbd79257cfaa9f7aabfc9418ac6324864c2264b0be0f4f'
4
- data.tar.gz: 33e7eee080dfbc1e993ccf60388694e560eaa95c01d6c57797775351a4063686
3
+ metadata.gz: d93b3436f460ab6b872e05f460f8b4d807e8e7d5a0d5320284306331063db1e8
4
+ data.tar.gz: 2ebdcc63a041e048569debeda1add50123d694491f8eaab20a0bc95ba7930cfe
5
5
  SHA512:
6
- metadata.gz: 992ef0a0f5e6c971a3789d0ce3ea8da7753f32f354967dd788024393b6458d3b01089dbdd4a301478b59b316a7bd950bba205371ff431db35944e61920d739bf
7
- data.tar.gz: 4fd645e68b7b66d3e5186418e3e2f18faceba41b05e700a3e7fd6a0d499abca32c3f021e95720f6350b78520bb5668df7f5e2d4bbb8b343e93cd8a84d4292af5
6
+ metadata.gz: 146333524dc958193695149dd8be51bb68cc9f2503b4b8122a97e6c3e4de5abd784a7c3c3691a89219bf4d295c70dacc2c84c4b7601154027fcd9eeae8208ffb
7
+ data.tar.gz: 6c8f0f8abe30c8138896064ffd83e5bdc2784ed02e9cd52577cd38052eee6695aff2d724defbae9006a10c12a92996a24bddc02cabcc07c5ad33ea21d5e82abf
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Ductwork Changelog
2
2
 
3
+ ## [0.18.0]
4
+
5
+ - fix: show countdown for pipelines/steps scheduled in the future
6
+ - feat: add input and output arguments to pipeline dashboard page
7
+ - feat: add RSpec matcher for asserting pipeline context
8
+
3
9
  ## [0.17.0]
4
10
 
5
11
  - feat: assign step node names unique hex values in the pipeline definition
@@ -7,7 +7,7 @@ document.addEventListener('DOMContentLoaded', function() {
7
7
 
8
8
  function updateTimer() {
9
9
  const now = new Date();
10
- const elapsed = Math.floor((now - startedAt) / 1000);
10
+ const elapsed = Math.floor(Math.abs(now - startedAt) / 1000);
11
11
 
12
12
  const hours = Math.floor(elapsed / 3600);
13
13
  const minutes = Math.floor((elapsed % 3600) / 60);
@@ -17,7 +17,11 @@ document.addEventListener('DOMContentLoaded', function() {
17
17
  const minutesStr = minutes == 0 ? '' : `${String(minutes)}m `;
18
18
  const secondsStr = seconds == 0 ? '' : `${String(seconds)}s`;
19
19
 
20
- displayElement.textContent = hoursStr + minutesStr + secondsStr;
20
+ if (now > startedAt) {
21
+ displayElement.textContent = hoursStr + minutesStr + secondsStr;
22
+ } else {
23
+ displayElement.textContent = 'In ' + hoursStr + minutesStr + secondsStr;
24
+ }
21
25
  }
22
26
 
23
27
  updateTimer();
@@ -27,16 +27,22 @@
27
27
  </div>
28
28
 
29
29
  <div>
30
- <div class="metric-heading">
31
- <label>Triggered At</label>
30
+ <div>
31
+ <label>Runtime</label>
32
32
  <span>
33
- <%= @pipeline.triggered_at.iso8601(3) %>
33
+ <% if @pipeline.completed_at.nil? %>
34
+ <div data-started-at=<%= @pipeline.started_at.iso8601 %>>
35
+ <span id="elapsed-timer">0h 0m 0s</span>
36
+ </div>
37
+ <% else %>
38
+ <%= formatted_time_distance(@pipeline.started_at, @pipeline.completed_at) %>
39
+ <% end %>
34
40
  </span>
35
41
  </div>
36
- <div>
37
- <label>Step Count</label>
42
+ <div class="metric-heading">
43
+ <label>Triggered At</label>
38
44
  <span>
39
- <%= @pipeline.steps.count %>
45
+ <%= @pipeline.triggered_at.iso8601(3) %>
40
46
  </span>
41
47
  </div>
42
48
  </div>
@@ -59,13 +65,13 @@
59
65
 
60
66
  <div style="margin-top: 1rem;">
61
67
  <label>Definition</label>
62
- <code>
68
+ <code style="width: 100%;">
63
69
  <%= @pipeline.parsed_definition %>
64
70
  </code>
65
71
  </div>
66
72
  </article>
67
73
 
68
- <h3>Steps</h3>
74
+ <h3>Steps (<%= @pipeline.steps.count %>)</h3>
69
75
 
70
76
  <div class="separate-content">
71
77
  <div class="filter-group">
@@ -128,6 +134,13 @@
128
134
  </div>
129
135
  </div>
130
136
 
137
+ <div>
138
+ <label>Class</label>
139
+ <code>
140
+ <%= step.klass %>
141
+ </code>
142
+ </div>
143
+
131
144
  <div>
132
145
  <label>Transition</label>
133
146
  <code>
@@ -163,16 +176,31 @@
163
176
  <div>
164
177
  <div class="grid">
165
178
  <div>
166
- <label>Node</label>
179
+ <label>Input</label>
167
180
  <code>
168
- <%= step.node %>
181
+ <% if step.job.input_args.present? %>
182
+ <%= JSON.parse(step.job.input_args).dig("args", 0).inspect %>
183
+ <% else %>
184
+ no value
185
+ <% end %>
169
186
  </code>
170
187
  </div>
171
188
 
172
189
  <div>
173
- <label>Class</label>
190
+ <label>Output</label>
174
191
  <code>
175
- <%= step.klass %>
192
+ <% if step.job.output_payload.present? %>
193
+ <%= JSON.parse(step.job.output_payload)["payload"].inspect %>
194
+ <% else %>
195
+ no value
196
+ <% end %>
197
+ </code>
198
+ </div>
199
+
200
+ <div>
201
+ <label>Node</label>
202
+ <code>
203
+ <%= step.node %>
176
204
  </code>
177
205
  </div>
178
206
 
@@ -189,7 +217,6 @@
189
217
  <%= step.completed_at&.iso8601(3) %>
190
218
  </div>
191
219
  </div>
192
-
193
220
  </div>
194
221
 
195
222
  <div style="margin-top: 1rem;">
@@ -62,6 +62,27 @@ RSpec::Matchers.define(:have_triggered_pipelines) do |*expected|
62
62
  end
63
63
  end
64
64
 
65
+ RSpec::Matchers.define(:have_set_context) do |expected|
66
+ supports_block_expectations
67
+
68
+ match do |block|
69
+ ctx = Ductwork::Context.new(pipeline_id)
70
+ before_values = expected.map { |k, _| ctx.get(k.to_s) }
71
+
72
+ block.call
73
+
74
+ after_context = expected.to_h { |k, _| [k, ctx.get(k.to_s)] }
75
+
76
+ before_values.all?(&:nil?) && after_context == expected
77
+ end
78
+
79
+ chain :for_pipeline, :pipeline_id
80
+
81
+ failure_message do
82
+ "Context does not match expected result"
83
+ end
84
+ end
85
+
65
86
  module Ductwork
66
87
  module Testing
67
88
  module RSpec
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ductwork
4
- VERSION = "0.17.0"
4
+ VERSION = "0.18.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ductwork
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.0
4
+ version: 0.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tyler Ewing