mushy 0.0.1 → 0.0.7

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.
data/lib/mushy/flow.rb CHANGED
@@ -26,9 +26,11 @@ module Mushy
26
26
 
27
27
  def self.parse data
28
28
  data = JSON.parse data
29
- flow = new
30
29
 
31
30
  data_fluxs = data['fluxs'] || []
31
+ data_fluxs.select { |x| x['parent'] }.map { |r| r["parent_fluxs"] = [r["parent"]] }
32
+
33
+ flow = new
32
34
 
33
35
  flow.fluxs = data_fluxs.map { |s| build_flux s }
34
36
 
data/lib/mushy/flux.rb CHANGED
@@ -40,17 +40,18 @@ module Mushy
40
40
 
41
41
  event = incoming_event
42
42
 
43
- mashed_config = masher.mash config, event
44
-
45
- incoming_split = mashed_config[:incoming_split]
43
+ incoming_split = masher.mash(config, event)[:incoming_split]
44
+ config_considering_an_imcoming_split = config
45
+ .reject { |x, _| incoming_split && x.to_s == 'join' }
46
+ .reduce({}) { |t, i| t[i[0]] = i[1]; t }
46
47
 
47
48
  events = incoming_split ? incoming_event[incoming_split] : [event]
48
49
 
49
- results = events.map { |e| execute_single_event e, config }
50
+ results = events.map { |e| execute_single_event e, config_considering_an_imcoming_split }
50
51
 
51
52
  return results.first unless incoming_split
52
53
 
53
- results = join_these_results(results, event, config[:join]) if config[:join]
54
+ results = join_these_results([results].flatten, event, config[:join]) if config[:join]
54
55
 
55
56
  results.flatten
56
57
  end
@@ -67,7 +68,7 @@ module Mushy
67
68
  returned_one_result = results.is_a?(Hash)
68
69
 
69
70
  results = standardize_these results
70
- results = shape_these results, event, mashed_config
71
+ results = shape_these results, event, config
71
72
 
72
73
  return results.first if the_original_join
73
74
 
@@ -27,6 +27,7 @@ module Mushy
27
27
  cookies: {
28
28
  description: 'Cookies for the web request. These can be received from a previous browser event with {{cookies}}, or can be typed manually.',
29
29
  type: 'editgrid',
30
+ shrink: true,
30
31
  value: [],
31
32
  editors: [
32
33
  { id: 'name', target: 'name', field: { type: 'text', value: '', default: '' } },
@@ -57,6 +58,11 @@ module Mushy
57
58
  type: 'text',
58
59
  value: 'headers',
59
60
  },
61
+ wait_before_closing: {
62
+ description: 'Wait this many seconds before closing the browser.',
63
+ type: 'integer',
64
+ value: '',
65
+ },
60
66
  },
61
67
  }
62
68
  end
@@ -80,6 +86,8 @@ module Mushy
80
86
  body: browser.body
81
87
  }
82
88
 
89
+ sleep(config[:wait_before_closing].to_i) if config[:wait_before_closing] && config[:wait_before_closing].to_i > 0
90
+
83
91
  browser.quit
84
92
 
85
93
  result
@@ -0,0 +1,19 @@
1
+ module Mushy
2
+
3
+ class Format < Flux
4
+
5
+ def self.details
6
+ {
7
+ name: 'Format',
8
+ description: 'Return the event passed to it. This opens the opportunity to further alter results.',
9
+ config: {},
10
+ }
11
+ end
12
+
13
+ def process event, config
14
+ event
15
+ end
16
+
17
+ end
18
+
19
+ end
@@ -10,26 +10,25 @@ module Mushy
10
10
  name: {
11
11
  description: 'The name of the file.',
12
12
  type: 'text',
13
- value: 'records',
13
+ value: 'file.csv',
14
14
  },
15
15
  directory: {
16
16
  description: 'The directory in which to write the file. Leave blank for the current directory.',
17
17
  type: 'text',
18
- value: 'records',
18
+ value: '',
19
19
  },
