mushy 0.1.4 → 0.2.0

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: 2eaed069f8d37db0a6d58fea9c994e4a5135f43a18a7e7ad8421a601983bb954
4
- data.tar.gz: 3224715b652898edaac99ad89a8378ccc4d2aa4ba21b891ca33fec0b99252a85
3
+ metadata.gz: dc571150c0fa3c2315c75186d48836987ca92d93045de5af848fe450c975a039
4
+ data.tar.gz: cbd83a5b9fa9c0106b6891afa33eeb16ddd947bba61c62f13b6ff7e7a574ee0e
5
5
  SHA512:
6
- metadata.gz: df28cc21a604e023284ad3f88b2cd11a3ab4261c3cd9747a2033d07528203262de29daa2d12f82e404eb91109b79ee9a5e5a5bf71396c360e26ff270d08a2449
7
- data.tar.gz: 05410eb4c9fee4afd4aa31397409b6c794bc152257cf599aa4fb1502cb7009c518b9fac2eb76b3f78ca1e58e2a31e28e6dcd6c5266febb8bddd7ea7fbe7fdea1
6
+ metadata.gz: 720fb42b4b3df8d46cd7e26a87b793e0d41111f12652d588c0378160a00af08de05bedcb32920d1ce01c2c0efe135caaa48a939edd6b25822f8383cac3acdd1a
7
+ data.tar.gz: 1707b73e264d067362a7bd00e48558a9981c807319ff925e92c4fc829cbf8129aac14f31dd0edaba53354893de2ec4be633eebe9da2d882ec568a6394e852d9f
data/lib/mushy.rb CHANGED
@@ -8,10 +8,4 @@ Dir[File.dirname(__FILE__) + '/mushy/fluxs/*.rb']
8
8
  .sort_by { |f| important_flux_files.any? { |x| f.end_with?(x) } ? 0 : 1 }
9
9
  .each { |f| require f }
10
10
 
11
- Dir[File.dirname(__FILE__) + '/mushy/builder/*.rb'].each { |f| require f }
12
-
13
- module Mushy
14
- def self.hi
15
- puts 'hello'
16
- end
17
- end
11
+ Dir[File.dirname(__FILE__) + '/mushy/builder/*.rb'].each { |f| require f }
@@ -40,7 +40,17 @@ module Mushy
40
40
  def self.get_flow file
41
41
  puts "trying to get: #{file}"
42
42
  file = "#{file}.json" unless file.downcase.end_with?('.json')
43
- JSON.parse File.open(file).read
43
+ data = JSON.parse File.open(file).read
44
+ data['fluxs']
45
+ .reject { |x| x['parents'] }
46
+ .each { |x| x['parents'] = [x['parent']].select { |y| y } }
47
+ data['fluxs']
48
+ .select { |x| x['parent'] }
49
+ .each { |x| x.delete 'parent' }
50
+ data['fluxs']
51
+ .select { |x| x['parents'] }
52
+ .each { |x| x['parents'] = x['parents'].select { |y| y } }
53
+ data
44
54
  rescue
45
55
  { fluxs: [] }
46
56
  end
@@ -20,16 +20,14 @@ module Mushy
20
20
  </tr>
21
21
  <tr v-for="flux in flow.fluxs">
22
22
  <td>{{flux.name}}</td>
23
- <td>{{flux_name_for(flux.parent, flow.fluxs)}}</td>
23
+ <td>{{flux_name_for(flux.parents, flow.fluxs)}}</td>
24
24
  <td>
25
25
  <button v-on:click.prevent.stop="editFlux({ flux: flux, setup: setup, configs: configs })">Edit</button>
26
26
  <button v-on:click.prevent.stop="deleteFlux({ flux: flux, flow: flow })">Delete</button>
27
27
  </td>
28
28
  </tr>
29
29
  </table>
