mushy 0.0.7 → 0.1.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: 8288db70f609116945bca0ee58a47ff6e9e0231e1c9ae1a80358753f206d628c
4
- data.tar.gz: fbc52d93b74c3f47c60dd9db7a28f0c1eca705b9306027fb28e5f3d10dd82202
3
+ metadata.gz: 5b0ff90e9b20233f5744ec73d94137a2a117dc5bbdcb1962242caf5d3fdec8f3
4
+ data.tar.gz: dd834f5294cf131393881c7647a25c27d54275e7c510c2b19bac233b9193be43
5
5
  SHA512:
6
- metadata.gz: 3f55e3d8fed0ec636afca90380fd029753c295570a21c13ac56428c92b424e1a07a43fcf7fb47048b26d3586715fe343db6a3242bb3c86683be285dc23c21fa8
7
- data.tar.gz: eccde58b22427b95ac22cbdd47bbedbf2eeaa2b9d8446057d2f3a027676858b3838859ae8a47bb1506fc9c6e44d240906edcdb2209a4531b6afae963da7e08f1
6
+ metadata.gz: 41b4cdfd6d24547838ba11b0bbdb3515ec8baee305ab5b97079d040019951354d29074d9a93c88cf94be9b70c0875220f3b76630097c9cc697ddf4ea4cef550f
7
+ data.tar.gz: 1ec8aab8a0ac9281d1ed036b84add01be639c6223ef46db6f7132d4140f09c10d2ea0a6707bca99aa79b3db024efa2f4cf34ce5430c68e8838953be21f125dd2
@@ -15,13 +15,16 @@ module Mushy
15
15
  <table v-if="setup.showFlux == false">
16
16
  <tr>
17
17
  <th>Name</th>
18
- <th>Parent</th>
18
+ <th>Receives Events From</th>
19
19
  <th>Actions</th>
20
20
  </tr>
21
21
  <tr v-for="flux in flow.fluxs">
22
22
  <td>{{flux.name}}</td>
23
23
  <td>{{flux_name_for(flux.parent, flow.fluxs)}}</td>
24
- <td><button v-on:click.prevent.stop="edit({ flux: flux, setup: setup, configs: configs })">Edit</button></td>
24
+ <td>
25
+ <button v-on:click.prevent.stop="editFlux({ flux: flux, setup: setup, configs: configs })">Edit</button>
26
+ <button v-on:click.prevent.stop="deleteFlux({ flux: flux, flow: flow })">Delete</button>
27
+ </td>
25
28
  </tr>
26
29
  </table>
27
30
  <button v-if="setup.showFlux == false" v-on:click.prevent.stop="startNew({ setup: setup, configs: configs })">Start a New Flux</button>
@@ -30,7 +33,7 @@ module Mushy
30
33
  <div v-if="setup.showFlux">
31
34
  <mip-heavy :data="setup"></mip-heavy>
32
35
  <mip-heavy v-for="(data, id) in configs" v-show="setup.flux.value === id" :data="data"></mip-heavy>
33
- <div v-if="results.loading">Loading...</div>
36
+ <div v-if="results.errorMessage">{{results.errorMessage}}</div>
34
37
  <div v-else>{{results.length}} result{{results.length == 1 ? "" : "s"}}</div>
35
38
  <mip-heavy v-for="data in results" :data="data"></mip-heavy>
36
39
  </div>
@@ -57,6 +60,22 @@ module Mushy
57
60
  props: ['label', 'description', 'hide_description'],
58
61
  template: '<label :for="id" v-if="label != \\'\\'">{{label || ' + fancyName('id') + '}} <i v-show="description && !hide_description">({{description}})</i></label>'
59
62
  },
63
+ h1: {
64
+ props: ['label', 'description', 'hide_description'],
65
+ template: '<h1 v-if="label != \\'\\'">{{label || ' + fancyName('id') + '}} <i v-show="description && !hide_description">({{description}})</i></h1>'
66
+ },
67
+ h2: {
68
+ props: ['label', 'description', 'hide_description'],
69
+ template: '<h2 v-if="label != \\'\\'">{{label || ' + fancyName('id') + '}} <i v-show="description && !hide_description">({{description}})</i></h2>'
70
+ },
71
+ h3: {
72
+ props: ['label', 'description', 'hide_description'],
73
+ template: '<h3 v-if="label != \\'\\'">{{label || ' + fancyName('id') + '}} <i v-show="description && !hide_description">({{description}})</i></h3>'
74
+ },
75
+ h4: {
76
+ props: ['label', 'description', 'hide_description'],
77
+ template: '<h4 v-if="label != \\'\\'">{{label || ' + fancyName('id') + '}} <i v-show="description && !hide_description">({{description}})</i></h4>'
78
+ },
60
79
  text: {
61
80
  props: ['label', 'placeholder', 'disabled', 'readonly', 'value', 'description', 'shrink'],
62
81
  template: '<div><mip-label :id="id" :label="label" :description="description" :hide_description="shrink"></mip-label> <a href="#" v-on:click.prevent.stop="shrink=false" v-show="shrink && !value">[^]</a><input type="text" :name="id" v-if="value || !shrink" :placeholder="placeholder" v-bind:value="value" v-on:input="$emit(\\'update:value\\', $event.target.value);" :disabled="disabled == \\'true\\'" :readonly="readonly == \\'true\\'"></div>'
@@ -90,7 +109,7 @@ module Mushy
90
109
  };
