Fixed jshint errors and fixed bug where edge types were not being properly limited based on sibling edge types

This commit is contained in:
Michael Abashian 2016-11-09 15:15:24 -05:00
parent 5ff2267211
commit 5a940ff06a
31 changed files with 173 additions and 183 deletions

View File

@ -33,7 +33,6 @@ if ($basePath) {
// Modules
import './helpers';
import * as forms from './forms';
import './lists';
import './widgets';
import './filters';
@ -219,9 +218,8 @@ var tower = angular.module('Tower', [
.config(['$urlRouterProvider', '$breadcrumbProvider', 'QuerySetProvider',
'$urlMatcherFactoryProvider', 'stateDefinitionsProvider', '$stateProvider', '$stateExtenderProvider',
function($urlRouterProvider, $breadcrumbProvider, QuerySet,
$urlMatcherFactoryProvider, stateDefinitionsProvider, $stateProvider, $stateExtenderProvider) {
let $stateExtender = $stateExtenderProvider.$get(),
stateDefinitions = stateDefinitionsProvider.$get();
$urlMatcherFactoryProvider, stateDefinitionsProvider, $stateProvider) {
let stateDefinitions = stateDefinitionsProvider.$get();
$urlMatcherFactoryProvider.strictMode(false);
$breadcrumbProvider.setOptions({
templateUrl: urlPrefix + 'partials/breadcrumb.html'

View File

@ -114,7 +114,7 @@ UsersList.$inject = ['$scope', '$rootScope', '$stateParams',
export function UsersAdd($scope, $rootScope, $stateParams, UserForm,
GenerateForm, Rest, Alert, ProcessErrors, ReturnToCaller, ClearScope,
GetBasePath, ResetForm, Wait, CreateSelect2, $state, i18n) {
GetBasePath, ResetForm, Wait, CreateSelect2, $state, $location) {
ClearScope();
@ -201,7 +201,7 @@ export function UsersAdd($scope, $rootScope, $stateParams, UserForm,
UsersAdd.$inject = ['$scope', '$rootScope', '$stateParams', 'UserForm', 'GenerateForm',
'Rest', 'Alert', 'ProcessErrors', 'ReturnToCaller', 'ClearScope', 'GetBasePath',
'ResetForm', 'Wait', 'CreateSelect2', '$state', 'i18n'
'ResetForm', 'Wait', 'CreateSelect2', '$state', '$location'
];
export function UsersEdit($scope, $rootScope, $location,

View File

@ -132,7 +132,7 @@ angular.module('InventoryFormDefinition', ['ScanJobsListDefinition'])
}
},
relatedSets: function(urls) {
relatedSets: function() {
return {
permissions: {
awToolTip: i18n._('Please save before assigning permissions'),

View File

@ -31,15 +31,18 @@ export default
options: [
{
label: 'On Success',
value: 'success'
value: 'success',
ngShow: '!edgeTypeRestriction || edgeTypeRestriction === "successFailure"'
},
{
label: 'On Failure',
value: 'failure'
value: 'failure',
ngShow: '!edgeTypeRestriction || edgeTypeRestriction === "successFailure"'
},
{
label: 'Always',
value: 'always'
value: 'always',
ngShow: '!edgeTypeRestriction || edgeTypeRestriction === "always"'
}
],
awRequiredWhen: {

View File

@ -1039,7 +1039,6 @@ export default
//plays = JSON.parse(JSON.stringify(scope.jobData.plays)),
plays = scope.jobData.plays,
filteredListX = [],
filteredListA = [],
filteredListB = [],
key,
keys;
@ -1113,7 +1112,6 @@ export default
var scope = params.scope,
result = [],
filteredListX = [],
filteredListA = [],
filteredListB = [],
idx, key, keys, newKeys, tasks, t;
@ -1196,11 +1194,9 @@ export default
return function(params) {
var scope = params.scope,
result = [],
filteredListA = [],
filteredListB = [],
idx = 0,
hostResults,
key,
keys;
if (scope.activePlay && scope.activeTask && scope.jobData.plays[scope.activePlay] &&
@ -1232,7 +1228,7 @@ export default
// else {
// filteredListB = filteredListA;
// }
keys = Object.keys(filteredListB);
keys.sort(function compare(a, b) {
if (filteredListB[a].name === filteredListB[b].name) {

View File

@ -381,7 +381,6 @@ export default
return function(params) {
var scope = params.scope,
id = params.id,
callback = params.callback,
url = GetBasePath('schedules') + id +'/';
// Perform the update

View File

@ -22,8 +22,7 @@ export default
return function (params) {
var scope = params.scope,
set = params.set,
iterator = params.iterator;
set = params.set;
// Listeners to perform lookups after main inventory list loads
@ -86,8 +85,7 @@ export default
scope.lookUpOrganization = function () {
var list = OrganizationList,
listGenerator = GenerateList,
listScope = listGenerator.inject(list, { mode: 'lookup', hdr: 'Select Organization' }),
defaultUrl = '/api/v1/organizations/';
listScope = listGenerator.inject(list, { mode: 'lookup', hdr: 'Select Organization' });
listScope.selectAction = function () {
var i, found = false;

View File

@ -45,8 +45,8 @@ export function format(f) {
var args = arguments;
var len = args.length;
var str = String(f).replace(formatRegExp, function(x) {
if (x === '%%') return '%';
if (i >= len) return x;
if (x === '%%') {return '%';}
if (i >= len) {return x;}
switch (x) {
case '%s': return String(args[i++]);
case '%d': return Number(args[i++]);
@ -57,6 +57,7 @@ export function format(f) {
} catch (_) {
return '[Circular]';
}
break;
default:
return x;
}
@ -78,12 +79,12 @@ export default
return function() {
var langInfo = $window.navigator.language ||
$window.navigator.userLanguage;
var langUrl = langInfo.replace('-', '_');
//var langUrl = langInfo.replace('-', '_');
//gettextCatalog.debug = true;
gettextCatalog.setCurrentLanguage(langInfo);
// TODO: the line below is commented out temporarily until
// the .po files are received from the i18n team, in order to avoid
// 404 file not found console errors in dev
// 404 file not found console errors in dev
// gettextCatalog.loadRemote('/static/languages/' + langUrl + '.json');
};
}])

View File

@ -8,8 +8,8 @@ export default ['$state', '$stateParams', '$scope', 'GroupForm', 'CredentialList
'GroupManageService', 'GetChoices', 'GetBasePath', 'CreateSelect2', 'GetSourceTypeOptions', 'rbacUiControlService', 'ToJSON',
function($state, $stateParams, $scope, GroupForm, CredentialList, ParseTypeChange, GenerateForm, inventoryData,
GroupManageService, GetChoices, GetBasePath, CreateSelect2, GetSourceTypeOptions, rbacUiControlService, ToJSON) {
var generator = GenerateForm,
form = GroupForm();
let form = GroupForm();
init();
function init() {

View File

@ -6,10 +6,10 @@
export default
['$scope', '$rootScope', '$state', '$stateParams', 'InventoryGroups', 'generateList', 'InventoryUpdate',
'GroupManageService', 'GroupsCancelUpdate', 'ViewUpdateStatus', 'rbacUiControlService', 'GetBasePath',
'InventoryManageService', 'groupsUrl', 'GetSyncStatusMsg', 'GetHostsStatusMsg', 'groupsDataset',
'InventoryManageService', 'groupsUrl', 'GetSyncStatusMsg', 'GetHostsStatusMsg', 'groupsDataset', 'Find',
function($scope, $rootScope, $state, $stateParams, InventoryGroups, generateList, InventoryUpdate,
GroupManageService, GroupsCancelUpdate, ViewUpdateStatus, rbacUiControlService, GetBasePath,
InventoryManageService, groupsUrl, GetSyncStatusMsg, GetHostsStatusMsg, groupsDataset){
InventoryManageService, groupsUrl, GetSyncStatusMsg, GetHostsStatusMsg, groupsDataset, Find){
let list = InventoryGroups;

View File

@ -187,7 +187,6 @@ export default
Rest.setUrl(GetBasePath('projects') + $scope.project + '/');
Rest.get()
.success(function (data) {
console.log(data)
var msg;
switch (data.status) {
case 'failed':
@ -252,7 +251,7 @@ export default
if ($scope.cloudCredentialReadyRemove) {
$scope.cloudCredentialReadyRemove();
}
$scope.cloudCredentialReadyRemove = $scope.$on('cloudCredentialReady', function (e, name) {
$scope.cloudCredentialReadyRemove = $scope.$on('cloudCredentialReady', function () {
$scope.$emit('jobTemplateLoadFinished');
});
@ -261,7 +260,7 @@ export default
if ($scope.jobTemplateLoadedRemove) {
$scope.jobTemplateLoadedRemove();
}
$scope.jobTemplateLoadedRemove = $scope.$on('jobTemplateLoaded', function (e, related_cloud_credential, masterObject, relatedSets) {
$scope.jobTemplateLoadedRemove = $scope.$on('jobTemplateLoaded', function (e, related_cloud_credential, masterObject) {
var dft;
master = masterObject;

View File

@ -297,6 +297,10 @@ angular.module('jobTemplates', [surveyMaker.name, jobTemplatesList.name, jobTemp
$scope[key] = value;
});
});
$scope.$on('setEdgeType', function(e, edgeType) {
$scope.edgeType = edgeType;
});
}
]
}

View File

@ -21,9 +21,6 @@ export default ['$scope', 'WorkflowHelpService', 'generateList', 'JobTemplateLis
formIsValid: false
};
// Set the intial edge type to success
$scope.edgeType = "success";
$scope.job_type_options = [{
label: "Run",
value: "run"
@ -35,14 +32,6 @@ export default ['$scope', 'WorkflowHelpService', 'generateList', 'JobTemplateLis
function init() {
$scope.treeDataMaster = angular.copy($scope.treeData.data);
$scope.$broadcast("refreshWorkflowChart");
$scope.$watchGroup(['selectedTemplate', 'edgeType'], function() {
if ($scope.selectedTemplate && $scope.edgeType) {
$scope.workflowMakerFormConfig.formIsValid = true;
} else {
$scope.workflowMakerFormConfig.formIsValid = false;
}
});
}
function resetNodeForm() {
@ -55,7 +44,6 @@ export default ['$scope', 'WorkflowHelpService', 'generateList', 'JobTemplateLis
delete $scope.placeholderNode;
delete $scope.betweenTwoNodes;
$scope.nodeBeingEdited = null;
$scope.edgeType = "success";
$scope.edgeTypeRestriction = null;
$scope.workflowMakerFormConfig.activeTab = "jobs";
}
@ -104,25 +92,29 @@ export default ['$scope', 'WorkflowHelpService', 'generateList', 'JobTemplateLis
parentId: betweenTwoNodes ? parent.source.id : parent.id
});
// Set the default to success
let edgeType = "success";
if (parent && ((betweenTwoNodes && parent.source.isStartNode) || (!betweenTwoNodes && parent.isStartNode))) {
// We don't want to give the user the option to select
// a type as this node will always be executed
$scope.edgeType = "always";
edgeType = "always";
$scope.showTypeOptions = false;
} else {
if ((_.includes(siblingConnectionTypes, "success") || _.includes(siblingConnectionTypes, "failure")) && _.includes(siblingConnectionTypes, "always")) {
// This is a problem...
} else if (_.includes(siblingConnectionTypes, "success") || _.includes(siblingConnectionTypes, "failure")) {
$scope.edgeTypeRestriction = "successFailure";
$scope.edgeType = "success";
edgeType = "success";
} else if (_.includes(siblingConnectionTypes, "always")) {
$scope.edgeTypeRestriction = "always";
$scope.edgeType = "always";
edgeType = "always";
}
$scope.showTypeOptions = true;
}
$scope.$broadcast("setEdgeType", edgeType);
$scope.$broadcast("refreshWorkflowChart");
};
@ -343,9 +335,11 @@ export default ['$scope', 'WorkflowHelpService', 'generateList', 'JobTemplateLis
break;
}
formValues.edgeType = $scope.nodeBeingEdited.edgeType;
//formValues.edgeType = $scope.nodeBeingEdited.edgeType;
$scope.showTypeOptions = (parent && parent.isStartNode) ? false : true;
$scope.$broadcast('setEdgeType', $scope.nodeBeingEdited.edgeType);
$scope.$broadcast('templateSelected', {
presetValues: formValues,
activeTab: $scope.workflowMakerFormConfig.activeTab

View File

@ -13,6 +13,48 @@ export default
function( Wait, $state, $scope, $rootScope, $location, GetBasePath, Rest,
ProcessErrors, CheckLicense, moment, $window, ConfigService,
FeaturesService, pendoService, i18n){
var calcDaysRemaining = function(seconds){
// calculate the number of days remaining on the license
var duration = moment.duration(seconds, 'seconds').asDays();
duration = Math.floor(duration);
if(duration < 0 ){
duration = 0;
}
duration = (duration!==1) ? `${duration} Days` : `${duration} Day`;
return duration;
};
var calcExpiresOn = function(days){
// calculate the expiration date of the license
days = parseInt(days);
return moment().add(days, 'days').calendar();
};
var reset = function(){
document.getElementById('License-form').reset();
};
var init = function(){
// license/license.partial.html compares fileName
$scope.fileName = N_("No file selected.");
$scope.title = $rootScope.licenseMissing ? ("Tower " + i18n._("License")) : i18n._("License Management");
Wait('start');
ConfigService.getConfig().then(function(config){
$scope.license = config;
$scope.license.version = config.version.split('-')[0];
$scope.time = {};
$scope.time.remaining = calcDaysRemaining($scope.license.license_info.time_remaining);
$scope.time.expiresOn = calcExpiresOn($scope.time.remaining);
$scope.valid = CheckLicense.valid($scope.license.license_info);
$scope.compliant = $scope.license.license_info.compliant;
Wait('stop');
});
};
init();
$scope.getKey = function(event){
// Mimic HTML5 spec, show filename
$scope.fileName = event.target.files[0].name;
@ -73,43 +115,5 @@ export default
});
});
};
var calcDaysRemaining = function(seconds){
// calculate the number of days remaining on the license
var duration = moment.duration(seconds, 'seconds').asDays();
duration = Math.floor(duration);
if(duration < 0 ){
duration = 0;
}
duration = (duration!==1) ? `${duration} Days` : `${duration} Day`;
return duration;
};
var calcExpiresOn = function(days){
// calculate the expiration date of the license
days = parseInt(days);
return moment().add(days, 'days').calendar();
};
var init = function(){
// license/license.partial.html compares fileName
$scope.fileName = N_("No file selected.");
$scope.title = $rootScope.licenseMissing ? ("Tower " + i18n._("License")) : i18n._("License Management");
Wait('start');
ConfigService.getConfig().then(function(config){
$scope.license = config;
$scope.license.version = config.version.split('-')[0];
$scope.time = {};
$scope.time.remaining = calcDaysRemaining($scope.license.license_info.time_remaining);
$scope.time.expiresOn = calcExpiresOn($scope.time.remaining);
$scope.valid = CheckLicense.valid($scope.license.license_info);
$scope.compliant = $scope.license.license_info.compliant;
Wait('stop');
});
};
var reset = function(){
document.getElementById('License-form').reset();
};
init();
}
];
];

View File

@ -94,10 +94,10 @@ export default
},
issuePendoIdentity: function () {
var config,
options,
var options,
c = ConfigService.get(),
config = c.license_info;
config = c.license_info;
config.analytics_status = c.analytics_status;
config.version = c.version;
config.ansible_version = c.ansible_version;
@ -114,7 +114,7 @@ export default
});
}
else {
$log.debug('Pendo is turned off.')
$log.debug('Pendo is turned off.');
}
}
};

View File

@ -1,3 +1,5 @@
/* jshint ignore:start */
/*
* pendo.io Angular Module
*
@ -25,7 +27,7 @@
setTimeout(waitFn, delay);
}
};
angular.module('pendolytics', [])
.provider('$pendolytics', function() {

View File

@ -11,15 +11,11 @@
* Controller for handling permissions adding
*/
export default ['$scope', '$rootScope', 'ProcessErrors', 'generateList', 'GetBasePath',
export default ['$scope', '$rootScope', 'ProcessErrors', 'GetBasePath',
'SelectionInit', 'templateUrl', '$state', 'Rest', '$q', 'Wait',
function($scope, $rootScope, ProcessErrors, generateList, GetBasePath,
function($scope, $rootScope, ProcessErrors, GetBasePath,
SelectionInit, templateUrl, $state, Rest, $q, Wait) {
$scope.$on("linkLists", function() {
var generator = generateList,
//list = AddUserList,
id = "addUsersList",
mode = "add";
if ($state.current.name.split(".")[1] === "users") {
$scope.addType = "Users";
@ -36,7 +32,7 @@ function($scope, $rootScope, ProcessErrors, generateList, GetBasePath,
$scope.add_users = $scope.$parent.add_user_dataset.results;
$scope.selectedItems = [];
$scope.$on('selectedOrDeselected', (item)=>{
$scope.$on('selectedOrDeselected', ()=>{
throw {name: 'NotYetImplemented'};
});
}

View File

@ -1,4 +1,3 @@
import routes from './organizations-linkout.route';
import AddUsers from './addUsers/main';
export default angular.module('organizationsLinkout', [AddUsers.name]);

View File

@ -4,7 +4,6 @@
* All Rights Reserved
*************************************************/
import { templateUrl } from '../../shared/template-url/template-url.factory';
import OrganizationsAdmins from './controllers/organizations-admins.controller';
import OrganizationsInventories from './controllers/organizations-inventories.controller';
import OrganizationsJobTemplates from './controllers/organizations-job-templates.controller';

View File

@ -34,8 +34,8 @@ export default {
views: {
'list@': {
templateUrl: templateUrl('portal-mode/portal-mode-layout'),
controller: ['$scope', '$rootScope', '$state', '$stateParams', 'GetBasePath', 'QuerySet', 'jobsDataset',
function($scope, $rootScope, $state, $stateParams, GetBasePath, qs, Dataset) {
controller: ['$scope', '$rootScope', '$state', '$stateParams', 'GetBasePath', 'QuerySet',
function($scope, $rootScope, $state, $stateParams, GetBasePath, qs) {
let path;
init();

View File

@ -90,9 +90,8 @@ export default [
});
};
base = $location.path().replace(/^\//, '').split('/')[0];
console.log(base)
if (base === 'management_jobs') {
$scope.base = base = 'system_job_templates';
}

View File

@ -142,10 +142,10 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
.factory('GenerateForm', ['$rootScope', '$location', '$compile', 'generateList',
'Attr', 'Icon', 'Column',
'NavigationLink', 'HelpCollapse', 'DropDown', 'Empty', 'SelectIcon',
'Store', 'ActionButton', '$log', 'i18n', '$timeout',
'Store', 'ActionButton', '$log', 'i18n',
function ($rootScope, $location, $compile, GenerateList,
Attr, Icon, Column, NavigationLink, HelpCollapse,
DropDown, Empty, SelectIcon, Store, ActionButton, $log, i18n, $timeout) {
DropDown, Empty, SelectIcon, Store, ActionButton, $log, i18n) {
return {
setForm: function (form) { this.form = form; },
@ -1079,6 +1079,7 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
html += (field.ngChange) ? this.attr(field, 'ngChange') : "";
html += (field.readonly) ? "disabled " : "";
html += (field.required) ? "required " : "";
html += (field.ngshow) ? "ng-show=\"" + field.ngShow + "\" " : "";
if(field.awRequiredWhen) {
html += field.awRequiredWhen.init ? "data-awrequired-init=\"" + field.awRequiredWhen.init + "\" " : "";
html += field.awRequiredWhen.reqExpression ? "aw-required-when=\"" + field.awRequiredWhen.reqExpression + "\" " : "";
@ -1233,8 +1234,8 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
// Generate HTML. Do NOT call this function directly. Called by inject(). Returns an HTML
// string to be injected into the current view.
//
var btn, button, fld, field, html = '', i, section, group,
tab, sectionShow, offset, width,ngDisabled, itm;
var btn, button, fld, field, html = '', section, group,
sectionShow, offset, width,ngDisabled, itm;
// title and exit button
if(!(this.form.showHeader !== undefined && this.form.showHeader === false)) {

View File

@ -1,4 +1,4 @@
export default ['templateUrl', '$compile', function(templateUrl, $compile) {
export default ['templateUrl', function(templateUrl) {
return {
restrict: 'E',
replace: true,

View File

@ -10,7 +10,6 @@ import lookupModal from './lookup/main';
import smartSearch from './smart-search/main';
import paginate from './paginate/main';
import columnSort from './column-sort/main';
import title from './title.directive';
import lodashAsPromised from './lodash-as-promised';
import stringFilters from './string-filters/main';
import truncatedText from './truncated-text.directive';

View File

@ -50,9 +50,9 @@ export default ['$scope', '$stateParams', '$state', '$filter', 'GetBasePath', 'Q
}
function calcDataRange() {
if ($scope.current() == 1 && $scope.dataset.count < parseInt(pageSize)) {
if ($scope.current() === 1 && $scope.dataset.count < parseInt(pageSize)) {
return `1 - ${$scope.dataset.count}`;
} else if ($scope.current() == 1) {
} else if ($scope.current() === 1) {
return `1 - ${pageSize}`;
} else {
let floor = (($scope.current() - 1) * parseInt(pageSize)) + 1;

View File

@ -1,5 +1,5 @@
export default ['$q', 'Rest', 'ProcessErrors', '$rootScope', 'Wait', 'DjangoSearchModel', '$cacheFactory', 'GetBasePath',
function($q, Rest, ProcessErrors, $rootScope, Wait, DjangoSearchModel, $cacheFactory, GetBasePath) {
export default ['$q', 'Rest', 'ProcessErrors', '$rootScope', 'Wait', 'DjangoSearchModel', '$cacheFactory',
function($q, Rest, ProcessErrors, $rootScope, Wait, DjangoSearchModel, $cacheFactory) {
return {
// kick off building a model for a specific endpoint
// this is usually a list's basePath

View File

@ -50,13 +50,13 @@ export default
$log.debug('Websocket Error Logged: ' + error); //log errors
};
self.socket.onconnecting = function (event) {
self.socket.onconnecting = function () {
self.checkStatus();
$log.debug('Websocket reconnecting');
needsResubscribing = true;
};
self.socket.onclose = function (event) {
self.socket.onclose = function () {
self.checkStatus();
$log.debug(`Websocket disconnected`);
};

View File

@ -9,8 +9,6 @@
* generateLookupNodes - Attaches to a form node. Builds an abstract '*.lookup' node with field-specific 'lookup.*' children e.g. {name: 'projects.add.lookup.organizations', ...}
*/
import { templateUrl } from './template-url/template-url.factory';
export default ['$injector', '$stateExtender', '$log', function($injector, $stateExtender, $log) {
return {
/**

View File

@ -13,7 +13,7 @@ export default ['workflowData',
workflowNodes,
$scope,
ParseTypeChange,
ParseVariableString,
ParseVariableString
) {
var getTowerLinks = function() {
var getTowerLink = function(key) {
@ -48,10 +48,10 @@ export default ['workflowData',
$scope.verbosity_label = getTowerLabel('verbosity');
};
var getTotalHostCount = function(count) {
return Object
.keys(count).reduce((acc, i) => acc += count[i], 0);
};
// var getTotalHostCount = function(count) {
// return Object
// .keys(count).reduce((acc, i) => acc += count[i], 0);
// };
// put initially resolved request data on scope
$scope.workflow = workflowData;
@ -101,60 +101,60 @@ export default ['workflowData',
// This is where the async updates to the UI actually happen.
// Flow is event queue munging in the service -> $scope setting in here
var processEvent = function(event) {
// put the event in the queue
eventQueue.populate(event).then(mungedEvent => {
// make changes to ui based on the event returned from the queue
if (mungedEvent.changes) {
mungedEvent.changes.forEach(change => {
// we've got a change we need to make to the UI!
// update the necessary scope and make the change
if (change === 'startTime' && !$scope.workflow.start) {
$scope.workflow.start = mungedEvent.startTime;
}
if (change === 'count' && !$scope.countFinished) {
// for all events that affect the host count,
// update the status bar as well as the host
// count badge
$scope.count = mungedEvent.count;
$scope.hostCount = getTotalHostCount(mungedEvent
.count);
}
if (change === 'playCount') {
$scope.playCount = mungedEvent.playCount;
}
if (change === 'taskCount') {
$scope.taskCount = mungedEvent.taskCount;
}
if (change === 'finishedTime' && !$scope.workflow.finished) {
$scope.workflow.finished = mungedEvent.finishedTime;
}
if (change === 'countFinished') {
// the playbook_on_stats event actually lets
// us know that we don't need to iteratively
// look at event to update the host counts
// any more.
$scope.countFinished = true;
}
if(change === 'stdout'){
angular
.element(".JobResultsStdOut-stdoutContainer")
.append($compile(mungedEvent
.stdout)($scope));
}
});
}
// the changes have been processed in the ui, mark it in the queue
eventQueue.markProcessed(event);
});
};
// var processEvent = function(event) {
// // put the event in the queue
// eventQueue.populate(event).then(mungedEvent => {
// // make changes to ui based on the event returned from the queue
// if (mungedEvent.changes) {
// mungedEvent.changes.forEach(change => {
// // we've got a change we need to make to the UI!
// // update the necessary scope and make the change
// if (change === 'startTime' && !$scope.workflow.start) {
// $scope.workflow.start = mungedEvent.startTime;
// }
//
// if (change === 'count' && !$scope.countFinished) {
// // for all events that affect the host count,
// // update the status bar as well as the host
// // count badge
// $scope.count = mungedEvent.count;
// $scope.hostCount = getTotalHostCount(mungedEvent
// .count);
// }
//
// if (change === 'playCount') {
// $scope.playCount = mungedEvent.playCount;
// }
//
// if (change === 'taskCount') {
// $scope.taskCount = mungedEvent.taskCount;
// }
//
// if (change === 'finishedTime' && !$scope.workflow.finished) {
// $scope.workflow.finished = mungedEvent.finishedTime;
// }
//
// if (change === 'countFinished') {
// // the playbook_on_stats event actually lets
// // us know that we don't need to iteratively
// // look at event to update the host counts
// // any more.
// $scope.countFinished = true;
// }
//
// if(change === 'stdout'){
// angular
// .element(".JobResultsStdOut-stdoutContainer")
// .append($compile(mungedEvent
// .stdout)($scope));
// }
// });
// }
//
// // the changes have been processed in the ui, mark it in the queue
// eventQueue.markProcessed(event);
// });
// };
// PULL! grab completed event data and process each event
// TODO: implement retry logic in case one of these requests fails
@ -174,10 +174,10 @@ export default ['workflowData',
// };
// getEvents($scope.job.related.job_events);
// Processing of job_events messages from the websocket
$scope.$on(`ws-job_events-${$scope.workflow.id}`, function(e, data) {
processEvent(data);
});
// // Processing of job_events messages from the websocket
// $scope.$on(`ws-job_events-${$scope.workflow.id}`, function(e, data) {
// processEvent(data);
// });
// Processing of job-status messages from the websocket
$scope.$on(`ws-jobs`, function(e, data) {

View File

@ -59,7 +59,8 @@ export default {
defer.resolve(data.results);
})
.error(function() {
defer.resolve(data);
// TODO: handle this
//defer.resolve(data);
});
return defer.promise;
}],

View File

@ -18,7 +18,7 @@ export default ['$q', 'Prompt', '$filter', 'Wait', 'Rest', '$state', 'ProcessErr
</div>`,
action: function() {
Wait('start');
Rest.setUrl(job.url);
Rest.setUrl(workflow.url);
Rest.destroy()
.success(function() {
Wait('stop');