marty 8.5.0 → 9.3.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.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/.eslintignore +1 -0
  3. data/.eslintrc.js +26 -0
  4. data/.gitignore +3 -0
  5. data/.gitlab-ci.yml +7 -0
  6. data/.prettierignore +14 -0
  7. data/.rubocop_todo.yml +1 -1
  8. data/Dockerfile.dummy +3 -0
  9. data/Makefile +1 -0
  10. data/app/assets/javascripts/marty/cable.js +7 -3
  11. data/app/assets/javascripts/marty/extjs/extensions/datetime_field/component.js +401 -0
  12. data/app/assets/javascripts/marty/extjs/extensions/datetime_field/field.js +140 -0
  13. data/app/assets/javascripts/marty/extjs/extensions/marty.js +845 -781
  14. data/app/assets/stylesheets/marty/codemirror/codemirror.css +215 -77
  15. data/app/assets/stylesheets/marty/codemirror/delorean.css +2 -2
  16. data/app/assets/stylesheets/marty/dark_mode.css +13 -3
  17. data/app/components/marty/auth_app/client/auth_app.js +107 -102
  18. data/app/components/marty/base_rule_view/client/base_rule_view.js +10 -8
  19. data/app/components/marty/data_grid_view/client/data_grid_edit.js +534 -519
  20. data/app/components/marty/form/client/form.js +3 -3
  21. data/app/components/marty/grid/client/grid.js +110 -87
  22. data/app/components/marty/import_view/client/import_view.js +18 -18
  23. data/app/components/marty/live_search_grid_panel/client/live_search_grid_panel.js +14 -13
  24. data/app/components/marty/main_auth_app/client/main_auth_app.js +42 -42
  25. data/app/components/marty/mcfly_grid_panel/client/mcfly_grid_panel.js +27 -18
  26. data/app/components/marty/new_posting_form/client/new_posting_form.js +3 -3
  27. data/app/components/marty/panel/client/panel.js +3 -3
  28. data/app/components/marty/posting_grid/client/posting_grid.js +24 -18
  29. data/app/components/marty/promise_view/client/promise_view.css +12 -12
  30. data/app/components/marty/promise_view/client/promise_view.js +46 -38
  31. data/app/components/marty/report_form/client/report_form.js +30 -28
  32. data/app/components/marty/report_select/client/report_select.js +28 -23
  33. data/app/components/marty/reporting/client/reporting.js +3 -3
  34. data/app/components/marty/script_form/client/script_form.js +29 -23
  35. data/app/components/marty/script_tester/client/script_tester.js +4 -5
  36. data/app/components/marty/scripting/client/scripting.js +40 -36
  37. data/app/components/marty/simple_app/client/simple_app.js +33 -24
  38. data/app/components/marty/simple_app/client/statusbar_ext.js +1 -1
  39. data/app/controllers/marty/rpc_controller.rb +3 -0
  40. data/app/models/marty/promise.rb +10 -2
  41. data/app/services/marty/data_grid/constraint.rb +2 -1
  42. data/app/services/marty/jobs/schedule.rb +2 -2
  43. data/app/services/marty/promises/delorean/create.rb +9 -2
  44. data/app/services/marty/promises/ruby/create.rb +7 -2
  45. data/config/initializers/delayed_job_config.rb +1 -0
  46. data/delorean/blame_report.dl +50 -58
  47. data/delorean/enum_report.dl +2 -3
  48. data/delorean/{marty_fields.dl → fields.dl} +16 -0
  49. data/delorean/styles.dl +216 -0
  50. data/delorean/table_report.dl +4 -4
  51. data/lib/marty/monkey.rb +17 -0
  52. data/lib/marty/promise_job.rb +9 -0
  53. data/lib/marty/promise_ruby_job.rb +8 -0
  54. data/lib/marty/version.rb +1 -1
  55. data/make-lint.mk +19 -0
  56. data/package.json +16 -0
  57. data/prettier.config.js +6 -0
  58. data/spec/controllers/diagnostic/controller_spec.rb +0 -1
  59. data/spec/controllers/rpc_controller_spec.rb +21 -7
  60. data/spec/dummy/delorean/data_report.dl +4 -4
  61. data/spec/dummy/delorean/fields.dl +1 -0
  62. data/spec/features/data_grid_spec.rb +37 -1
  63. data/spec/job_helper.rb +6 -0
  64. data/spec/lib/data_blame_spec.rb +4 -4
  65. data/spec/lib/data_importer_spec.rb +6 -4
  66. data/spec/models/promise_spec.rb +31 -0
  67. data/spec/spec_helper.rb +8 -0
  68. data/spec/support/download_helper.rb +53 -49
  69. data/spec/support/json_helper.rb +11 -0
  70. data/spec/support/shared_connection_db_helpers.rb +1 -0
  71. data/spec/support/suite.rb +20 -14
  72. data/yarn.lock +967 -0
  73. metadata +16 -4
  74. data/spec/dummy/delorean/marty_fields.dl +0 -1
