mutx 0.1.69 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +2 -2
  3. data/documentation/repos.md +21 -24
  4. data/lib/generators/task_rack.rb +8 -2
  5. data/lib/generators/templates/config.ru.tt +1 -1
  6. data/lib/mutx/API/execution.rb +8 -44
  7. data/lib/mutx/API/repo.rb +7 -10
  8. data/lib/mutx/background_jobs/workers/executor.rb +44 -38
  9. data/lib/mutx/commands/install.rb +1 -1
  10. data/lib/mutx/commands/start.rb +1 -1
  11. data/lib/mutx/custom/execution.rb +1 -1
  12. data/lib/mutx/database/mongo_connector.rb +19 -22
  13. data/lib/mutx/execution.rb +1 -0
  14. data/lib/mutx/lib/authentication.rb +23 -0
  15. data/lib/mutx/lib/helpers.rb +52 -0
  16. data/lib/mutx/lib/middlewares/database_middleware.rb +16 -0
  17. data/lib/mutx/lib/middlewares/flash_middleware.rb +31 -0
  18. data/lib/mutx/lib/middlewares/logger_middleware.rb +13 -0
  19. data/lib/mutx/lib/monkey_patch.rb +28 -0
  20. data/lib/mutx/lib/paths.rb +80 -0
  21. data/lib/mutx/platforms/ruby.rb +8 -0
  22. data/lib/mutx/public/css/bootstrap.min.css +7 -0
  23. data/lib/mutx/public/css/font-awesome.min.css +4 -0
  24. data/lib/mutx/public/css/jquery.json-viewer.css +44 -0
  25. data/{favicon.ico → lib/mutx/public/img/favicon.ico} +0 -0
  26. data/lib/mutx/public/js/bootstrap.min.js +6 -0
  27. data/lib/mutx/public/js/jquery.json-viewer.js +148 -0
  28. data/lib/mutx/public/js/jquery.min.js +6 -0
  29. data/lib/mutx/{view/javascript.mote → public/js/mutx.js} +0 -5
  30. data/lib/mutx/public/js/notify.min.js +1 -0
  31. data/lib/mutx/results/result.rb +60 -68
  32. data/lib/mutx/results/results.rb +4 -0
  33. data/lib/mutx/routes.rb +85 -883
  34. data/lib/mutx/routes/admin_routes.rb +16 -0
  35. data/lib/mutx/routes/admin_routes/custom_params_routes.rb +97 -0
  36. data/lib/mutx/routes/admin_routes/repositories_routes.rb +35 -0
  37. data/lib/mutx/routes/admin_routes/tasks_routes.rb +110 -0
  38. data/lib/mutx/routes/api_routes.rb +49 -0
  39. data/lib/mutx/routes/api_routes/custom_params_routes.rb +41 -0
  40. data/lib/mutx/routes/api_routes/input_routes.rb +48 -0
  41. data/lib/mutx/routes/api_routes/repos_routes.rb +74 -0
  42. data/lib/mutx/routes/api_routes/results_routes.rb +50 -0
  43. data/lib/mutx/routes/api_routes/tasks_routes.rb +47 -0
  44. data/lib/mutx/routes/api_routes/tests_routes.rb +42 -0
  45. data/lib/mutx/routes/features_routes.rb +24 -0
  46. data/lib/mutx/routes/help_routes.rb +23 -0
  47. data/lib/mutx/routes/logs_routes.rb +22 -0
  48. data/lib/mutx/routes/message_routes.rb +24 -0
  49. data/lib/mutx/routes/repositories_routes.rb +25 -0
  50. data/lib/mutx/routes/results_routes.rb +53 -0
  51. data/lib/mutx/routes/task_results_routes.rb +25 -0
  52. data/lib/mutx/routes/tasks_routes.rb +67 -0
  53. data/lib/mutx/routes/tests_routes.rb +66 -0
  54. data/lib/mutx/support/change_inspector.rb +3 -3
  55. data/lib/mutx/support/files_cleanner.rb +12 -3
  56. data/lib/mutx/support/git.rb +11 -2
  57. data/lib/mutx/support/processes.rb +2 -2
  58. data/lib/mutx/support/project_type.rb +12 -0
  59. data/lib/mutx/tasks/task.rb +8 -2
  60. data/lib/mutx/version.rb +1 -1
  61. data/lib/mutx/view/{custom/params/delete_form.mote → admin/custom-params/_delete_form.mote} +2 -4
  62. data/lib/mutx/view/{custom/params/create_edit_form.mote → admin/custom-params/_form.mote} +5 -9
  63. data/lib/mutx/view/{custom/params/custom_param_task_deleting_box.mote → admin/custom-params/_task_deleting_box.mote} +1 -2
  64. data/lib/mutx/view/{custom/params → admin/custom-params}/delete.mote +1 -3
  65. data/lib/mutx/view/{custom/params → admin/custom-params}/edit.mote +1 -5
  66. data/lib/mutx/view/{custom/params/list.mote → admin/custom-params/index.mote} +8 -13
  67. data/lib/mutx/view/{custom/params → admin/custom-params}/new.mote +1 -5
  68. data/lib/mutx/view/{custom/params/custom_param_selection_box.mote → admin/custom-params/selection_box.mote} +2 -3
  69. data/lib/mutx/view/{list_repos.mote → admin/repositories/index.mote} +2 -6
  70. data/lib/mutx/view/{repos.mote → admin/repositories/new.mote} +2 -6
  71. data/lib/mutx/view/{tasks/admin/delete_form.mote → admin/tasks/_delete_form.mote} +2 -12
  72. data/lib/mutx/view/{tasks/admin/create_edit_form.mote → admin/tasks/_form.mote} +6 -9
  73. data/lib/mutx/view/{tasks/admin → admin/tasks}/delete.mote +1 -3
  74. data/lib/mutx/view/{tasks/admin → admin/tasks}/edit.mote +1 -4
  75. data/lib/mutx/view/{tasks/admin/list.mote → admin/tasks/index.mote} +5 -10
  76. data/lib/mutx/view/{tasks/admin → admin/tasks}/new.mote +1 -5
  77. data/lib/mutx/view/{tasks/admin/view.mote → admin/tasks/show.mote} +1 -3
  78. data/lib/mutx/view/body.mote +13 -51
  79. data/lib/mutx/view/{custom/params.mote → custom-params/_custom_params.mote} +3 -4
  80. data/lib/mutx/view/{custom/params → custom-params/types}/json.mote +0 -0
  81. data/lib/mutx/view/{custom/params → custom-params/types}/select_list.mote +0 -0
  82. data/lib/mutx/view/{custom/params → custom-params/types}/text.mote +0 -0
  83. data/lib/mutx/view/error_handler.mote +4 -54
  84. data/lib/mutx/view/features/{feature.mote → file.mote} +0 -0
  85. data/lib/mutx/view/features/index.mote +9 -0
  86. data/lib/mutx/view/git_information.mote +2 -8
  87. data/lib/mutx/view/help/{main.mote → _main.mote} +0 -0
  88. data/lib/mutx/view/help/{page.mote → _page.mote} +0 -0
  89. data/lib/mutx/view/help/{search_result.mote → _search_result.mote} +0 -0
  90. data/lib/mutx/view/help/index.mote +38 -0
  91. data/lib/mutx/view/layout/flash.mote +7 -0
  92. data/lib/mutx/view/{footer.mote → layout/footer.mote} +1 -1
  93. data/lib/mutx/view/layout/javascript.mote +6 -0
  94. data/lib/mutx/view/{modals.mote → layout/modals.mote} +0 -0
  95. data/lib/mutx/view/layout/navigation_bar.mote +88 -0
  96. data/lib/mutx/view/{styles.mote → layout/styles.mote} +10 -0
  97. data/lib/mutx/view/logs/{logs.mote → index.mote} +1 -1
  98. data/lib/mutx/view/logs/show.mote +3 -0
  99. data/lib/mutx/view/repositories/_repository.mote +7 -0
  100. data/lib/mutx/view/repositories/index.mote +23 -0
  101. data/lib/mutx/view/repositories/show.mote +21 -0
  102. data/lib/mutx/view/results/{detailed_info.mote → _result.mote} +5 -5
  103. data/lib/mutx/view/results/console.mote +63 -106
  104. data/lib/mutx/view/results/{all.mote → index.mote} +18 -24
  105. data/lib/mutx/view/sections.rb +36 -24
  106. data/lib/mutx/view/task_results/_result.mote +57 -0
  107. data/lib/mutx/view/{results/result.mote → task_results/_result_item.mote} +6 -5
  108. data/lib/mutx/view/task_results/index.mote +35 -0
  109. data/lib/mutx/view/tasks/_task.mote +90 -0
  110. data/lib/mutx/view/tasks/index.mote +61 -0
  111. data/lib/mutx/view/tasks/show.mote +167 -0
  112. data/lib/mutx/view/tests/_test.mote +90 -0
  113. data/lib/mutx/view/tests/index.mote +59 -0
  114. data/lib/mutx/view/tests/show.mote +172 -0
  115. data/lib/mutx/view/view.rb +172 -10
  116. metadata +89 -50
  117. data/lib/mutx/database/middleware.rb +0 -18
  118. data/lib/mutx/view/features.mote +0 -57
  119. data/lib/mutx/view/features/features_list.mote +0 -10
  120. data/lib/mutx/view/help.mote +0 -75
  121. data/lib/mutx/view/logs/log.mote +0 -3
  122. data/lib/mutx/view/message.mote +0 -8
  123. data/lib/mutx/view/navigation_bar.mote +0 -67
  124. data/lib/mutx/view/results/results.mote +0 -112
  125. data/lib/mutx/view/tasks/message.mote +0 -37
  126. data/lib/mutx/view/tasks/task.mote +0 -167
  127. data/lib/mutx/view/tasks/task_item.mote +0 -77
  128. data/lib/mutx/view/tasks/tasks.mote +0 -74