20
- path: {
21
- description: 'The path to the data to write.',
20
+ data: {
21
+ description: 'The text to write. You can use Liquid templating here to pull data from the event, or write hardcoded data.',
22
22
  type: 'text',
23
- value: 'records',
23
+ value: '{{data}}',
24
24
  },
25
25
  },
26
26
  }
27
27
  end
28
28
 
29
29
  def process event, config
30
- data = event[config[:path].to_sym] || event[config[:path].to_s]
31
30
 
32
- File.open(config[:name], 'w') { |f| f.write data }
31
+ File.open(config[:name], 'w') { |f| f.write config[:data] }
33
32
 
34
33
  {}
35
34
  end
data/lib/site.rb CHANGED
@@ -2,53 +2,49 @@ require 'sinatra'
2
2
 
3
3
  require_relative 'mushy'
4
4
 
5
+ the_file = 'hey.json'
6
+
5
7
  get '/' do
6
- File.read(File.join(File.dirname(__FILE__), 'public', 'index.html'))
8
+ Mushy::Builder::Index.file
9
+ end
10
+
11
+ get '/dark.css' do
12
+ content_type :css
13
+ Mushy::Builder::Dark.file
14
+ end
15
+
16
+ get '/axios.js' do
17
+ content_type :js
18
+ Mushy::Builder::Axios.file
19
+ end
20
+
21
+ get '/vue.js' do
22
+ content_type :js
23
+ Mushy::Builder::Vue.file
24
+ end
25
+
26
+ get '/flow' do
27
+ content_type :json
28
+ Mushy::Builder::Api.get_flow(the_file).to_json
7
29
  end
8
30
 
9
31
  get '/fluxs' do
10
32
  content_type :json
11
- {
12
- fluxs: Mushy::Flux.all.select { |x| x.respond_to? :details }.map do |flux|
13
- details = flux.details
14
- details[:config][:incoming_split] = { type: 'text', description: 'Split an incoming event into multiple events by this key, an each event will be processed independently.' }
15
- details[:config][:outgoing_split] = { type: 'text', description: 'Split an outgoing event into multiple events by this key.' }
16
- details[:config][:merge] = { type: 'text', description: 'A comma-delimited list of fields from the event to carry through. Use * to merge all fields.' }
17
- details[:config][:group] = { type: 'text', description: 'Group events by a field, which is stored in a key. The format is group_by|group_key.' }
18
- details[:config][:limit] = { type: 'integer', description: 'Limit the number of events to this number.' }
19
- details[:config][:join] = { type: 'text', description: 'Join all of the events from this flux into one event, under this name.' }
20
- details[:config][:sort] = { type: 'text', description: 'Sort by this key.' }
21
- details[:config][:model] = { type: 'keyvalue', description: 'Reshape the outgoing events.', value: {} }
22
-
23
- details[:config]
24
- .select { |_, v| v[:type] == 'keyvalue' }
25
- .select { |_, v| v[:editors].nil? }
26
- .each do |_, v|
27
- v[:editors] = [
28
- { id: 'new_key', target: 'key', field: { type: 'text', value: '', default: '' } },
29
- { id: 'new_value', target: 'value', field: { type: 'text', value: '', default: '' } }
30
- ]
31
- end
32
-
33
- details
34
- end
35
- }.to_json
33
+ Mushy::Builder::Api.get_fluxs.to_json
36
34
  end
37
35
 
38
36
  post '/run' do
39
37
  content_type :json
40
38
 
41
- data = SymbolizedHash.new JSON.parse(request.body.read)
42
-
43
- event = SymbolizedHash.new JSON.parse(data[:setup][:event].to_json)
44
-
45
- config = SymbolizedHash.new data[:config]
39
+ result = Mushy::Builder::Api.run request.body.read
46
40
 
47
- flux = Mushy::Flow.build_flux( { type: data[:setup][:flux], config: config } )
41
+ { result: result }.to_json
42
+ end
48
43
 
49
- result = flux.execute event
44
+ post '/save' do
45
+ content_type :json
50
46
 
