marty 0.5.38 → 0.5.39
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/marty/diagnostic.css +34 -0
- data/app/components/marty/script_grid.rb +21 -3
- data/app/controllers/marty/diagnostic_controller.rb +66 -0
- data/app/models/marty/enum.rb +2 -7
- data/app/views/layouts/marty/diagnostic.html.erb +11 -0
- data/app/views/marty/diagnostic/diagnostic.html.erb +15 -0
- data/config/locales/en.yml +2 -0
- data/config/routes.rb +2 -0
- data/db/seeds.rb +2 -1
- data/lib/marty/engine.rb +2 -0
- data/lib/marty/railtie.rb +1 -0
- data/lib/marty/version.rb +1 -1
- data/spec/controllers/diagnostic_controller_spec.rb +70 -0
- data/spec/dummy/config/application.rb +1 -1
- data/spec/features/scripting_spec.rb +44 -0
- metadata +7 -4
- data/app/assets/javascripts/marty/application.js +0 -15
- data/spec/dummy/app/assets/javascripts/application.js +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c7c49130696eaee7cf90daac35a2e8f7de5b4d4
|
4
|
+
data.tar.gz: d9c02183be57f6889d9071b27461315571278226
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49df1bf75aac668d3e2e2431a38826a55f75bbf51a68194b7fee998f19bfa58f3e98cb63b724866d6764d7a0cc8d179bb00ed9a483f91acb606ba7fafd3d6ba1
|
7
|
+
data.tar.gz: 73d88973b75a3291f77db255243f99927e2ea8dd6d46d6f34bdc088e5d12799c9058d5219452721d231f7465202a62f4e63ca7c3cdb70b51f328beaf207e2034
|
@@ -0,0 +1,34 @@
|
|
1
|
+
body { margin: 0;
|
2
|
+
padding: 0;
|
3
|
+
border: 0;
|
4
|
+
background-color: #fff;
|
5
|
+
color: #333333;
|
6
|
+
text-align: left;
|
7
|
+
font-family: Arial, Helvetica, Verdana, sans-serif;
|
8
|
+
font-weight: normal;
|
9
|
+
font-size: 11pt; }
|
10
|
+
table { border-width: 0px;
|
11
|
+
margin-left: auto;
|
12
|
+
margin-right: auto;
|
13
|
+
border-spacing: 1px;
|
14
|
+
width: 75% }
|
15
|
+
th { padding: 9px;
|
16
|
+
background-color: #d6d6d6 }
|
17
|
+
td { padding: 9px;
|
18
|
+
-moz-border-radius: 5px;
|
19
|
+
border-radius: 5px;
|
20
|
+
-webkit-border-radius: 5px;
|
21
|
+
border-style: solid;
|
22
|
+
border-width: 1px;
|
23
|
+
border-color: #999999; }
|
24
|
+
tr.passed { background-color: #9ed515 }
|
25
|
+
tr.warning { background-color: #ffdb58 }
|
26
|
+
tr.failed { background-color: #ff5555 }
|
27
|
+
td.desc { font-size: 10pt; }
|
28
|
+
h1 { display: block;
|
29
|
+
margin: 0px auto 40px auto;
|
30
|
+
padding: 8px;
|
31
|
+
background-color: #3e2155;
|
32
|
+
font-size: 18pt;
|
33
|
+
color: #ffffff;
|
34
|
+
line-height: 1.5em; }
|
@@ -3,7 +3,7 @@ class Marty::ScriptGrid < Marty::Grid
|
|
3
3
|
create: [:dev],
|
4
4
|
read: :any,
|
5
5
|
update: [:dev],
|
6
|
-
delete: [
|
6
|
+
delete: [:dev]
|
7
7
|
|
8
8
|
def configure(c)
|
9
9
|
super
|
@@ -29,7 +29,6 @@ class Marty::ScriptGrid < Marty::Grid
|
|
29
29
|
# if there are no non-DEV tags we get an exception above
|
30
30
|
ts = 'infinity'
|
31
31
|
end
|
32
|
-
|
33
32
|
tb = data_class.table_name
|
34
33
|
data_class.where("#{tb}.obsoleted_dt >= ? AND #{tb}.created_dt < ?",
|
35
34
|
ts, ts).scoping do
|
@@ -37,6 +36,25 @@ class Marty::ScriptGrid < Marty::Grid
|
|
37
36
|
end
|
38
37
|
end
|
39
38
|
|
39
|
+
action :del do |a|
|
40
|
+
a.text = I18n.t("script_grid.delete")
|
41
|
+
a.tooltip = I18n.t("script_grid.delete")
|
42
|
+
a.icon = :script_delete
|
43
|
+
a.disabled = config[:prohibit_delete]
|
44
|
+
end
|
45
|
+
|
46
|
+
endpoint :server_delete do |params, this|
|
47
|
+
return this.netzke_feedback("Permission Denied") if
|
48
|
+
config[:prohibit_delete]
|
49
|
+
|
50
|
+
tag = Marty::Tag.map_to_tag(root_sess[:selected_tag_id])
|
51
|
+
|
52
|
+
return this.netzke_feedback("Can only delete in DEV tag") unless
|
53
|
+
tag && tag.isdev?
|
54
|
+
|
55
|
+
super(params, this)
|
56
|
+
end
|
57
|
+
|
40
58
|
# override the add_in_form endpoint. Script creation needs to use
|
41
59
|
# the create_script method.
|
42
60
|
endpoint :add_window__add_form__netzke_submit do |params, this|
|
@@ -72,7 +90,7 @@ class Marty::ScriptGrid < Marty::Grid
|
|
72
90
|
end
|
73
91
|
|
74
92
|
def default_bbar
|
75
|
-
[:add_in_form]
|
93
|
+
[:add_in_form, :del]
|
76
94
|
end
|
77
95
|
|
78
96
|
def default_context_menu
|
@@ -0,0 +1,66 @@
|
|
1
|
+
module Marty
|
2
|
+
class DiagnosticController < ActionController::Base
|
3
|
+
layout 'marty/diagnostic'
|
4
|
+
|
5
|
+
def index
|
6
|
+
if action_methods.include?(params[:testop].to_s)
|
7
|
+
self.send(params[:testop])
|
8
|
+
else
|
9
|
+
render file: 'public/404', status: 404, layout: false
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def version
|
14
|
+
diag_response git_details +
|
15
|
+
[Diagnostic.new('Marty Version', true, VERSION)]
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
def diag_response details
|
20
|
+
if @aggregate_diags
|
21
|
+
@aggregated_details += details
|
22
|
+
else
|
23
|
+
@details = details
|
24
|
+
respond_to do |format|
|
25
|
+
format.html { render 'diagnostic' }
|
26
|
+
format.json { render json: [{ error_count: error_count(details),
|
27
|
+
diag_count: details.count }] + details }
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def aggregate_diags
|
33
|
+
begin
|
34
|
+
@aggregate_diags = true
|
35
|
+
@aggregated_details = []
|
36
|
+
yield
|
37
|
+
ensure
|
38
|
+
@aggregate_diags = false
|
39
|
+
diag_response @aggregated_details
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def error_count details
|
44
|
+
details.count { |detail| !detail.status }
|
45
|
+
end
|
46
|
+
|
47
|
+
def git_details app_name = Rails.application.class.parent.to_s
|
48
|
+
[
|
49
|
+
Diagnostic.new("#{app_name} Git Version", true,
|
50
|
+
`git describe 2>&1`.strip),
|
51
|
+
Diagnostic.new("#{app_name} Git Details", true,
|
52
|
+
`git show --pretty=format:"sha: %h, %D" 2>&1`.strip)
|
53
|
+
]
|
54
|
+
end
|
55
|
+
|
56
|
+
class Diagnostic < Struct.new(:name, :status, :description)
|
57
|
+
def status_css
|
58
|
+
status ? 'passed' : 'failed'
|
59
|
+
end
|
60
|
+
|
61
|
+
def status_text
|
62
|
+
status ? 'Passed' : 'Failed'
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
data/app/models/marty/enum.rb
CHANGED
@@ -6,14 +6,9 @@ module Marty::Enum
|
|
6
6
|
|
7
7
|
res = @LOOKUP_CACHE[index] ||= find_by_name(index)
|
8
8
|
|
9
|
-
|
9
|
+
raise "no such #{self.name}: '#{index}'" unless res
|
10
10
|
|
11
|
-
|
12
|
-
end
|
13
|
-
|
14
|
-
def to_s
|
15
|
-
# FIXME: hacky since not all enums have name
|
16
|
-
self.name
|
11
|
+
res
|
17
12
|
end
|
18
13
|
|
19
14
|
def clear_lookup_cache!
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<h1><%= Rails.application.class.parent %> Diagnostics</h1>
|
2
|
+
|
3
|
+
<table>
|
4
|
+
<th width=20%>Diagnostic Name</th>
|
5
|
+
<th width=10%>Status</th>
|
6
|
+
<th width=70%>Description</th>
|
7
|
+
<% @details.each do |d| %>
|
8
|
+
<tr class="<%= d.status_css %>">
|
9
|
+
<td><%= d.name %></td>
|
10
|
+
<td><%= d.status_text %></td>
|
11
|
+
<td class="desc"><%= d.description %></td>
|
12
|
+
</tr>
|
13
|
+
<% end %>
|
14
|
+
</table>
|
15
|
+
|
data/config/locales/en.yml
CHANGED
@@ -43,6 +43,7 @@ en:
|
|
43
43
|
name: Name
|
44
44
|
tag: Associated Tag
|
45
45
|
created_dt: Create Date/Time
|
46
|
+
delete: Delete Script
|
46
47
|
|
47
48
|
user_grid:
|
48
49
|
title: Users
|
@@ -64,6 +65,7 @@ en:
|
|
64
65
|
discarded: Discarded
|
65
66
|
checked_out: Checked out
|
66
67
|
print: Print
|
68
|
+
delete: Delete
|
67
69
|
|
68
70
|
script_tester:
|
69
71
|
attributes: Compute Attributes
|
data/config/routes.rb
CHANGED
@@ -2,4 +2,6 @@ Marty::Engine.routes.draw do
|
|
2
2
|
match via: [:get, :post], "rpc/:action(.:format)" => "rpc", as: :rpc
|
3
3
|
get "job/:action" => "job", as: :job
|
4
4
|
match via: [:get, :post], "report(.:format)" => "report#index", as: :report
|
5
|
+
get 'diag/(:action)', controller: 'diagnostic'
|
6
|
+
get 'diagnostic/(:action)', controller: 'diagnostic'
|
5
7
|
end
|
data/db/seeds.rb
CHANGED
@@ -26,7 +26,8 @@ Marty::Role.all.map { |role|
|
|
26
26
|
}
|
27
27
|
|
28
28
|
# Create default PostingType from configuration
|
29
|
-
default_p_type =
|
29
|
+
default_p_type = Rails.configuration.marty.default_posting_type
|
30
|
+
|
30
31
|
Marty::PostingType.create(name: default_p_type)
|
31
32
|
|
32
33
|
# Create NOW posting
|
data/lib/marty/engine.rb
CHANGED
data/lib/marty/railtie.rb
CHANGED
data/lib/marty/version.rb
CHANGED
@@ -0,0 +1,70 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Marty
|
4
|
+
RSpec.describe DiagnosticController, type: :controller do
|
5
|
+
before(:each) { @routes = Marty::Engine.routes }
|
6
|
+
let(:json_response) { JSON.parse(response.body) }
|
7
|
+
|
8
|
+
describe 'GET #index' do
|
9
|
+
it 'returns http success' do
|
10
|
+
get :index, testop: :version
|
11
|
+
|
12
|
+
expect(response).to have_http_status(:success)
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'returns the current version' do
|
16
|
+
get :index, testop: :version
|
17
|
+
|
18
|
+
aggregate_failures do
|
19
|
+
expect(assigns('details').count).to eq(3)
|
20
|
+
expect(assigns('details').third.methods)
|
21
|
+
.to include(:name, :status, :description)
|
22
|
+
expect(assigns('details').third.description).to eq(Marty::VERSION)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'returns the appropriate json' do
|
27
|
+
get :index, {format: :json, testop: :version}
|
28
|
+
|
29
|
+
aggregate_failures do
|
30
|
+
expect(json_response.first['diag_count']).to eq(3)
|
31
|
+
expect(json_response.first['error_count']).to eq(0)
|
32
|
+
expect(json_response
|
33
|
+
.find { |d| d['name'] == 'Marty Version' }['description'])
|
34
|
+
.to eq(Marty::VERSION)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
describe 'GET #version' do
|
40
|
+
it 'returns http success' do
|
41
|
+
get :version
|
42
|
+
|
43
|
+
expect(response).to have_http_status(:success)
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'returns the current version' do
|
47
|
+
get :version
|
48
|
+
|
49
|
+
aggregate_failures do
|
50
|
+
expect(assigns('details').count).to eq(3)
|
51
|
+
expect(assigns('details').third.methods)
|
52
|
+
.to include(:name, :status, :description)
|
53
|
+
expect(assigns('details').third.description).to eq(Marty::VERSION)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
it 'returns the appropriate json' do
|
58
|
+
get :version, format: :json
|
59
|
+
|
60
|
+
aggregate_failures do
|
61
|
+
expect(json_response.first['diag_count']).to eq(3)
|
62
|
+
expect(json_response.first['error_count']).to eq(0)
|
63
|
+
expect(json_response
|
64
|
+
.find { |d| d['name'] == 'Marty Version' }['description'])
|
65
|
+
.to eq(Marty::VERSION)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -178,6 +178,7 @@ feature 'under Applications menu, Scripting workflows', js: true do
|
|
178
178
|
expect(row_count(sg)).to eq 0
|
179
179
|
expect(row_count(tg)).to eq 0
|
180
180
|
expect(btn_disabled?('New Script', sg)).to be_truthy
|
181
|
+
expect(btn_disabled?('Delete Script', sg)).to be_truthy
|
181
182
|
expect(btn_disabled?('New Tag', tg)).to be_truthy
|
182
183
|
log_out
|
183
184
|
end
|
@@ -193,6 +194,7 @@ feature 'under Applications menu, Scripting workflows', js: true do
|
|
193
194
|
select_row(1, tg)
|
194
195
|
wait_for_ajax
|
195
196
|
expect(btn_disabled?('New Script', sg)).to be_truthy
|
197
|
+
expect(btn_disabled?('Delete Script', sg)).to be_truthy
|
196
198
|
expect(btn_disabled?('New Tag', tg)).to be_truthy
|
197
199
|
select_row(4, tg)
|
198
200
|
wait_for_ajax
|
@@ -305,4 +307,46 @@ feature 'under Applications menu, Scripting workflows', js: true do
|
|
305
307
|
expect(find(:msg)).to have_content 'no save needed'
|
306
308
|
end
|
307
309
|
end
|
310
|
+
|
311
|
+
it 'deletes a script' do
|
312
|
+
log_in_as('dev1')
|
313
|
+
go_to_scripting
|
314
|
+
|
315
|
+
by 'select DEV tag' do
|
316
|
+
wait_for_ajax
|
317
|
+
select_row(1, tg)
|
318
|
+
end
|
319
|
+
|
320
|
+
and_by 'delete script' do
|
321
|
+
select_row(1, sg)
|
322
|
+
press('Delete Script')
|
323
|
+
find(:xpath, "//div[text()='Confirmation']", wait: 5)
|
324
|
+
press('Yes')
|
325
|
+
end
|
326
|
+
|
327
|
+
and_by 'script is gone' do
|
328
|
+
expect(row_count(sg)).to eq 4
|
329
|
+
end
|
330
|
+
end
|
331
|
+
|
332
|
+
it 'only allows delete on DEV tag' do
|
333
|
+
log_in_as('dev1')
|
334
|
+
go_to_scripting
|
335
|
+
|
336
|
+
by 'select not DEV tag' do
|
337
|
+
wait_for_ajax
|
338
|
+
select_row(2, tg)
|
339
|
+
end
|
340
|
+
|
341
|
+
and_by 'delete script' do
|
342
|
+
select_row(1, sg)
|
343
|
+
press('Delete Script')
|
344
|
+
find(:xpath, "//div[text()='Confirmation']", wait: 5)
|
345
|
+
press('Yes')
|
346
|
+
end
|
347
|
+
|
348
|
+
and_by 'delete did not work' do
|
349
|
+
expect(find(:msg)).to have_content 'Can only delete in DEV tag'
|
350
|
+
end
|
351
|
+
end
|
308
352
|
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: 0.5.
|
4
|
+
version: 0.5.39
|
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: 2016-
|
17
|
+
date: 2016-06-03 00:00:00.000000000 Z
|
18
18
|
dependencies:
|
19
19
|
- !ruby/object:Gem::Dependency
|
20
20
|
name: pg
|
@@ -158,8 +158,8 @@ files:
|
|
158
158
|
- README.md
|
159
159
|
- Rakefile
|
160
160
|
- app/assets/images/marty/.gitkeep
|
161
|
-
- app/assets/javascripts/marty/application.js
|
162
161
|
- app/assets/stylesheets/marty/application.css
|
162
|
+
- app/assets/stylesheets/marty/diagnostic.css
|
163
163
|
- app/components/marty/api_auth_view.rb
|
164
164
|
- app/components/marty/auth_app.rb
|
165
165
|
- app/components/marty/auth_app/javascripts/auth_app.js
|
@@ -357,6 +357,7 @@ files:
|
|
357
357
|
- app/components/marty/user_view.rb
|
358
358
|
- app/controllers/marty/application_controller.rb
|
359
359
|
- app/controllers/marty/components_controller.rb
|
360
|
+
- app/controllers/marty/diagnostic_controller.rb
|
360
361
|
- app/controllers/marty/job_controller.rb
|
361
362
|
- app/controllers/marty/report_controller.rb
|
362
363
|
- app/controllers/marty/rpc_controller.rb
|
@@ -384,6 +385,8 @@ files:
|
|
384
385
|
- app/models/marty/user.rb
|
385
386
|
- app/models/marty/user_role.rb
|
386
387
|
- app/views/layouts/marty/application.html.erb
|
388
|
+
- app/views/layouts/marty/diagnostic.html.erb
|
389
|
+
- app/views/marty/diagnostic/diagnostic.html.erb
|
387
390
|
- config/database.yml.travis
|
388
391
|
- config/locales/en.yml
|
389
392
|
- config/routes.rb
|
@@ -442,12 +445,12 @@ files:
|
|
442
445
|
- marty.gemspec
|
443
446
|
- script/rails
|
444
447
|
- spec/controllers/application_controller_spec.rb
|
448
|
+
- spec/controllers/diagnostic_controller_spec.rb
|
445
449
|
- spec/controllers/job_controller_spec.rb
|
446
450
|
- spec/controllers/rpc_controller_spec.rb
|
447
451
|
- spec/controllers/rpc_import_spec.rb
|
448
452
|
- spec/dummy/README.rdoc
|
449
453
|
- spec/dummy/Rakefile
|
450
|
-
- spec/dummy/app/assets/javascripts/application.js
|
451
454
|
- spec/dummy/app/assets/stylesheets/application.css
|
452
455
|
- spec/dummy/app/controllers/application_controller.rb
|
453
456
|
- spec/dummy/app/controllers/components_controller.rb
|
@@ -1,15 +0,0 @@
|
|
1
|
-
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
-
// listed below.
|
3
|
-
//
|
4
|
-
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
-
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
6
|
-
//
|
7
|
-
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
-
// the compiled file.
|
9
|
-
//
|
10
|
-
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
|
11
|
-
// GO AFTER THE REQUIRES BELOW.
|
12
|
-
//
|
13
|
-
//= require jquery
|
14
|
-
//= require jquery_ujs
|
15
|
-
//= require_tree .
|
@@ -1,15 +0,0 @@
|
|
1
|
-
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
-
// listed below.
|
3
|
-
//
|
4
|
-
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
-
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
6
|
-
//
|
7
|
-
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
-
// the compiled file.
|
9
|
-
//
|
10
|
-
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
|
11
|
-
// GO AFTER THE REQUIRES BELOW.
|
12
|
-
//
|
13
|
-
//= require jquery
|
14
|
-
//= require jquery_ujs
|
15
|
-
//= require_tree .
|