@@ -1,4 +1,14 @@
1
+ <link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
2
+ <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet">
3
+ <!--
4
+ <link href='https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/jumbotron-narrow.css' rel='stylesheet'>
5
+ -->
6
+ <link href="/css/jquery.json-viewer.css" rel="stylesheet">
1
7
  <style>
8
+
9
+ body {
10
+ padding-top: 40px;
11
+ }
2
12
  label{
3
13
  font-family: Verdana;
4
14
  text-vertical-align: center;
@@ -1,6 +1,6 @@
1
1
  <div class="btn-group" role="group" aria-label="...">
2
2
  % Mutx::Support::Logs.all.keys.each do |log|
3
- <button type="button" class="btn btn-default">Left</button><a href='/logs/{{log}}'>{{log.split('_').first.capitalize}}</a></li>
3
+ <button type="button" class="btn btn-default">Left</button><a href='{{ path_for(:logs_show, log_name: log) }}'>{{ log.split('_').first.capitalize }}</a></li>
4
4
  % end
5
5
 
6
6
  </div>
@@ -0,0 +1,3 @@
1
+ <h3>{{ log_name.gsub("_"," ").capitalize }} Log</h3>
2
+ % content = Mutx::Support::Logs.read_log_file_content_for log_name
3
+ <pre style="height:400px; overflow:scroll; white-space:pre; word-wrap:normal;">{{ content }}</pre>
@@ -0,0 +1,7 @@
1
+ <th>
2
+ <a href="#" onclick="goClean('{{ path_for(:repositories_show, repository_id: repository['_id']) }}');" >{{ repository["repo_name"] }}</a>
3
+ </th>
4
+
5
+ <th>
6
+ {{ repository["last_update"] }}
7
+ </th>
@@ -0,0 +1,23 @@
1
+ % if repositories.empty?
2
+ <br>
3
+ <br>
4
+ <div id='well'>
5
+ <h3>No Respositories defined</h3>
6
+ </div>
7
+ <br>
8
+ <br>
9
+ % else
10
+ <div class="panel panel-default">
11
+ <div class="panel-heading"><h4>{{section.capitalize}}</h4></div>
12
+ <table class="table table-striped table-hover">
13
+ <tbody>
14
+ % repositories.each do |repository|
15
+ <tr>
16
+ {{ partial('repositories/_repository', repository: repository) }}
17
+ </tr>
18
+ % end
19
+ </tbody>
20
+ </table>
21
+ </div>
22
+ </div>
23
+ % end
@@ -0,0 +1,21 @@
1
+ <div class='starter-template'>
2
+
3
+ <div class="panel panel-default">
4
+ <div class="panel-heading">
5
+ <h4>{{ repository['repo_name'] }}</h4>
6
+ <p class="text-right">Last Update {{ repository['last_update'] }} </p>
7
+ </div>
8
+ <div class="panel-body" >
9
+ <ul class='list-group'>
10
+ <li class="list-group-item">
11
+ <div id="json-viewer" style="min-height: 500px; max-height: 500px; overflow-y: scroll;">
12
+ </div>
13
+ </li>
14
+ </ul>
15
+ </div>
16
+ </div>
17
+ </div>
18
+
19
+ <script type="text/javascript">
20
+ $('#json-viewer').jsonViewer({{ repository['value'].to_json }});
21
+ </script>
@@ -77,7 +77,7 @@
77
77
  <small>Execution data</small>
78
78
  </th>
79
79
  <th>
80
- <a href="#" class='label label-default' onclick="window.open('/api/results/{{result["_id"]}}/data', '_blank', 'toolbar=no, scrollbars=yes, resizable=yes, top=300, left=300, width=800, height=600');">Click here to see</a>
80
+ <a href="#" class='label label-default' onclick="window.open('{{ path_for(:api_results_data, result_id: result["_id"]) }}', '_blank', 'toolbar=no, scrollbars=yes, resizable=yes, top=300, left=300, width=800, height=600');">Click here to see</a>
81
81
  </th>
82
82
  </tr>
83
83
 
@@ -88,22 +88,22 @@
88
88
  </table>
89
89
 
90
90
  % if result["status"] == 'finished' and result["has_report"].eql? true
91
- <a onclick="window.open('/results/report/{{result["_id"]}}', '_blank', 'toolbar=no, scrollbars=yes, resizable=yes, top=300, left=300, width=800, height=600');" class='btn btn-{{Mutx::View.color(result["show_as"])}}'>
91
+ <a onclick="window.open('{{ path_for(:results_report, result_id: result["_id"]) }}', '_blank', 'toolbar=no, scrollbars=yes, resizable=yes, top=300, left=300, width=800, height=600');" class='btn btn-{{Mutx::View.color(result["show_as"])}}'>
92
92
  See Report
93
93
  </a>
94
94
  % end
95
95
 
96
- <a href='/results/{{result["_id"]}}/log', 'toolbar=no, scrollbars=yes, resizable=yes, top=300, left=300, width=800, height=600';" class='btn btn-info'>
96
+ <a href='{{ path_for(:results_log, result_id: result["_id"]) }}', 'toolbar=no, scrollbars=yes, resizable=yes, top=300, left=300, width=800, height=600';" class='btn btn-info'>
97
97
  Console Log
98
98
  </a>
99
99
 
100
- <a onclick="window.open('/api/results/{{result["_id"]}}', '_blank', 'toolbar=no, scrollbars=yes, resizable=yes, top=300, left=300, width=800, height=600');" class='btn btn-default'>
100
+ <a onclick="window.open('{{ path_for(:api_results_data, result_id: result["_id"]) }}', '_blank', 'toolbar=no, scrollbars=yes, resizable=yes, top=300, left=300, width=800, height=600');" class='btn btn-default'>
101
101
  Raw
102
102
  </a>
103
103
 
104
104
  % unless result["status"] =~ /finished|stopped/
105
105
 
106
- <a href='/results/{{result["_id"]}}/reset' class='btn btn-danger'>
106
+ <a href='{{ path_for(:results_reset, result_id: result["_id"]) }}' class='btn btn-danger'>
107
107
  Stop execution
108
108
  </a>
109
109
 
@@ -1,22 +1,9 @@
1
1
 
2
2
  <?
3
- result = Mutx::Results::Result.get(result_id)
4
3
  if result
5
4
  result.mark_as_saw! if (result.finished? or result.stopped?)
6
- text = ""
7
- #text += result.bundle_output.split("\n").join("</p><p>") if result.bundle_output
8
- text += result.console_output.split("\n").join("</p><p>") if result.console_output
9
- #if text.empty?
10
- # lines = []
11
- # begin
12
- # File.open("ls_#{result.id}.out","r").each_line do |line|
13
- # lines << line
14
- # end
15
- # rescue
16
- # lines << "Wait..."
17
- # end
18
- # text = lines.join("</small></p><p><small>")
19
- #end
5
+ text = result.console_output.split("\n").join("</p><p>") if result.console_output
6
+
20
7
  size_of_lines = text.split("</p>").size
21
8
 
22
9
  task = Mutx::Tasks::Task.get(result.task_id)
@@ -25,101 +12,71 @@ if result
25
12
 
26
13
  execution_name = result.execution_name.empty? ? 'Not Defined' : result.execution_name.gsub('-_-',' ')
27
14
 
28
- git_log = result.git_log.split('Author').first
29
- else
30
-
31
15
  end
32
16
 
33
- javascript = Mote.parse(File.read("#{Mutx::View.path}/javascript.mote"), self, []).call()
34
-
35
17
  ?>
36
-
37
- <html lang='en'>
38
- <head>
39
- <meta charset='utf-8'>
40
- <meta http-equiv='X-UA-Compatible' content='IE=edge'>
41
- <meta name='viewport' content='width=device-width, initial-scale=1'>
42
- <!-- <meta http-equiv='refresh' content='{{Mutx::Support::Configuration.refresh_time}}'> -->
43
- <link rel='icon' href='../../favicon.ico'>
44
- <title>Result for {{result.task_name}}</title>
45
- <!-- Bootstrap core CSS -->
46
- <link href='https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css' rel='stylesheet'>
47
- <!-- Custom styles for this template -->
48
- <link href='https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/jumbotron-narrow.css' rel='stylesheet'>
49
- {{javascript}}
50
-
51
- </head>
52
-
53
- <body>
54
- % if result
55
- <div class='container'>
56
- <br>
57
- <div class='well'>
58
- <h3>Result for <b>{{result.task_name}}</b> execution {{result.stopped? ? '(Stopped)' : ''}}</h3>
59
- <h6><b>Result ID:</b> {{result.id}}</h6>
60
- % if Mutx::Support::Configuration.use_git?
61
- <h6><b>Git log:</b> {{git_log}}</h6>
62
- % end
63
- <h6><b>Status: </b>{{result.status}}</h6>
64
- % if result.timeout
65
- <h6><b>Timeout:</b> Stopped After {{result.timeout}} seconds</h6>
66
- % end
67
- % if result.started_at
68
- <h6><b>Duration:</b> {{result.elapsed_time}} seconds</h6>
69
- % end
70
- <h6><b>Execution Name: </b>{{execution_name}}</h6>
71
- <h6><b>Custom parameters:</b>{{custom_params}}</h6>
72
- <h6>&nbsp;</h6>
73
- <h6>
74
- <div>
75
- <a onclick="window.history.go(-1);" style="cursor:pointer;" class='label label-default' >GO BACK</a>
76
- <a href='#' class='label label-info' onclick="window.open('/api/results/{{result.id}}', '_blank', 'toolbar=no, scrollbars=yes, resizable=yes, top=300, left=300, width=800, height=600');" class='btn btn-default'>
77
- Result Data</a>
78
- <a href='#' class='label label-warning' onclick="window.open('/api/results/{{result.id}}/data', '_blank', 'toolbar=no, scrollbars=yes, resizable=yes, top=300, left=300, width=800, height=600');" class='btn btn-default'>
79
- Execution Data</a>
80
- % unless result.status =~ /finished|stopped/
81
- <a href='#' onclick="getAndClose('/results/{{result.id}}/reset');" class='label label-danger'>
82
- Stop execution
83
- </a>
84
- % end
85
- </div>
86
- </h6>
87
- </div>
88
- <div class='page-header'>
89
- <h4>Console Output</h4>
90
- </div>
91
- <div id='result'>
92
- % if size_of_lines > 15
93
- <button type='button' class='btn btn-default' title='Go down' onclick='goToBottom()' style='float: right'><span class='glyphicon glyphicon-chevron-down' aria-hidden='true'></span> Go down</button>
94
- <br>
95
- % end
96
- <h3>
97
- <small>
98
- <pre style="height:400px; overflow:scroll; white-space:pre; word-wrap:normal;">
99
- <b style='color:Black'>{{text}}</b>
100
- </pre>
101
- </small>
102
- </h3>
103
- % if size_of_lines > 15
104
- <button type='button' class='btn btn-default' title='Go up' onclick='goToTop()' style='float: right'><span class='glyphicon glyphicon-chevron-up' aria-hidden='true'></span> Go up</button><br><br>
105
- % end
106
- </div>
107
- <br>
18
+ % if result
19
+ <br>
20
+ <div class='well'>
21
+ <h3>{{result.task['type'].capitalize}} <b>{{result.task_name}}</b> result execution {{result.stopped? ? '(Stopped)' : ''}}</h3>
22
+ <h6><b>ID:</b> {{result.id}}</h6>
23
+ <h6><b>Status: </b>{{result.status}}</h6>
24
+ % if result.timeout
25
+ <h6><b>Timeout:</b> Stopped After {{result.timeout}} seconds</h6>
26
+ % end
27
+ % if result.started_at
28
+ <h6><b>Duration:</b>{{Mutx::View.formatted_for result.elapsed_time}}</h6>
29
+ % end
30
+ <h6><b>Execution Name: </b>{{execution_name}}</h6>
31
+ <h6><b>Custom parameters:</b>{{custom_params}}</h6>
32
+ <h6>&nbsp;</h6>
33
+ <h6>
108
34
  <div>
109
- <a onclick="window.history.go(-1);" style="cursor:pointer;" class='label label-default' >GO BACK</a>
110
- </div>
111
- <br>
112
- <br>
113
- </div>
114
- % else
115
- <div class='container'>
116
- <br>
117
- <div id='well'>
118
- <h3>There is no result with id: <b>{{result_id}}</b></h3>
35
+ % if result.task['type'] == "task"
36
+ <a onclick="goClean('{{path_for(:tasks_show, task_name:result.task['name'])}}');" style="cursor:pointer;" class='btn btn-default' >
37
+ {{Mutx::View.icon_for("back")}}&nbsp;Return to task
38
+ </a>&nbsp;
39
+ % else
40
+ <a onclick="goClean('{{path_for(:tests_show, test_name:result.task['name'])}}');" style="cursor:pointer;" class='btn btn-default' >
41
+ {{Mutx::View.icon_for("back")}}&nbsp;Return to test
42
+ </a>&nbsp;
43
+ % end
44
+ <a href='#' onclick="window.open('{{ path_for(:api_results_show, result_id: result.id) }}', '_blank', 'toolbar=no, scrollbars=yes, resizable=yes, top=300, left=300, width=800, height=600');" class='btn btn-default'>
45
+ JSON Data</a>
46
+ <a href='#' onclick="window.open('{{ path_for(:api_results_data, result_id: result.id) }}', '_blank', 'toolbar=no, scrollbars=yes, resizable=yes, top=300, left=300, width=800, height=600');" class='btn btn-default'>
47
+ Execution Data</a>
119
48
  </div>
49
+ </h6>
50
+ </div>
51
+ <div class='page-header'>
52
+ <h4>Console Output</h4>
53
+ </div>
54
+ <div id='result'>
55
+ % if size_of_lines > 15
56
+ <button type='button' class='btn btn-default' title='Go down' onclick='goToBottom()' style='float: right'><span class='glyphicon glyphicon-chevron-down' aria-hidden='true'></span> Go down</button>
120
57
  <br>
121
- <a onclick="window.history.go(-1);" style="cursor:pointer;" class='label label-default' >GO BACK</a>
122
- </div>
58
+ % end
59
+ <h3>
60
+ <small>
61
+ <pre style="height:400px; overflow:scroll; white-space:pre; word-wrap:normal;">
62
+ <b style='color:Black'>{{text}}</b>
63
+ </pre>
64
+ </small>
65
+ </h3>
66
+ % if size_of_lines > 15
67
+ <button type='button' class='btn btn-default' title='Go up' onclick='goToTop()' style='float: right'><span class='glyphicon glyphicon-chevron-up' aria-hidden='true'></span> Go up</button><br><br>
123
68
  % end
124
- </body>
125
- </html>
69
+ </div>
70
+ <br>
71
+ <div>
72
+ <a onclick="window.history.go(-1);" style="cursor:pointer;" class='label label-default' >Return to task</a>
73
+ </div>
74
+ <br>
75
+ <br>
76
+ % else
77
+ <div id='well'>
78
+ <h3>There is no result with id: <b>{{result_id}}</b></h3>
79
+ </div>
80
+ <br>
81
+ <a onclick="window.history.go(-1);" style="cursor:pointer;" class='label label-default' >Back</a>
82
+ % end
@@ -1,15 +1,11 @@
1
1
  <?
2
2
 
3
- key = args[:query_string].keyword if (args[:query_string].keyword and !args[:query_string].keyword.empty?)
4
- status = args[:query_string].status if (args[:query_string].status and !args[:query_string].status.empty?)
5
- application = args[:query_string].application if (args[:query_string].application and !args[:query_string].application.empty?)
6
-
7
-
8
- results = Mutx::API::Results.show()
9
- results_list = results["results"]
3
+ key = query_string.keyword if (query_string.keyword and !query_string.keyword.empty?)
4
+ status = query_string.status if (query_string.status and !query_string.status.empty?)
5
+ application = query_string.application if (query_string.application and !query_string.application.empty?)
10
6
  if key
11
7
  keyword = key.downcase
12
- results_list.select! do |result_data|
8
+ results.select! do |result_data|
13
9
  result_data["execution_name"].downcase.include? keyword or
14
10
  result_data["summary"].downcase.include? keyword or
15
11
  result_data["task"].inspect.downcase.include? keyword or
@@ -18,12 +14,12 @@
18
14
  result_data["custom_params"].inspect.downcase.include? keyword
19
15
  end
20
16
 
21
- results_list.select!{|result_data| result_data["_id"]==key} if key.is_a? Fixnum
17
+ results.select!{|result_data| result_data["_id"]==key} if key.is_a? Fixnum
22
18
 
23
19
  end
24
20
 
25
21
  if status
26
- results_list.select! do |res|
22
+ results.select! do |res|
27
23
  by_status = res["status"].downcase==status.downcase
28
24
  by_first_part_summary = res["summary"].split("step").first.downcase.include? status.downcase
29
25
  first_part = res["summary"].split("step").first
@@ -38,7 +34,7 @@
38
34
  end
39
35
 
40
36
  if application
41
- results_list.select! do |res|
37
+ results.select! do |res|
42
38
  by_application = res["application"].downcase==application.downcase
43
39
  by_first_part_summary = res["summary"].split("step").first.downcase.include? application.downcase
44
40
  first_part = res["summary"].split("step").first
@@ -53,18 +49,18 @@
53
49
  end
54
50
 
55
51
  results_size_text = if (key or status)
56
- "#{results_list.size} result#{'s' if results_list.size>1} found"
52
+ "#{results.size} result#{'s' if results.size>1} found"
57
53
  else
58
- total_of_results = results_list.size
59
- results_list = results_list[0..19] if total_of_results > 20
60
- "Showing #{results_list.size} results of #{total_of_results}."
54
+ total_of_results = results.size
55
+ results = results[0..19] if total_of_results > 20
56
+ "Showing #{results.size} results of #{total_of_results}."
61
57
  end
62
58
 
63
59
 
64
60
  ?>
65
61
 
66
62
  <div class='well'>
67
- <form name='search' method='get' action='/results/all'>
63
+ <form name='search' method='get' action='{{ path_for(:results_index) }}'>
68
64
  <input type='text' name='keyword' title='' placeholder='Search' value='{{key}}' style='height: 34px; padding: 6px 12px; font-size: 14px; line-height: 1.42857143; color: #555; background-color: #fff; background-image: none; border: 1px solid #ccc; border-radius: 4px;' />
69
65
  <select id='status' name='status' style='height: 34px; padding: 6px 12px; font-size: 14px; line-height: 1.42857143; color: #555; background-color: #fff; background-image: none; border: 1px solid #ccc; border-radius: 4px;'>
70
66
  <option value='' {{'selected' if status.nil?}}>Any status</option>
@@ -80,10 +76,10 @@
80
76
  </select>
81
77
  <input type='submit' class='btn btn-success' value='Search'>&nbsp;&nbsp;
82
78
  % if key or status or application
83
- <a class='btn btn-danger' href='/results/all' role='button'>Clear</a>
79
+ <a class='btn btn-danger' href='{{ path_for(:results_index) }}' role='button'>Clear</a>
84
80
  % end
85
81
 
86
- % if results_list.size > 0
82
+ % if results.size > 0
87
83
  <div class='btn-group pull-right' role='group'>
88
84
  <button type='button' class='btn btn-default' aria-label='Left Align' title='Toggle collapse' onclick="autoCollapse()" title='collapse all panels'>
89
85
  <div id='collapse_icon'>
@@ -98,12 +94,10 @@
98
94
  <p style='text-align:right'>{{results_size_text}}</p>
99
95
  </div>
100
96
 
101
- % if results_list.size > 0
102
- % result_info = Mote.parse(File.read("#{Mutx::View.path}/results/detailed_info.mote"), self, [:result])
103
- % results_list.each do |result_data|
104
- {{result_info.call(result:result_data)}}
105
- % end
106
- % else
97
+ % results.each do |result_data|
98
+ {{ partial('results/_result', result: result_data) }}
99
+ % end
100
+ % unless results.size > 0
107
101
  <br>
108
102
  <br>
109
103
  <div id='well'>
@@ -4,33 +4,45 @@ module Mutx
4
4
  class Sections
5
5
 
6
6
  @@sections = {
7
- "Edit Tasks" => "tasks/admin/list",
8
- "Add Task" => "tasks/admin/new",
9
- "Edit Task" => "tasks/admin/edit",
10
- "View Task" => "tasks/admin/view",
11
- "Delete Task" => "tasks/admin/delete",
12
- "Tests" => "tasks/tasks",
13
- "Test Message" => 'tasks/message',
14
- "Tasks" => "tasks/tasks",
15
- "Task Message" => 'tasks/message',
16
- "Features" => "features/features",
17
- "Feature" => "features/feature",
18
- "Results"=> "results/results",
19
- "Console" => "results/console",
20
- "Report" => "results/report",
21
- "All Results"=> "results/all",
22
- "Custom Params" => "custom/params/list",
23
- "New Custom Param" => "custom/params/new",
24
- "Edit Custom Param" => "custom/params/edit",
25
- "Delete Custom Param" => "custom/params/delete",
7
+
8
+ "Admin Tasks" => "admin/tasks/index",
9
+ "Admin Tasks New" => "admin/tasks/new",
10
+ "Admin Tasks Edit" => "admin/tasks/edit",
11
+ "Admin Task" => "admin/tasks/show",
12
+ "Admin Tasks Delete" => "admin/tasks/delete",
13
+
14
+ "Admin Custom Params" => "admin/custom-params/index",
15
+ "Admin Custom Params New" => "admin/custom-params/new",
16
+ "Admin Custom Params Edit" => "admin/custom-params/edit",
17
+ "Admin Custom Params Delete" => "admin/custom-params/delete",
18
+
19
+ "Admin Repositories New" => "admin/repositories/new",
20
+ "Admin Repositories" => "admin/repositories/index",
21
+
22
+ 'Tests' => "tests/index",
23
+ 'Test' => "tests/show",
24
+ 'Tasks' => "tasks/index",
25
+ 'Task' => "tasks/show",
26
+
27
+ 'Task Results' => 'task_results/index',
28
+
29
+ "Results"=> "results/index",
30
+ "Result Console" => "results/console",
31
+ "Result Report" => "results/report",
32
+
33
+ "Features" => "features/index",
34
+ "Feature" => "features/file",
35
+
26
36
  "View Configuration" => "admin/config",
27
37
  "Edit Configuration" => "admin/config/edit",
28
38
  "Repo" => "",
29
- "Logs" => "logs",
30
- "Log" => "logs/log",
31
- "Help" => "",
32
- "New Repo" => "repos",
33
- "List Repos" => "list_repos",
39
+ "Repositories" => "repositories/index",
40
+ "Repository" => "repositories/show",
41
+ "Logs" => "logs/index",
42
+ "Log" => "logs/show",
43
+ "Help" => "help/index",
44
+
45
+ "Error" => "error_handler"
34
46
  }
35
47
 
36
48
  def self.path_for section