@@ -1,5 +1,5 @@
1
- {
2
- findComponent: function (name) {
1
+ ({
2
+ findComponent(name) {
3
3
  return Ext.ComponentQuery.query(`[name=${name}]`)[0];
4
4
  }
5
- }
5
+ });
@@ -1,4 +1,4 @@
1
- {
1
+ ({
2
2
  getComponent(name) {
3
3
  return Ext.getCmp(name);
4
4
  },
@@ -8,7 +8,7 @@
8
8
  },
9
9
 
10
10
  setDisableComponentActions(prefix, flag) {
11
- for (var key in this.actions) {
11
+ for (const key in this.actions) {
12
12
  if (key.substring(0, prefix.length) == prefix) {
13
13
  this.actions[key].setDisabled(flag);
14
14
  }
@@ -17,28 +17,30 @@
17
17
 
18
18
  initComponent() {
19
19
  this.dockedItems = this.dockedItems || [];
20
- if (this.paging == 'pagination') {
20
+ if (this.paging == "pagination") {
21
21
  this.dockedItems.push({
22
- xtype: 'pagingtoolbar',
23
- dock: 'bottom',
22
+ xtype: "pagingtoolbar",
23
+ dock: "bottom",
24
24
  layout: {
25
- overflowHandler: 'Menu'
25
+ overflowHandler: "Menu"
26
26
  },
27
27
  listeners: {
28
- 'beforechange': this.disableDirtyPageWarning ? {} : {
29
- fn: this.netzkeBeforePageChange,
30
- scope: this
31
- }
28
+ beforechange: this.disableDirtyPageWarning
29
+ ? {}
30
+ : {
31
+ fn: this.netzkeBeforePageChange,
32
+ scope: this
33
+ }
32
34
  },
33
35
  store: this.store,
34
36
  items: this.bbar && ["-"].concat(this.bbar)
35
37
  });
36
38
  } else if (this.bbar) {
37
39
  this.dockedItems.push({
38
- xtype: 'toolbar',
39
- dock: 'bottom',
40
+ xtype: "toolbar",
41
+ dock: "bottom",
40
42
  layout: {
41
- overflowHandler: 'Menu'
43
+ overflowHandler: "Menu"
42
44
  },
43
45
  items: this.bbar
44
46
  });
@@ -46,72 +48,75 @@
46
48
 
47
49
  // block creation of toolbars in parent
48
50
  delete this.bbar;
49
- var paging = this.paging
50
- if (paging != 'buffered') {
51
+ const paging = this.paging;
52
+ if (paging != "buffered") {
51
53
  this.paging = false;
52
54
  }
53
55
  this.callParent();
54
- this.paging = paging
56
+ this.paging = paging;
55
57
 
56
- var me = this;
58
+ const me = this;
57
59
 
58
- var children = me.serverConfig.child_components || [];
59
- me.onSelectionChange(
60
- function(m) {
61
- var has_sel = m.hasSelection();
60
+ const children = me.serverConfig.child_components || [];
61
+ me.onSelectionChange(function(m) {
62
+ const has_sel = m.hasSelection();
62
63
 
63
- var rid = null;
64
- if (has_sel) {
65
- if (m.type == 'spreadsheet') {
66
- var cell = m.getSelected().startCell;
67
- rid = cell && cell.record.getId();
68
- }
69
- if (!rid) {
70
- selected = m.getSelection()[0];
71
- rid = selected && selected.getId();
72
- }
64
+ let rid = null;
65
+ if (has_sel) {
66
+ if (m.type == "spreadsheet") {
67
+ const cell = m.getSelected().startCell;
68
+ rid = cell && cell.record.getId();
73
69
  }
70
+ if (!rid) {
71
+ const selected = m.getSelection()[0];
72
+ rid = selected && selected.getId();
73
+ }
74
+ }
74
75
 
75
- me.serverConfig.selected = rid;
76
- me.setDisableComponentActions('do', !has_sel);
76
+ me.serverConfig.selected = rid;
77
+ me.setDisableComponentActions("do", !has_sel);
77
78
 
78
- for (var child of children) {
79
- var comp = me.findComponent(child)
80
- if (comp) {
81
- comp.serverConfig.parent_id = rid;
82
- if (comp.setDisableComponentActions) {
83
- comp.setDisableComponentActions('parent', !has_sel);
84
- }
85
- if (comp.reload) {
86
- comp.reload()
87
- }
79
+ for (const child of children) {
80
+ const comp = me.findComponent(child);
81
+ if (comp) {
82
+ comp.serverConfig.parent_id = rid;
83
+ if (comp.setDisableComponentActions) {
84
+ comp.setDisableComponentActions("parent", !has_sel);
85
+ }
86
+ if (comp.reload) {
87
+ comp.reload();
88
88
  }
89
89
  }
90
- });
90
+ }
91
+ });
91
92
 
92
- var store = me.getStore();
93
- var linked = me.serverConfig.linked_components || [];
94
- for (var event of ['update', 'netzkerefresh']) {
95
- store.on(event, function() {
96
- for (var link of linked) {
97
- var comp = me.findComponent(link);
98
- if (comp && comp.reload) {
99
- comp.reload()
93
+ const store = me.getStore();
94
+ const linked = me.serverConfig.linked_components || [];
95
+ for (const event of ["update", "netzkerefresh"]) {
96
+ store.on(
97
+ event,
98
+ function() {
99
+ for (const link of linked) {
100
+ const comp = me.findComponent(link);
101
+ if (comp && comp.reload) {
102
+ comp.reload();
103
+ }
100
104
  }
101
- }
102
- }, this);
105
+ },
106
+ this
107
+ );
103
108
  }
104
109
  },
105
110
 
106
111
  onSelectionChange(f) {
107
- var me = this;
108
- me.getSelectionModel().on('selectionchange', f);
112
+ const me = this;
113
+ me.getSelectionModel().on("selectionchange", f);
109
114
  },
110
115
 
111
116
  // override netzkeReloadStore to allow option passthrough
112
117
  // reference: http://api.netzke.org/client/files/doc_client_netzke-basepack_javascripts_grid_event_handlers.js.html
113
118
  netzkeReloadStore(opts = {}) {
114
- var store = this.getStore();
119
+ const store = this.getStore();
115
120
 
116
121
  // HACK to work around buffered store's buggy reload()
117
122
  if (!store.lastRequestStart) {
@@ -124,13 +129,17 @@
124
129
  serverConfig: {
125
130
  record_id: record.id
126
131
  },
127
- callback: function(w) {
132
+ callback(w) {
128
133
  w.show();
129
- w.on('close', function() {
130
- if (w.closeRes === "ok") {
131
- this.netzkeReloadStore();
132
- }
133
- }, this);
134
+ w.on(
135
+ "close",
136
+ function() {
137
+ if (w.closeRes === "ok") {
138
+ this.netzkeReloadStore();
139
+ }
140
+ },
141
+ this
142
+ );
134
143
  }
135
144
  });
136
145
  },
@@ -143,13 +152,13 @@
143
152
  },
144
153
 
145
154
  reloadAll() {
146
- var me = this;
147
- var children = me.serverConfig.child_components || [];
155
+ const me = this;
156
+ const children = me.serverConfig.child_components || [];
148
157
  this.store.reload();
149
- for (child of children) {
150
- var comp = me.findComponent(child);
158
+ for (const child of children) {
159
+ const comp = me.findComponent(child);
151
160
  if (comp && comp.reload) {
152
- comp.reload()
161
+ comp.reload();
153
162
  }
154
163
  }
155
164
  },
@@ -164,53 +173,67 @@
164
173
  Please use netzkeCallEndpoint instead.
165
174
  `);
166
175
 
167
- var selected = this.getSelectionModel().getSelection().map((r) => r.id)
176
+ const selected = this.getSelectionModel()
177
+ .getSelection()
178
+ .map((r) => r.id);
168
179
 
169
180
  if (confirmation) {
170
181
  Ext.Msg.confirm(
171
182
  confirmation,
172
- Ext.String.format('Are you sure?'),
173
- (btn, value, cfg) => {
183
+ Ext.String.format("Are you sure?"),
184
+ (btn, _value, _cfg) => {
174
185
  if (btn == "yes") {
175
- this.server[endpoint](selected, () => { this.unmask() })
186
+ this.server[endpoint](selected, () => {
187
+ this.unmask();
188
+ });
176
189
  }
177
190
  }
178
191
  );
179
192
  } else {
180
- this.server[endpoint](selected, () => { this.unmask() })
193
+ this.server[endpoint](selected, () => {
194
+ this.unmask();
195
+ });
181
196
  }
182
197
  },
183
198
 
184
199
  // FIXME: move to netzke
185
200
  netzkeCallEndpoint(action) {
186
- const selected = this.getSelectionModel().getSelection().map((r) => r.id)
201
+ const selected = this.getSelectionModel()
202
+ .getSelection()
203
+ .map((r) => r.id);
187
204
  const endpointName = action.endpointName || action.name;
188
205
 
189
- const camelCasedEndpointName = endpointName.replace(
190
- /_([a-z])/g,
191
- (g) => g[1].toUpperCase()
206
+ const camelCasedEndpointName = endpointName.replace(/_([a-z])/g, (g) =>
207
+ g[1].toUpperCase()
192
208
  );
193
209
 
194
- const requireConfirmation = action.requireConfirmation || action.confirmationMessage;
210
+ const requireConfirmation =
211
+ action.requireConfirmation || action.confirmationMessage;
195
212
 
196
213
  const handlerFunction = this.server[camelCasedEndpointName];
197
214
 
198
215
  if (!requireConfirmation) {
199
- return handlerFunction(selected, () => { this.unmask()});
200
- };
216
+ return handlerFunction(selected, () => {
217
+ this.unmask();
218
+ });
219
+ }
201
220
 
202
221
  const confirmationTitle = action.confirmationTitle || action.name;
203
- const confirmationMessage = action.confirmationMessage || 'Are you sure?';
204
- const inProgressMessage = action.inProgressMessage || 'In progress...';
222
+ const confirmationMessage = action.confirmationMessage || "Are you sure?";
223
+ const inProgressMessage = action.inProgressMessage || "In progress...";
205
224
 
206
225
  return Ext.Msg.confirm(
207
226
  confirmationTitle,
208
227
  Ext.String.format(confirmationMessage),
209
- (btn, value, cfg) => {
210
- if (btn !== "yes") { return null; };
228
+ (btn, _value, _cfg) => {
229
+ if (btn !== "yes") {
230
+ return null;
231
+ }
211
232
  this.mask(inProgressMessage);
212
- return handlerFunction(selected, () => { this.unmask()});
233
+ return handlerFunction(selected, () => {
234
+ this.unmask();
235
+ });
213
236
  }
214
237
  );
215
- },
216
- }
238
+ }
239
+ });
@@ -1,32 +1,32 @@
1
- {
2
- initComponent: function () {
3
- var me = this;
1
+ ({
2
+ initComponent() {
3
+ const me = this;
4
4
  me.callParent();
5
- var form = me.getForm();
5
+ // const form = me.getForm();
6
6
 
7
- var window = this.netzkeGetParentComponent();
8
- var parent_view = window.netzkeGetParentComponent();
7
+ const window = this.netzkeGetParentComponent();
8
+ const parent_view = window.netzkeGetParentComponent();
9
9
 
10
- this.serverConfig.parent_id = parent_view.serverConfig.parent_id ||
11
- parent_view.serverConfig.selected;
10
+ this.serverConfig.parent_id =
11
+ parent_view.serverConfig.parent_id || parent_view.serverConfig.selected;
12
12
 
13
- var textname = form.findField('import_data');
14
- var importbutton = me.actions["apply"].items[0];
13
+ // const textname = form.findField("import_data");
14
+ const importbutton = me.actions["apply"].items[0];
15
15
 
16
- importbutton.on('click', function (t, e, ops) {
17
- me.netzkeGetComponent('result').updateBodyHtml('');
16
+ importbutton.on("click", function(_t, _e, _ops) {
17
+ me.netzkeGetComponent("result").updateBodyHtml("");
18
18
  });
19
19
  },
20
20
 
21
- setResult: function (html) {
22
- var result = this.netzkeGetComponent('result');
21
+ setResult(html) {
22
+ const result = this.netzkeGetComponent("result");
23
23
  result.updateBodyHtml(html);
24
24
 
25
- var window = this.netzkeGetParentComponent();
26
- var parent_view = window.netzkeGetParentComponent();
25
+ const window = this.netzkeGetParentComponent();
26
+ const parent_view = window.netzkeGetParentComponent();
27
27
 
28
28
  if (parent_view && parent_view.reload) {
29
- parent_view.reload()
29
+ parent_view.reload();
30
30
  }
31
31
  }
32
- }
32
+ });
@@ -1,27 +1,28 @@
1
- {
2
- initComponent: function () {
3
- var me = this;
4
- me.tbar = ['->',
1
+ ({
2
+ initComponent() {
3
+ const me = this;
4
+ me.tbar = [
5
+ "->",
5
6
  {
6
- name: 'live_search_text',
7
- xtype: 'textfield',
7
+ name: "live_search_text",
8
+ xtype: "textfield",
8
9
  enable_key_events: true,
9
- ref: '../live_search_field',
10
- empty_text: 'Search',
10
+ ref: "../live_search_field",
11
+ empty_text: "Search",
11
12
  listeners: {
12
13
  change: {
13
14
  fn: me.listenFn,
14
- buffer: 500,
15
+ buffer: 500
15
16
  }
16
17
  }
17
18
  }
18
- ]
19
+ ];
19
20
  this.callParent();
20
21
  },
21
22
 
22
- listenFn: function (obj, search_text) {
23
- var lg = this.ownerCt.ownerCt;
23
+ listenFn(obj, search_text) {
24
+ const lg = this.ownerCt.ownerCt;
24
25
  lg.getStore().getProxy().extraParams.live_search = search_text;
25
26
  lg.getStore().load();
26
27
  }
27
- }
28
+ });
@@ -1,7 +1,7 @@
1
- {
2
- showDetail: function (details, title) {
1
+ ({
2
+ showDetail(details, title) {
3
3
  this.hideLoadMask();
4
- Ext.create('Ext.Window', {
4
+ Ext.create("Ext.Window", {
5
5
  height: 400,
6
6
  minWidth: 400,
7
7
  maxWidth: 1200,
@@ -13,112 +13,112 @@
13
13
  }).show();
14
14
  },
15
15
 
16
- showLoadMask: function (msg) {
16
+ showLoadMask(msg) {
17
17
  this.maskCmp = new Ext.LoadMask({
18
- msg: msg || 'Loading...',
19
- target: this,
18
+ msg: msg || "Loading...",
19
+ target: this
20
20
  });
21
21
  this.maskCmp.show();
22
22
  },
23
23
 
24
- hideLoadMask: function () {
24
+ hideLoadMask() {
25
25
  if (this.maskCmp) {
26
26
  this.maskCmp.hide();
27
- };
27
+ }
28
28
  },
29
29
 
30
- netzkeOnNewPosting: function (params) {
30
+ netzkeOnNewPosting(_params) {
31
31
  this.netzkeLoadComponent("new_posting_window", {
32
- callback: function (w) {
32
+ callback(w) {
33
33
  w.show();
34
- },
34
+ }
35
35
  });
36
36
  },
37
37
 
38
- netzkeOnSelectPosting: function (params) {
38
+ netzkeOnSelectPosting(_params) {
39
39
  this.netzkeLoadComponent("posting_window", {
40
- callback: function (w) {
40
+ callback(w) {
41
41
  w.show();
42
- },
42
+ }
43
43
  });
44
44
  },
45
45
 
46
- netzkeOnReload: function (params) {
46
+ netzkeOnReload(_params) {
47
47
  window.location.reload();
48
48
  },
49
49
 
50
- netzkeOnLoadSeed: function (params) {
50
+ netzkeOnLoadSeed(_params) {
51
51
  this.server.loadSeed({});
52
52
  },
53
53
 
54
- netzkeOnSelectNow: function (params) {
54
+ netzkeOnSelectNow(_params) {
55
55
  this.server.selectPosting({});
56
56
  },
57
57
 
58
- netzkeOnReloadScripts: function (params) {
59
- var me = this;
58
+ netzkeOnReloadScripts(_params) {
59
+ const me = this;
60
60
  Ext.Msg.show({
61
- title: 'Reload Scripts',
62
- msg: 'Enter RELOAD and press OK to force a reload of all scripts',
61
+ title: "Reload Scripts",
62
+ msg: "Enter RELOAD and press OK to force a reload of all scripts",
63
63
  width: 375,
64
64
  buttons: Ext.Msg.OKCANCEL,
65
65
  prompt: true,
66
- fn: function (btn, value) {
66
+ fn(btn, value) {
67
67
  btn == "ok" && value == "RELOAD" && me.server.reloadScripts({});
68
68
  }
69
69
  });
70
70
  },
71
71
 
72
- netzkeOnBgStop: function (params) {
73
- var me = this;
72
+ netzkeOnBgStop(_params) {
73
+ const me = this;
74
74
  Ext.Msg.show({
75
- title: 'Stop Delayed Jobs',
76
- msg: 'Enter STOP and press OK to force a stop of delayed_job',
75
+ title: "Stop Delayed Jobs",
76
+ msg: "Enter STOP and press OK to force a stop of delayed_job",
77
77
  width: 375,
78
78
  buttons: Ext.Msg.OKCANCEL,
79
79
  prompt: true,
80
- fn: function (btn, value) {
80
+ fn(btn, value) {
81
81
  if (btn == "ok" && value == "STOP") {
82
- me.showLoadMask('Stopping delayed job...');
82
+ me.showLoadMask("Stopping delayed job...");
83
83
  me.server.bgStop({});
84
84
  }
85
85
  }
86
86
  });
87
87
  },
88
88
 
89
- netzkeOnBgRestart: function (params) {
90
- var me = this;
89
+ netzkeOnBgRestart(_params) {
90
+ const me = this;
91
91
  Ext.Msg.show({
92
- title: 'Restart Delayed Jobs',
93
- msg: 'Enter RESTART and press OK to force a restart of delayed_job',
92
+ title: "Restart Delayed Jobs",
93
+ msg: "Enter RESTART and press OK to force a restart of delayed_job",
94
94
  width: 375,
95
95
  buttons: Ext.Msg.OKCANCEL,
96
96
  prompt: true,
97
- fn: function (btn, value) {
97
+ fn(btn, value) {
98
98
  if (btn == "ok" && value == "RESTART") {
99
- me.showLoadMask('Restarting delayed job...');
99
+ me.showLoadMask("Restarting delayed job...");
100
100
  me.server.bgRestart({});
101
101
  }
102
102
  }
103
103
  });
104
104
  },
105
105
 
106
- netzkeOnBgStatus: function () {
107
- this.showLoadMask('Checking delayed job status...');
106
+ netzkeOnBgStatus() {
107
+ this.showLoadMask("Checking delayed job status...");
108
108
  this.server.bgStatus({});
109
109
  },
110
110
 
111
- netzkeOnLogCleanup: function (params) {
112
- var me = this;
111
+ netzkeOnLogCleanup(_params) {
112
+ const me = this;
113
113
  Ext.Msg.show({
114
- title: 'Log Cleanup',
115
- msg: 'Enter number of days to keep',
114
+ title: "Log Cleanup",
115
+ msg: "Enter number of days to keep",
116
116
  width: 375,
117
117
  buttons: Ext.Msg.OKCANCEL,
118
118
  prompt: true,
119
- fn: function (btn, value) {
119
+ fn(btn, value) {
120
120
  btn == "ok" && me.server.logCleanup(value);
121
121
  }
122
122
  });
123
123
  }
124
- }
124
+ });