-
${this.getCollapseIcon(event, lineArr[1])}${lineArr[0]}
-
diff --git a/awx/ui/client/src/standard-out/adhoc/standard-out-adhoc.route.js b/awx/ui/client/src/standard-out/adhoc/standard-out-adhoc.route.js
deleted file mode 100644
index 899a98e9f7..0000000000
--- a/awx/ui/client/src/standard-out/adhoc/standard-out-adhoc.route.js
+++ /dev/null
@@ -1,36 +0,0 @@
-/*************************************************
- * Copyright (c) 2016 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-import { templateUrl } from '../../shared/template-url/template-url.factory';
-
-export default {
- name: 'adHocJobStdout',
- route: '/ad_hoc_commands/:id',
- templateUrl: templateUrl('standard-out/adhoc/standard-out-adhoc'),
- controller: 'JobStdoutController',
- ncyBreadcrumb: {
- parent: "jobs",
- label: "{{ job.module_name }}"
- },
- data: {
- jobType: 'ad_hoc_commands',
- socket: {
- "groups": {
- "jobs": ["status_changed", "summary"],
- "ad_hoc_command_events": []
- }
- }
- },
- resolve: {
- jobData: ['Rest', 'GetBasePath', '$stateParams', function(Rest, GetBasePath, $stateParams) {
- Rest.setUrl(GetBasePath('base') + 'ad_hoc_commands/' + $stateParams.id + '/');
- return Rest.get()
- .then(({data}) => {
- return data;
- });
- }]
- }
-};
diff --git a/awx/ui/client/src/standard-out/inventory-sync/standard-out-inventory-sync.partial.html b/awx/ui/client/src/standard-out/inventory-sync/standard-out-inventory-sync.partial.html
deleted file mode 100644
index 48f2d65b7e..0000000000
--- a/awx/ui/client/src/standard-out/inventory-sync/standard-out-inventory-sync.partial.html
+++ /dev/null
@@ -1,152 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
STATUS
-
-
- {{ job.status }}
-
-
-
-
-
-
EXPLANATION
-
- {{task_detail | limitTo:explanationLimit}}
-
- ...
- Show More
-
- Show Less
-
-
-
-
-
LICENSE ERROR
-
- {{ job.license_error }}
-
-
-
-
-
STARTED
-
- {{ job.started | longDate }}
-
-
-
-
-
FINISHED
-
- {{ job.finished | longDate }}
-
-
-
-
-
ELAPSED
-
- {{ job.elapsed }} seconds
-
-
-
-
-
LAUNCH TYPE
-
- {{ job.launch_type }}
-
-
-
-
-
-
-
SOURCE
-
- {{ source }}
-
-
-
-
-
REGIONS
-
- {{ source_regions }}
-
-
-
-
-
OVERWRITE
-
- {{ job.overwrite }}
-
-
-
-
-
OVERWRITE VARS
-
- {{ job.overwrite_vars }}
-
-
-
-
-
-
-
-
-
-
diff --git a/awx/ui/client/src/standard-out/inventory-sync/standard-out-inventory-sync.route.js b/awx/ui/client/src/standard-out/inventory-sync/standard-out-inventory-sync.route.js
deleted file mode 100644
index bdd1a9a2b1..0000000000
--- a/awx/ui/client/src/standard-out/inventory-sync/standard-out-inventory-sync.route.js
+++ /dev/null
@@ -1,38 +0,0 @@
-/*************************************************
- * Copyright (c) 2016 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-import {templateUrl} from '../../shared/template-url/template-url.factory';
-
-// TODO: figure out what this route should be - should it be inventory_sync?
-
-export default {
- name: 'inventorySyncStdout',
- route: '/inventory_sync/:id',
- templateUrl: templateUrl('standard-out/inventory-sync/standard-out-inventory-sync'),
- controller: 'JobStdoutController',
- ncyBreadcrumb: {
- parent: "jobs",
- label: "{{ inventory_source_name }}"
- },
- data: {
- socket: {
- "groups":{
- "jobs": ["status_changed", "summary"],
- "inventory_update_events": [],
- }
- },
- jobType: 'inventory_updates'
- },
- resolve: {
- jobData: ['Rest', 'GetBasePath', '$stateParams', function(Rest, GetBasePath, $stateParams) {
- Rest.setUrl(GetBasePath('base') + 'inventory_updates/' + $stateParams.id + '/');
- return Rest.get()
- .then(({data}) => {
- return data;
- });
- }]
- }
-};
diff --git a/awx/ui/client/src/standard-out/log/main.js b/awx/ui/client/src/standard-out/log/main.js
deleted file mode 100644
index bb97a737be..0000000000
--- a/awx/ui/client/src/standard-out/log/main.js
+++ /dev/null
@@ -1,10 +0,0 @@
-/*************************************************
- * Copyright (c) 2015 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-import standardOutLog from './standard-out-log.directive';
-export default
- angular.module('standardOutLogDirective', [])
- .directive('standardOutLog', standardOutLog);
diff --git a/awx/ui/client/src/standard-out/log/standard-out-log.controller.js b/awx/ui/client/src/standard-out/log/standard-out-log.controller.js
deleted file mode 100644
index 728f8faedf..0000000000
--- a/awx/ui/client/src/standard-out/log/standard-out-log.controller.js
+++ /dev/null
@@ -1,202 +0,0 @@
-/*************************************************
- * Copyright (c) 2016 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-export default ['$log', '$rootScope', '$scope', '$state', '$stateParams', 'ProcessErrors', 'Rest', 'Wait',
- function ($log, $rootScope, $scope, $state, $stateParams, ProcessErrors, Rest, Wait) {
-
- var api_complete = false,
- current_range,
- loaded_sections = [],
- event_queue = 0,
- auto_scroll_down=true, // programmatic scroll to bottom
- live_event_processing = true,
- page_size = 500,
- job_id = $stateParams.id;
-
- $scope.should_apply_live_events = true;
-
- // Open up a socket for events depending on the type of job
- function openSockets() {
- if ($state.current.name === 'jobResult') {
- $log.debug("socket watching on job_events-" + job_id);
- $scope.$on(`ws-job_events-${job_id}`, function() {
- $log.debug("socket fired on job_events-" + job_id);
- if (api_complete) {
- event_queue++;
- }
- });
- }
- if ($state.current.name === 'adHocJobStdout') {
- $log.debug("socket watching on ad_hoc_command_events-" + job_id);
- $scope.$on(`ws-ad_hoc_command_events-${job_id}`, function() {
- $log.debug("socket fired on ad_hoc_command_events-" + job_id);
- if (api_complete) {
- event_queue++;
- }
- });
- }
- }
-
- openSockets();
-
- // This is a trigger for loading up the standard out
- if ($scope.removeLoadStdout) {
- $scope.removeLoadStdout();
- }
- $scope.removeLoadStdout = $scope.$on('LoadStdout', function() {
- if (loaded_sections.length === 0) {
- loadStdout();
- }
- else if (live_event_processing) {
- getNextSection();
- }
- });
-
- // This interval checks to see whether or not we've gotten a new
- // event via sockets. If so, go out and update the standard out
- // log.
- $rootScope.jobStdOutInterval = setInterval( function() {
- if (event_queue > 0) {
- // events happened since the last check
- $log.debug('checking for stdout...');
- if (loaded_sections.length === 0) { ////this if statement for refresh
- $log.debug('calling LoadStdout');
- loadStdout();
- }
- else if (live_event_processing) {
- $log.debug('calling getNextSection');
- getNextSection();
- }
- event_queue = 0;
- }
- }, 2000);
-
- // stdoutEndpoint gets passed through in the directive declaration.
- // This watcher fires off loadStdout() when the endpoint becomes
- // available.
- $scope.$watch('stdoutEndpoint', function(newVal, oldVal) {
- if(newVal && newVal !== oldVal) {
- // Fire off the server call
- loadStdout();
- }
- });
-
- // stdoutText optionall gets passed through in the directive declaration.
- $scope.$watch('stdoutText', function(newVal, oldVal) {
- if(newVal && newVal !== oldVal) {
- $('#pre-container-content').html(newVal);
- }
- });
-
- function loadStdout() {
- if (!$scope.stdoutEndpoint) {
- return;
- }
-
- Rest.setUrl($scope.stdoutEndpoint + '?format=json&start_line=0&end_line=' + page_size);
- Rest.get()
- .then(({data}) => {
- Wait('stop');
- if (data.content) {
- api_complete = true;
- $('#pre-container-content').html(data.content);
- current_range = data.range;
- if (data.content !== "Waiting for results...") {
- loaded_sections.push({
- start: (data.range.start < 0) ? 0 : data.range.start,
- end: data.range.end
- });
- }
-
- $('#pre-container').scrollTop($('#pre-container').prop("scrollHeight"));
- }
- else {
- api_complete = true;
- }
- })
- .catch(({data, status}) => {
- ProcessErrors($scope, data, status, null, { hdr: 'Error!',
- msg: 'Failed to retrieve stdout for job: ' + job_id + '. GET returned: ' + status });
- });
- }
-
- function getNextSection() {
- if (!$scope.stdoutEndpoint) {
- return;
- }
-
- // get the next range of data from the API
- var start = loaded_sections[loaded_sections.length - 1].end, url;
- url = $scope.stdoutEndpoint + '?format=json&start_line=' + start + '&end_line=' + (start + page_size);
- $('#stdoutMoreRowsBottom').fadeIn();
- Rest.setUrl(url);
- Rest.get()
- .then(({data}) => {
- if ($('#pre-container-content').html() === "Waiting for results...") {
- $('#pre-container-content').html(data.content);
- } else {
- $('#pre-container-content').append(data.content);
- }
- loaded_sections.push({
- start: (data.range.start < 0) ? 0 : data.range.start,
- end: data.range.end
- });
- if ($scope.should_apply_live_events) {
- // if user has not disabled live event view by scrolling upward, then scroll down to the new content
- current_range = data.range;
- auto_scroll_down = true; // prevent auto load from happening
- $('#pre-container').scrollTop($('#pre-container').prop("scrollHeight"));
- }
- $('#stdoutMoreRowsBottom').fadeOut(400);
- })
- .catch(({data, status}) => {
- ProcessErrors($scope, data, status, null, { hdr: 'Error!',
- msg: 'Failed to retrieve stdout for job: ' + job_id + '. GET returned: ' + status });
- });
- }
-
- // lrInfiniteScroll handler
- // grabs the next stdout section
- $scope.stdOutGetNextSection = function(){
- if (current_range.absolute_end > current_range.end){
- var url = $scope.stdoutEndpoint + '?format=json&start_line=' + current_range.end +
- '&end_line=' + (current_range.end + page_size);
- Rest.setUrl(url);
- Rest.get()
- .then(({data}) => {
- $('#pre-container-content').append(data.content);
- current_range = data.range;
- })
- .catch(({data, status}) => {
- ProcessErrors($scope, data, status, null, { hdr: 'Error!',
- msg: 'Failed to retrieve stdout for job: ' + job_id + '. GET returned: ' + status });
- });
- }
- };
-
- // We watch for job status changes here. If the job completes we want to clear out the
- // stdout interval and kill the live_event_processing flag.
- $scope.$on(`ws-jobs`, function(e, data) {
- if (parseInt(data.unified_job_id, 10) === parseInt(job_id,10)) {
- if (data.status === 'failed' || data.status === 'canceled' ||
- data.status === 'error' || data.status === 'successful') {
- if ($rootScope.jobStdOutInterval) {
- window.clearInterval($rootScope.jobStdOutInterval);
- }
- if (live_event_processing) {
- if (loaded_sections.length === 0) {
- loadStdout();
- }
- else {
- getNextSection();
- }
- }
- live_event_processing = false;
- }
- }
- });
-
-}];
diff --git a/awx/ui/client/src/standard-out/log/standard-out-log.directive.js b/awx/ui/client/src/standard-out/log/standard-out-log.directive.js
deleted file mode 100644
index d7d0656441..0000000000
--- a/awx/ui/client/src/standard-out/log/standard-out-log.directive.js
+++ /dev/null
@@ -1,47 +0,0 @@
-/*************************************************
- * Copyright (c) 2016 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-import standardOutLogController from './standard-out-log.controller';
-export default [ 'templateUrl',
- function(templateUrl) {
- return {
- scope: {
- stdoutEndpoint: '=',
- stdoutText: '=',
- jobId: '='
- },
- templateUrl: templateUrl('standard-out/log/standard-out-log'),
- restrict: 'E',
- controller: standardOutLogController,
- link: function(scope) {
- // All of our DOM related stuff will go in here
-
- var lastScrollTop,
- direction;
-
- function detectDirection() {
- var st = $('#pre-container').scrollTop();
- if (st > lastScrollTop) {
- direction = "down";
- } else {
- direction = "up";
- }
- lastScrollTop = st;
- return direction;
- }
-
- $('#pre-container').bind('scroll', function() {
- if (detectDirection() === "up") {
- scope.should_apply_live_events = false;
- }
-
- if ($(this).scrollTop() + $(this).height() === $(this).prop("scrollHeight")) {
- scope.should_apply_live_events = true;
- }
- });
- }
- };
-}];
diff --git a/awx/ui/client/src/standard-out/log/standard-out-log.partial.html b/awx/ui/client/src/standard-out/log/standard-out-log.partial.html
deleted file mode 100644
index 45d9f70cbb..0000000000
--- a/awx/ui/client/src/standard-out/log/standard-out-log.partial.html
+++ /dev/null
@@ -1,8 +0,0 @@
-
diff --git a/awx/ui/client/src/standard-out/main.js b/awx/ui/client/src/standard-out/main.js
deleted file mode 100644
index 1e0f451014..0000000000
--- a/awx/ui/client/src/standard-out/main.js
+++ /dev/null
@@ -1,22 +0,0 @@
-/*************************************************
- * Copyright (c) 2016 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-import stdoutAdhocRoute from './adhoc/standard-out-adhoc.route';
-import stdoutManagementJobsRoute from './management-jobs/standard-out-management-jobs.route';
-import stdoutInventorySyncRoute from './inventory-sync/standard-out-inventory-sync.route';
-import stdoutScmUpdateRoute from './scm-update/standard-out-scm-update.route';
-import {JobStdoutController} from './standard-out.controller';
-import StandardOutHelper from './standard-out-factories/main';
-import standardOutLogDirective from './log/main';
-
-export default angular.module('standardOut', [StandardOutHelper.name, standardOutLogDirective.name])
- .controller('JobStdoutController', JobStdoutController)
- .run(['$stateExtender', function($stateExtender) {
- $stateExtender.addState(stdoutAdhocRoute);
- $stateExtender.addState(stdoutManagementJobsRoute);
- $stateExtender.addState(stdoutInventorySyncRoute);
- $stateExtender.addState(stdoutScmUpdateRoute);
- }]);
diff --git a/awx/ui/client/src/standard-out/management-jobs/standard-out-management-jobs.partial.html b/awx/ui/client/src/standard-out/management-jobs/standard-out-management-jobs.partial.html
deleted file mode 100644
index 8c9740a5eb..0000000000
--- a/awx/ui/client/src/standard-out/management-jobs/standard-out-management-jobs.partial.html
+++ /dev/null
@@ -1,84 +0,0 @@
-
-
-
-
-
-
-
-
-
-
NAME
-
{{ job.name }}
-
-
-
-
STATUS
-
-
- {{ job.status }}
-
-
-
-
-
STARTED
-
- {{ job.started | longDate }}
-
-
-
-
-
FINISHED
-
- {{ job.finished | longDate }}
-
-
-
-
-
ELAPSED
-
- {{ job.elapsed }} seconds
-
-
-
-
-
LAUNCH TYPE
-
- {{ job.launch_type }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
STANDARD OUT
-
-
-
-
-
-
-
-
-
-
diff --git a/awx/ui/client/src/standard-out/management-jobs/standard-out-management-jobs.route.js b/awx/ui/client/src/standard-out/management-jobs/standard-out-management-jobs.route.js
deleted file mode 100644
index e3a59e884d..0000000000
--- a/awx/ui/client/src/standard-out/management-jobs/standard-out-management-jobs.route.js
+++ /dev/null
@@ -1,36 +0,0 @@
-/*************************************************
- * Copyright (c) 2016 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-import { templateUrl } from '../../shared/template-url/template-url.factory';
-
-export default {
- name: 'managementJobStdout',
- route: '/management_jobs/:id',
- templateUrl: templateUrl('standard-out/management-jobs/standard-out-management-jobs'),
- controller: 'JobStdoutController',
- ncyBreadcrumb: {
- parent: "jobs",
- label: "{{ job.name }}"
- },
- data: {
- jobType: 'system_jobs',
- socket: {
- "groups": {
- "jobs": ["status_changed", "summary"],
- "system_job_events": [],
- }
- }
- },
- resolve: {
- jobData: ['Rest', 'GetBasePath', '$stateParams', function(Rest, GetBasePath, $stateParams) {
- Rest.setUrl(GetBasePath('base') + 'system_jobs/' + $stateParams.id + '/');
- return Rest.get()
- .then(({data}) => {
- return data;
- });
- }]
- }
-};
diff --git a/awx/ui/client/src/standard-out/scm-update/standard-out-scm-update.partial.html b/awx/ui/client/src/standard-out/scm-update/standard-out-scm-update.partial.html
deleted file mode 100644
index f9828d4c02..0000000000
--- a/awx/ui/client/src/standard-out/scm-update/standard-out-scm-update.partial.html
+++ /dev/null
@@ -1,113 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
STATUS
-
-
- {{ job.status }}
-
-
-
-
-
STARTED
-
- {{ job.started | longDate }}
-
-
-
-
-
FINISHED
-
- {{ job.finished | longDate }}
-
-
-
-
-
ELAPSED
-
- {{ job.elapsed }} seconds
-
-
-
-
-
LAUNCH TYPE
-
- {{ job.launch_type }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/awx/ui/client/src/standard-out/scm-update/standard-out-scm-update.route.js b/awx/ui/client/src/standard-out/scm-update/standard-out-scm-update.route.js
deleted file mode 100644
index 818509ccc7..0000000000
--- a/awx/ui/client/src/standard-out/scm-update/standard-out-scm-update.route.js
+++ /dev/null
@@ -1,38 +0,0 @@
-/*************************************************
- * Copyright (c) 2016 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-import { templateUrl } from '../../shared/template-url/template-url.factory';
-
-// TODO: figure out what this route should be - should it be scm_update?
-
-export default {
- name: 'scmUpdateStdout',
- route: '/scm_update/:id',
- templateUrl: templateUrl('standard-out/scm-update/standard-out-scm-update'),
- controller: 'JobStdoutController',
- ncyBreadcrumb: {
- parent: "jobs",
- label: "{{ project_name }}"
- },
- data: {
- jobType: 'project_updates',
- socket: {
- "groups": {
- "jobs": ["status_changed", "summary"],
- "project_update_events": [],
- }
- },
- },
- resolve: {
- jobData: ['Rest', 'GetBasePath', '$stateParams', function(Rest, GetBasePath, $stateParams) {
- Rest.setUrl(GetBasePath('base') + 'project_updates/' + $stateParams.id + '/');
- return Rest.get()
- .then(({data}) => {
- return data;
- });
- }]
- }
-};
diff --git a/awx/ui/client/src/standard-out/standard-out-factories/delete-job.factory.js b/awx/ui/client/src/standard-out/standard-out-factories/delete-job.factory.js
deleted file mode 100644
index 6e28362f3a..0000000000
--- a/awx/ui/client/src/standard-out/standard-out-factories/delete-job.factory.js
+++ /dev/null
@@ -1,145 +0,0 @@
-export default
-function DeleteJob($state, Find, Rest, Wait, ProcessErrors, Prompt, Alert,
- $filter, i18n) {
- return function(params) {
- var scope = params.scope,
- id = params.id,
- job = params.job,
- callback = params.callback,
- action, jobs, url, action_label, hdr;
-
- if (!job) {
- if (scope.completed_jobs) {
- jobs = scope.completed_jobs;
- }
- else if (scope.running_jobs) {
- jobs = scope.running_jobs;
- }
- else if (scope.queued_jobs) {
- jobs = scope.queued_jobs;
- }
- else if (scope.all_jobs) {
- jobs = scope.all_jobs;
- }
- else if (scope.jobs) {
- jobs = scope.jobs;
- }
- job = Find({list: jobs, key: 'id', val: id });
- }
-
- if (job.status === 'pending' || job.status === 'running' || job.status === 'waiting') {
- url = job.related.cancel;
- action_label = 'cancel';
- hdr = i18n._('Cancel');
- } else {
- url = job.url;
- action_label = 'delete';
- hdr = i18n._('Delete');
- }
-
- action = function () {
- Wait('start');
- Rest.setUrl(url);
- if (action_label === 'cancel') {
- Rest.post()
- .then(() => {
- $('#prompt-modal').modal('hide');
- if (callback) {
- scope.$emit(callback, action_label);
- }
- else {
- $state.reload();
- Wait('stop');
- }
- })
- .catch(({obj, status}) => {
- Wait('stop');
- $('#prompt-modal').modal('hide');
- if (status === 403) {
- Alert('Error', obj.detail);
- }
- // Ignore the error. The job most likely already finished.
- // ProcessErrors(scope, data, status, null, { hdr: 'Error!', msg: 'Call to ' + url +
- // ' failed. POST returned status: ' + status });
- });
- } else {
- Rest.destroy()
- .then(() => {
- $('#prompt-modal').modal('hide');
- if (callback) {
- scope.$emit(callback, action_label);
- }
- else {
- let reloadListStateParams = null;
-
- if(scope.jobs.length === 1 && $state.params.job_search && !_.isEmpty($state.params.job_search.page) && $state.params.job_search.page !== '1') {
- reloadListStateParams = _.cloneDeep($state.params);
- reloadListStateParams.job_search.page = (parseInt(reloadListStateParams.job_search.page)-1).toString();
- }
-
- $state.go('.', reloadListStateParams, {reload: true});
- Wait('stop');
- }
- })
- .catch(({obj, status}) => {
- Wait('stop');
- $('#prompt-modal').modal('hide');
- if (status === 403) {
- Alert('Error', obj.detail);
- }
- // Ignore the error. The job most likely already finished.
- //ProcessErrors(scope, data, status, null, { hdr: 'Error!', msg: 'Call to ' + url +
- // ' failed. DELETE returned status: ' + status });
- });
- }
- };
-
- if (scope.removeCancelNotAllowed) {
- scope.removeCancelNotAllowed();
- }
- scope.removeCancelNotAllowed = scope.$on('CancelNotAllowed', function() {
- Wait('stop');
- Alert('Job Completed', 'The request to cancel the job could not be submitted. The job already completed.', 'alert-info');
- });
-
- if (scope.removeCancelJob) {
- scope.removeCancelJob();
- }
- scope.removeCancelJob = scope.$on('CancelJob', function() {
- var cancelBody = "
" + i18n._("Are you sure you want to submit the request to cancel this job?") + "
";
- var deleteBody = "
" + i18n._("Are you sure you want to delete this job?") + "
";
- Prompt({
- hdr: hdr,
- resourceName: `#${job.id} ` + $filter('sanitize')(job.name),
- body: (action_label === 'cancel' || job.status === 'new') ? cancelBody : deleteBody,
- action: action,
- actionText: (action_label === 'cancel' || job.status === 'new') ? i18n._("OK") : i18n._("DELETE")
- });
- });
-
- if (action_label === 'cancel') {
- Rest.setUrl(url);
- Rest.get()
- .then(({data}) => {
- if (data.can_cancel) {
- scope.$emit('CancelJob');
- }
- else {
- scope.$emit('CancelNotAllowed');
- }
- })
- .catch(({data, status}) => {
- ProcessErrors(scope, data, status, null, { hdr: 'Error!', msg: 'Call to ' + url +
- ' failed. GET returned: ' + status });
- });
- }
- else {
- scope.$emit('CancelJob');
- }
- };
-}
-
-DeleteJob.$inject =
-[ '$state', 'Find', 'Rest', 'Wait',
- 'ProcessErrors', 'Prompt', 'Alert', '$filter', 'i18n'
-];
diff --git a/awx/ui/client/src/standard-out/standard-out-factories/lookup-name.factory.js b/awx/ui/client/src/standard-out/standard-out-factories/lookup-name.factory.js
deleted file mode 100644
index 43b39da58c..0000000000
--- a/awx/ui/client/src/standard-out/standard-out-factories/lookup-name.factory.js
+++ /dev/null
@@ -1,36 +0,0 @@
-/*************************************************
- * Copyright (c) 2016 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
- export default
- ['Rest', 'ProcessErrors', 'Empty', function(Rest, ProcessErrors, Empty) {
- return function(params) {
- var url = params.url,
- scope_var = params.scope_var,
- scope = params.scope,
- callback = params.callback;
- Rest.setUrl(url);
- Rest.get()
- .then(({data}) => {
- if (scope_var === 'inventory_source') {
- scope.inventory = data.inventory;
- }
- if (!Empty(data.name)) {
- scope[scope_var + '_name'] = data.name;
- }
-
- if (callback) {
- scope.$emit(callback, data);
- }
- })
- .catch(({data, status}) => {
- if (status === 403 && params.ignore_403) {
- return;
- }
- 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-factories/main.js b/awx/ui/client/src/standard-out/standard-out-factories/main.js
deleted file mode 100644
index 935c8dca37..0000000000
--- a/awx/ui/client/src/standard-out/standard-out-factories/main.js
+++ /dev/null
@@ -1,13 +0,0 @@
-/*************************************************
- * Copyright (c) 2016 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-import lookUpName from './lookup-name.factory';
-import DeleteJob from './delete-job.factory';
-
-export default
- angular.module('StandardOutHelper', [])
- .factory('LookUpName', lookUpName)
- .factory('DeleteJob', DeleteJob);
diff --git a/awx/ui/client/src/standard-out/standard-out.controller.js b/awx/ui/client/src/standard-out/standard-out.controller.js
deleted file mode 100644
index 1a707aa706..0000000000
--- a/awx/ui/client/src/standard-out/standard-out.controller.js
+++ /dev/null
@@ -1,266 +0,0 @@
-/*************************************************
- * Copyright (c) 2015 Ansible, Inc.
- *
- * All Rights Reserved
- *************************************************/
-
-/**
- * @ngdoc function
- * @name controllers.function:JobStdout
- * @description This controller's for the standard out page that can be displayed when a job runs
-*/
-
-export function JobStdoutController ($rootScope, $scope, $state, $stateParams,
- GetBasePath, Rest, ProcessErrors, Empty, GetChoices, LookUpName,
- ParseTypeChange, ParseVariableString, DeleteJob, Wait, i18n,
- fieldChoices, fieldLabels, Project, Alert, InventorySource,
- jobData) {
-
- var job_id = $stateParams.id,
- jobType = $state.current.data.jobType;
-
- // This scope variable controls whether or not the left panel is shown and the right panel
- // is expanded to take up the full screen
- $scope.stdoutFullScreen = false;
- $scope.toggleStdoutFullscreenTooltip = i18n._("Expand Output");
-
- $scope.explanationLimit = 150;
-
- // Listen for job status updates that may come across via sockets. We need to check the payload
- // to see whethere the updated job is the one that we're currently looking at.
- $scope.$on(`ws-jobs`, function(e, data) {
- if (parseInt(data.unified_job_id, 10) === parseInt(job_id,10) && $scope.job) {
- $scope.job.status = data.status;
- }
-
- if (data.status === 'failed' || data.status === 'canceled' || data.status === 'error' || data.status === 'successful') {
- // Go out and refresh the job details
-
- Rest.setUrl(GetBasePath('base') + jobType + '/' + job_id + '/');
- Rest.get()
- .then(({data}) => {
- updateJobObj(data);
- });
- }
- });
-
- $scope.previousTaskFailed = false;
-
- $scope.$watch('job.job_explanation', function(explanation) {
- if (explanation && explanation.split(":")[0] === "Previous Task Failed") {
- $scope.previousTaskFailed = true;
-
- var taskObj = JSON.parse(explanation.substring(explanation.split(":")[0].length + 1));
- // return a promise from the options request with the permission type choices (including adhoc) as a param
- var fieldChoice = fieldChoices({
- $scope: $scope,
- url: GetBasePath('unified_jobs'),
- field: 'type'
- });
-
- // manipulate the choices from the options request to be set on
- // scope and be usable by the list form
- fieldChoice.then(function (choices) {
- choices =
- fieldLabels({
- choices: choices
- });
- $scope.explanation_fail_type = choices[taskObj.job_type];
- $scope.explanation_fail_name = taskObj.job_name;
- $scope.explanation_fail_id = taskObj.job_id;
- $scope.task_detail = $scope.explanation_fail_type + " failed for " + $scope.explanation_fail_name + " with ID " + $scope.explanation_fail_id + ".";
- });
- } else {
- $scope.previousTaskFailed = false;
- }
- });
-
- // Set the parse type so that CodeMirror knows how to display extra params YAML/JSON
- $scope.parseType = 'yaml';
-
- function updateJobObj(updatedJobData) {
-
- // Go out and get the job details based on the job type. jobType gets defined
- // in the data block of the route declaration for each of the different types
- // of stdout jobs.
-
- $scope.job = updatedJobData;
- $scope.job_template_name = updatedJobData.name;
- $scope.created_by = updatedJobData.summary_fields.created_by;
- $scope.project_name = (updatedJobData.summary_fields.project) ? updatedJobData.summary_fields.project.name : '';
- $scope.inventory_name = (updatedJobData.summary_fields.inventory) ? updatedJobData.summary_fields.inventory.name : '';
- $scope.job_template_url = '/#/templates/' + updatedJobData.unified_job_template;
- if($scope.inventory_name && updatedJobData.inventory && updatedJobData.summary_fields.inventory && updatedJobData.summary_fields.inventory.kind) {
- if(updatedJobData.summary_fields.inventory.kind === '') {
- $scope.inventory_url = '/#/inventories/inventory' + updatedJobData.inventory;
- }
- else if(updatedJobData.summary_fields.inventory.kind === 'smart') {
- $scope.inventory_url = '/#/inventories/smart_inventory' + updatedJobData.inventory;
- }
- }
- else {
- $scope.inventory_url = '';
- }
- $scope.project_url = ($scope.project_name && updatedJobData.project) ? '/#/projects/' + updatedJobData.project : '';
- $scope.credential_name = (updatedJobData.summary_fields.credential) ? updatedJobData.summary_fields.credential.name : '';
- $scope.credential_url = (updatedJobData.credential) ? '/#/credentials/' + updatedJobData.credential : '';
- $scope.cloud_credential_url = (updatedJobData.cloud_credential) ? '/#/credentials/' + updatedJobData.cloud_credential : '';
- if(updatedJobData.summary_fields && updatedJobData.summary_fields.source_workflow_job &&
- updatedJobData.summary_fields.source_workflow_job.id){
- $scope.workflow_result_link = `/#/workflows/${updatedJobData.summary_fields.source_workflow_job.id}`;
- }
- $scope.playbook = updatedJobData.playbook;
- $scope.credential = updatedJobData.credential;
- $scope.cloud_credential = updatedJobData.cloud_credential;
- $scope.forks = updatedJobData.forks;
- $scope.limit = updatedJobData.limit;
- $scope.verbosity = updatedJobData.verbosity;
- $scope.job_tags = updatedJobData.job_tags;
- $scope.job.module_name = updatedJobData.module_name;
- if (updatedJobData.extra_vars) {
- $scope.variables = ParseVariableString(updatedJobData.extra_vars);
- }
-
- $scope.$on('getInventorySource', function(e, d) {
- $scope.inv_manage_group_link = '/#/inventories/inventory/' + d.inventory + '/inventory_sources/edit/' + d.id;
- });
-
- // If we have a source then we have to go get the source choices from the server
- if (!Empty(updatedJobData.source)) {
- if ($scope.removeChoicesReady) {
- $scope.removeChoicesReady();
- }
- $scope.removeChoicesReady = $scope.$on('ChoicesReady', function() {
- $scope.source_choices.every(function(e) {
- if (e.value === updatedJobData.source) {
- $scope.source = e.label;
- return false;
- }
- return true;
- });
- });
- // GetChoices can be found in the helper: Utilities.js
- // It attaches the source choices to $scope.source_choices.
- // Then, when the callback is fired, $scope.source is bound
- // to the corresponding label.
- GetChoices({
- scope: $scope,
- url: GetBasePath('inventory_sources'),
- field: 'source',
- variable: 'source_choices',
- choice_name: 'choices',
- callback: 'ChoicesReady'
- });
- }
-
- // LookUpName can be found in the lookup-name.factory
- // It attaches the name that it gets (based on the url)
- // to the $scope variable defined by the attribute scope_var.
- if (!Empty(updatedJobData.credential)) {
- LookUpName({
- scope: $scope,
- scope_var: 'credential',
- url: GetBasePath('credentials') + updatedJobData.credential + '/',
- ignore_403: true
- });
- }
-
- if (!Empty(updatedJobData.inventory)) {
- LookUpName({
- scope: $scope,
- scope_var: 'inventory',
- url: GetBasePath('inventory') + updatedJobData.inventory + '/'
- });
- }
-
- if (!Empty(updatedJobData.project)) {
- LookUpName({
- scope: $scope,
- scope_var: 'project',
- url: GetBasePath('projects') + updatedJobData.project + '/'
- });
- }
-
- if (!Empty(updatedJobData.cloud_credential)) {
- LookUpName({
- scope: $scope,
- scope_var: 'cloud_credential',
- url: GetBasePath('credentials') + updatedJobData.cloud_credential + '/',
- ignore_403: true
- });
- }
-
- if (!Empty(updatedJobData.inventory_source)) {
- LookUpName({
- scope: $scope,
- scope_var: 'inventory_source',
- url: GetBasePath('inventory_sources') + updatedJobData.inventory_source + '/',
- callback: 'getInventorySource'
- });
- }
-
- if (updatedJobData.extra_vars) {
- ParseTypeChange({
- scope: $scope,
- field_id: 'pre-formatted-variables',
- readOnly: true
- });
- }
-
- // If the job isn't running we want to clear out the interval that goes out and checks for stdout updates.
- // This interval is defined in the standard out log directive controller.
- if (updatedJobData.status === 'successful' || updatedJobData.status === 'failed' || updatedJobData.status === 'error' || updatedJobData.status === 'canceled') {
- if ($rootScope.jobStdOutInterval) {
- window.clearInterval($rootScope.jobStdOutInterval);
- }
- }
-
- }
-
- if ($scope.removeDeleteFinished) {
- $scope.removeDeleteFinished();
- }
- $scope.removeDeleteFinished = $scope.$on('DeleteFinished', function(e, action) {
- Wait('stop');
- if (action !== 'cancel') {
- Wait('stop');
- $state.go('jobs');
- }
- });
-
- // TODO: this is currently not used but is necessary for cases where sockets
- // are not available and a manual refresh trigger is needed.
- $scope.refresh = function(){
- $scope.$emit('LoadStdout');
- };
-
- // Click binding for the expand/collapse button on the standard out log
- $scope.toggleStdoutFullscreen = function() {
- $scope.stdoutFullScreen = !$scope.stdoutFullScreen;
-
- if ($scope.stdoutFullScreen === true) {
- $scope.toggleStdoutFullscreenTooltip = i18n._("Collapse Output");
- } else if ($scope.stdoutFullScreen === false) {
- $scope.toggleStdoutFullscreenTooltip = i18n._("Expand Output");
- }
- };
-
- $scope.deleteJob = function() {
- DeleteJob({
- scope: $scope,
- id: $scope.job.id,
- job: $scope.job,
- callback: 'DeleteFinished'
- });
- };
-
- updateJobObj(jobData);
-
-}
-
-JobStdoutController.$inject = [ '$rootScope', '$scope', '$state',
- '$stateParams', 'GetBasePath', 'Rest', 'ProcessErrors',
- 'Empty', 'GetChoices', 'LookUpName', 'ParseTypeChange',
- 'ParseVariableString', 'DeleteJob', 'Wait', 'i18n',
- 'fieldChoices', 'fieldLabels', 'ProjectModel', 'Alert', 'InventorySourceModel',
- 'jobData'];
diff --git a/awx/ui/client/src/standard-out/standard-out.block.less b/awx/ui/client/src/workflow-results/standard-out.block.less
similarity index 99%
rename from awx/ui/client/src/standard-out/standard-out.block.less
rename to awx/ui/client/src/workflow-results/standard-out.block.less
index 5fd5742e82..980f401c75 100644
--- a/awx/ui/client/src/standard-out/standard-out.block.less
+++ b/awx/ui/client/src/workflow-results/standard-out.block.less
@@ -169,4 +169,4 @@ standard-out-log {
cursor: pointer;
border-radius: 5px;
font-size: 11px;
-}
+}
\ No newline at end of file
diff --git a/awx/ui/test/spec/job-results/job-results.controller-test.js b/awx/ui/test/spec/job-results/job-results.controller-test.js
deleted file mode 100644
index c05f2329f7..0000000000
--- a/awx/ui/test/spec/job-results/job-results.controller-test.js
+++ /dev/null
@@ -1,701 +0,0 @@
-'use strict';
-import moment from 'moment';
-
-describe('Controller: jobResultsController', () => {
- // Setup
- let jobResultsController;
-
- let jobData, jobDataOptions, jobLabels, jobFinished, count, $scope, ParseTypeChange, ParseVariableString, jobResultsService, eventQueue, $compile, eventResolve, populateResolve, $rScope, q, $log, Dataset, Rest, $state, QuerySet, i18n,fieldChoices, fieldLabels, $interval, workflowResultsService, statusSocket, jobExtraCredentials;
-
- statusSocket = function() {
- var fn = function() {};
- return fn;
- };
- jobData = {
- related: {},
- summary_fields: {
- inventory: {
- id: null,
- kind: ''
- }
- }
- };
- jobDataOptions = {
- actions: {
- get: {}
- }
- };
- jobLabels = {};
- jobFinished = true;
- count = {
- val: {},
- countFinished: false
- };
- eventResolve = {
- results: []
- };
- populateResolve = {};
-
- Dataset = {
- data: {foo: "bar"}
- };
-
- let provideVals = () => {
- angular.mock.module('jobResults', ($provide) => {
- ParseTypeChange = jasmine.createSpy('ParseTypeChange');
- ParseVariableString = jasmine.createSpy('ParseVariableString');
- jobResultsService = jasmine.createSpyObj('jobResultsService', [
- 'deleteJob',
- 'cancelJob',
- 'relaunchJob',
- 'getEvents',
- 'getJobData',
- ]);
- eventQueue = jasmine.createSpyObj('eventQueue', [
- 'populate',
- 'markProcessed',
- 'initialize'
- ]);
-
- Rest = jasmine.createSpyObj('Rest', [
- 'setUrl',
- 'get'
- ]);
-
- $state = jasmine.createSpyObj('$state', [
- 'reload'
- ]);
-
- QuerySet = jasmine.createSpyObj('QuerySet', [
- 'encodeQueryset'
- ]);
-
- i18n = {
- _: function(txt) {
- return txt;
- }
- };
-
- $provide.service('workflowResultsService', () => {
- return jasmine.createSpyObj('workflowResultsService', ['createOneSecondTimer', 'destroyTimer']);
- });
-
- $provide.value('statusSocket', statusSocket);
-
- $provide.value('jobData', jobData);
- $provide.value('jobDataOptions', jobDataOptions);
- $provide.value('jobLabels', jobLabels);
- $provide.value('jobFinished', jobFinished);
- $provide.value('count', count);
- $provide.value('ParseTypeChange', ParseTypeChange);
- $provide.value('ParseVariableString', ParseVariableString);
- $provide.value('jobResultsService', jobResultsService);
- $provide.value('eventQueue', eventQueue);
- $provide.value('Dataset', Dataset);
- $provide.value('Rest', Rest);
- $provide.value('$state', $state);
- $provide.value('QuerySet', QuerySet);
- $provide.value('i18n', i18n);
- $provide.value('fieldChoices', fieldChoices);
- $provide.value('fieldLabels', fieldLabels);
- $provide.value('jobExtraCredentials', jobExtraCredentials);
- });
- };
-
- let injectVals = () => {
- angular.mock.inject((_jobData_, _jobDataOptions_, _jobLabels_, _jobFinished_, _count_, _ParseTypeChange_, _ParseVariableString_, _jobResultsService_, _eventQueue_, _$compile_, $rootScope, $controller, $q, $httpBackend, _$log_, _Dataset_, _Rest_, _$state_, _QuerySet_, _$interval_, _workflowResultsService_, _statusSocket_) => {
- // when you call $scope.$apply() (which you need to do to
- // to get inside of .then blocks to test), something is
- // causing a request for all static files.
- //
- // this is a hack to just pass those requests through
- //
- // from googling this is probably due to angular-router
- // weirdness
- $httpBackend.when("GET", (url) => (url
- .indexOf("/static/") !== -1))
- .respond('');
-
- $httpBackend
- .whenGET('/api')
- .respond(200, '');
-
- $scope = $rootScope.$new();
- $rScope = $rootScope;
- q = $q;
- jobData = _jobData_;
- jobDataOptions = _jobDataOptions_;
- jobLabels = _jobLabels_;
- jobFinished = _jobFinished_;
- count = _count_;
- ParseTypeChange = _ParseTypeChange_;
- ParseVariableString = _ParseVariableString_;
- ParseVariableString.and.returnValue(jobData.extra_vars);
- jobResultsService = _jobResultsService_;
- eventQueue = _eventQueue_;
- $log = _$log_;
- Dataset = _Dataset_;
- Rest = _Rest_;
- $state = _$state_;
- QuerySet = _QuerySet_;
- $interval = _$interval_;
- workflowResultsService = _workflowResultsService_;
- statusSocket = _statusSocket_;
-
- jobResultsService.getEvents.and
- .returnValue(eventResolve);
- eventQueue.populate.and
- .returnValue(populateResolve);
-
- jobResultsService.getJobData = function() {
- var deferred = $q.defer();
- deferred.resolve({});
- return deferred.promise;
- };
-
- $compile = _$compile_;
-
- jobResultsController = $controller('jobResultsController', {
- $scope: $scope,
- jobData: jobData,
- jobDataOptions: jobDataOptions,
- jobLabels: jobLabels,
- jobFinished: jobFinished,
- count: count,
- ParseTypeChange: ParseTypeChange,
- jobResultsService: jobResultsService,
- eventQueue: eventQueue,
- $compile: $compile,
- $log: $log,
- $q: q,
- Dataset: Dataset,
- Rest: Rest,
- $state: $state,
- QuerySet: QuerySet,
- statusSocket: statusSocket
- });
- });
- };
-
- beforeEach(angular.mock.module('shared'));
-
- let bootstrapTest = () => {
- provideVals();
- injectVals();
- };
-
- describe('bootstrap resolve values on scope', () => {
- beforeEach(() => {
- bootstrapTest();
- });
-
- it('should set values to scope based on resolve', () => {
- expect($scope.job).toBe(jobData);
- expect($scope.jobOptions).toBe(jobDataOptions.actions.GET);
- expect($scope.labels).toBe(jobLabels);
- });
- });
-
- describe('getLinks()', () => {
- beforeEach(() => {
- jobData.related = {
- "created_by": "api/v2/users/12",
- "inventory": "api/v2/inventories/12",
- "project": "api/v2/projects/12",
- "credential": "api/v2/credentials/12",
- "cloud_credential": "api/v2/credentials/13",
- "network_credential": "api/v2/credentials/14",
- };
-
- jobData.summary_fields.inventory = {
- id: 12,
- kind: ''
- };
-
- bootstrapTest();
- });
-
- it('should transform related links and set to scope var', () => {
- expect($scope.created_by_link).toBe('/#/users/12');
- expect($scope.inventory_link).toBe('/#/inventories/inventory/12');
- expect($scope.project_link).toBe('/#/projects/12');
- expect($scope.machine_credential_link).toBe('/#/credentials/12');
- expect($scope.cloud_credential_link).toBe('/#/credentials/13');
- expect($scope.network_credential_link).toBe('/#/credentials/14');
- });
- });
-
- describe('getLabels()', () => {
- beforeEach(() => {
- jobDataOptions.actions.GET = {
- status: {
- choices: [
- ["new",
- "New"]
- ]
- },
- job_type: {
- choices: [
- ["job",
- "Playbook Run"]
- ]
- },
- verbosity: {
- choices: [
- [0,
- "0 (Normal)"]
- ]
- }
- };
- jobData.status = "new";
- jobData.job_type = "job";
- jobData.verbosity = 0;
-
- bootstrapTest();
- });
-
- it('should set scope variables based on options', () => {
- $scope.job_status = jobData.status;
-
- $scope.$apply();
- expect($scope.status_label).toBe("New");
- expect($scope.type_label).toBe("Playbook Run");
- expect($scope.verbosity_label).toBe("0 (Normal)");
- });
- });
-
- describe('elapsed timer', () => {
- describe('job running', () => {
- beforeEach(() => {
- jobData.started = moment();
- jobData.status = 'running';
-
- bootstrapTest();
- });
-
- it('should start timer', () => {
- expect(workflowResultsService.createOneSecondTimer).toHaveBeenCalled();
- });
- });
-
- describe('job waiting', () => {
- beforeEach(() => {
- jobData.started = null;
- jobData.status = 'waiting';
-
- bootstrapTest();
- });
-
- it('should not start timer', () => {
- expect(workflowResultsService.createOneSecondTimer).not.toHaveBeenCalled();
- });
- });
-
- describe('job transitions to running', () => {
- beforeEach(() => {
- jobData.started = null;
- jobData.status = 'waiting';
- jobData.id = 13;
-
- bootstrapTest();
-
- $rScope.$broadcast('ws-jobs', { unified_job_id: jobData.id, status: 'running' });
- });
-
- it('should start timer', () => {
- expect(workflowResultsService.createOneSecondTimer).toHaveBeenCalled();
- });
-
- describe('job transitions from running to finished', () => {
- it('should cleanup timer', () => {
- $rScope.$broadcast('ws-jobs', { unified_job_id: jobData.id, status: 'successful' });
- expect(workflowResultsService.destroyTimer).toHaveBeenCalled();
- });
- });
- });
- });
-
- describe('extra vars stuff', () => {
- let extraVars = "foo";
-
- beforeEach(() => {
- jobData.extra_vars = extraVars;
-
- bootstrapTest();
- });
-
- it('should have extra vars on scope', () => {
- expect($scope.job.extra_vars).toBe(extraVars);
- });
-
- it('should call ParseVariableString and set to scope', () => {
- expect(ParseVariableString)
- .toHaveBeenCalledWith(extraVars);
- expect($scope.variables).toBe(extraVars);
- });
-
- it('should set the parse type to yaml', () => {
- expect($scope.parseType).toBe('yaml');
- });
-
- it('should call ParseTypeChange with proper params', () => {
- let params = {
- scope: $scope,
- field_id: 'pre-formatted-variables',
- readOnly: true
- };
-
- expect(ParseTypeChange)
- .toHaveBeenCalledWith(params);
- });
- });
-
- describe('$scope.toggleStdoutFullscreen', () => {
- beforeEach(() => {
- bootstrapTest();
- });
-
- it('should toggle $scope.stdoutFullScreen', () => {
- // essentially set to false
- expect($scope.stdoutFullScreen).toBe(false);
-
- // toggle once to true
- $scope.toggleStdoutFullscreen();
- expect($scope.stdoutFullScreen).toBe(true);
-
- // toggle again to false
- $scope.toggleStdoutFullscreen();
- expect($scope.stdoutFullScreen).toBe(false);
- });
- });
-
- describe('$scope.deleteJob', () => {
- beforeEach(() => {
- bootstrapTest();
- });
-
- it('should delete the job', () => {
- let job = $scope.job;
- $scope.deleteJob();
- expect(jobResultsService.deleteJob).toHaveBeenCalledWith(job);
- });
- });
-
- describe('$scope.cancelJob', () => {
- beforeEach(() => {
- bootstrapTest();
- });
-
- it('should cancel the job', () => {
- let job = $scope.job;
- $scope.cancelJob();
- expect(jobResultsService.cancelJob).toHaveBeenCalledWith(job);
- });
- });
-
- describe('count stuff', () => {
- beforeEach(() => {
- count = {
- val: {
- ok: 1,
- skipped: 2,
- unreachable: 3,
- failures: 4,
- changed: 5
- },
- countFinished: true
- };
-
- bootstrapTest();
- });
-
- it('should set count values to scope', () => {
- expect($scope.count).toBe(count.val);
- expect($scope.countFinished).toBe(true);
- });
-
- it('should find the hostCount based on the count', () => {
- expect($scope.hostCount).toBe(15);
- });
- });
-
- describe('follow stuff - incomplete', () => {
- beforeEach(() => {
- jobFinished = false;
-
- bootstrapTest();
- });
-
- it('should set followEngaged based on jobFinished incomplete', () => {
- expect($scope.followEngaged).toBe(true);
- });
-
- it('should set followTooltip based on jobFinished incomplete', () => {
- expect($scope.followTooltip).toBe("Currently following standard out as it comes in. Click to unfollow.");
- });
- });
-
- describe('follow stuff - finished', () => {
- beforeEach(() => {
- jobFinished = true;
-
- bootstrapTest();
- });
-
- it('should set followEngaged based on jobFinished', () => {
- expect($scope.followEngaged).toBe(false);
- });
-
- it('should set followTooltip based on jobFinished', () => {
- expect($scope.followTooltip).toBe("Jump to last line of standard out.");
- });
- });
-
- describe('event stuff', () => {
- beforeEach(() => {
- jobData.id = 1;
- jobData.related.job_events = "url";
-
- bootstrapTest();
- });
-
- xit('should make a rest call to get already completed events', () => {
- expect(jobResultsService.getEvents).toHaveBeenCalledWith("url");
- });
-
- xit('should call processEvent when receiving message', () => {
- let eventPayload = {"foo": "bar"};
- $rScope.$broadcast('ws-job_events-1', eventPayload);
- expect(eventQueue.populate).toHaveBeenCalledWith(eventPayload);
- });
-
- it('should set the job status on scope when receiving message', () => {
- let eventPayload = {
- unified_job_id: 1,
- status: 'finished'
- };
- $rScope.$broadcast('ws-jobs', eventPayload);
- expect($scope.job_status).toBe(eventPayload.status);
- });
- });
-
- describe('getEvents and populate stuff', () => {
- describe('getEvents', () => {
- let event1 = {
- event: 'foo'
- };
-
- let event2 = {
- event_name: 'bar'
- };
-
- let event1Processed = {
- event_name: 'foo'
- };
-
- beforeEach(() => {
- eventResolve = {
- results: [
- event1,
- event2
- ]
- };
-
- bootstrapTest();
-
- $scope.$apply();
- });
-
- xit('should change the event name to event_name', () => {
- expect(eventQueue.populate)
- .toHaveBeenCalledWith(event1Processed);
- });
-
- xit('should pass through the event with event_name', () => {
- expect(eventQueue.populate)
- .toHaveBeenCalledWith(event2);
- });
-
- xit('should have called populate twice', () => {
- expect(eventQueue.populate.calls.count()).toEqual(2);
- });
-
- // TODO: can't figure out how to a test of events.next...
- // if you set events.next to true it causes the tests to
- // stop running
- });
-
- describe('populate - start time', () => {
- beforeEach(() => {
- jobData.start = "";
-
- populateResolve = {
- startTime: 'foo',
- changes: ['startTime']
- };
-
- bootstrapTest();
-
- $scope.$apply();
- });
-
- xit('sets start time when passed as a change', () => {
- expect($scope.job.start).toBe('foo');
- });
- });
-
- describe('populate - start time already set', () => {
- beforeEach(() => {
- jobData.start = "bar";
-
- populateResolve = {
- startTime: 'foo',
- changes: ['startTime']
- };
-
- bootstrapTest();
-
- $scope.$apply();
- });
-
- xit('does not set start time because already set', () => {
- expect($scope.job.start).toBe('bar');
- });
- });
-
- describe('populate - count already received', () => {
- let receiveCount = {
- ok: 2,
- skipped: 2,
- unreachable: 2,
- failures: 2,
- changed: 2
- };
-
- let alreadyCount = {
- ok: 3,
- skipped: 3,
- unreachable: 3,
- failures: 3,
- changed: 3
- };
-
- beforeEach(() => {
- count.countFinished = true;
- count.val = alreadyCount;
-
- populateResolve = {
- count: receiveCount,
- changes: ['count']
- };
-
- bootstrapTest();
-
- $scope.$apply();
- });
-
- xit('count does not change', () => {
- expect($scope.count).toBe(alreadyCount);
- expect($scope.hostCount).toBe(15);
- });
- });
-
- describe('populate - playCount, taskCount and countFinished', () => {
- beforeEach(() => {
-
- populateResolve = {
- playCount: 12,
- taskCount: 13,
- changes: ['playCount', 'taskCount', 'countFinished']
- };
-
- bootstrapTest();
-
- $scope.$apply();
- });
-
- xit('sets playCount', () => {
- expect($scope.playCount).toBe(12);
- });
-
- xit('sets taskCount', () => {
- expect($scope.taskCount).toBe(13);
- });
-
- xit('sets countFinished', () => {
- expect($scope.countFinished).toBe(true);
- });
- });
-
- describe('populate - finishedTime', () => {
- beforeEach(() => {
- jobData.finished = "";
-
- populateResolve = {
- finishedTime: "finished_time",
- changes: ['finishedTime']
- };
-
- bootstrapTest();
-
- $scope.$apply();
- });
-
- xit('sets finished time and changes follow tooltip', () => {
- expect($scope.job.finished).toBe('finished_time');
- expect($scope.jobFinished).toBe(true);
- expect($scope.followTooltip)
- .toBe("Jump to last line of standard out.");
- });
- });
-
- describe('populate - finishedTime when already finished', () => {
- beforeEach(() => {
- jobData.finished = "already_set";
-
- populateResolve = {
- finishedTime: "finished_time",
- changes: ['finishedTime']
- };
-
- bootstrapTest();
-
- $scope.$apply();
- });
-
- xit('does not set finished time because already set', () => {
- expect($scope.job.finished).toBe('already_set');
- expect($scope.jobFinished).toBe(true);
- expect($scope.followTooltip)
- .toBe("Jump to last line of standard out.");
- });
- });
-
- describe('populate - stdout', () => {
- beforeEach(() => {
-
- populateResolve = {
- counter: 12,
- stdout: "line",
- changes: ['stdout']
- };
-
- bootstrapTest();
-
- spyOn($log, 'error');
-
- $scope.followEngaged = true;
-
- $scope.$apply();
- });
-
- xit('creates new child scope for the event', () => {
- expect($scope.events[12].event).toBe(populateResolve);
-
- // in unit test, followScroll should not be defined as
- // directive has not been instantiated
- expect($log.error).toHaveBeenCalledWith("follow scroll undefined, standard out directive not loaded yet?");
- });
- });
- });
-});
diff --git a/awx/ui/test/spec/job-results/job-results.service-test.js b/awx/ui/test/spec/job-results/job-results.service-test.js
deleted file mode 100644
index 1219f2e450..0000000000
--- a/awx/ui/test/spec/job-results/job-results.service-test.js
+++ /dev/null
@@ -1,50 +0,0 @@
-'use strict';
-
-describe('jobResultsService', () => {
- let jobResultsService;
-
- beforeEach(angular.mock.module('awApp'));
-
- beforeEach(angular.mock.inject(( _jobResultsService_) => {
- jobResultsService = _jobResultsService_;
- }));
-
- describe('getCountsFromStatsEvent()', () => {
- it('properly counts hosts based on task state', () => {
- let event_data = {
- "skipped": {
- "skipped-host": 5 // this host skipped all 5 tasks
- },
- "ok": {
- "ok-host": 5, // this host was ok on all 5 tasks
- "changed-host": 4 // this host had 4 ok tasks, had 1 changed task
- },
- "changed": {
- "changed-host": 1
- },
- "failures": {
- "failed-host": 1 // this host had a failed task
- },
- "dark": {
- "unreachable-host": 1 // this host was unreachable
- },
- "processed": {
- "ok-host": 1,
- "changed-host": 1,
- "skipped-host": 1,
- "failed-host": 1,
- "unreachable-host": 1
- },
- "playbook_uuid": "c23d8872-c92a-4e96-9f78-abe6fef38f33",
- "playbook": "some_playbook.yml",
- };
- expect(jobResultsService.getCountsFromStatsEvent(event_data)).toEqual({
- 'ok': 1,
- 'skipped': 1,
- 'unreachable': 1,
- 'failures': 1,
- 'changed': 1
- });
- });
- });
-});
diff --git a/awx/ui/test/spec/job-results/parse-stdout.service-test.js b/awx/ui/test/spec/job-results/parse-stdout.service-test.js
deleted file mode 100644
index 86441c1ffa..0000000000
--- a/awx/ui/test/spec/job-results/parse-stdout.service-test.js
+++ /dev/null
@@ -1,212 +0,0 @@
-'use strict';
-
-describe('parseStdoutService', () => {
- let parseStdoutService,
- log;
-
- beforeEach(angular.mock.module('awApp'));
-
- beforeEach(angular.mock.module('jobResults',($provide) => {
- log = jasmine.createSpyObj('$log', [
- 'error'
- ]);
-
- $provide.value('$log', log);
- }));
-
- beforeEach(angular.mock.inject((_$log_, _parseStdoutService_) => {
- parseStdoutService = _parseStdoutService_;
- }));
-
- describe('prettify()', () => {
- it('returns lines of stdout with styling classes', () => {
- let line = "[0;32mok: [host-00][0m",
- styledLine = '
ok: [host-00]';
- expect(parseStdoutService.prettify(line)).toBe(styledLine);
- });
-
- it('can return lines of stdout without styling classes', () => {
- let line = "[0;32mok: [host-00][0m",
- unstyled = "unstyled",
- unstyledLine = 'ok: [host-00]';
- expect(parseStdoutService.prettify(line, unstyled)).toBe(unstyledLine);
- });
-
- it('can return empty strings', () => {
- expect(parseStdoutService.prettify("")).toBe("");
- });
- });
-
- describe('getLineClasses()', () => {
- it('creates a string that is used as a class', () => {
- let headerEvent = {
- event_name: 'playbook_on_task_start',
- event_data: {
- play_uuid:"0f667a23-d9ab-4128-a735-80566bcdbca0",
- task_uuid: "80dd087c-268b-45e8-9aab-1083bcfd9364"
- }
- };
- let lineNum = 3;
- let line = "TASK [setup] *******************************************************************";
- let styledLine = " header_task header_task_80dd087c-268b-45e8-9aab-1083bcfd9364 actual_header play_0f667a23-d9ab-4128-a735-80566bcdbca0 line_num_3";
- expect(parseStdoutService.getLineClasses(headerEvent, line, lineNum)).toBe(styledLine);
- });
- });
-
- describe('getStartTime()', () => {
- // TODO: the problem is that the date here calls moment, and thus
- // the date will be timezone'd in the string (this could be
- // different based on where you are)
- xit('creates returns a badge with the start time of the event', () => {
- let headerEvent = {
- event_name: 'playbook_on_play_start',
- created: "2016-11-22T21:15:54.736Z"
- };
-
- let line = "PLAY [add hosts to inventory] **************************************************";
- let badgeDiv = '
13:15:54
';
- expect(parseStdoutService.getStartTimeBadge(headerEvent, line)).toBe(badgeDiv);
- });
- });
-
- describe('getCollapseIcon()', () => {
- let emptySpan = `
-
`;
-
- it('returns empty expander for non-header event', () => {
- let nonHeaderEvent = {
- event_name: 'not_header',
- start_line: 0,
- end_line: 1,
- stdout:"line1"
- };
- expect(parseStdoutService.getCollapseIcon(nonHeaderEvent))
- .toBe(emptySpan);
- });
-
- it('returns collapse/decollapse icons for header events', () => {
- let headerEvent = {
- event_name: 'playbook_on_task_start',
- start_line: 0,
- end_line: 1,
- stdout:"line1",
- event_data: {
- task_uuid: '1da9012d-18e6-4562-85cd-83cf10a97f86'
- }
- };
- let line = "TASK [setup] *******************************************************************";
- let expandSpan = `
-
-
-
-`;
-
- expect(parseStdoutService.getCollapseIcon(headerEvent, line))
- .toBe(expandSpan);
- });
- });
-
- describe('getLineArr()', () => {
- it('returns stdout in array format', () => {
- let mockEvent = {
- start_line: 12,
- end_line: 14,
- stdout: "line1\r\nline2\r\n"
- };
- let expectedReturn = [[13, "line1"],[14, "line2"]];
-
- let returnedEvent = parseStdoutService.getLineArr(mockEvent);
-
- expect(returnedEvent).toEqual(expectedReturn);
- });
-
- it('deals correctly with capped lines', () => {
- let mockEvent = {
- start_line: 7,
- end_line: 11,
- stdout: "a\r\nb\r\nc..."
- };
- let expectedReturn = [[8, "a"],[9, "b"], [10,"c..."]];
-
- let returnedEvent = parseStdoutService.getLineArr(mockEvent);
-
- expect(returnedEvent).toEqual(expectedReturn);
- });
- });
-
- describe('parseStdout()', () => {
- let mockEvent = {"foo": "bar"};
-
- it('calls functions', function() {
- spyOn(parseStdoutService, 'getLineArr').and
- .returnValue([[13, 'line1'], [14, 'line2']]);
- spyOn(parseStdoutService, 'getLineClasses').and
- .returnValue("");
- spyOn(parseStdoutService, 'getCollapseIcon').and
- .returnValue("");
- spyOn(parseStdoutService, 'getAnchorTags').and
- .returnValue("");
- spyOn(parseStdoutService, 'prettify').and
- .returnValue("prettified_line");
- spyOn(parseStdoutService, 'getStartTimeBadge').and
- .returnValue("");
-
- parseStdoutService.parseStdout(mockEvent);
-
- expect(parseStdoutService.getLineArr)
- .toHaveBeenCalledWith(mockEvent);
- expect(parseStdoutService.getLineClasses)
- .toHaveBeenCalledWith(mockEvent, 'line1', 13);
- expect(parseStdoutService.getCollapseIcon)
- .toHaveBeenCalledWith(mockEvent, 'line1');
- expect(parseStdoutService.getAnchorTags)
- .toHaveBeenCalledWith(mockEvent);
- expect(parseStdoutService.prettify)
- .toHaveBeenCalledWith('line1');
- expect(parseStdoutService.getStartTimeBadge)
- .toHaveBeenCalledWith(mockEvent, 'line1');
-
- // get line arr should be called once for the event
- expect(parseStdoutService.getLineArr.calls.count())
- .toBe(1);
-
- // other functions should be called twice (once for each
- // line)
- expect(parseStdoutService.getLineClasses.calls.count())
- .toBe(2);
- expect(parseStdoutService.getCollapseIcon.calls.count())
- .toBe(2);
- expect(parseStdoutService.getAnchorTags.calls.count())
- .toBe(2);
- expect(parseStdoutService.prettify.calls.count())
- .toBe(2);
- });
-
- it('returns dom-ified lines', function() {
- spyOn(parseStdoutService, 'getLineArr').and
- .returnValue([[13, 'line1']]);
- spyOn(parseStdoutService, 'getLineClasses').and
- .returnValue("line_classes");
- spyOn(parseStdoutService, 'getCollapseIcon').and
- .returnValue("collapse_icon_dom");
- spyOn(parseStdoutService, 'getAnchorTags').and
- .returnValue(`" anchor_tag_dom`);
- spyOn(parseStdoutService, 'prettify').and
- .returnValue("prettified_line");
- spyOn(parseStdoutService, 'getStartTimeBadge').and
- .returnValue("");
-
- var returnedString = parseStdoutService.parseStdout(mockEvent);
-
- var expectedString = `
-
-
collapse_icon_dom13
-
prettified_line
-
`;
- expect(returnedString).toBe(expectedString);
- });
- });
-});