91
110
  },
92
111
  props: ['label', 'placeholder', 'disabled', 'readonly', 'value', 'description', 'view'],
93
- template: '<div><mip-label :id="id" :label="label" :description="description"></mip-label> <a href="#" v-on:click.prevent.stop="view=toggle(view)">{{(view == \\'beautiful\\' ? \\'>\\' : \\'^\\')}}</a><a href="#" v-on:click.prevent.stop="copy(view, value)">copy</a><pre><code>{{show(view, value)}}</code></pre></div>'
112
+ template: '<div><mip-h4 :id="id" :label="label" :description="description"></mip-h4> <pre><code>{{show(view, value)}}</code></pre><button :disabled="view==\\'beautiful\\'" v-on:click.prevent.stop="view=toggle(view)">{{(view == \\'beautiful\\' ? \\'View Smaller\\' : \\'View Pretty\\')}}</button><button :disabled="view!=\\'beautiful\\'" v-on:click.prevent.stop="view=toggle(view)">View Smaller</button><button v-on:click.prevent.stop="copy(view, value)">Copy</button></div>'
94
113
  },
95
114
  radio: {
96
115
  props: ['label', 'value', 'options', 'description', 'shrink'],
@@ -147,7 +166,7 @@ module Mushy
147
166
  },
148
167
  button: {
149
168
  props: ['click', 'description', 'name'],
150
- template: '<button v-on:click.prevent.stop="click(pull(this))">{{name || id}}</button>'
169
+ template: '<button v-on:click.prevent.stop="click(pull(this), thisComponent())">{{name || id}}</button>'
151
170
  }
152
171
  };
153
172
 
@@ -167,6 +186,7 @@ module Mushy
167
186
  return {
168
187
  console: console,
169
188
  pull: function(x) { return thingToData(foundIt.data); },
189
+ thisComponent: function() { return foundIt.data; },
170
190
  }
171
191
  },
172
192
  props: props,
@@ -225,12 +245,15 @@ module Mushy
225
245
  id: { type: 'hide', value: '' },
226
246
  name: { type: 'text', value: '' },
227
247
  flux: { type: 'select', value: fluxdata.fluxs[0].name, options: options},
228
- parent: { type: 'selectrecord', value: '', options: flowdata.fluxs },
248
+ parent: { type: 'selectrecord', label: 'Receive Events From', value: '', options: flowdata.fluxs },
229
249
  };
230
250
 
231
251
  for (var key in configs)
