mirror of
https://github.com/ansible/awx.git
synced 2026-05-20 07:17:40 -02:30
add standard out download button to various places in the UI
This commit is contained in:
@@ -4,11 +4,11 @@
|
|||||||
* All Rights Reserved
|
* All Rights Reserved
|
||||||
*************************************************/
|
*************************************************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ngdoc function
|
* @ngdoc function
|
||||||
* @name helpers.function:LogViewer
|
* @name helpers.function:LogViewer
|
||||||
* @description logviewer
|
* @description logviewer
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export default
|
export default
|
||||||
angular.module('LogViewerHelper', ['ModalDialog', 'Utilities', 'FormGenerator', 'VariablesHelper'])
|
angular.module('LogViewerHelper', ['ModalDialog', 'Utilities', 'FormGenerator', 'VariablesHelper'])
|
||||||
@@ -96,9 +96,12 @@ export default
|
|||||||
|
|
||||||
if (data.result_stdout) {
|
if (data.result_stdout) {
|
||||||
$('#logview-tabs li:eq(1)').show();
|
$('#logview-tabs li:eq(1)').show();
|
||||||
|
var showStandardOut = (data.type !== "system_job") ? true : false;
|
||||||
AddPreFormattedText({
|
AddPreFormattedText({
|
||||||
id: 'stdout-form-container',
|
id: 'stdout-form-container',
|
||||||
val: data.result_stdout
|
val: data.result_stdout,
|
||||||
|
standardOut: showStandardOut,
|
||||||
|
jobUrl: data.url
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -360,8 +363,11 @@ export default
|
|||||||
return function(params) {
|
return function(params) {
|
||||||
var id = params.id,
|
var id = params.id,
|
||||||
val = params.val,
|
val = params.val,
|
||||||
html;
|
html = "";
|
||||||
html = "<pre ng-non-bindable>" + val + "</pre>\n";
|
if (params.standardOut) {
|
||||||
|
html += '<a href="' + params.jobUrl + 'stdout?format=txt_download" class="btn btn-primary btn-xs DownloadStandardOut DownloadStandardOut--onModal" id="download-stdout-button" type="button" aw-tool-tip="Download standard out as a .txt file" data-placement="top" ng-show="status === \'cancelled\' || status === \'failed\' || status === \'error\' || status === \'successful\'"><i class="fa fa-download DownloadStandardOut-icon DownloadStandardOut-icon--withText"></i>Download</a>';
|
||||||
|
}
|
||||||
|
html += "<pre ng-non-bindable>" + val + "</pre>\n";
|
||||||
$('#' + id).empty().html(html);
|
$('#' + id).empty().html(html);
|
||||||
};
|
};
|
||||||
}])
|
}])
|
||||||
|
|||||||
23
awx/ui/static/js/shared/download-standard.out.block.less
Normal file
23
awx/ui/static/js/shared/download-standard.out.block.less
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
/** @define DownloadStandardOut */
|
||||||
|
|
||||||
|
.DownloadStandardOut {
|
||||||
|
color: #fff !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.DownloadStandardOut--onStandardOutPage {
|
||||||
|
margin-top: -3px;
|
||||||
|
margin-right: -9px;
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.DownloadStandardOut--onModal {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.DownloadStandardOut-icon {
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.DownloadStandardOut-icon--withText {
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
@@ -20,8 +20,10 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="panel panel-default job-stdout-panel">
|
<div class="panel panel-default job-stdout-panel">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
<h3 class="panel-title">Standard Output</h3>
|
<h3 class="panel-title">Standard Output
|
||||||
|
<a href="/api/v1/jobs/{{ job.id }}/stdout?format=txt_download" class="btn btn-primary btn-xs DownloadStandardOut DownloadStandardOut--onStandardOutPage" id="download-stdout-button" type="button" aw-tool-tip="Download standard out as a .txt file" data-placement="top" ng-show="job.status === 'cancelled' || job.status === 'failed' || job.status === 'error' || job.status === 'successful'">
|
||||||
|
<i class="fa fa-download DownloadStandardOut-icon DownloadStandardOut-icon--withText"></i>Download</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body stdout-panel-body">
|
<div class="panel-body stdout-panel-body">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|||||||
@@ -158,8 +158,10 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
<h3 class="panel-title">Standard Output</h3>
|
<h3 class="panel-title">Standard Output
|
||||||
|
<a href="/api/v1/ad_hoc_commands/{{ job.id }}/stdout?format=txt_download" class="btn btn-primary btn-xs DownloadStandardOut DownloadStandardOut--onStandardOutPage" id="download-stdout-button" type="button" aw-tool-tip="Download standard out as a .txt file" data-placement="top" ng-show="job.status === 'cancelled' || job.status === 'failed' || job.status === 'error' || job.status === 'successful'"><i class="fa fa-download DownloadStandardOut-icon DownloadStandardOut-icon--withText"></i>Download</a>
|
||||||
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body stdout-panel-body">
|
<div class="panel-body stdout-panel-body">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|||||||
Reference in New Issue
Block a user