marty 8.4.1 → 8.5.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: 6d2b7a71540fdd0a796cc8bd62725ddfa80231af28875eff79b5cbf1e6b8d65a
4
- data.tar.gz: de508c108b52dc8b89d9d873030173594952a5c48ee507c68438f2e01a21d136
3
+ metadata.gz: f6fd0c089c5ad585e2ee595e562468d11ba1bcb93561faf4af44b7efd657eead
4
+ data.tar.gz: 706faaa4fd4c52cdf947546fbe5362b6862335ff085c68a8a78b52c257e35380
5
5
  SHA512:
6
- metadata.gz: efbcc2b834193e2525809e494d6e12936d75606b03f7c2fb9970008eb3adac30bb4a193c9bd64323691db0fdd983401aba0e73907df16f839bfb4675551094af
7
- data.tar.gz: 1c2834966a5b98f4177a14a297eed967b88a94b7f56c6c3597445e6dcd25ab96cad08465bcbf31f4675a76cc2d977f0a198efae2b15f47e64f771159ae2dfdf6
6
+ metadata.gz: 5350b886990d9c4efffa480d3727efed7f357208d966394ae637f7cfae110203046a768379d1b373f931cf8bcb85d982f97ef1e5c7e1240e5ddde3e2f4038324
7
+ data.tar.gz: b4ac412e00641a7e5138036f9af8eac4c5c68fb48fd76c05296c195825a6eb3755659adf7287f92c70d0a058c645a7dacec675c2a590376e6ed2e786053cf6e0
@@ -1,21 +1,53 @@
1
1
  # ONLY FOR DEVELOPMENT PURPOSES
2
2
  # dockerfile is not suitable to produce a production-grade docker image
3
- FROM ruby:2.6.3
3
+ FROM ruby:2.6.3-buster
4
4
 
5
5
  WORKDIR /opt/app
6
6
 
7
- ADD https://dl.yarnpkg.com/debian/pubkey.gpg /tmp/yarn-pubkey.gpg
8
- RUN apt-key add /tmp/yarn-pubkey.gpg && rm /tmp/yarn-pubkey.gpg
9
- RUN echo 'deb http://dl.yarnpkg.com/debian/ stable main' > /etc/apt/sources.list.d/yarn.list
7
+ # Versioned dependencies
8
+ ENV FREETDS_VER 1.1.20
9
+ ENV TDSVER 7.1
10
+ ENV NODE_VER 12.x
11
+ ENV POSTGRES_VER 11
10
12
 
11
- RUN apt-get update && apt-get install -qq -y --no-install-recommends \
12
- build-essential libpq-dev curl
13
-
14
- RUN curl -sL https://deb.nodesource.com/setup_6.x | bash -
15
- RUN apt-get update && apt-get install -qq -y --no-install-recommends nodejs yarn
13
+ # Other useful env variables to set
14
+ ENV BUNDLE_PATH /bundle_box/bundle
15
+ ENV GEM_HOME /bundle_box/bundle
16
+ ENV PATH /bundle_box/bundle/bin:$PATH
16
17
 