51
- result = [result].flatten
47
+ result = Mushy::Builder::Api.save the_file, request.body.read
52
48
 
53
49
  { result: result }.to_json
54
50
  end
data/mushy.gemspec CHANGED
@@ -4,10 +4,10 @@ require 'mushy/version'
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = 'mushy'
7
- s.version = '0.0.1'
7
+ s.version = '0.0.7'
8
8
  s.date = '2020-11-23'
9
9
  s.summary = 'Process streams of work using common modules.'
10
- s.description = 'Process streams of work using common modules.'
10
+ s.description = 'This tool assists in the creation and processing of workflows.'
11
11
  s.authors = ['Darren Cauthon']
12
12
  s.email = 'darren@cauthon.com'
13
13
  s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
@@ -17,6 +17,9 @@ Gem::Specification.new do |s|
17
17
  s.license = 'MIT'
18
18
 
19
19
  s.add_development_dependency 'minitest'
20
+ s.add_runtime_dependency 'sinatra'
21
+ s.add_runtime_dependency 'symbolized'
22
+ s.add_runtime_dependency 'thor'
20
23
  s.add_runtime_dependency 'liquid'
21
24
  s.add_runtime_dependency 'ferrum'
22
25
  s.add_runtime_dependency 'nokogiri'
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.1
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Darren Cauthon
@@ -24,6 +24,48 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: sinatra
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: symbolized
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: thor
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
27
69
  - !ruby/object:Gem::Dependency
28
70
  name: liquid
29
71
  requirement: !ruby/object:Gem::Requirement
@@ -80,7 +122,7 @@ dependencies:
80
122
  - - ">="
81
123
  - !ruby/object:Gem::Version
82
124
  version: '0'
83
- description: Process streams of work using common modules.
125
+ description: This tool assists in the creation and processing of workflows.
84
126
  email: darren@cauthon.com
85
127
  executables:
86
128
  - mushy
@@ -89,6 +131,11 @@ extra_rdoc_files: []
89
131
  files:
90
132
  - bin/mushy
91
133
  - lib/mushy.rb
134
+ - lib/mushy/builder/api.rb
135
+ - lib/mushy/builder/axios.rb
136
+ - lib/mushy/builder/dark.rb
137
+ - lib/mushy/builder/index.rb
138
+ - lib/mushy/builder/vue.rb
92
139
  - lib/mushy/event.rb
93
140
  - lib/mushy/flow.rb
94
141
  - lib/mushy/flux.rb
@@ -97,6 +144,7 @@ files:
97
144
  - lib/mushy/fluxs/build_csv.rb
98
145
  - lib/mushy/fluxs/collection.rb
99
146
  - lib/mushy/fluxs/filter.rb
147
+ - lib/mushy/fluxs/format.rb
100
148
  - lib/mushy/fluxs/get.rb
101
149
  - lib/mushy/fluxs/ls.rb
102
150
  - lib/mushy/fluxs/parse_html.rb
@@ -106,7 +154,6 @@ files:
106
154
  - lib/mushy/run.rb
107
155
  - lib/mushy/runner.rb
108
156
  - lib/mushy/version.rb
109
- - lib/public/index.html
110
157
  - lib/site.rb
111
158
  - mushy.gemspec
112
159
  - note.txt
