lib/mutx/view/results/console.mote in mutx-0.1.69 vs lib/mutx/view/results/console.mote in mutx-0.2.0
- old
+ new
@@ -1,125 +1,82 @@
<?
-result = Mutx::Results::Result.get(result_id)
if result
result.mark_as_saw! if (result.finished? or result.stopped?)
- text = ""
- #text += result.bundle_output.split("\n").join("</p><p>") if result.bundle_output
- text += result.console_output.split("\n").join("</p><p>") if result.console_output
- #if text.empty?
- # lines = []
- # begin
- # File.open("ls_#{result.id}.out","r").each_line do |line|
- # lines << line
- # end
- # rescue
- # lines << "Wait..."
- # end
- # text = lines.join("</small></p><p><small>")
- #end
+ text = result.console_output.split("\n").join("</p><p>") if result.console_output
+
size_of_lines = text.split("</p>").size
task = Mutx::Tasks::Task.get(result.task_id)
custom_params = result.custom_params.empty? ? 'Not Defined' : result.custom_params_values.gsub('mutx_custom_params=',"")
execution_name = result.execution_name.empty? ? 'Not Defined' : result.execution_name.gsub('-_-',' ')
- git_log = result.git_log.split('Author').first
-else
-
end
-javascript = Mote.parse(File.read("#{Mutx::View.path}/javascript.mote"), self, []).call()
-
?>
-
-<html lang='en'>
- <head>
- <meta charset='utf-8'>
- <meta http-equiv='X-UA-Compatible' content='IE=edge'>
- <meta name='viewport' content='width=device-width, initial-scale=1'>
- <!-- <meta http-equiv='refresh' content='{{Mutx::Support::Configuration.refresh_time}}'> -->
- <link rel='icon' href='../../favicon.ico'>
- <title>Result for {{result.task_name}}</title>
- <!-- Bootstrap core CSS -->
- <link href='https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css' rel='stylesheet'>
- <!-- Custom styles for this template -->
- <link href='https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/jumbotron-narrow.css' rel='stylesheet'>
- {{javascript}}
-
- </head>
-
- <body>
- % if result
- <div class='container'>
- <br>
- <div class='well'>
- <h3>Result for <b>{{result.task_name}}</b> execution {{result.stopped? ? '(Stopped)' : ''}}</h3>
- <h6><b>Result ID:</b> {{result.id}}</h6>
- % if Mutx::Support::Configuration.use_git?
- <h6><b>Git log:</b> {{git_log}}</h6>
- % end
- <h6><b>Status: </b>{{result.status}}</h6>
- % if result.timeout
- <h6><b>Timeout:</b> Stopped After {{result.timeout}} seconds</h6>
- % end
- % if result.started_at
- <h6><b>Duration:</b> {{result.elapsed_time}} seconds</h6>
- % end
- <h6><b>Execution Name: </b>{{execution_name}}</h6>
- <h6><b>Custom parameters:</b>{{custom_params}}</h6>
- <h6> </h6>
- <h6>
- <div>
- <a onclick="window.history.go(-1);" style="cursor:pointer;" class='label label-default' >GO BACK</a>
- <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'>
- Result Data</a>
- <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'>
- Execution Data</a>
- % unless result.status =~ /finished|stopped/
- <a href='#' onclick="getAndClose('/results/{{result.id}}/reset');" class='label label-danger'>
- Stop execution
- </a>
- % end
- </div>
- </h6>
- </div>
- <div class='page-header'>
- <h4>Console Output</h4>
- </div>
- <div id='result'>
- % if size_of_lines > 15
- <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>
- <br>
+% if result
+ <br>
+ <div class='well'>
+ <h3>{{result.task['type'].capitalize}} <b>{{result.task_name}}</b> result execution {{result.stopped? ? '(Stopped)' : ''}}</h3>
+ <h6><b>ID:</b> {{result.id}}</h6>
+ <h6><b>Status: </b>{{result.status}}</h6>
+ % if result.timeout
+ <h6><b>Timeout:</b> Stopped After {{result.timeout}} seconds</h6>
+ % end
+ % if result.started_at
+ <h6><b>Duration:</b>{{Mutx::View.formatted_for result.elapsed_time}}</h6>
+ % end
+ <h6><b>Execution Name: </b>{{execution_name}}</h6>
+ <h6><b>Custom parameters:</b>{{custom_params}}</h6>
+ <h6> </h6>
+ <h6>
+ <div>
+ % if result.task['type'] == "task"
+ <a onclick="goClean('{{path_for(:tasks_show, task_name:result.task['name'])}}');" style="cursor:pointer;" class='btn btn-default' >
+ {{Mutx::View.icon_for("back")}} Return to task
+ </a>
+ % else
+ <a onclick="goClean('{{path_for(:tests_show, test_name:result.task['name'])}}');" style="cursor:pointer;" class='btn btn-default' >
+ {{Mutx::View.icon_for("back")}} Return to test
+ </a>
% end
- <h3>
- <small>
- <pre style="height:400px; overflow:scroll; white-space:pre; word-wrap:normal;">
- <b style='color:Black'>{{text}}</b>
- </pre>
- </small>
- </h3>
- % if size_of_lines > 15
- <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>
- % end
+ <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'>
+ JSON Data</a>
+ <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'>
+ Execution Data</a>
</div>
+ </h6>
+ </div>
+ <div class='page-header'>
+ <h4>Console Output</h4>
+ </div>
+ <div id='result'>
+ % if size_of_lines > 15
+ <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>
<br>
- <div>
- <a onclick="window.history.go(-1);" style="cursor:pointer;" class='label label-default' >GO BACK</a>
- </div>
- <br>
- <br>
- </div>
- % else
- <div class='container'>
- <br>
- <div id='well'>
- <h3>There is no result with id: <b>{{result_id}}</b></h3>
- </div>
- <br>
- <a onclick="window.history.go(-1);" style="cursor:pointer;" class='label label-default' >GO BACK</a>
- </div>
+ % end
+ <h3>
+ <small>
+ <pre style="height:400px; overflow:scroll; white-space:pre; word-wrap:normal;">
+ <b style='color:Black'>{{text}}</b>
+ </pre>
+ </small>
+ </h3>
+ % if size_of_lines > 15
+ <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>
% end
- </body>
-</html>
+ </div>
+ <br>
+ <div>
+ <a onclick="window.history.go(-1);" style="cursor:pointer;" class='label label-default' >Return to task</a>
+ </div>
+ <br>
+ <br>
+% else
+ <div id='well'>
+ <h3>There is no result with id: <b>{{result_id}}</b></h3>
+ </div>
+ <br>
+ <a onclick="window.history.go(-1);" style="cursor:pointer;" class='label label-default' >Back</a>
+% end
\ No newline at end of file