17
- # Install psql client for tests
18
- RUN apt-get install -qq -y --no-install-recommends postgresql-client
18
+ # Install several necessary packages and add Postgres repo key
19
+ RUN apt-get update && apt-get install -y -qq software-properties-common apt-transport-https
20
+
21
+ # Add Debian Buster postgres keychain for verification to download psql client
22
+ RUN \
23
+ echo "deb http://apt.postgresql.org/pub/repos/apt/ buster-pgdg main" > /etc/apt/sources.list.d/pgdg.list && \
24
+ wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - &&\
25
+ apt-get update
26
+
27
+ # Install several more packages
28
+ RUN \
29
+ apt-get install -qq -y --no-install-recommends \
30
+ build-essential libpq-dev curl unixodbc unixodbc-dev freetds-dev \
31
+ freetds-bin tdsodbc postgresql-client-${POSTGRES_VER} xvfb imagemagick \
32
+ netcat-openbsd vim libc6-dev
33
+
34
+ # Install FreeTDS
35
+ RUN wget https://www.freetds.org/files/stable/freetds-"${FREETDS_VER}".tar.gz && \
36
+ tar -xzf freetds-"${FREETDS_VER}".tar.gz && \
37
+ rm freetds-"${FREETDS_VER}".tar.gz && \
38
+ cd freetds-"${FREETDS_VER}" && \
39
+ ./configure --prefix=/usr/local --with-tdsver=${TDSVER} && \
40
+ make && \
41
+ make install && \
42
+ make clean
43
+
44
+ # Install Nodejs
45
+ RUN export VERSION="node_${NODE_VER}" DISTRO="$(lsb_release -s -c)" && \
46
+ curl -sSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | apt-key add - && \
47
+ echo "deb https://deb.nodesource.com/$VERSION $DISTRO main" | tee /etc/apt/sources.list.d/nodesource.list && \
48
+ echo "deb-src https://deb.nodesource.com/$VERSION $DISTRO main" | tee -a /etc/apt/sources.list.d/nodesource.list && \
49
+ apt-get -o Acquire::Check-Valid-Until=false update && \
50
+ apt-get install -qq -y --no-install-recommends nodejs
19
51
 
20
52
  # Install chrome for integration tests
21
53
  RUN curl -L -o google-chrome.deb https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \
@@ -24,25 +56,4 @@ RUN curl -L -o google-chrome.deb https://dl.google.com/linux/direct/google-chrom
24
56
  && sed -i 's|HERE/chrome\"|HERE/chrome\" --disable-setuid-sandbox|g' /opt/google/chrome/google-chrome \
25
57
  && rm google-chrome.deb
26
58
 
27
- # Install additional tools
28
- RUN apt-get install -qq -y --no-install-recommends netcat-openbsd vim
29
-
30
- RUN gem install bundler
31
-
32
- ENV BUNDLE_PATH /bundle_box/bundle
33
- ENV GEM_HOME /bundle_box/bundle
34
- ENV PATH /bundle_box/bundle/bin:$PATH
35
- # ENV NODE_PATH /bundle_box/node
36
-
37
- COPY . .
38
-
39
- # RUN bundle install
40
- # RUN yarn install
41
-
42
- # RUN mv .rbenv-vars.example .rbenv-vars
43
- # RUN chmod +x entrypoint.sh
44
-
45
- # ENV RAILS_ENV=development
46
- # ENV PORT=3001
47
- # EXPOSE 3001
48
-
59
+ RUN gem update --system
@@ -68,6 +68,11 @@ module Marty
68
68
  a.tooltip = 'Run'
69
69
  a.icon_cls = 'fa fa-play glyph'
70
70
  a.disabled = true
71
+ a.handler = :netzke_call_endpoint
72
+ a.require_confirmation = true
73
+ a.confirmation_title = 'Run Job'
74
+ a.in_progress_message = 'Performing job...'
75
+ a.endpoint_name = :job_run
71
76
  end
72
77
 
73
78
  endpoint :edit_window__edit_form__submit do |params|
@@ -121,7 +126,7 @@ module Marty
121
126
  res
122
127
  end
123
128
 
124
- endpoint :job_run do
129
+ endpoint :job_run do |_ids|
125
130
  begin
126
131
  s = Marty::BackgroundJob::Schedule.find(client_config['selected'])
127
132
  klass = s.job_class
@@ -61,15 +61,22 @@ module Marty
61
61
  a.text = 'Delete all'
62
62
  a.tooltip = 'Delete all logs'
63
63
  a.icon_cls = 'fa fa-trash glyph'
64
+
65
+ a.handler = :netzke_call_endpoint
66
+ a.require_confirmation = true
67
+ a.confirmation_title = 'Delete All'
68
+ a.in_progress_message = 'Deleting...'
69
+ a.endpoint_name = :destroy_all
64
70
  end
65
71
 
66
72
  action :ignore do |a|
67
73
  a.text = 'Ignore in diag'