30
- <button v-if="setup.showFlux == false" v-on:click.prevent.stop="startNew({ setup: setup, configs: configs })">Start a New Flux</button>
31
- <button v-if="setup.showFlux == false" v-on:click.prevent.stop="saveFlow({ setup: setup, flow: flow })">Save This Flow</button>
32
- <button v-if="setup.showFlux" v-on:click.prevent.stop="setup.showFlux = false">&lt; Go Back To List</button>
30
+ <button v-if="setup.showFlux == false" v-on:click.prevent.stop="startNew({ setup: setup, configs: configs })">Add a New Flux To This Flow</button>
33
31
  <div v-if="setup.showFlux">
34
32
  <mip-heavy :data="setup"></mip-heavy>
35
33
  <mip-heavy v-for="(data, id) in configs" v-show="setup.flux.value === id" :data="data"></mip-heavy>
@@ -123,6 +121,32 @@ module Mushy
123
121
  props: ['label', 'value', 'options', 'description', 'shrink'],
124
122
  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><select :name="id" v-if="value || !shrink" v-on:input="$emit(\\'update:value\\', $event.target.value)"><option v-for="option in options" v-bind:value="option.id" :selected="value == option.id">{{option.name}}</option></select></div>'
125
123
  },
124
+ selectmanyrecords: {
125
+ data: function() {
126
+ return {
127
+ selectedValue: '',
128
+ remove: function(value, set) {
129
+ if (set.includes(value) == false) return;
130
+ for(var i = 0; i < set.length; i++)
131
+ {
132
+ if (set[i] === value)
133
+ {
134
+ set.splice(i, 1);
135
+ i--;
136
+ }
137
+ }
138
+ return set;
139
+ },
140
+ doit: function(value, set) {
141
+ if (set.includes(value) == false)
142
+ set.push(value);
143
+ return set;
144
+ },
145
+ };
146
+ },
147
+ props: ['label', 'value', 'options', 'description', 'shrink'],
148
+ 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> <span v-for="option in options" v-if="value && value.includes(option.id)">{{option.name}} <a href="#" v-on:click.prevent.stop="remove(option.id, value);$emit(\\'update:value\\', value)">[X]</a> </span> <a href="#" v-on:click.prevent.stop="doit(selectedValue, value);$emit(\\'update:value\\', value)">ADD</a> <select :name="id" v-if="value || !shrink" v-on:input="selectedValue=$event.target.value;"><option v-for="option in options" v-bind:value="option.id">{{option.name}}</option></select></div>'
149
+ },
126
150
  boolean: {
127
151
  props: ['label', 'value', 'options', 'description', 'shrink'],
128
152
  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><select :name="id" v-if="(value != undefined && value != null && value != \\'\\') || !shrink" v-on:input="$emit(\\'update:value\\', $event.target.value)"><option v-for="option in [true, false]" v-bind:value="option" :selected="value == option">{{option}}</option></select></div>'
@@ -240,47 +264,64 @@ module Mushy
240
264
  for(var type in fluxTypes)
241
265
  options.push(fluxTypes[type]);
242
266
 
243
- var setup = {
244
- showFlux: false,
245
- id: { type: 'hide', value: '' },
246
- name: { type: 'text', value: '' },
247
- flux: { type: 'select', value: fluxdata.fluxs[0].name, options: options},
248
- parent: { type: 'selectrecord', label: 'Receive Events From', value: '', options: flowdata.fluxs },
249
- };
250
-
251
- var saveFlux = function(config, hey) {
252
- var nameOfTheSaveButton = hey.save.name;
253
- Vue.set(hey.save, 'name', 'Saving');
267
+ var saveTheFlux = function(input)
268
+ {
269
+ var theApp = input.app;
270
+ var config = input.config;
254
271
  delete config.test_event;
255
- var setup = thingToData(app.setup);
272
+ var setup = thingToData(theApp.setup);
256
273
  var flux = {
257
274
  id: setup.id,
258
275
  name: setup.name,
259
276
  flux: setup.flux,
260
- parent: setup.parent,
277
+ parents: setup.parents,
261
278
  config: config,
262
279
  };
263
280
  var index = -1;
264
- for(var i = 0; i < app.flow.fluxs.length; i++)
265
- if (app.flow.fluxs[i].id == flux.id)
281
+ for(var i = 0; i < theApp.flow.fluxs.length; i++)
282
+ if (theApp.flow.fluxs[i].id == flux.id)
266
283
  index = i;
267
284
 
268
285
  if (index < 0)
269
- app.flow.fluxs.push(flux);
286
+ theApp.flow.fluxs.push(flux);
270
287
  else
271
- app.flow.fluxs[index] = flux;
288
+ theApp.flow.fluxs[index] = flux;
289
+ };
290
+
291
+ var saveTheFlow = function(input)
292
+ {
293
+ var setup = input.setup;
294
+ var flow = input.flow;
295
+ axios.post('/save', flow)
296
+ .then(function(result){});
297
+ };
272
298
 
273
- setTimeout(function(){
274
- Vue.set(hey.save, 'name', nameOfTheSaveButton);
275
- app.setup.id.value = '';
299
+ var saveFlux = function(config) {
300
+ };
301
+
302
+ var ignoreFlux = function(config) {
303
+ };
276
304
 
277
- Vue.set(app.setup, 'showFlux', false);
278
- }, 500);
305
+ var setup = {
306
+ showFlux: false,
307
+ id: { type: 'hide', value: '' },
308
+ name: { type: 'text', value: '' },
309
+ flux: { type: 'select', value: fluxdata.fluxs[0].name, options: options},
310
+ parents: { type: 'selectmanyrecords', label: 'Receive Events From', value: '', options: flowdata.fluxs },
279
311
  };
280
312
 
281
313
  for (var key in configs)
282
314
  {
283
- configs[key].save = { type: 'button', name: 'Save This Flux', click: saveFlux };
315
+ configs[key].save = { type: 'button', name: 'Save Changes', click: function(config) {
316
+ saveTheFlux({ app: app, config: config });
317
+ saveTheFlow({ setup: app.setup, flow: app.flow });
318
+ app.setup.showFlux = false;
319
+ }
320
+ };
321
+ configs[key].cancel = { type: 'button', name: 'Ignore Changes', click: function() {
322
+ app.setup.showFlux = false;
323
+ }
324
+ };
284
325
 
285
326
  configs[key].test_event = { type: 'json', value: '{}', default: '{}' };
286
327
 
@@ -319,7 +360,7 @@ module Mushy
319
360
  Vue.set(setup.id, 'value', flux.id);
320
361
  Vue.set(setup.name, 'value', flux.name);
321
362
  Vue.set(setup.flux, 'value', flux.flux);
322
- Vue.set(setup.parent, 'value', flux.parent);
363
+ Vue.set(setup.parents, 'value', flux.parents);
323
364
 
324
365
  var applicable_config = configs[flux.flux];
325
366
  for(var key in applicable_config)
@@ -333,7 +374,7 @@ module Mushy
333
374
 
334
375
  options = flowdata.fluxs.filter(function(x){ return x.id != flux.id });
335
376
  options.unshift( { id: '', name: '' } );
336
- setup.parent.options = options;
377
+ setup.parents.options = options;
337
378
 
338
379
  Vue.set(setup, 'showFlux', true);
339
380
  app.results = [];
@@ -353,6 +394,7 @@ module Mushy
353
394
  flux = {
354
395
  id: uuidv4(),
355
396
  name: '',
397
+ parents: [],
356
398
  config: {}
357
399
  };
358
400
  loadThisFlux({ flux: flux, setup: x.setup, configs: x.configs });
@@ -377,9 +419,9 @@ module Mushy
377
419
  },
378
420
  configs: configs,
379
421
  setup: setup,
380
- flux_name_for: function(id, fluxes) {
381
- var flux = fluxes.filter(function(x){ return x.id == id })[0];
382
- return flux != undefined ? flux.name : '';
422
+ flux_name_for: function(ids, fluxes) {
423
+ var fluxs = fluxes.filter(function(x){ return ids.includes(x.id) });
424
+ return fluxs.map(function(x){ return x.name }).join(', ');
383
425
  },
384
426
  results: [],
385
427
  }
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.1.4'
7
+ s.version = '0.2.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.'
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.1.4
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Darren Cauthon