232
252
  {
233
- configs[key].save = { type: 'button', name: 'Save This Flux', click: function(config) {
253
+ configs[key].save = { type: 'button', name: 'Save This Flux', click: function(config, hey) {
254
+ var nameOfTheSaveButton = hey.save.name;
255
+ Vue.set(hey.save, 'name', 'Saving');
256
+ delete config.test_event;
234
257
  var setup = thingToData(app.setup);
235
258
  var flux = {
236
259
  id: setup.id,
@@ -248,30 +271,39 @@ module Mushy
248
271
  else
249
272
  app.flow.fluxs[index] = flux;
250
273
 
251
- app.setup.id.value = '';
274
+ setTimeout(function(){
275
+ Vue.set(hey.save, 'name', nameOfTheSaveButton);
276
+ app.setup.id.value = '';
252
277
 
253
- Vue.set(app.setup, 'showFlux', false);
278
+ Vue.set(app.setup, 'showFlux', false);
279
+ }, 500);
254
280
  }
255
281
  };
256
282
 
257
283
  configs[key].test_event = { type: 'json', value: '{}', default: '{}' };
258
284
 
259
- configs[key].run_test = { type: 'button', name: 'Test Run This Flux', click: function(c) {
285
+ configs[key].run_test = { type: 'button', name: 'Test Run This Flux', click: function(c, hey) {
286
+ var previousName = hey.run_test.name;
287
+ Vue.set(hey.run_test, 'name', 'Loading');
260
288
  app.results = [];
261
- Vue.set(app.results, 'loading', true);
289
+ Vue.set(app.results, 'errorMessage', '');
262
290
  var the_setup = thingToData(app.setup);
263
291
  the_setup.event = c.test_event;
264
292
  axios.post('/run', { config: c, setup: the_setup })
265
293
  .then(function(r){
266
- Vue.set(app.results, 'loading', false);
267
294
  var index = 1;
268
295
  for (var key in r.data.result)
269
296
  {
270
297
  var result = {};
271
- result['event_' + index] = { type: 'jsonview', value: r.data.result[key], view: 'thin' };
298
+ result['event_' + index] = { type: 'jsonview', label: 'Event ' + index + ' of ' + r.data.result.length, value: r.data.result[key], view: 'thin' };
272
299
  app.results.push(result);
273
300
  index += 1;
274
301
  }
302
+ }).catch(function(r){
303
+ console.log(r);
304
+ Vue.set(app.results, 'errorMessage', 'This app failed while trying to execute your flux.');
305
+ }).then(function(){
306
+ Vue.set(hey.run_test, 'name', previousName);
275
307
  });
276
308
  } };
277
309
  }
@@ -294,6 +326,8 @@ module Mushy
294
326
  else
295
327
  Vue.set(applicable_config[key], 'value', applicable_config[key].default);
296
328
 
329
+ if (applicable_config)
330
+ Vue.set(applicable_config.test_event, 'value', '{}');
297
331
 
298
332
  options = flowdata.fluxs.filter(function(x){ return x.id != flux.id });
299
333
  options.unshift( { id: '', name: '' } );
@@ -321,11 +355,15 @@ module Mushy
321
355
  };
322
356
  loadThisFlux({ flux: flux, setup: x.setup, configs: x.configs });
323
357
  },
324
- edit: function(x) {
358
+ editFlux: function(x) {
325
359
  var flux = x.flux;
326
360
 
327
361
  loadThisFlux({ flux: x.flux, setup: x.setup, configs: x.configs });
328
362
  },
363
+ deleteFlux: function(x) {
364
+ var set = x.flow.fluxs.filter( function(v){ return v.id != x.flux.id } );
365
+ Vue.set(x.flow, 'fluxs', set);
366
+ },
329
367
  saveFlow: function(input)
330
368
  {
331
369
  var setup = input.setup;
@@ -17,11 +17,13 @@ module Mushy
17
17
  headless: {
18
18
  description: 'Run this browser headless.',
19
19
  type: 'boolean',
20
+ shrink: true,
20
21
  value: 'true',
21
22
  },
22
23
  execute: {
23
24
  description: 'Javascript to run after the page is loaded.',
24
25
  type: 'textarea',
26
+ shrink: true,
25
27
  value: '',
26
28
  },
27
29
  cookies: {
@@ -41,26 +43,29 @@ module Mushy
41
43
  { id: 'sameSite', target: 'sameSite', field: { type: 'text', value: 'None', default: 'None' } },
42
44
  { id: 'priority', target: 'priority', field: { type: 'text', value: 'Medium', default: 'Medium' } },
43
45
  ],
44
- #{"name":"1P_JAR","value":"2021-01-21-13","domain":".google.com","path":"/","expires":1613828458.870408,"size":19,"httpOnly":false,"secure":true,"session":false,"sameSite":"None","priority":"Medium"
45
46
  },
46
47
  carry_cookies_from: {
47
48
  description: 'Carry the cookies from this path in the event.',
48
49
  type: 'text',
50
+ shrink: true,
49
51
  value: 'cookies',
50
52
  },
51
53
  headers: {
52
54
  description: 'Headers for the web request. These can be received from a previous browser event with {{headers}}, or can be typed manually.',
53
55
  type: 'keyvalue',
56
+ shrink: true,
54
57
  value: {},
55
58
  },
56
59
  carry_headers_from: {
57
60
  description: 'Carry the headers from this path in the event.',
58
61
  type: 'text',
62
+ shrink: true,
59
63
  value: 'headers',
60
64
  },
61
65
  wait_before_closing: {
62
66
  description: 'Wait this many seconds before closing the browser.',
63
67
  type: 'integer',
68
+ shrink: true,
64
69
  value: '',
65
70
  },
66
71
  },
@@ -79,6 +84,8 @@ module Mushy
79
84
 
80
85
  browser.execute(config[:execute]) if config[:execute]
81
86
 
87
+ sleep(config[:wait_before_closing].to_i) if config[:wait_before_closing] && config[:wait_before_closing].to_i > 0
88
+
82
89
  result = {
83
90
  url: browser.url,
84
91
  cookies: browser.cookies.all.map { |k, v| v.instance_variable_get('@attributes') },
@@ -86,8 +93,6 @@ module Mushy
86
93
  body: browser.body
87
94
  }
88
95
 
89
- sleep(config[:wait_before_closing].to_i) if config[:wait_before_closing] && config[:wait_before_closing].to_i > 0
90
-
91
96
  browser.quit
92
97
 
93
98
  result
data/mushy.gemspec CHANGED
@@ -4,7 +4,7 @@ require 'mushy/version'
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = 'mushy'
7
- s.version = '0.0.7'
7
+ s.version = '0.1.0'
8
8
  s.date = '2020-11-23'
9
9
  s.summary = 'Process streams of work using common modules.'
10
10
  s.description = 'This tool assists in the creation and processing of workflows.'
@@ -24,4 +24,4 @@ Gem::Specification.new do |s|
24
24
  s.add_runtime_dependency 'ferrum'
25
25
  s.add_runtime_dependency 'nokogiri'
26
26
  s.add_runtime_dependency 'faraday'
27
- end
27
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mushy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Darren Cauthon