68
74
  a.tooltip = 'Ignore in diag'
69
75
  a.icon_cls = 'fa fa-trash glyph'
76
+ a.handler = :netzke_call_endpoint
70
77
  end
71
78
 
72
- endpoint :destroy_all do
79
+ endpoint :destroy_all do |_params|
73
80
  Marty::BackgroundJob::Log.delete_all
74
81
  client.reload
75
82
  end
@@ -1,13 +1,13 @@
1
1
  {
2
- getComponent: function(name) {
2
+ getComponent(name) {
3
3
  return Ext.getCmp(name);
4
4
  },
5
5
 
6
- findComponent: function(name) {
6
+ findComponent(name) {
7
7
  return Ext.ComponentQuery.query(`[name=${name}]`)[0];
8
8
  },
9
9
 
10
- setDisableComponentActions: function(prefix, flag) {
10
+ setDisableComponentActions(prefix, flag) {
11
11
  for (var key in this.actions) {
12
12
  if (key.substring(0, prefix.length) == prefix) {
13
13
  this.actions[key].setDisabled(flag);
@@ -15,7 +15,7 @@
15
15
  }
16
16
  },
17
17
 
18
- initComponent: function() {
18
+ initComponent() {
19
19
  this.dockedItems = this.dockedItems || [];
20
20
  if (this.paging == 'pagination') {
21
21
  this.dockedItems.push({
@@ -103,14 +103,14 @@
103
103
  }
104
104
  },
105
105
 
106
- onSelectionChange: function(f) {
106
+ onSelectionChange(f) {
107
107
  var me = this;
108
108
  me.getSelectionModel().on('selectionchange', f);
109
109
  },
110
110
 
111
111
  // override netzkeReloadStore to allow option passthrough
112
112
  // reference: http://api.netzke.org/client/files/doc_client_netzke-basepack_javascripts_grid_event_handlers.js.html
113
- netzkeReloadStore: function(opts = {}) {
113
+ netzkeReloadStore(opts = {}) {
114
114
  var store = this.getStore();
115
115
 
116
116
  // HACK to work around buffered store's buggy reload()
@@ -119,7 +119,7 @@
119
119
  } else store.reload(opts);
120
120
  },
121
121
 
122
- doViewInForm: function(record) {
122
+ doViewInForm(record) {
123
123
  this.netzkeLoadComponent("view_window", {
124
124
  serverConfig: {
125
125
  record_id: record.id
@@ -138,13 +138,11 @@
138
138
  // always reset store to first page on reload
139
139
  // to avoid load bug when moving from a higher page count
140
140
  // to a grid with a lower page count
141
- reload: function(opts = {
142
- start: 0
143
- }) {
141
+ reload(opts = { start: 0 }) {
144
142
  this.netzkeReloadStore(opts);
145
143
  },
146
144
 
147
- reloadAll: function() {
145
+ reloadAll() {
148
146
  var me = this;
149
147
  var children = me.serverConfig.child_components || [];
150
148
  this.store.reload();
@@ -156,11 +154,16 @@
156
154
  }
157
155
  },
158
156
 
159
- clearFilters: function() {
157
+ clearFilters() {
160
158
  this.filters.clearFilters();
161
159
  },
162
160
 
163
- netzkeGridSelectedDefaultAction: function(endpoint, confirmation) {
161
+ netzkeGridSelectedDefaultAction(endpoint, confirmation) {
162
+ console.log(`
163
+ netzkeGridSelectedDefaultAction is deprecated.
164
+ Please use netzkeCallEndpoint instead.
165
+ `);
166
+
164
167
  var selected = this.getSelectionModel().getSelection().map((r) => r.id)
165
168
 
166
169
  if (confirmation) {
@@ -176,5 +179,38 @@
176
179
  } else {
177
180
  this.server[endpoint](selected, () => { this.unmask() })
178
181
  }
179
- }
182
+ },
183
+
184
+ // FIXME: move to netzke
185
+ netzkeCallEndpoint(action) {
186
+ const selected = this.getSelectionModel().getSelection().map((r) => r.id)
187
+ const endpointName = action.endpointName || action.name;
188
+
189
+ const camelCasedEndpointName = endpointName.replace(
190
+ /_([a-z])/g,
191
+ (g) => g[1].toUpperCase()
192
+ );
193
+
194
+ const requireConfirmation = action.requireConfirmation || action.confirmationMessage;
195
+
196
+ const handlerFunction = this.server[camelCasedEndpointName];
197
+
198
+ if (!requireConfirmation) {
199
+ return handlerFunction(selected, () => { this.unmask()});
200
+ };
201
+
202
+ const confirmationTitle = action.confirmationTitle || action.name;
203
+ const confirmationMessage = action.confirmationMessage || 'Are you sure?';
204
+ const inProgressMessage = action.inProgressMessage || 'In progress...';
205
+
206
+ return Ext.Msg.confirm(
207
+ confirmationTitle,
208
+ Ext.String.format(confirmationMessage),
209
+ (btn, value, cfg) => {
210
+ if (btn !== "yes") { return null; };
211
+ this.mask(inProgressMessage);
212
+ return handlerFunction(selected, () => { this.unmask()});
213
+ }
214
+ );
215
+ },
180
216
  }
@@ -89,9 +89,21 @@ class Marty::PromiseView < Netzke::Tree::Base
89
89
  client.netzke_on_refresh
90
90
  end
91
91
 
92
- def get_records params
92
+ def get_records(params)
93
93
  search_scope = config[:live_search_scope] || :live_search
94
- Marty::VwPromise.children_for_id(params[:id], params[search_scope])
94
+ res = Marty::VwPromise.children_for_id(params[:id], params[search_scope])
95
+
96
+ # Fetch actual promise objects without results in advance to avoid N+1
97
+ promises_without_status_ids = res.reject(&:status).map(&:id)
98
+ promises_without_status = Marty::Promise.where(
99
+ id: promises_without_status_ids
100
+ )
101
+
102
+ @results = promises_without_status.each_with_object({}) do |promise, hash|
103
+ hash[promise.id] = promise.result.to_s
104
+ end
105
+
106
+ res
95
107
  end
96
108
 
97
109
  attribute :title do |config|
@@ -130,11 +142,10 @@ class Marty::PromiseView < Netzke::Tree::Base
130
142
  end
131
143
 
132
144
  attribute :error do |config|
133
- config.getter = ->(record) {
134
- if !record.status
135
- Marty::Promise.find_by(id: record.id).try(:result).to_s
136
- end
137
- }
145
+ config.getter = ->(record) do
146
+ @results[record.id] unless record.status
147
+ end
148
+
138
149
  config.flex = 1
139
150
  end
140
151
  end
@@ -1,5 +1,5 @@
1
1
  {
2
- initComponent: function () {
2
+ initComponent() {
3
3
  this.callParent();
4
4
 
5
5
  this.mainPanel = this.down('panel[itemId="main_panel"]');
@@ -10,9 +10,11 @@
10
10
  Ext.Ajax.on('beforerequest', function () {
11
11
  statusBar.showBusy();
12
12
  });
13
+
13
14
  Ext.Ajax.on('requestcomplete', function () {
14
15
  statusBar.hideBusy();
15
16
  });
17
+
16
18
  Ext.Ajax.on('requestexception', function () {
17
19
  statusBar.hideBusy();
18
20
  });
@@ -21,13 +23,13 @@
21
23
  this.netzkeInitComponentCallback();
22
24
  },
23
25
 
24
- setRouting: function () {
26
+ setRouting() {
25
27
  this.router = Ext.util.History;
26
28
  this.router.init();
27
29
  this.router.on('change', this.loadRoute, this);
28
30
  },
29
31
 
30
- loadRoute: function (token) {
32
+ loadRoute(token) {
31
33
  if (token) {
32
34
  this.netzkeLoadComponent(token, {
33
35
  container: this.mainPanel
@@ -37,7 +39,7 @@
37
39
  }
38
40
  },
39
41
 
40
- afterRender: function () {
42
+ afterRender() {
41
43
  this.callParent();
42
44
  var currentToken = this.router.getToken();
43
45
  if (typeof currentToken == "string" && currentToken.length > 0) {
@@ -45,18 +47,51 @@
45
47
  }
46
48
  },
47
49
 
48
- appLoadComponent: function (name) {
50
+ appLoadComponent(name) {
49
51
  this.router.add(name);
50
52
  },
51
53
 
52
- netzkeLoadComponentByAction: function (action) {
54
+ netzkeLoadComponentByAction(action) {
53
55
  this.router.add(action.name.underscore());
54
56
  },
55
57
 
56
- onToggleConfigMode: function (params) {
58
+ onToggleConfigMode(params) {
57
59
  this.toggleConfigMode();
58
60
  },
59
61
 
60
- netzkeInitComponentCallback: function() {
62
+ netzkeInitComponentCallback() {
63
+ },
64
+
65
+ // FIXME: move to netzke
66
+ netzkeCallEndpoint(action) {
67
+ const selected = this.getSelectionModel().getSelection().map((r) => r.id)
68
+ const endpointName = action.endpointName || action.name;
69
+
70
+ const camelCasedEndpointName = endpointName.replace(
71
+ /_([a-z])/g,
72
+ (g) => g[1].toUpperCase()
73
+ );
74
+
75
+ const requireConfirmation = action.requireConfirmation || action.confirmationMessage;
76
+
77
+ const handlerFunction = this.server[camelCasedEndpointName];
78
+
79
+ if (!requireConfirmation) {
80
+ return handlerFunction(selected, () => { this.unmask()});
81
+ };
82
+
83
+ const confirmationTitle = action.confirmationTitle || action.name;
84
+ const confirmationMessage = action.confirmationMessage || 'Are you sure?';
85
+ const inProgressMessage = action.inProgressMessage || 'In progress...';
86
+
87
+ return Ext.Msg.confirm(
88
+ confirmationTitle,
89
+ Ext.String.format(confirmationMessage),
90
+ (btn, value, cfg) => {
91
+ if (btn !== "yes") { return null; };
92
+ this.mask(inProgressMessage);
93
+ return handlerFunction(selected, () => { this.unmask()});
94
+ }
95
+ );
61
96
  },
62
97
  }
@@ -176,12 +176,12 @@ class Marty::Promise < Marty::Base
176
176
 
177
177
  delorean_fn :result_and_status, sig: 1 do |promise_id|
178
178
  promise = find_by(id: promise_id)
179
- next { error: 'not found' } if promise.nil?
179
+ next { 'error' => 'not found' } if promise.nil?
180
180
 
181
181
  {
182
- completed: !promise.status.nil?,
183
- status: promise.status,
184
- result: promise.result
182
+ 'completed' => !promise.status.nil?,
183
+ 'status' => promise.status,
184
+ 'result' => promise.result
185
185
  }
186
186
  end
187
187
 
@@ -32,7 +32,7 @@ services:
32
32
  stdin_open: true
33
33
 
34
34
  postgres:
35
- image: "postgres:9.6"
35
+ image: "postgres:11"
36
36
  volumes:
37
37
  - postgresql-data:/var/lib/postgresql/data
38
38
 
@@ -122,7 +122,11 @@ module Netzke
122
122
  return unless @model_adapter.attr_type(name) == :boolean
123
123
  return if key?(:default_value)
124
124
 
125
- self.default_value = false
125
+ m = @model_adapter.model
126
+
127
+ return self.default_value = false unless m.respond_to?(:column_defaults)
128
+
129
+ self.default_value = @model_adapter.model.column_defaults[name] || false
126
130
  end
127
131
  end
128
132
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Marty
4
- VERSION = '8.4.1'
4
+ VERSION = '8.5.0'
5
5
  end
@@ -12,6 +12,7 @@ class Gemini::SimpleView < Marty::McflyGridPanel
12
12
  :user_id,
13
13
  :some_name,
14
14
  :active,
15
+ :default_true
15
16
  ]
16
17
  end
17
18
  end
@@ -0,0 +1,9 @@
1
+ class AddDefaultTrueColumnToSimple < ActiveRecord::Migration[5.2]
2
+ def up
3
+ add_column :gemini_simples, :default_true, :boolean, null: false, default: true
4
+ end
5
+
6
+ def down
7
+ remove_column :gemini_simples, :default_true
8
+ end
9
+ end
@@ -14,9 +14,8 @@ feature 'Inline editing', js: true do
14
14
  grid = netzke_find('simple_view')
15
15
  press 'Add'
16
16
 
17
- row = grid.select_row(1)
18
- user_id = row.all('.x-grid-cell')[0]
19
- name = row.all('.x-grid-cell')[1]
17
+ user_id = grid.all('.x-grid-cell')[0]
18
+ name = grid.all('.x-grid-cell')[1]
20
19
 
21
20
  user_id.double_click
22
21
  user_id.fill_in 'user_id', with: 1
@@ -29,5 +28,6 @@ feature 'Inline editing', js: true do
29
28
 
30
29
  model = Gemini::Simple.find_by(some_name: 'test name')
31
30
  expect(model.active).to be false
31
+ expect(model.default_true).to be true
32
32
  end
33
33
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: marty
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.4.1
4
+ version: 8.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arman Bostani
@@ -14,7 +14,7 @@ authors:
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
- date: 2019-12-05 00:00:00.000000000 Z
17
+ date: 2019-12-11 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: actioncable
@@ -313,9 +313,7 @@ files:
313
313
  - app/components/marty/background_job/delayed_jobs_grid.rb
314
314
  - app/components/marty/background_job/schedule_jobs_dashboard.rb
315
315
  - app/components/marty/background_job/schedule_jobs_grid.rb
316
- - app/components/marty/background_job/schedule_jobs_grid/client/schedule_jobs_grid.js
317
316
  - app/components/marty/background_job/schedule_jobs_logs.rb
318
- - app/components/marty/background_job/schedule_jobs_logs/client/schedule_jobs_logs.js
319
317
  - app/components/marty/base_rule_view.rb
320
318
  - app/components/marty/base_rule_view/client/base_rule_view.js
321
319
  - app/components/marty/config_view.rb
@@ -665,6 +663,7 @@ files:
665
663
  - spec/dummy/db/migrate/20171222150100_add_rule_indices.rb
666
664
  - spec/dummy/db/migrate/20190702115241_add_simple_guards_options_to_rules.rb
667
665
  - spec/dummy/db/migrate/20191101132729_add_activity_flag_to_simple.rb
666
+ - spec/dummy/db/migrate/20191206132729_add_default_true_column_to_simple.rb
668
667
  - spec/dummy/db/seeds.rb
669
668
  - spec/dummy/delorean/base_code.dl
670
669
  - spec/dummy/delorean/blame_report.dl
@@ -1,13 +0,0 @@
1
- {
2
- netzkeOnDoJobRun: function(params) {
3
- Ext.Msg.confirm(
4
- 'Run Job',
5
- Ext.String.format('Are you sure?'),
6
- (btn, value, cfg) => {
7
- if (btn == "yes") {
8
- this.mask('Performing job...');
9
- this.server.jobRun(() => { this.unmask()});
10
- }
11
- });
12
- }
13
- }
@@ -1,15 +0,0 @@
1
- {
2
- netzkeOnDestroyAll: function(params) {
3
- Ext.Msg.confirm(
4
- 'Delete all',
5
- Ext.String.format('Are you sure?'),
6
- (btn, value, cfg) => {
7
- if (btn == "yes") {
8
- this.mask('Deleting...');
9
- this.server.destroyAll(() => { this.unmask()});
10
- }
11
- });
12
- },
13
-
14
- netzkeOnIgnore: function(_) { return this.netzkeGridSelectedDefaultAction('ignore') }
15
- }