Changes to LogViewer widget to remove back-end, command line and environment related stuff.

This commit is contained in:
Chris Houseknecht 2014-03-28 17:58:00 -04:00
parent 558f7ef2eb
commit 9a3ee04783
7 changed files with 44 additions and 49 deletions

View File

@ -208,7 +208,8 @@ function ProjectsList ($scope, $rootScope, $location, $log, $routeParams, Rest,
Wait('start');
LogViewer({
scope: $scope,
url: project.related.last_update
url: project.related.last_update,
status_icon: 'icon-job-' + project.statusIcon
});
/*
ProjectStatus({

View File

@ -13,16 +13,6 @@ angular.module('LogViewerOptionsDefinition', [])
well: false,
fields: {
"job_args": {
label: "Arguments",
type: "text",
readonly: true
},
"job_cwd": {
label: "CWD",
type: "text",
readonly: true
},
"job_type": {
label: "Job Type",
type: "text",

View File

@ -18,18 +18,18 @@ angular.module('LogViewerStatusDefinition', [])
type: "text",
readonly: true,
},
"created": {
label: "Created",
"started": {
label: "Started",
type: "text",
readonly: true
},
"modified": {
label: "Modified",
"finished": {
label: "Finished",
type: "text",
readonly: true
},
"unified_job_template": {
label: "Job Template",
"elapsed": {
label: "Elapsed",
type: "text",
readonly: true
},
@ -47,21 +47,6 @@ angular.module('LogViewerStatusDefinition', [])
label: "License Error",
type: "text",
readonly: true
},
"started": {
label: "Started",
type: "text",
readonly: true
},
"finished": {
label: "Finished",
type: "text",
readonly: true
},
"elapsed": {
label: "Elapsed",
type: "text",
readonly: true
}
}

View File

@ -16,6 +16,7 @@ angular.module('LogViewerHelper', ['ModalDialog', 'Utilities', 'FormGenerator'])
return function(params) {
var parent_scope = params.scope,
url = params.url,
status_icon = params.status_icon,
scope = parent_scope.$new();
if (scope.removeModalReady) {
@ -36,8 +37,8 @@ angular.module('LogViewerHelper', ['ModalDialog', 'Utilities', 'FormGenerator'])
scope[key] = data[key];
}
AddTable({ scope: scope, form: LogViewerStatusForm, id: 'status-form-container' });
AddTable({ scope: scope, form: LogViewerOptionsForm, id: 'options-form-container' });
AddTable({ scope: scope, form: LogViewerStatusForm, id: 'status-form-container', status_icon: status_icon });
AddTable({ scope: scope, form: LogViewerOptionsForm, id: 'options-form-container', status_icon: status_icon });
if (data.result_stdout) {
AddTextarea({
@ -61,12 +62,12 @@ angular.module('LogViewerHelper', ['ModalDialog', 'Utilities', 'FormGenerator'])
$('#logview-tabs li:eq(2)').hide();
}
if (data.job_env) {
/*if (data.job_env) {
EnvTable({
id: 'env-form-container',
vars: data.job_env
});
}
}*/
if (!Empty(scope.credential)) {
LookUpName({
@ -124,7 +125,7 @@ angular.module('LogViewerHelper', ['ModalDialog', 'Utilities', 'FormGenerator'])
CreateDialog({
scope: scope,
width: 600,
height: 675,
height: 550,
minWidth: 450,
callback: 'ModalReady',
id: 'logviewer-modal-dialog',
@ -172,7 +173,11 @@ angular.module('LogViewerHelper', ['ModalDialog', 'Utilities', 'FormGenerator'])
Rest.get()
.success(function(data) {
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) {
@ -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) {
var form = params.form,
id = params.id,
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";
for (fld in form.fields) {
if (!Empty(scope[fld])) {
html += "<tr><td class=\"fld-label col-md-3 col-sm-3 col-xs-3\">" + form.fields[fld].label + "</td>" +
"<td>";
if (fld === "credential" || fld === "project" || fld === "inventory" || fld === "cloud_credential" ||
fld === "inventory_source") {
html += "{{ " + fld + " }}";
url = Find({ list: urls, key: "variable", val: fld });
if (url) {
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 {
html += scope[fld];

View File

@ -32,7 +32,7 @@ angular.module('HomeGroupListDefinition', [])
sourceModel: 'inventory',
sourceField: 'name',
columnClass: 'col-lg-3 col-md2 col-sm-2 hidden-xs elllipsis',
linkTo: "{{ /#/inventories/' + group.inventory + '/' }}"
linkTo: "{{ '/#/inventories/' + group.inventory + '/' }}"
},
source: {
label: 'Source',

View File

@ -59,6 +59,7 @@ body.modal-open {
.pad-left-sm { padding-left: 10px; }
.pad-left-lg { padding-left: 50px; }
.normal-weight { font-weight: normal; }
.small-text { font-size: 12px; }
.no-bullets { list-style: none; }
.nowrap { white-space: nowrap; }
.capitalize { text-transform: capitalize; }

View File

@ -2,10 +2,9 @@
<div id="logviewer-modal-dialog" title="Log View" style="display: none;">
<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><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="#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>
<div class="tab-content">
<div class="tab-pane active" id="status">
@ -20,8 +19,5 @@
<div class="tab-pane" id="options">
<div id="options-form-container"></div>
</div>
<div class="tab-pane" id="env">
<div id="env-form-container"></div>
</div>
</div>
</div>