diff --git a/awx/ui/client/src/app.js b/awx/ui/client/src/app.js
index 43ad6627fb..47031f3bc0 100644
--- a/awx/ui/client/src/app.js
+++ b/awx/ui/client/src/app.js
@@ -171,7 +171,7 @@ var tower = angular.module('Tower', [
'SchedulesHelper',
'JobsListDefinition',
'LogViewerStatusDefinition',
- 'LogViewerHelper',
+ 'StandardOutHelper',
'LogViewerOptionsDefinition',
'EventViewerHelper',
'HostEventsViewerHelper',
diff --git a/awx/ui/client/src/controllers/Home.js b/awx/ui/client/src/controllers/Home.js
index d857330d4b..3d8adebad2 100644
--- a/awx/ui/client/src/controllers/Home.js
+++ b/awx/ui/client/src/controllers/Home.js
@@ -149,7 +149,7 @@ Home.$inject = ['$scope', '$compile', '$stateParams', '$rootScope', '$location',
* @description This controls the 'home/groups' page that is loaded from the dashboard
*
*/
-export function HomeGroups($rootScope, $log, $scope, $filter, $compile, $location, $stateParams, LogViewer, HomeGroupList, GenerateList, ProcessErrors, ReturnToCaller, ClearScope,
+export function HomeGroups($rootScope, $log, $scope, $filter, $compile, $location, $stateParams, HomeGroupList, GenerateList, ProcessErrors, ReturnToCaller, ClearScope,
GetBasePath, SearchInit, PaginateInit, FormatDate, GetHostsStatusMsg, GetSyncStatusMsg, ViewUpdateStatus, GroupsEdit, Wait,
Alert, Rest, Empty, InventoryUpdate, Find, GroupsCancelUpdate, Store) {
@@ -461,58 +461,6 @@ export function HomeGroups($rootScope, $log, $scope, $filter, $compile, $locatio
attachElem(event, html, title);
});
- if (scope.removeGroupSummaryReady) {
- scope.removeGroupSummaryReady();
- }
- scope.removeGroupSummaryReady = scope.$on('GroupSummaryReady', function(e, event, inventory, data) {
- var html, title;
-
- Wait('stop');
-
- // Build the html for our popover
- html = "
\n";
- html += "\n";
- html += "";
- html += "| Status | ";
- html += "Last Sync | ";
- html += "Group | ";
- html += "
";
- html += "\n";
- html += "\n";
- data.results.forEach( function(row) {
- html += "";
- html += " | ";
- html += "" + ($filter('longDate')(row.last_updated)).replace(/ /,' ') + " | ";
- html += "" + ellipsis(row.summary_fields.group.name) + " | ";
- html += "
\n";
- });
- html += "\n";
- html += "
\n";
- title = "Sync Status";
- attachElem(event, html, title);
- });
-
- scope.showGroupSummary = function(event, id) {
- var group, status;
- if (!Empty(id)) {
- group = Find({ list: scope.home_groups, key: 'id', val: id });
- status = group.summary_fields.inventory_source.status;
- if (status === 'running' || status === 'failed' || status === 'error' || status === 'successful') {
- Wait('start');
- Rest.setUrl(group.related.inventory_sources + '?or__source=ec2&or__source=rax&order_by=-last_job_run&page_size=5');
- Rest.get()
- .success(function(data) {
- scope.$emit('GroupSummaryReady', event, group, data);
- })
- .error(function(data, status) {
- ProcessErrors( scope, data, status, null, { hdr: 'Error!',
- msg: 'Call to ' + group.related.inventory_sources + ' failed. GET returned status: ' + status
- });
- });
- }
- }
- };
-
scope.showHostSummary = function(event, id) {
var url, jobs = [];
if (!Empty(id)) {
@@ -549,13 +497,6 @@ export function HomeGroups($rootScope, $log, $scope, $filter, $compile, $locatio
}
};
- scope.viewJob = function(url) {
- LogViewer({
- scope: modal_scope,
- url: url
- });
- };
-
scope.cancelUpdate = function(id) {
var group = Find({ list: scope.home_groups, key: 'id', val: id });
GroupsCancelUpdate({ scope: scope, group: group });
@@ -564,7 +505,7 @@ export function HomeGroups($rootScope, $log, $scope, $filter, $compile, $locatio
}
-HomeGroups.$inject = ['$rootScope', '$log', '$scope', '$filter', '$compile', '$location', '$stateParams', 'LogViewer', 'HomeGroupList', 'generateList', 'ProcessErrors', 'ReturnToCaller',
+HomeGroups.$inject = ['$rootScope', '$log', '$scope', '$filter', '$compile', '$location', '$stateParams', 'HomeGroupList', 'generateList', 'ProcessErrors', 'ReturnToCaller',
'ClearScope', 'GetBasePath', 'SearchInit', 'PaginateInit', 'FormatDate', 'GetHostsStatusMsg', 'GetSyncStatusMsg', 'ViewUpdateStatus',
'GroupsEdit', 'Wait', 'Alert', 'Rest', 'Empty', 'InventoryUpdate', 'Find', 'GroupsCancelUpdate', 'Store', 'Socket'
];
@@ -578,7 +519,7 @@ HomeGroups.$inject = ['$rootScope', '$log', '$scope', '$filter', '$compile', '$l
*/
export function HomeHosts($scope, $location, $stateParams, HomeHostList, GenerateList, ProcessErrors, ReturnToCaller, ClearScope,
- GetBasePath, SearchInit, PaginateInit, FormatDate, SetStatus, ToggleHostEnabled, HostsEdit, Find, ShowJobSummary, ViewJob) {
+ GetBasePath, SearchInit, PaginateInit, FormatDate, SetStatus, ToggleHostEnabled, HostsEdit, Find, ShowJobSummary) {
ClearScope('htmlTemplate'); //Garbage collection. Don't leave behind any listeners/watchers from the prior
//scope.
@@ -647,10 +588,6 @@ export function HomeHosts($scope, $location, $stateParams, HomeHostList, Generat
$scope.search(list.iterator);
};
- $scope.viewJob = function(id) {
- ViewJob({ scope: $scope, id: id });
- };
-
$scope.toggleHostEnabled = function (id, sources) {
ToggleHostEnabled({
host_id: id,
@@ -687,5 +624,5 @@ export function HomeHosts($scope, $location, $stateParams, HomeHostList, Generat
HomeHosts.$inject = ['$scope', '$location', '$stateParams', 'HomeHostList', 'generateList', 'ProcessErrors', 'ReturnToCaller',
'ClearScope', 'GetBasePath', 'SearchInit', 'PaginateInit', 'FormatDate', 'SetStatus', 'ToggleHostEnabled', 'HostsEdit',
- 'Find', 'ShowJobSummary', 'ViewJob'
+ 'Find', 'ShowJobSummary'
];
diff --git a/awx/ui/client/src/controllers/Inventories.js b/awx/ui/client/src/controllers/Inventories.js
index a506d78ead..234747fdb7 100644
--- a/awx/ui/client/src/controllers/Inventories.js
+++ b/awx/ui/client/src/controllers/Inventories.js
@@ -16,7 +16,7 @@ export function InventoriesList($scope, $rootScope, $location, $log,
$stateParams, $compile, $filter, sanitizeFilter, Rest, Alert, InventoryList,
generateList, Prompt, SearchInit, PaginateInit, ReturnToCaller,
ClearScope, ProcessErrors, GetBasePath, Wait,
- EditInventoryProperties, Find, Empty, LogViewer, $state) {
+ EditInventoryProperties, Find, Empty, $state) {
var list = InventoryList,
defaultUrl = GetBasePath('inventory'),
@@ -295,10 +295,12 @@ export function InventoriesList($scope, $rootScope, $location, $log,
};
$scope.viewJob = function(url) {
- LogViewer({
- scope: $scope,
- url: url
- });
+
+ // Pull the id out of the URL
+ var id = url.replace(/^\//, '').split('/')[3];
+
+ $state.go('inventorySyncStdout', {id: id});
+
};
$scope.editInventoryProperties = function (inventory_id) {
@@ -364,7 +366,7 @@ export function InventoriesList($scope, $rootScope, $location, $log,
InventoriesList.$inject = ['$scope', '$rootScope', '$location', '$log', '$stateParams', '$compile', '$filter', 'sanitizeFilter', 'Rest', 'Alert', 'InventoryList', 'generateList',
'Prompt', 'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope', 'ProcessErrors',
- 'GetBasePath', 'Wait', 'EditInventoryProperties', 'Find', 'Empty', 'LogViewer', '$state'
+ 'GetBasePath', 'Wait', 'EditInventoryProperties', 'Find', 'Empty', '$state'
];
@@ -781,7 +783,7 @@ export function InventoriesManage ($log, $scope, $rootScope, $location,
GetHostsStatusMsg, GroupsEdit, InventoryUpdate, GroupsCancelUpdate,
ViewUpdateStatus, GroupsDelete, Store, HostsEdit, HostsDelete,
EditInventoryProperties, ToggleHostEnabled, ShowJobSummary,
- InventoryGroupsHelp, HelpDialog, ViewJob,
+ InventoryGroupsHelp, HelpDialog,
GroupsCopy, HostsCopy, $stateParams) {
var PreviousSearchParams,
@@ -1254,12 +1256,8 @@ export function InventoriesManage ($log, $scope, $rootScope, $location,
opts.autoShow = params.autoShow || false;
}
HelpDialog(opts);
- };
-
- $scope.viewJob = function(id) {
- ViewJob({ scope: $scope, id: id });
- };
-
+ }
+;
$scope.showHosts = function (group_id, show_failures) {
// Clicked on group
if (group_id !== null) {
@@ -1293,6 +1291,6 @@ InventoriesManage.$inject = ['$log', '$scope', '$rootScope', '$location',
'GroupsEdit', 'InventoryUpdate', 'GroupsCancelUpdate', 'ViewUpdateStatus',
'GroupsDelete', 'Store', 'HostsEdit', 'HostsDelete',
'EditInventoryProperties', 'ToggleHostEnabled', 'ShowJobSummary',
- 'InventoryGroupsHelp', 'HelpDialog', 'ViewJob', 'GroupsCopy',
+ 'InventoryGroupsHelp', 'HelpDialog', 'GroupsCopy',
'HostsCopy', '$stateParams'
];
diff --git a/awx/ui/client/src/controllers/Projects.js b/awx/ui/client/src/controllers/Projects.js
index d7f5786b6d..5650500088 100644
--- a/awx/ui/client/src/controllers/Projects.js
+++ b/awx/ui/client/src/controllers/Projects.js
@@ -15,7 +15,7 @@ export function ProjectsList ($scope, $rootScope, $location, $log, $stateParams,
Rest, Alert, ProjectList, GenerateList, Prompt, SearchInit,
PaginateInit, ReturnToCaller, ClearScope, ProcessErrors, GetBasePath,
SelectionInit, ProjectUpdate, Refresh, Wait, GetChoices, Empty,
- Find, LogViewer, GetProjectIcon, GetProjectToolTip, $filter, $state) {
+ Find, GetProjectIcon, GetProjectToolTip, $filter, $state) {
ClearScope();
@@ -200,24 +200,19 @@ export function ProjectsList ($scope, $rootScope, $location, $log, $stateParams,
$state.transitionTo('projects.edit', {id: id});
};
- if ($scope.removeShowLogViewer) {
- $scope.removeShowLogViewer();
+ if ($scope.removeGoToJobDetails) {
+ $scope.removeGoToJobDetails();
}
- $scope.removeShowLogViewer = $scope.$on('ShowLogViewer', function(e, data) {
- if (data.related.current_update) {
+ $scope.removeGoToJobDetails = $scope.$on('GoToJobDetails', function(e, data) {
+ if (data.related.current_update || data.related.last_update) {
+
Wait('start');
- LogViewer({
- scope: $scope,
- url: data.related.current_update,
- getIcon: GetProjectIcon
- });
- } else if (data.related.last_update) {
- Wait('start');
- LogViewer({
- scope: $scope,
- url: data.related.last_update,
- getIcon: GetProjectIcon
- });
+
+ // Pull the id out of the URL
+ var id = (data.related.current_update) ? data.related.current_update.replace(/^\//, '').split('/')[3] : data.related.last_update.replace(/^\//, '').split('/')[3];
+
+ $state.go('scmUpdateStdout', {id: id});
+
} else {
Alert('No Updates Available', 'There is no SCM update information available for this project. An update has not yet been ' +
' completed. If you have not already done so, start an update for this project.', 'alert-info');
@@ -235,7 +230,7 @@ export function ProjectsList ($scope, $rootScope, $location, $log, $stateParams,
Rest.setUrl(project.url);
Rest.get()
.success(function(data) {
- $scope.$emit('ShowLogViewer', data);
+ $scope.$emit('GoToJobDetails', data);
})
.error(function(data, status) {
ProcessErrors($scope, data, status, null, { hdr: 'Error!',
@@ -374,7 +369,7 @@ ProjectsList.$inject = ['$scope', '$rootScope', '$location', '$log',
'SearchInit', 'PaginateInit', 'ReturnToCaller', 'ClearScope',
'ProcessErrors', 'GetBasePath', 'SelectionInit', 'ProjectUpdate',
'Refresh', 'Wait', 'GetChoices', 'Empty', 'Find',
- 'LogViewer', 'GetProjectIcon', 'GetProjectToolTip', '$filter', '$state'
+ 'GetProjectIcon', 'GetProjectToolTip', '$filter', '$state'
];
diff --git a/awx/ui/client/src/helpers.js b/awx/ui/client/src/helpers.js
index 4a277970da..94acbd1382 100644
--- a/awx/ui/client/src/helpers.js
+++ b/awx/ui/client/src/helpers.js
@@ -21,7 +21,7 @@ import JobTemplates from "./helpers/JobTemplates";
import Jobs from "./helpers/Jobs";
import License from "./helpers/License";
import LoadConfig from "./helpers/LoadConfig";
-import LogViewer from "./helpers/LogViewer";
+import StandardOut from "./helpers/StandardOut";
import Lookup from "./helpers/Lookup";
import PaginationHelpers from "./helpers/PaginationHelpers";
import Parse from "./helpers/Parse";
@@ -59,7 +59,7 @@ export
Jobs,
License,
LoadConfig,
- LogViewer,
+ StandardOut,
Lookup,
PaginationHelpers,
Parse,
diff --git a/awx/ui/client/src/helpers/EventViewer.js b/awx/ui/client/src/helpers/EventViewer.js
index c56d7f05a4..cb075fa5e9 100644
--- a/awx/ui/client/src/helpers/EventViewer.js
+++ b/awx/ui/client/src/helpers/EventViewer.js
@@ -13,8 +13,8 @@
export default
angular.module('EventViewerHelper', ['ModalDialog', 'Utilities', 'EventsViewerFormDefinition', 'HostsHelper'])
- .factory('EventViewer', ['$compile', 'CreateDialog', 'GetEvent', 'Wait', 'EventAddTable', 'GetBasePath', 'LookUpName', 'Empty', 'EventAddPreFormattedText',
- function($compile, CreateDialog, GetEvent, Wait, EventAddTable, GetBasePath, LookUpName, Empty, EventAddPreFormattedText) {
+ .factory('EventViewer', ['$compile', 'CreateDialog', 'GetEvent', 'Wait', 'EventAddTable', 'GetBasePath', 'Empty', 'EventAddPreFormattedText',
+ function($compile, CreateDialog, GetEvent, Wait, EventAddTable, GetBasePath, Empty, EventAddPreFormattedText) {
return function(params) {
var parent_scope = params.scope,
url = params.url,
diff --git a/awx/ui/client/src/helpers/Groups.js b/awx/ui/client/src/helpers/Groups.js
index 920c4641bc..b366a02a50 100644
--- a/awx/ui/client/src/helpers/Groups.js
+++ b/awx/ui/client/src/helpers/Groups.js
@@ -18,7 +18,7 @@ export default
angular.module('GroupsHelper', [ 'RestServices', 'Utilities', listGenerator.name, 'GroupListDefinition', 'SearchHelper',
'PaginationHelpers', listGenerator.name, 'GroupsHelper', 'InventoryHelper', 'SelectionHelper',
'JobSubmissionHelper', 'RefreshHelper', 'PromptDialog', 'CredentialsListDefinition', 'InventoryTree',
- 'InventoryStatusDefinition', 'VariablesHelper', 'SchedulesListDefinition', 'SourceFormDefinition', 'LogViewerHelper',
+ 'InventoryStatusDefinition', 'VariablesHelper', 'SchedulesListDefinition', 'SourceFormDefinition', 'StandardOutHelper',
'SchedulesHelper'
])
@@ -65,8 +65,8 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', listGenerator.name
* TODO: Document
*
*/
-.factory('ViewUpdateStatus', ['Rest', 'ProcessErrors', 'GetBasePath', 'Alert', 'Wait', 'Empty', 'Find', 'LogViewer',
- function (Rest, ProcessErrors, GetBasePath, Alert, Wait, Empty, Find, LogViewer) {
+.factory('ViewUpdateStatus', ['$state', 'Rest', 'ProcessErrors', 'GetBasePath', 'Alert', 'Wait', 'Empty', 'Find',
+ function ($state, Rest, ProcessErrors, GetBasePath, Alert, Wait, Empty, Find) {
return function (params) {
var scope = params.scope,
@@ -76,11 +76,13 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', listGenerator.name
if (scope.removeSourceReady) {
scope.removeSourceReady();
}
- scope.removeSourceReady = scope.$on('SourceReady', function(e, url) {
- LogViewer({
- scope: scope,
- url: url
- });
+ scope.removeSourceReady = scope.$on('SourceReady', function(e, source) {
+
+ // Pull the ID out of related.current_update / related.last_update
+ var update_id = (source.current_update) ? source.related.current_update.replace(/^\//, '').split('/')[3] : source.related.last_update.replace(/^\//, '').split('/')[3];
+
+ $state.go('inventorySyncStdout', {id: update_id});
+
});
if (group) {
@@ -94,8 +96,7 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', listGenerator.name
Rest.setUrl(group.related.inventory_source);
Rest.get()
.success(function (data) {
- var url = (data.related.current_update) ? data.related.current_update : data.related.last_update;
- scope.$emit('SourceReady', url);
+ scope.$emit('SourceReady', data);
})
.error(function (data, status) {
ProcessErrors(scope, data, status, null, { hdr: 'Error!',
diff --git a/awx/ui/client/src/helpers/Hosts.js b/awx/ui/client/src/helpers/Hosts.js
index 517fee8a52..b9bde5fe2c 100644
--- a/awx/ui/client/src/helpers/Hosts.js
+++ b/awx/ui/client/src/helpers/Hosts.js
@@ -20,7 +20,7 @@ export default
angular.module('HostsHelper', [ 'RestServices', 'Utilities', listGenerator.name, 'HostListDefinition',
'SearchHelper', 'PaginationHelpers', listGenerator.name, 'HostsHelper',
'InventoryHelper', 'RelatedSearchHelper', 'InventoryFormDefinition', 'SelectionHelper',
- 'HostGroupsFormDefinition', 'VariablesHelper', 'ModalDialog', 'LogViewerHelper',
+ 'HostGroupsFormDefinition', 'VariablesHelper', 'ModalDialog', 'StandardOutHelper',
'GroupListDefinition'
])
@@ -159,17 +159,6 @@ angular.module('HostsHelper', [ 'RestServices', 'Utilities', listGenerator.name,
};
}])
-.factory('ViewJob', ['LogViewer', 'GetBasePath', function(LogViewer, GetBasePath) {
- return function(params) {
- var scope = params.scope,
- id = params.id;
- LogViewer({
- scope: scope,
- url: GetBasePath('jobs') + id + '/'
- });
- };
-}])
-
.factory('HostsReload', [ '$stateParams', 'Empty', 'InventoryHosts', 'GetBasePath', 'SearchInit', 'PaginateInit', 'Wait',
'SetHostStatus', 'SetStatus', 'ApplyEllipsis',
function($stateParams, Empty, InventoryHosts, GetBasePath, SearchInit, PaginateInit, Wait, SetHostStatus, SetStatus,
diff --git a/awx/ui/client/src/helpers/Jobs.js b/awx/ui/client/src/helpers/Jobs.js
index 6320259ade..dd7e83d57f 100644
--- a/awx/ui/client/src/helpers/Jobs.js
+++ b/awx/ui/client/src/helpers/Jobs.js
@@ -14,7 +14,7 @@ import listGenerator from '../shared/list-generator/main';
export default
angular.module('JobsHelper', ['Utilities', 'RestServices', 'FormGenerator', 'JobSummaryDefinition', 'InventoryHelper', 'GeneratorHelpers',
- 'JobSubmissionHelper', 'LogViewerHelper', 'SearchHelper', 'PaginationHelpers', 'AdhocHelper', listGenerator.name])
+ 'JobSubmissionHelper', 'StandardOutHelper', 'SearchHelper', 'PaginationHelpers', 'AdhocHelper', listGenerator.name])
/**
* JobsControllerInit({ scope: $scope });
@@ -22,8 +22,8 @@ export default
* Initialize calling scope with all the bits required to support a jobs list
*
*/
- .factory('JobsControllerInit', ['$state', 'Find', 'DeleteJob', 'RelaunchJob', 'LogViewer', '$window',
- function($state, Find, DeleteJob, RelaunchJob, LogViewer, $window) {
+ .factory('JobsControllerInit', ['$state', 'Find', 'DeleteJob', 'RelaunchJob', '$window',
+ function($state, Find, DeleteJob, RelaunchJob, $window) {
return function(params) {
var scope = params.scope,
iterator = (params.iterator) ? params.iterator : scope.iterator;
diff --git a/awx/ui/client/src/helpers/LogViewer.js b/awx/ui/client/src/helpers/LogViewer.js
deleted file mode 100644
index 90e9a3f407..0000000000
--- a/awx/ui/client/src/helpers/LogViewer.js
+++ /dev/null
@@ -1,390 +0,0 @@
-/*************************************************
- * Copyright (c) 2015 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
- /**
- * @ngdoc function
- * @name helpers.function:LogViewer
- * @description logviewer
-*/
-
-export default
- angular.module('LogViewerHelper', ['ModalDialog', 'Utilities', 'FormGenerator', 'VariablesHelper'])
-
- .factory('LogViewer', ['$location', '$compile', 'CreateDialog', 'GetJob', 'Wait', 'GenerateForm', 'LogViewerStatusForm', 'AddTable', 'AddTextarea',
- 'LogViewerOptionsForm', 'EnvTable', 'GetBasePath', 'LookUpName', 'Empty', 'AddPreFormattedText', 'ParseVariableString', 'GetChoices',
- function($location, $compile, CreateDialog, GetJob, Wait, GenerateForm, LogViewerStatusForm, AddTable, AddTextarea, LogViewerOptionsForm, EnvTable,
- GetBasePath, LookUpName, Empty, AddPreFormattedText, ParseVariableString, GetChoices) {
- return function(params) {
- var parent_scope = params.scope,
- url = params.url,
- getIcon = params.getIcon,
- scope = parent_scope.$new(true),
- base = $location.path().replace(/^\//, '').split('/')[0],
- pieces;
-
- if (scope.removeModalReady) {
- scope.removeModalReady();
- }
- scope.removeModalReady = scope.$on('ModalReady', function() {
- Wait('stop');
- $('#logviewer-modal-dialog').dialog('open');
- });
-
- if (scope.removeJobReady) {
- scope.removeJobReady();
- }
- scope.removeJobReady = scope.$on('JobReady', function(e, data) {
- var key, resizeText, elem;
- $('#status-form-container').empty();
- $('#options-form-container').empty();
- $('#stdout-form-container').empty();
- $('#traceback-form-container').empty();
- $('#variables-container').empty();
- $('#source-container').empty();
- $('#logview-tabs li:eq(1)').hide();
- $('#logview-tabs li:eq(2)').hide();
- $('#logview-tabs li:eq(4)').hide();
- $('#logview-tabs li:eq(5)').hide();
-
- // Make sure subsequenct scope references don't bubble up to the parent
- for (key in LogViewerStatusForm.fields) {
- scope[key] = '';
- }
- for (key in LogViewerOptionsForm.fields) {
- scope[key] = '';
- }
-
- for (key in data) {
- scope[key] = data[key];
- }
- scope.created_by = '';
- scope.job_template = '';
-
- if (data.related.created_by) {
- pieces = data.related.created_by.replace(/^\//,'').replace(/\/$/,'').split('/');
- scope.created_by = parseInt(pieces[pieces.length - 1],10);
- LookUpName({
- scope: scope,
- scope_var: 'created_by',
- url: GetBasePath('users') + scope.created_by + '/'
- });
- }
-
- // For jobs link the name to the job parent
- if (base === 'jobs') {
- if (data.type === 'job') {
- scope.name_link = "job_template";
- scope.job_template = data.unified_job_template;
- scope.job_template_name = (data.summary_fields.job_template) ? data.summary_fields.job_template.name : data.name;
- scope.name_id = data.unified_job_template;
- }
- if (data.type === 'project_update') {
- scope.name_link = "project";
- scope.name_id = data.unified_job_template;
- }
- if (data.type === 'inventory_update') {
- scope.name_link = "inventory_source";
- scope.name_id = scope.group;
- }
- }
-
- AddTable({ scope: scope, form: LogViewerStatusForm, id: 'status-form-container', getIcon: getIcon });
- AddTable({ scope: scope, form: LogViewerOptionsForm, id: 'options-form-container', getIcon: getIcon });
-
- if (data.result_stdout) {
- $('#logview-tabs li:eq(1)').show();
- var showStandardOut = (data.type !== "system_job") ? true : false;
- AddPreFormattedText({
- id: 'stdout-form-container',
- val: data.result_stdout,
- standardOut: showStandardOut,
- jobUrl: data.url
- });
- }
-
- if (data.result_traceback) {
- $('#logview-tabs li:eq(2)').show();
- AddPreFormattedText({
- id: 'traceback-form-container',
- val: data.result_traceback
- });
- }
-
- /*if (data.job_env) {
- EnvTable({
- id: 'env-form-container',
- vars: data.job_env
- });
- }*/
-
- if (data.extra_vars) {
- $('#logview-tabs li:eq(4)').show();
- AddTextarea({
- container_id: 'variables-container',
- fld_id: 'variables',
- val: ParseVariableString(data.extra_vars)
- });
- }
-
- if (data.source_vars) {
- $('#logview-tabs li:eq(5)').show();
- AddTextarea({
- container_id: 'source-container',
- fld_id: 'source-variables',
- val: ParseVariableString(data.source_vars)
- });
- }
-
- if (!Empty(scope.source)) {
- if (scope.removeChoicesReady) {
- scope.removeChoicesReady();
- }
- scope.removeChoicesReady = scope.$on('ChoicesReady', function() {
- scope.source_choices.every(function(e) {
- if (e.value === scope.source) {
- scope.source = e.label;
- return false;
- }
- return true;
- });
- });
- GetChoices({
- scope: scope,
- url: GetBasePath('inventory_sources'),
- field: 'source',
- variable: 'source_choices',
- choice_name: 'choices',
- callback: 'ChoicesReady'
- });
- }
-
- if (!Empty(scope.credential)) {
- LookUpName({
- scope: scope,
- scope_var: 'credential',
- url: GetBasePath('credentials') + scope.credential + '/'
- });
- }
-
- if (!Empty(scope.inventory)) {
- LookUpName({
- scope: scope,
- scope_var: 'inventory',
- url: GetBasePath('inventory') + scope.inventory + '/'
- });
- }
-
- if (!Empty(scope.project)) {
- LookUpName({
- scope: scope,
- scope_var: 'project',
- url: GetBasePath('projects') + scope.project + '/'
- });
- }
-
- if (!Empty(scope.cloud_credential)) {
- LookUpName({
- scope: scope,
- scope_var: 'cloud_credential',
- url: GetBasePath('credentials') + scope.cloud_credential + '/'
- });
- }
-
- if (!Empty(scope.inventory_source)) {
- LookUpName({
- scope: scope,
- scope_var: 'inventory_source',
- url: GetBasePath('inventory_sources') + scope.inventory_source + '/'
- });
- }
-
- resizeText = function() {
- var u = $('#logview-tabs').outerHeight() + 25,
- h = $('#logviewer-modal-dialog').innerHeight(),
- rows = Math.floor((h - u) / 20);
- rows -= 3;
- rows = (rows < 6) ? 6 : rows;
- $('#logviewer-modal-dialog #variables').attr({ rows: rows });
- $('#logviewer-modal-dialog #source-variables').attr({ rows: rows });
- };
-
- elem = angular.element(document.getElementById('logviewer-modal-dialog'));
- $compile(elem)(scope);
-
- CreateDialog({
- scope: scope,
- width: 600,
- height: 550,
- minWidth: 450,
- callback: 'ModalReady',
- id: 'logviewer-modal-dialog',
- onResizeStop: resizeText,
- title: 'Job Results',
- onOpen: function() {
- $('#logview-tabs a:first').tab('show');
- $('#dialog-ok-button').focus();
- resizeText();
- }
- });
- });
-
- GetJob({
- url: url,
- scope: scope
- });
-
- scope.modalOK = function() {
- $('#logviewer-modal-dialog').dialog('close');
- scope.$destroy();
- };
- };
- }])
-
- .factory('GetJob', ['Rest', 'ProcessErrors', function(Rest, ProcessErrors) {
- return function(params) {
- var url = params.url,
- scope = params.scope;
- Rest.setUrl(url);
- Rest.get()
- .success(function(data){
- scope.$emit('JobReady', data);
- })
- .error(function(data, status) {
- ProcessErrors(scope, data, status, null, { hdr: 'Error!',
- msg: 'Failed to retrieve ' + url + '. GET returned: ' + status });
- });
- };
- }])
-
- .factory('LookUpName', ['Rest', 'ProcessErrors', 'Empty', function(Rest, ProcessErrors, Empty) {
- return function(params) {
- var url = params.url,
- scope_var = params.scope_var,
- scope = params.scope;
- Rest.setUrl(url);
- Rest.get()
- .success(function(data) {
- if (scope_var === 'inventory_source') {
- scope[scope_var + '_name'] = data.summary_fields.group.name;
- }
- else if (!Empty(data.name)) {
- scope[scope_var + '_name'] = data.name;
- }
- if (!Empty(data.group)) {
- // Used for inventory_source
- scope.group = data.group;
- }
- })
- .error(function(data, status) {
- ProcessErrors(scope, data, status, null, { hdr: 'Error!',
- msg: 'Failed to retrieve ' + url + '. GET returned: ' + status });
- });
- };
- }])
-
- .factory('AddTable', ['$compile', 'Empty', 'Find', function($compile, Empty, Find) {
- return function(params) {
- var form = params.form,
- id = params.id,
- scope = params.scope,
- getIcon = params.getIcon,
- fld, html, url, e,
- 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={{ group }}" },
- { "variable": "job_template", "url": "/#/job_templates/" },
- { "variable": "created_by", "url": "/#/users/" }
- ];
- html = "\n";
- for (fld in form.fields) {
- if (!Empty(scope[fld])) {
- html += "| " + form.fields[fld].label + " | " +
- "";
- url = Find({ list: urls, key: "variable", val: fld });
- if (url) {
- html += "{{ " + fld + '_name' + " }}";
- }
- else if (fld === 'name' && scope.name_link) {
- url = Find({ list: urls, key: "variable", val: scope.name_link });
- html += "{{ " +
- ( (scope.name_link === 'inventory_source') ? 'inventory_source_name' : fld ) + " }}";
- }
- else if (fld === 'elapsed') {
- html += scope[fld] + " seconds";
- }
- else if (fld === 'status') {
- if (getIcon) {
- html += " " + scope[fld];
- }
- else {
- html += " " + scope[fld];
- }
- if (scope.job_explanation) {
- html += " " + scope.job_explanation + " ";
- }
- }
- else {
- html += "{{ " + fld ;
- html += (form.fields[fld].filter) ? " | " + form.fields[fld].filter : "" ;
- html += " }}";
- }
- html += " |
\n";
- }
- }
- html += "
\n";
- e = angular.element(document.getElementById(id));
- e.empty().html(html);
- $compile(e)(scope);
- };
- }])
-
- .factory('AddTextarea', [ function() {
- return function(params) {
- var container_id = params.container_id,
- val = params.val,
- fld_id = params.fld_id,
- html;
- html = "\n" +
- "" +
- "
\n";
- $('#' + container_id).empty().html(html);
- };
- }])
-
- .factory('AddPreFormattedText', ['$rootScope', function($rootScope) {
- return function(params) {
- var id = params.id,
- val = params.val,
- html = "";
- if (params.standardOut) {
- html += 'Download';
- html += "" + val + "
\n";
- } else {
- html += "" + val + "
\n";
- }
- $('#' + id).empty().html(html);
- };
- }])
-
- .factory('EnvTable', [ function() {
- return function(params) {
- var id = params.id,
- vars = params.vars,
- key, html;
- html = "\n";
- for (key in vars) {
- html += "| " + key + " | " +
- "" + vars[key] + " |
\n";
- }
- html += "
\n";
- $('#' + id).empty().html(html);
- };
- }]);
diff --git a/awx/ui/client/src/helpers/StandardOut.js b/awx/ui/client/src/helpers/StandardOut.js
new file mode 100644
index 0000000000..a739bef764
--- /dev/null
+++ b/awx/ui/client/src/helpers/StandardOut.js
@@ -0,0 +1,40 @@
+/*************************************************
+ * Copyright (c) 2016 Ansible, Inc.
+ *
+ * All Rights Reserved
+ *************************************************/
+
+ /**
+ * @ngdoc function
+ * @name helpers.function:StandardOut
+ * @description Helpers for the standard out views
+*/
+
+export default
+ angular.module('StandardOutHelper', [])
+
+ .factory('LookUpName', ['Rest', 'ProcessErrors', 'Empty', function(Rest, ProcessErrors, Empty) {
+ return function(params) {
+ var url = params.url,
+ scope_var = params.scope_var,
+ scope = params.scope;
+ Rest.setUrl(url);
+ Rest.get()
+ .success(function(data) {
+ if (scope_var === 'inventory_source') {
+ scope[scope_var + '_name'] = data.summary_fields.group.name;
+ }
+ else if (!Empty(data.name)) {
+ scope[scope_var + '_name'] = data.name;
+ }
+ if (!Empty(data.group)) {
+ // Used for inventory_source
+ scope.group = data.group;
+ }
+ })
+ .error(function(data, status) {
+ ProcessErrors(scope, data, status, null, { hdr: 'Error!',
+ msg: 'Failed to retrieve ' + url + '. GET returned: ' + status });
+ });
+ };
+ }])
diff --git a/awx/ui/client/src/standard-out/standard-out.controller.js b/awx/ui/client/src/standard-out/standard-out.controller.js
index f95eaab1fb..7c6d196aa6 100644
--- a/awx/ui/client/src/standard-out/standard-out.controller.js
+++ b/awx/ui/client/src/standard-out/standard-out.controller.js
@@ -197,7 +197,7 @@ export function JobStdoutController ($location, $log, $rootScope, $scope, $compi
return true;
});
});
- // GetChoices can be found in the helper: LogViewer.js
+ // GetChoices can be found in the helper: StandardOut.js
// It attaches the source choices to $scope.source_choices.
// Then, when the callback is fired, $scope.source is bound
// to the corresponding label.
@@ -211,7 +211,7 @@ export function JobStdoutController ($location, $log, $rootScope, $scope, $compi
});
}
- // LookUpName can be found in the helper: LogViewer.js
+ // LookUpName can be found in the helper: StandardOut.js
// It attaches the name that it gets (based on the url)
// to the $scope variable defined by the attribute scope_var.
if (!Empty(data.credential)) {