marty 8.5.0 → 9.3.0

Sign up to get free protection for your applications and to get access to all the features.
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,37 +1,46 @@
1
- {
2
- initComponent: function () {
1
+ ({
2
+ initComponent() {
3
3
  this.callParent();
4
4
 
5
5
  // dup is a non standard button, so we have to explicitly manage
6
6
  // its clickability
7
- this.getSelectionModel().on('selectionchange', function (selModel) {
8
- this.actions.dupInForm &&
9
- this.actions.dupInForm.setDisabled(!selModel.hasSelection() ||
10
- !this.permissions.create);
11
- }, this);
7
+ this.getSelectionModel().on(
8
+ "selectionchange",
9
+ function(selModel) {
10
+ this.actions.dupInForm &&
11
+ this.actions.dupInForm.setDisabled(
12
+ !selModel.hasSelection() || !this.permissions.create
13
+ );
14
+ },
15
+ this
16
+ );
12
17
  },
13
18
  // copied from basepack grid's onEditInForm
14
- netzkeOnDupInForm: function () {
15
- var selModel = this.getSelectionModel();
16
- var recordId = selModel.getSelection()[0].getId();
19
+ netzkeOnDupInForm() {
20
+ const selModel = this.getSelectionModel();
21
+ const recordId = selModel.getSelection()[0].getId();
17
22
  this.netzkeLoadComponent("edit_window", {
18
23
  title: "Duplicate in Form",
19
24
  serverConfig: {
20
25
  record_id: recordId
21
26
  },
22
- callback: function (w) {
27
+ callback(w) {
23
28
  w.show();
24
- var form = w.items.first();
29
+ const form = w.items.first();
25
30
  form.baseParams = {
26
31
  dup: true
27
32
  };
28
- w.on('close', function () {
29
- if (w.closeRes === "ok") {
30
- this.store.load();
31
- }
32
- }, this);
33
+ w.on(
34
+ "close",
35
+ function() {
36
+ if (w.closeRes === "ok") {
37
+ this.store.load();
38
+ }
39
+ },
40
+ this
41
+ );
33
42
  },
34
43
  scope: this
35
44
  });
36
45
  }
37
- }
46
+ });
@@ -1,6 +1,6 @@
1
- {
2
- closeMe: function () {
1
+ ({
2
+ closeMe() {
3
3
  // assume we're embedded in a window
4
4
  this.netzkeGetParentComponent().close();
5
5
  }
6
- }
6
+ });
@@ -1,5 +1,5 @@
1
- {
2
- updateBodyHtml: function (html) {
1
+ ({
2
+ updateBodyHtml(html) {
3
3
  this.body.update(html);
4
4
  }
5
- }
5
+ });
@@ -1,22 +1,28 @@
1
- {
2
- initComponent: function () {
1
+ ({
2
+ initComponent() {
3
3
  this.callParent();
4
4
 
5
- this.getSelectionModel().on('selectionchange', function (selModel) {
6
- this.actions.detail &&
7
- this.actions.detail.setDisabled(!selModel.hasSelection());
8
- }, this);
5
+ this.getSelectionModel().on(
6
+ "selectionchange",
7
+ function(selModel) {
8
+ this.actions.detail &&
9
+ this.actions.detail.setDisabled(!selModel.hasSelection());
10
+ },
11
+ this
12
+ );
9
13
  },
10
14
 
11
- detail: function () {
12
- record_id = this.getSelectionModel().getSelection()[0].getId();
15
+ detail() {
16
+ const record_id = this.getSelectionModel()
17
+ .getSelection()[0]
18
+ .getId();
13
19
  this.server.detail({
14
- record_id: record_id
20
+ record_id
15
21
  });
16
22
  },
17
23
 
18
- netzkeShowDetail: function (details) {
19
- Ext.create('Ext.Window', {
24
+ netzkeShowDetail(details) {
25
+ Ext.create("Ext.Window", {
20
26
  height: 150,
21
27
  minWidth: 250,
22
28
  autoWidth: true,
@@ -27,17 +33,17 @@
27
33
  }).show();
28
34
  },
29
35
 
30
- netzkeOnDelete: function () {
31
- var records = [];
32
- var me = this;
33
- me.getSelectionModel().selected.each(function (r) {
36
+ netzkeOnDelete() {
37
+ const records = [];
38
+ const me = this;
39
+ me.getSelectionModel().selected.each(function(r) {
34
40
  records.push(r.getId());
35
41
  }, me);
36
42
 
37
43
  // find the root component (main application)
38
- var main_app = me;
44
+ let main_app = me;
39
45
  while (1) {
40
- var p = main_app.netzkeGetParentComponent();
46
+ const p = main_app.netzkeGetParentComponent();
41
47
  if (!p) {
42
48
  break;
43
49
  }
@@ -47,4 +53,4 @@
47
53
  // assumes main_app has serverSelectPosting method
48
54
  main_app.server.selectPosting(records);
49
55
  }
50
- }
56
+ });
@@ -1,29 +1,29 @@
1
1
  .green-row {
2
- background-color: #91FF91;
2
+ background-color: #91ff91;
3
3
  }
4
4
 
5
5
  .red-row {
6
- background-color: #FF4545;
6
+ background-color: #ff4545;
7
7
  }
8
8
 
9
9
  .orange-row {
10
- background-color: #FF9D5C;
10
+ background-color: #ff9d5c;
11
11
  }
12
12
 
13
13
  .x-grid-item-selected .green-row {
14
- background-color: #549454;
15
- /* V: 58 */
16
- font-weight: bold;
14
+ background-color: #549454;
15
+ /* V: 58 */
16
+ font-weight: bold;
17
17
  }
18
18
 
19
19
  .x-grid-item-selected .red-row {
20
- background-color: #bd3333;
21
- /* V: 74 */
22
- font-weight: bold;
20
+ background-color: #bd3333;
21
+ /* V: 74 */
22
+ font-weight: bold;
23
23
  }
24
24
 
25
25
  .x-grid-item-selected .orange-row {
26
- background-color: #b87243;
27
- /* V: 74 */
28
- font-weight: bold;
26
+ background-color: #b87243;
27
+ /* V: 74 */
28
+ font-weight: bold;
29
29
  }
@@ -1,60 +1,68 @@
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
- this.getSelectionModel().on('selectionchange', function (selModel) {
21
- this.actions.download && this.actions.download.setDisabled(!selModel.hasSelection());
22
- }, this);
21
+ this.getSelectionModel().on(
22
+ "selectionchange",
23
+ function(selModel) {
24
+ this.actions.download &&
25
+ this.actions.download.setDisabled(!selModel.hasSelection());
26
+ },
27
+ this
28
+ );
23
29
  this.getView().getRowClass = this.defaultGetRowClass;
24
30
  },
25
- defaultGetRowClass: function (record, index, rowParams, ds) {
26
- var status = record.get('status');
31
+ defaultGetRowClass(record, _index, _rowParams, _ds) {
32
+ const status = record.get("status");
27
33
  if (status === false) return "red-row";
28
34
  if (status === true) return "green-row";
29
35
  return "orange-row";
30
36
  },
31
37
 
32
- listenFn: function (obj, search_text) {
33
- var lg = this.ownerCt.ownerCt;
38
+ listenFn(obj, search_text) {
39
+ const lg = this.ownerCt.ownerCt;
34
40
  lg.getStore().getProxy().extraParams.live_search = search_text;
35
41
  lg.getStore().load();
36
42
  },
37
43
 
38
- netzkeOnDownload: function () {
39
- var jid = this.getSelectionModel().getSelection()[0].getId();
44
+ netzkeOnDownload() {
45
+ const jid = this.getSelectionModel()
46
+ .getSelection()[0]
47
+ .getId();
40
48
  // FIXME: seems pretty hacky
41
49
  window.location = this.jobPath(jid);
42
50
  },
43
51
 
44
- netzkeOnRefresh: function () {
52
+ netzkeOnRefresh() {
45
53
  this.store.load();
46
54
  },
47
55
 
48
- netzkeOnClear: function (params) {
49
- var me = this;
56
+ netzkeOnClear(_params) {
57
+ const me = this;
50
58
  Ext.Msg.show({
51
- title: 'Clear All Jobs',
52
- msg: 'Enter CLEAR and press OK to clear all previous jobs',
59
+ title: "Clear All Jobs",
60
+ msg: "Enter CLEAR and press OK to clear all previous jobs",
53
61
  width: 375,
54
62
  buttons: Ext.Msg.OKCANCEL,
55
63
  prompt: true,
56
- fn: function (btn, value) {
57
- (btn == "ok" && value == "CLEAR") && me.server.clear({});
64
+ fn(btn, value) {
65
+ btn == "ok" && value == "CLEAR" && me.server.clear({});
58
66
  }
59
67
  });
60
68
  },
@@ -62,25 +70,25 @@
62
70
  // Updates model's `expanded` column if it's present.
63
71
  // Since promises don't have such column, we don't need to send that
64
72
  // extra request for every node expand event.
65
- netzkeOnNodeStateChange: function() {
73
+ netzkeOnNodeStateChange() {
66
74
  return;
67
75
  },
68
76
 
69
- netzkeOnCancelJob: function (params) {
70
- var me = this;
71
- var sel = this.getSelectionModel().getSelection();
72
- if (sel.length != 1) {
73
- return this.netzkeNotify('select one job to cancel')
74
- }
77
+ netzkeOnCancelJob(_params) {
78
+ const me = this;
79
+ const sel = this.getSelectionModel().getSelection();
80
+ if (sel.length != 1) {
81
+ return this.netzkeNotify("select one job to cancel");
82
+ }
75
83
  Ext.Msg.show({
76
- title: 'Cancel this Job?',
77
- msg: 'Enter CANCEL and press OK to cancel the job',
84
+ title: "Cancel this Job?",
85
+ msg: "Enter CANCEL and press OK to cancel the job",
78
86
  width: 375,
79
87
  buttons: Ext.Msg.OKCANCEL,
80
88
  prompt: true,
81
- fn: function (btn, value) {
82
- (btn == "ok" && value == "CANCEL") && me.server.cancelJob(sel[0].getId());
89
+ fn(btn, value) {
90
+ btn == "ok" && value == "CANCEL" && me.server.cancelJob(sel[0].getId());
83
91
  }
84
92
  });
85
93
  }
86
- }
94
+ });
@@ -1,10 +1,10 @@
1
- {
2
- netzkeOnForeground: function () {
3
- var values = this.getForm().getValues();
4
- var data = Ext.encode(values);
1
+ ({
2
+ netzkeOnForeground() {
3
+ const values = this.getForm().getValues();
4
+ const data = Ext.encode(values);
5
5
 
6
- var params = {
7
- data: data,
6
+ const params = {
7
+ data,
8
8
  reptitle: this.reptitle
9
9
  };
10
10
 
@@ -15,21 +15,21 @@
15
15
  params["disposition"] = "inline";
16
16
  }
17
17
 
18
- var form = document.createElement("form");
18
+ const form = document.createElement("form");
19
19
 
20
20
  form.setAttribute("method", "post");
21
21
  form.setAttribute("action", this.mountPath() + "/report." + this.repformat);
22
22
 
23
23
  // set authenticity token
24
- var hiddenField = document.createElement("input");
24
+ const hiddenField = document.createElement("input");
25
25
  hiddenField.setAttribute("type", "hidden");
26
26
  hiddenField.setAttribute("name", "authenticity_token");
27
27
  hiddenField.setAttribute("value", this.authenticityToken);
28
28
  form.appendChild(hiddenField);
29
29
 
30
- for (var key in params) {
31
- if (params.hasOwnProperty(key)) {
32
- var hiddenField = document.createElement("input");
30
+ for (const key in params) {
31
+ if (Object.prototype.hasOwnProperty.call(params, key)) {
32
+ const hiddenField = document.createElement("input");
33
33
  hiddenField.setAttribute("type", "hidden");
34
34
  hiddenField.setAttribute("name", key);
35
35
  hiddenField.setAttribute("value", params[key]);
@@ -43,36 +43,38 @@
43
43
  document.body.removeChild(form);
44
44
  },
45
45
 
46
- netzkeOnLink: function () {
47
- var values = this.getForm().getValues();
46
+ netzkeOnLink() {
47
+ const values = this.getForm().getValues();
48
48
 
49
49
  // check for early url generation and exit with error message
50
- if (values['selected_script_name'] == null) {
50
+ if (values["selected_script_name"] == null) {
51
51
  alert("Please select a report before generating url.");
52
52
  return;
53
53
  }
54
54
 
55
- params = {
56
- "format": this.repformat,
57
- "reptitle": this.reptitle
58
- }
55
+ const params = {
56
+ format: this.repformat,
57
+ reptitle: this.reptitle
58
+ };
59
+
60
+ let key;
59
61
 
60
- for (var key in values) {
62
+ for (key in values) {
61
63
  if (values[key] == "") {
62
- delete values[key]
64
+ delete values[key];
63
65
  }
64
66
  }
65
- data = Ext.encode(values)
67
+ const data = Ext.encode(values);
66
68
 
67
69
  // construct url
68
- var proto_host = location.protocol + '//' + location.host
69
- var url = proto_host + '/report?data=' + data
70
- for (var key in params) {
70
+ const proto_host = location.protocol + "//" + location.host;
71
+ let url = proto_host + "/report?data=" + data;
72
+ for (key in params) {
71
73
  if (params[key] == "") continue;
72
- url += '&' + key + '=' + params[key];
74
+ url += "&" + key + "=" + params[key];
73
75
  }
74
- url = encodeURI(url)
75
- var win = window.open('');
76
+ url = encodeURI(url);
77
+ const win = window.open("");
76
78
  win.document.write(url.link(url));
77
79
  }
78
- }
80
+ });
@@ -1,50 +1,55 @@
1
- {
2
- initComponent: function () {
3
- var me = this;
1
+ ({
2
+ initComponent() {
3
+ const me = this;
4
4
  me.callParent();
5
5
 
6
- var tag_grid = me.netzkeGetComponent('tag_grid').getView();
7
- var script_grid = me.netzkeGetComponent('script_grid').getView();
8
- var nodename = me.getForm().findField('nodename');
6
+ const tag_grid = me.netzkeGetComponent("tag_grid").getView();
7
+ const script_grid = me.netzkeGetComponent("script_grid").getView();
8
+ const nodename = me.getForm().findField("nodename");
9
9
 
10
- nodename.on('select', function (self, record) {
10
+ nodename.on("select", function(self, record) {
11
11
  if (record instanceof Array) {
12
- record = record[0]
12
+ record = record[0];
13
13
  }
14
- var data = record && record.data;
14
+ const data = record && record.data;
15
15
  me.server.selectNode({
16
16
  node: data.value
17
17
  });
18
18
  });
19
19
 
20
- tag_grid.getSelectionModel().on('selectionchange',
21
- function (self, records) {
22
- var tag_id = records[0].get('id');
20
+ tag_grid.getSelectionModel().on(
21
+ "selectionchange",
22
+ function(self, records) {
23
+ const tag_id = records[0].get("id");
23
24
  me.server.selectTag({
24
- tag_id: tag_id
25
+ tag_id
25
26
  });
26
27
  script_grid.getStore().load();
27
- }, me);
28
+ },
29
+ me
30
+ );
28
31
 
29
- script_grid.getSelectionModel().on('selectionchange',
30
- function (self, records) {
32
+ script_grid.getSelectionModel().on(
33
+ "selectionchange",
34
+ function(self, records) {
31
35
  if (script_grid.getStore().isLoading() == true) return;
32
36
 
33
- if (records[0] == null)
34
- return;
37
+ if (records[0] == null) return;
35
38
 
36
- var script_name = records[0].get('name');
39
+ const script_name = records[0].get("name");
37
40
  me.server.selectScript({
38
- script_name: script_name
41
+ script_name
39
42
  });
40
43
  nodename.reset();
41
44
  nodename.store.load({
42
45
  params: {}
43
46
  });
44
- }, me);
47
+ },
48
+ me
49
+ );
45
50
  },
46
51
 
47
- parentSelectReport: function () {
52
+ parentSelectReport() {
48
53
  this.netzkeGetParentComponent().selectReport();
49
54
  }
50
- }
55
+ });