mirror of
https://github.com/ansible/awx.git
synced 2026-05-19 14:57:39 -02:30
Changes to LogViewer widget to remove back-end, command line and environment related stuff.
This commit is contained in:
@@ -208,7 +208,8 @@ function ProjectsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
|
|||||||
Wait('start');
|
Wait('start');
|
||||||
LogViewer({
|
LogViewer({
|
||||||
scope: $scope,
|
scope: $scope,
|
||||||
url: project.related.last_update
|
url: project.related.last_update,
|
||||||
|
status_icon: 'icon-job-' + project.statusIcon
|
||||||
});
|
});
|
||||||
/*
|
/*
|
||||||
ProjectStatus({
|
ProjectStatus({
|
||||||
|
|||||||
@@ -13,16 +13,6 @@ angular.module('LogViewerOptionsDefinition', [])
|
|||||||
well: false,
|
well: false,
|
||||||
|
|
||||||
fields: {
|
fields: {
|
||||||
"job_args": {
|
|
||||||
label: "Arguments",
|
|
||||||
type: "text",
|
|
||||||
readonly: true
|
|
||||||
},
|
|
||||||
"job_cwd": {
|
|
||||||
label: "CWD",
|
|
||||||
type: "text",
|
|
||||||
readonly: true
|
|
||||||
},
|
|
||||||
"job_type": {
|
"job_type": {
|
||||||
label: "Job Type",
|
label: "Job Type",
|
||||||
type: "text",
|
type: "text",
|
||||||
|
|||||||
@@ -18,18 +18,18 @@ angular.module('LogViewerStatusDefinition', [])
|
|||||||
type: "text",
|
type: "text",
|
||||||
readonly: true,
|
readonly: true,
|
||||||
},
|
},
|
||||||
"created": {
|
"started": {
|
||||||
label: "Created",
|
label: "Started",
|
||||||
type: "text",
|
type: "text",
|
||||||
readonly: true
|
readonly: true
|
||||||
},
|
},
|
||||||
"modified": {
|
"finished": {
|
||||||
label: "Modified",
|
label: "Finished",
|
||||||
type: "text",
|
type: "text",
|
||||||
readonly: true
|
readonly: true
|
||||||
},
|
},
|
||||||
"unified_job_template": {
|
"elapsed": {
|
||||||
label: "Job Template",
|
label: "Elapsed",
|
||||||
type: "text",
|
type: "text",
|
||||||
readonly: true
|
readonly: true
|
||||||
},
|
},
|
||||||
@@ -47,21 +47,6 @@ angular.module('LogViewerStatusDefinition', [])
|
|||||||
label: "License Error",
|
label: "License Error",
|
||||||
type: "text",
|
type: "text",
|
||||||
readonly: true
|
readonly: true
|
||||||
},
|
|
||||||
"started": {
|
|
||||||
label: "Started",
|
|
||||||
type: "text",
|
|
||||||
readonly: true
|
|
||||||
},
|
|
||||||
"finished": {
|
|
||||||
label: "Finished",
|
|
||||||
type: "text",
|
|
||||||
readonly: true
|
|
||||||
},
|
|
||||||
"elapsed": {
|
|
||||||
label: "Elapsed",
|
|
||||||
type: "text",
|
|
||||||
readonly: true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ angular.module('LogViewerHelper', ['ModalDialog', 'Utilities', 'FormGenerator'])
|
|||||||
return function(params) {
|
return function(params) {
|
||||||
var parent_scope = params.scope,
|
var parent_scope = params.scope,
|
||||||
url = params.url,
|
url = params.url,
|
||||||
|
status_icon = params.status_icon,
|
||||||
scope = parent_scope.$new();
|
scope = parent_scope.$new();
|
||||||
|
|
||||||
if (scope.removeModalReady) {
|
if (scope.removeModalReady) {
|
||||||
@@ -36,8 +37,8 @@ angular.module('LogViewerHelper', ['ModalDialog', 'Utilities', 'FormGenerator'])
|
|||||||
scope[key] = data[key];
|
scope[key] = data[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
AddTable({ scope: scope, form: LogViewerStatusForm, id: 'status-form-container' });
|
AddTable({ scope: scope, form: LogViewerStatusForm, id: 'status-form-container', status_icon: status_icon });
|
||||||
AddTable({ scope: scope, form: LogViewerOptionsForm, id: 'options-form-container' });
|
AddTable({ scope: scope, form: LogViewerOptionsForm, id: 'options-form-container', status_icon: status_icon });
|
||||||
|
|
||||||
if (data.result_stdout) {
|
if (data.result_stdout) {
|
||||||
AddTextarea({
|
AddTextarea({
|
||||||
@@ -61,12 +62,12 @@ angular.module('LogViewerHelper', ['ModalDialog', 'Utilities', 'FormGenerator'])
|
|||||||
$('#logview-tabs li:eq(2)').hide();
|
$('#logview-tabs li:eq(2)').hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.job_env) {
|
/*if (data.job_env) {
|
||||||
EnvTable({
|
EnvTable({
|
||||||
id: 'env-form-container',
|
id: 'env-form-container',
|
||||||
vars: data.job_env
|
vars: data.job_env
|
||||||
});
|
});
|
||||||
}
|
}*/
|
||||||
|
|
||||||
if (!Empty(scope.credential)) {
|
if (!Empty(scope.credential)) {
|
||||||
LookUpName({
|
LookUpName({
|
||||||
@@ -124,7 +125,7 @@ angular.module('LogViewerHelper', ['ModalDialog', 'Utilities', 'FormGenerator'])
|
|||||||
CreateDialog({
|
CreateDialog({
|
||||||
scope: scope,
|
scope: scope,
|
||||||
width: 600,
|
width: 600,
|
||||||
height: 675,
|
height: 550,
|
||||||
minWidth: 450,
|
minWidth: 450,
|
||||||
callback: 'ModalReady',
|
callback: 'ModalReady',
|
||||||
id: 'logviewer-modal-dialog',
|
id: 'logviewer-modal-dialog',
|
||||||
@@ -172,7 +173,11 @@ angular.module('LogViewerHelper', ['ModalDialog', 'Utilities', 'FormGenerator'])
|
|||||||
Rest.get()
|
Rest.get()
|
||||||
.success(function(data) {
|
.success(function(data) {
|
||||||
if (!Empty(data.name)) {
|
if (!Empty(data.name)) {
|
||||||
scope[scope_var] = data.name;
|
scope[scope_var + '_name'] = data.name;
|
||||||
|
}
|
||||||
|
if (!Empty(data.group)) {
|
||||||
|
// Used for inventory_source
|
||||||
|
scope.group = data.group;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.error(function(data, status) {
|
.error(function(data, status) {
|
||||||
@@ -182,20 +187,37 @@ angular.module('LogViewerHelper', ['ModalDialog', 'Utilities', 'FormGenerator'])
|
|||||||
};
|
};
|
||||||
}])
|
}])
|
||||||
|
|
||||||
.factory('AddTable', ['Empty', function(Empty) {
|
.factory('AddTable', ['Empty', 'Find', function(Empty, Find) {
|
||||||
return function(params) {
|
return function(params) {
|
||||||
var form = params.form,
|
var form = params.form,
|
||||||
id = params.id,
|
id = params.id,
|
||||||
scope = params.scope,
|
scope = params.scope,
|
||||||
fld, html;
|
status_icon = params.status_icon,
|
||||||
|
fld, html, url,
|
||||||
|
urls = [
|
||||||
|
{ "variable": "credential", "url": "/#/credentials/" },
|
||||||
|
{ "variable": "project", "url": "/#/projects/" },
|
||||||
|
{ "variable": "inventory", "url": "/#/inventories/" },
|
||||||
|
{ "variable": "cloud_credential", "url": "/#/credentials/" },
|
||||||
|
{ "variable": "inventory_source", "url": "/#/home/groups/?id=" }
|
||||||
|
];
|
||||||
|
|
||||||
html = "<table class=\"table logviewer-status\">\n";
|
html = "<table class=\"table logviewer-status\">\n";
|
||||||
for (fld in form.fields) {
|
for (fld in form.fields) {
|
||||||
if (!Empty(scope[fld])) {
|
if (!Empty(scope[fld])) {
|
||||||
html += "<tr><td class=\"fld-label col-md-3 col-sm-3 col-xs-3\">" + form.fields[fld].label + "</td>" +
|
html += "<tr><td class=\"fld-label col-md-3 col-sm-3 col-xs-3\">" + form.fields[fld].label + "</td>" +
|
||||||
"<td>";
|
"<td>";
|
||||||
if (fld === "credential" || fld === "project" || fld === "inventory" || fld === "cloud_credential" ||
|
url = Find({ list: urls, key: "variable", val: fld });
|
||||||
fld === "inventory_source") {
|
if (url) {
|
||||||
html += "{{ " + fld + " }}";
|
html += "<a href=\"" + url.url;
|
||||||
|
html += (fld === "inventory_source") ? "{{ group }}" : scope[fld];
|
||||||
|
html += "\" ng-click=\"modalOK()\">{{ " + fld + '_name' + " }}</a>";
|
||||||
|
}
|
||||||
|
else if (fld === 'elapsed') {
|
||||||
|
html += scope[fld] + " <span class=\"small-text\">seconds</span>";
|
||||||
|
}
|
||||||
|
else if (status_icon && fld === 'status') {
|
||||||
|
html += "<i class=\"fa " + status_icon + "\"></i> " + scope[fld];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
html += scope[fld];
|
html += scope[fld];
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ angular.module('HomeGroupListDefinition', [])
|
|||||||
sourceModel: 'inventory',
|
sourceModel: 'inventory',
|
||||||
sourceField: 'name',
|
sourceField: 'name',
|
||||||
columnClass: 'col-lg-3 col-md2 col-sm-2 hidden-xs elllipsis',
|
columnClass: 'col-lg-3 col-md2 col-sm-2 hidden-xs elllipsis',
|
||||||
linkTo: "{{ /#/inventories/' + group.inventory + '/' }}"
|
linkTo: "{{ '/#/inventories/' + group.inventory + '/' }}"
|
||||||
},
|
},
|
||||||
source: {
|
source: {
|
||||||
label: 'Source',
|
label: 'Source',
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ body.modal-open {
|
|||||||
.pad-left-sm { padding-left: 10px; }
|
.pad-left-sm { padding-left: 10px; }
|
||||||
.pad-left-lg { padding-left: 50px; }
|
.pad-left-lg { padding-left: 50px; }
|
||||||
.normal-weight { font-weight: normal; }
|
.normal-weight { font-weight: normal; }
|
||||||
|
.small-text { font-size: 12px; }
|
||||||
.no-bullets { list-style: none; }
|
.no-bullets { list-style: none; }
|
||||||
.nowrap { white-space: nowrap; }
|
.nowrap { white-space: nowrap; }
|
||||||
.capitalize { text-transform: capitalize; }
|
.capitalize { text-transform: capitalize; }
|
||||||
|
|||||||
@@ -2,10 +2,9 @@
|
|||||||
<div id="logviewer-modal-dialog" title="Log View" style="display: none;">
|
<div id="logviewer-modal-dialog" title="Log View" style="display: none;">
|
||||||
<ul id="logview-tabs" class="nav nav-tabs">
|
<ul id="logview-tabs" class="nav nav-tabs">
|
||||||
<li class="active"><a href="#status" id="status-link" data-toggle="tab" ng-click="toggleTab($event, 'status-link', 'logview-tabs')">Status</a></li>
|
<li class="active"><a href="#status" id="status-link" data-toggle="tab" ng-click="toggleTab($event, 'status-link', 'logview-tabs')">Status</a></li>
|
||||||
<li><a href="#stdout" id="stdout-link" data-toggle="tab" ng-click="toggleTab($event, 'stdout-link', 'logview-tabs')">Std Out</a></li>
|
<li><a href="#stdout" id="stdout-link" data-toggle="tab" ng-click="toggleTab($event, 'stdout-link', 'logview-tabs')">Standard Out</a></li>
|
||||||
<li><a href="#traceback" id="traceback-link" data-toggle="tab" ng-click="toggleTab($event, 'traceback-link', 'logview-tabs')">Traceback</a></li>
|
<li><a href="#traceback" id="traceback-link" data-toggle="tab" ng-click="toggleTab($event, 'traceback-link', 'logview-tabs')">Traceback</a></li>
|
||||||
<li><a href="#options" id="options-link" data-toggle="tab" ng-click="toggleTab($event, 'options-link', 'logview-tabs')">Options</a></li>
|
<li><a href="#options" id="options-link" data-toggle="tab" ng-click="toggleTab($event, 'options-link', 'logview-tabs')">Options</a></li>
|
||||||
<li><a href="#env" id="env-link" data-toggle="tab" ng-click="toggleTab($event, 'env-link', 'logview-tabs')">Env</a></li>
|
|
||||||
</ul>
|
</ul>
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
<div class="tab-pane active" id="status">
|
<div class="tab-pane active" id="status">
|
||||||
@@ -20,8 +19,5 @@
|
|||||||
<div class="tab-pane" id="options">
|
<div class="tab-pane" id="options">
|
||||||
<div id="options-form-container"></div>
|
<div id="options-form-container"></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="tab-pane" id="env">
|
|
||||||
<div id="env-form-container"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
Reference in New Issue
Block a user