@@ -1,256 +0,0 @@
1
- <html>
2
- <head>
3
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/water.css@2/out/dark.css">
4
- <script src="https://cdn.jsdelivr.net/npm/vue@2.6.12/dist/vue.js"></script>
5
- <script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
6
- </head>
7
- <body>
8
- <div id="app">
9
- <table>
10
- <tr v-for="flux in flow.fluxs">
11
- <td>{{flux.name}}</td>
12
- </tr>
13
- </table>
14
- <mip-heavy :data="setup"></mip-heavy>
15
- <mip-heavy v-for="(data, id) in configs" v-show="setup.flux.value === id" :data="data"></mip-heavy>
16
- <div v-if="results.loading">Loading...</div>
17
- <div v-else>{{results.length}} result{{results.length == 1 ? "" : "s"}}</div>
18
- <mip-heavy v-for="data in results" :data="data"></mip-heavy>
19
- </div>
20
- </body>
21
- </html>
22
-
23
- <script type="text/javascript">
24
-
25
- var fancyName = function(id) { return '(' + id + '.split(/[ _]/).map(function(x){return x[0].toUpperCase() + x.substring(1)}).join(\' \'))' };
26
- var thingToData = function(thing) {
27
- var record = {};
28
- for (var key in thing)
29
- if (thing[key].value)
30
- if (thing[key].type == 'json')
31
- record[key] = JSON.parse(thing[key].value);
32
- else
33
- record[key] = thing[key].value;
34
- return record;
35
- };
36
-
37
- var components = {
38
- label: {
39
- props: ['label', 'description'],
40
- template: '<label :for="id" v-if="label != \'\'">{{label || ' + fancyName('id') + '}} <i v-show="description">({{description}})</i></label>'
41
- },
42
- text: {
43
- props: ['label', 'placeholder', 'disabled', 'readonly', 'value', 'description'],
44
- template: '<div><mip-label :id="id" :label="label" :description="description"></mip-label><input type="text" :name="id" :placeholder="placeholder" v-bind:value="value" v-on:input="$emit(\'update:value\', $event.target.value);" :disabled="disabled == \'true\'" :readonly="readonly == \'true\'"></div>'
45
- },
46
- integer: {
47
- props: ['label', 'placeholder', 'disabled', 'readonly', 'value', 'description'],
48
- template: '<div><mip-label :id="id" :label="label" :description="description"></mip-label><input type="text" :name="id" :placeholder="placeholder" v-bind:value="value" v-on:input="$emit(\'update:value\', $event.target.value);" :disabled="disabled == \'true\'" :readonly="readonly == \'true\'"></div>'
49
- },
50
- email: {
51
- props: ['label', 'placeholder', 'disabled', 'readonly', 'value', 'description'],
52
- template: '<div><mip-label :id="id" :label="label" :description="description"></mip-label><input type="email" :name="id" :placeholder="placeholder" v-bind:value="value" v-on:input="$emit(\'update:value\', $event.target.value)" :disabled="disabled == \'true\'" :readonly="readonly == \'true\'"></div>'
53
- },
54
- textarea: {
55
- props: ['label', 'placeholder', 'disabled', 'readonly', 'value', 'description'],
56
- template: '<div><mip-label :id="id" :label="label" :description="description"></mip-label><textarea :name="id" :placeholder="placeholder" v-bind:value="value" v-on:input="$emit(\'update:value\', $event.target.value)" :disabled="disabled == \'true\'" :readonly="readonly == \'true\'"></textarea></div>'
57
- },
58
- json: {
59
- props: ['label', 'placeholder', 'disabled', 'readonly', 'value', 'description'],
60
- template: '<div><mip-label :id="id" :label="label" :description="description"></mip-label><pre><code>{{value}}</code></pre><textarea :name="id" :placeholder="placeholder" v-bind:value="value" v-on:input="$emit(\'update:value\', $event.target.value)" :disabled="disabled == \'true\'" :readonly="readonly == \'true\'"></textarea></div>'
61
- },
62
- jsonview: {
63
- data: function() {
64
- return {
65
- toggle: function(view) { return view == 'beautiful' ? 'thin' : 'beautiful'; },
66
- copy: function(view, json) { console.log(view); return navigator.clipboard.writeText((view == 'beautiful' ? JSON.stringify(json, null, " ") : JSON.stringify(json))); },
67
- show: function(view, json) { return view == 'beautiful' ? JSON.stringify(json, null, " ") : JSON.stringify(json); },
68
- };
69
- },
70
- props: ['label', 'placeholder', 'disabled', 'readonly', 'value', 'description', 'view'],
71
- 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>'
72
- },
73
- radio: {
74
- props: ['label', 'value', 'options', 'description'],
75
- template: '<div><mip-label :id="id" :label="label" :description="description"></mip-label><div v-for="option in options"><input type="radio" :name="id" v-bind:value="option" v-on:input="$emit(\'update:value\', $event.target.value)" :checked="value == option"> <label for="option">{{option}}</label></div></div>'
76
- },
77
- select: {
78
- props: ['label', 'value', 'options', 'description'],
79
- template: '<div><mip-label :id="id" :label="label" :description="description"></mip-label><select :name="id" v-on:input="$emit(\'update:value\', $event.target.value)"><option v-for="option in options" v-bind:value="option" :selected="value == option">{{option}}</option></select></div>'
80
- },
81
- boolean: {
82
- props: ['label', 'value', 'options', 'description'],
83
- template: '<div><mip-label :id="id" :label="label" :description="description"></mip-label><select :name="id" 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>'
84
- },
85
- table: {
86
- props: ['value', 'description'],
87
- template: '<table><tr><th v-for="(d, i) in value[0]">{{' + fancyName('i') + '}}</th></tr><tr v-for="v in value"><td v-for="(d, i) in v">{{d}}</td></tr></table>'
88
- },
89
- editgrid: {
90
- data: function() {
91
- return {
92
- removeRecord: function(record, records, index) { records.splice(index, 1); },
93
- addRecord: function(editors, records) {
94
- var record = {};
95
- for (var i = 0; i < editors.length; i++)
96
- {
97
- record[editors[i].target] = editors[i].field.value;
98
- editors[i].field.value = editors[i].field.default ? editors[i].field.default : '';
99
- }
100
- records.push(record);
101
- }
102
- };
103
- },
104
- props: ['value', 'editors', 'label', 'description'],
105
- template: '<div><mip-label :id="id" :label="label" :description="description"></mip-label><table><tr><th v-for="(d, i) in value[0]">{{' + fancyName('i') + '}}</th></tr><tr v-for="(v, z) in value"><td v-for="(d, i) in v">{{d}}</td><td><a href="#" v-on:click.prevent.stop="removeRecord(v, value, z)">[x]</a></td></tr><tr><td v-for="editor in editors"><mip-thing :data="editor.field" :id="editor.id"></mip-thing></td><td><a href="#" v-on:click.prevent.stop="addRecord(editors, value)">[Add]</a></td></tr></table></div>'
106
- },
107
- keyvalue: {
108
- data: function() {
109
- return {
110
- removeRecord: function(data, key) { Vue.delete(data, key) },
111
- addRecord: function(editors, data) {
112
- Vue.set(data, editors[0].field.value, editors[1].field.value)
113
- editors[0].field.value = editors[0].field.default;
114
- editors[1].field.value = editors[1].field.default;
115
- }
116
- };
117
- },
118
- props: ['value', 'label', 'editors', 'description'],
119
- template: '<div><mip-label :id="id" :label="label" :description="description"></mip-label><table><tr v-for="(v, k) in value"><td>{{k}}</td><td>{{v}}</td><td><a href="#" v-on:click.prevent.stop="removeRecord(value, k)">[x]</a></td></tr><tr><td v-for="editor in editors"><mip-thing :data="editor.field" :id="editor.id"></mip-thing></td><td><a href="#" v-on:click.prevent.stop="addRecord(editors, value)" v-show="editors[0].field.value">[Add]</a></td></tr></table></div>'
120
- },
121
- button: {
122
- props: ['click', 'description'],
123
- template: '<button v-on:click.prevent.stop="click(pull(this))">{{id}}</button>'
124
- }
125
- };
126
-
127
- for(var property in components)
128
- {
129
- var props = JSON.parse(JSON.stringify(components[property].props));
130
- props.push('id');
131
- Vue.component('mip-' + property, {
132
- data: components[property].data ?? function () {
133
- var foundIt = this.$parent;
134
- var counter = 0;
135
- while (foundIt.$parent.constructor.name == "VueComponent" && counter < 10)
136
- {
137
- foundIt = foundIt.$parent;
138
- counter += 1;
139
- }
140
- return {
141
- console: console,
142
- pull: function(x) { return thingToData(foundIt.data); },
143
- }
144
- },
145
- props: props,
146
- template: components[property].template
147
- });
148
- }
149
-
150
- var thingTemplate = '<div>';
151
- for (var property in components)
152
- thingTemplate = thingTemplate + '<mip-' + property + ' v-if="data.type == \'' + property + '\'" :id="id" ' + components[property].props.map(function(x){ return ':' + x + '.sync="data.' + x + '"';}).join(' ') + '></mip-' + property + '>'
153
- thingTemplate = thingTemplate + '</div>';
154
-
155
- Vue.component('mip-thing', {
156
- data: function () {
157
- return {
158
- console: console,
159
- }
160
- },
161
- props: ['data', 'value', 'id', 'model'],
162
- template: thingTemplate
163
- });
164
-
165
- Vue.component('mip-heavy', {
166
- data: function () {
167
- return {
168
- console: console,
169
- }
170
- },
171
- props: ['data'],
172
- template: '<div><mip-thing v-for="(d, id) in data" :data="d" :id="id"></mip-thing></div>',
173
- });
174
-
175
- var sample = {
176
- email: { type: 'email', value: 'darren@cauthon.com' },
177
- first_name: { type: 'text', value: 'Darren' },
178
- description: { type: 'textarea', value: 'more data' },
179
- size: { type: 'select', value: 'medium', options: ['small', 'medium', 'large']},
180
- heynow: { type: 'keyvalue',
181
- value: {
182
- first_name: 'John',
183
- last_name: 'Doe',
184
- },
185
- editors: [
186
- { id: 'new_key', target: 'key', field: { type: 'text', value: '', default: '' } },
187
- { id: 'new_value', target: 'value', field: { type: 'text', value: '', default: '' } }
188
- ] },
189
- past: { type: 'editgrid',
190
- value: [
191
- { name: 'Godzilla', quantity: 1 },
192
- { name: 'Mothra', quantity: 2 },
193
- ],
194
- editors: [
195
- { id: 'new_name', target: 'name', field: { type: 'text', value: '', default: '' } },
196
- { id: 'new_quantity', target: 'quantity', field: { type: 'select', value: '1', options: [1, 2, 3], default: 1 } }
197
- ] },
198
- super_action: { type: 'button', click: function(x) { console.log(x) } },
199
- };
200
-
201
- var app = null;
202
-
203
- axios.get('/fluxs')
204
- .then(function(data){
205
-
206
- var configs = {};
207
- data.data.fluxs.map(function(x){
208
- configs[x.name] = x.config;
209
- });
210
-
211
- var setup = {
212
- event: { type: 'json', value: '{}' },
213
- id: { type: 'text', value: '' },
214
- name: { type: 'text', value: '' },
215
- flux: { type: 'select', value: data.data.fluxs[0].name, options: data.data.fluxs.map(function(x){ return x.name })},
216
- };
217
-
218
- for (var key in configs)
219
- {
220
- configs[key].go = { type: 'button', click: function(c) {
221
- app.results = [];
222
- Vue.set(app.results, 'loading', true);
223
- axios.post('/run', { config: c, setup: thingToData(app.setup) })
224
- .then(function(r){
225
- Vue.set(app.results, 'loading', false);
226
- for (var key in r.data.result)
227
- app.results.push({darren: { type:'jsonview', value: r.data.result[key], view: 'thin' }});
228
- });
229
- } };
230
-
231
- configs[key].save = { type: 'button', click: function(config) {
232
- var setup = thingToData(app.setup);
233
- var flux = {
234
- id: setup.id,
235
- name: setup.name,
236
- config: config,
237
- };
238
- app.flow.fluxs.push(flux);
239
- console.log(flux);
240
- }
241
- };
242
- }
243
-
244
- app = new Vue({
245
- el: '#app',
246
- data: {
247
- flow: {
248
- fluxs: [],
249
- },
250
- configs: configs,
251
- setup: setup,
252
- results: [],
253
- }
254
- });
255
- });
256
- </script>