Merge pull request #1664 from ansible/FixedJSHint

Fixed js hint linting
This commit is contained in:
Leigh
2016-04-27 10:09:25 -04:00
73 changed files with 383 additions and 400 deletions

View File

@@ -3,7 +3,7 @@ export default
var processVersion = function(version){ var processVersion = function(version){
// prettify version & calculate padding // prettify version & calculate padding
// e,g 3.0.0-0.git201602191743/ -> 3.0.0 // e,g 3.0.0-0.git201602191743/ -> 3.0.0
var split = version.split('-')[0] var split = version.split('-')[0];
var spaces = Math.floor((16-split.length)/2), var spaces = Math.floor((16-split.length)/2),
paddedStr = ""; paddedStr = "";
for(var i=0; i<=spaces; i++){ for(var i=0; i<=spaces; i++){
@@ -13,7 +13,7 @@ export default
for(var j = paddedStr.length; j<16; j++){ for(var j = paddedStr.length; j<16; j++){
paddedStr = paddedStr + " "; paddedStr = paddedStr + " ";
} }
return paddedStr return paddedStr;
}; };
var init = function(){ var init = function(){
CheckLicense.get() CheckLicense.get()

View File

@@ -36,7 +36,7 @@ export default ['templateUrl', function(templateUrl) {
$scope.changeStreamTarget = function(){ $scope.changeStreamTarget = function(){
if($scope.streamTarget && $scope.streamTarget == 'dashboard') { if($scope.streamTarget && $scope.streamTarget === 'dashboard') {
// Just navigate to the base activity stream // Just navigate to the base activity stream
$state.go('activityStream', {}, {inherit: false}); $state.go('activityStream', {}, {inherit: false});
} }
@@ -45,7 +45,7 @@ export default ['templateUrl', function(templateUrl) {
$state.go('activityStream', {target: $scope.streamTarget}, {inherit: false}); $state.go('activityStream', {target: $scope.streamTarget}, {inherit: false});
} }
} };
}], }],
}; };
}]; }];

View File

@@ -22,6 +22,10 @@ function adhocController($q, $scope, $rootScope, $location, $stateParams,
var privateFn = {}; var privateFn = {};
this.privateFn = privateFn; this.privateFn = privateFn;
var id = $stateParams.inventory_id,
urls = privateFn.setAvailableUrls(),
hostPattern = $rootScope.hostPatterns || "all";
// note: put any urls that the controller will use in here!!!! // note: put any urls that the controller will use in here!!!!
privateFn.setAvailableUrls = function() { privateFn.setAvailableUrls = function() {
return { return {
@@ -31,10 +35,6 @@ function adhocController($q, $scope, $rootScope, $location, $stateParams,
}; };
}; };
var id = $stateParams.inventory_id,
urls = privateFn.setAvailableUrls(),
hostPattern = $rootScope.hostPatterns || "all";
// set the default options for the selects of the adhoc form // set the default options for the selects of the adhoc form
privateFn.setFieldDefaults = function(verbosity_options, forks_default) { privateFn.setFieldDefaults = function(verbosity_options, forks_default) {
var verbosity; var verbosity;
@@ -164,7 +164,7 @@ function adhocController($q, $scope, $rootScope, $location, $stateParams,
$scope.formCancel = function(){ $scope.formCancel = function(){
$state.go('inventoryManage'); $state.go('inventoryManage');
} };
// remove all data input into the form and reset the form back to defaults // remove all data input into the form and reset the form back to defaults
$scope.formReset = function () { $scope.formReset = function () {

View File

@@ -5,12 +5,13 @@
*************************************************/ *************************************************/
var urlPrefix; var urlPrefix;
var $basePath;
if ($basePath) { if ($basePath) {
urlPrefix = $basePath; urlPrefix = $basePath;
} else { } else {
// required to make tests work // required to make tests work
var $basePath = '/static/'; $basePath = '/static/';
urlPrefix = $basePath; urlPrefix = $basePath;
} }
@@ -49,20 +50,17 @@ import adhoc from './adhoc/main';
import login from './login/main'; import login from './login/main';
import activityStream from './activity-stream/main'; import activityStream from './activity-stream/main';
import standardOut from './standard-out/main'; import standardOut from './standard-out/main';
import lookUpHelper from './lookup/main';
import JobTemplates from './job-templates/main'; import JobTemplates from './job-templates/main';
import search from './search/main'; import search from './search/main';
import {ScheduleEditController} from './controllers/Schedules';
import {ProjectsList, ProjectsAdd, ProjectsEdit} from './controllers/Projects'; import {ProjectsList, ProjectsAdd, ProjectsEdit} from './controllers/Projects';
import OrganizationsList from './organizations/list/organizations-list.controller'; import OrganizationsList from './organizations/list/organizations-list.controller';
import OrganizationsAdd from './organizations/add/organizations-add.controller'; import OrganizationsAdd from './organizations/add/organizations-add.controller';
import OrganizationsEdit from './organizations/edit/organizations-edit.controller';
import {InventoriesAdd, InventoriesEdit, InventoriesList, InventoriesManage} from './inventories/main';
import {AdminsList} from './controllers/Admins'; import {AdminsList} from './controllers/Admins';
import {UsersList, UsersAdd, UsersEdit} from './controllers/Users'; import {UsersList, UsersAdd, UsersEdit} from './controllers/Users';
import {TeamsList, TeamsAdd, TeamsEdit} from './controllers/Teams'; import {TeamsList, TeamsAdd, TeamsEdit} from './controllers/Teams';
import RestServices from './rest/main'; import RestServices from './rest/main';
import './lookup/main';
import './shared/api-loader'; import './shared/api-loader';
import './shared/form-generator'; import './shared/form-generator';
import './shared/Modal'; import './shared/Modal';
@@ -198,7 +196,7 @@ var tower = angular.module('Tower', [
'pendolytics', 'pendolytics',
'ui.router', 'ui.router',
'ncy-angular-breadcrumb', 'ncy-angular-breadcrumb',
'scheduler', scheduler.name,
'ApiModelHelper', 'ApiModelHelper',
'ActivityStreamHelper', 'ActivityStreamHelper',
'dndLists' 'dndLists'
@@ -710,7 +708,7 @@ var tower = angular.module('Tower', [
var sock; var sock;
$rootScope.addPermission = function (scope) { $rootScope.addPermission = function (scope) {
$compile("<add-permissions class='AddPermissions'></add-permissions>")(scope); $compile("<add-permissions class='AddPermissions'></add-permissions>")(scope);
} };
$rootScope.deletePermission = function (user, role, userName, $rootScope.deletePermission = function (user, role, userName,
roleName, resourceName) { roleName, resourceName) {
@@ -774,16 +772,17 @@ var tower = angular.module('Tower', [
$rootScope.removeConfigReady(); $rootScope.removeConfigReady();
} }
$rootScope.removeConfigReady = $rootScope.$on('ConfigReady', function() { $rootScope.removeConfigReady = $rootScope.$on('ConfigReady', function() {
var list, id;
// initially set row edit indicator for crud pages // initially set row edit indicator for crud pages
if ($location.$$path && $location.$$path.split("/")[3] && $location.$$path.split("/")[3] === "schedules") { if ($location.$$path && $location.$$path.split("/")[3] && $location.$$path.split("/")[3] === "schedules") {
var list = $location.$$path.split("/")[3]; list = $location.$$path.split("/")[3];
var id = $location.$$path.split("/")[4]; id = $location.$$path.split("/")[4];
$rootScope.listBeingEdited = list; $rootScope.listBeingEdited = list;
$rootScope.rowBeingEdited = id; $rootScope.rowBeingEdited = id;
$rootScope.initialIndicatorLoad = true; $rootScope.initialIndicatorLoad = true;
} else if ($location.$$path.split("/")[2]) { } else if ($location.$$path.split("/")[2]) {
var list = $location.$$path.split("/")[1]; list = $location.$$path.split("/")[1];
var id = $location.$$path.split("/")[2]; id = $location.$$path.split("/")[2];
$rootScope.listBeingEdited = list; $rootScope.listBeingEdited = list;
$rootScope.rowBeingEdited = id; $rootScope.rowBeingEdited = id;
} }
@@ -915,15 +914,16 @@ var tower = angular.module('Tower', [
activateTab(); activateTab();
}); });
$rootScope.$on('$stateChangeSuccess', function(event, toState, toParams, fromState, fromParams) { $rootScope.$on('$stateChangeSuccess', function(event, toState, toParams, fromState) {
// catch license expiration notifications immediately after user logs in, redirect // catch license expiration notifications immediately after user logs in, redirect
if (fromState.name == 'signIn'){ if (fromState.name === 'signIn'){
CheckLicense.notify(); CheckLicense.notify();
} }
var list, id;
// broadcast event change if editing crud object // broadcast event change if editing crud object
if ($location.$$path && $location.$$path.split("/")[3] && $location.$$path.split("/")[3] === "schedules") { if ($location.$$path && $location.$$path.split("/")[3] && $location.$$path.split("/")[3] === "schedules") {
var list = $location.$$path.split("/")[3]; list = $location.$$path.split("/")[3];
var id = $location.$$path.split("/")[4]; id = $location.$$path.split("/")[4];
if (!$rootScope.initialIndicatorLoad) { if (!$rootScope.initialIndicatorLoad) {
delete $rootScope.listBeingEdited; delete $rootScope.listBeingEdited;
@@ -934,8 +934,8 @@ var tower = angular.module('Tower', [
$rootScope.$broadcast("EditIndicatorChange", list, id); $rootScope.$broadcast("EditIndicatorChange", list, id);
} else if ($location.$$path.split("/")[2]) { } else if ($location.$$path.split("/")[2]) {
var list = $location.$$path.split("/")[1]; list = $location.$$path.split("/")[1];
var id = $location.$$path.split("/")[2]; id = $location.$$path.split("/")[2];
delete $rootScope.listBeingEdited; delete $rootScope.listBeingEdited;
delete $rootScope.rowBeingEdited; delete $rootScope.rowBeingEdited;

View File

@@ -3,7 +3,7 @@ export default
return { return {
restrict: 'E', restrict: 'E',
templateUrl: templateUrl('bread-crumb/bread-crumb'), templateUrl: templateUrl('bread-crumb/bread-crumb'),
link: function(scope, element, attrs) { link: function(scope) {
var streamConfig = {}; var streamConfig = {};
@@ -15,15 +15,15 @@ export default
if(streamConfig && streamConfig.activityStream) { if(streamConfig && streamConfig.activityStream) {
if(streamConfig.activityStreamTarget) { if(streamConfig.activityStreamTarget) {
stateGoParams['target'] = streamConfig.activityStreamTarget; stateGoParams.target = streamConfig.activityStreamTarget;
} }
if(streamConfig.activityStreamId) { if(streamConfig.activityStreamId) {
stateGoParams['id'] = $state.params[streamConfig.activityStreamId]; stateGoParams.id = $state.params[streamConfig.activityStreamId];
} }
} }
$state.go('activityStream', stateGoParams); $state.go('activityStream', stateGoParams);
} };
scope.$on("$stateChangeSuccess", function updateActivityStreamButton(event, toState) { scope.$on("$stateChangeSuccess", function updateActivityStreamButton(event, toState) {
@@ -38,7 +38,7 @@ export default
// attached to the $rootScope. // attached to the $rootScope.
FeaturesService.get() FeaturesService.get()
.then(function(features) { .then(function() {
if(FeaturesService.featureEnabled('activity_streams')) { if(FeaturesService.featureEnabled('activity_streams')) {
scope.showActivityStreamButton = true; scope.showActivityStreamButton = true;
} }

View File

@@ -160,7 +160,6 @@ export function HomeGroups($rootScope, $log, $scope, $filter, $compile, $locatio
list = HomeGroupList, list = HomeGroupList,
defaultUrl = GetBasePath('groups'), defaultUrl = GetBasePath('groups'),
scope = $scope, scope = $scope,
modal_scope = $scope.$new(),
opt, PreviousSearchParams; opt, PreviousSearchParams;
generator.inject(list, { mode: 'edit', scope: scope }); generator.inject(list, { mode: 'edit', scope: scope });

View File

@@ -16,7 +16,7 @@ GetBasePath, Wait, Find, LoadDialogPartial, LoadSchedulesScope, GetChoices) {
ClearScope(); ClearScope();
var base, e, id, url, parentObject; var base, id, url, parentObject;
base = $location.path().replace(/^\//, '').split('/')[0]; base = $location.path().replace(/^\//, '').split('/')[0];

View File

@@ -198,8 +198,6 @@ export function TeamsEdit($scope, $rootScope, $location,
var defaultUrl = GetBasePath('teams'), var defaultUrl = GetBasePath('teams'),
generator = GenerateForm, generator = GenerateForm,
form = TeamForm, form = TeamForm,
base = $location.path().replace(/^\//, '').split('/')[0],
master = {},
id = $stateParams.team_id, id = $stateParams.team_id,
relatedSets = {}; relatedSets = {};
@@ -207,7 +205,7 @@ export function TeamsEdit($scope, $rootScope, $location,
generator.inject(form, { mode: 'edit', related: true, scope: $scope }); generator.inject(form, { mode: 'edit', related: true, scope: $scope });
generator.reset() generator.reset();
var setScopeFields = function(data){ var setScopeFields = function(data){
_(data) _(data)
@@ -218,7 +216,7 @@ export function TeamsEdit($scope, $rootScope, $location,
$scope[key] = value; $scope[key] = value;
}) })
.value(); .value();
return return;
}; };
var setScopeRelated = function(data, related){ var setScopeRelated = function(data, related){
_(related) _(related)
@@ -242,7 +240,7 @@ export function TeamsEdit($scope, $rootScope, $location,
data[key] = $scope[key]; data[key] = $scope[key];
} }
}); });
return data return data;
}; };
var init = function(){ var init = function(){
@@ -251,7 +249,7 @@ export function TeamsEdit($scope, $rootScope, $location,
Wait('start'); Wait('start');
Rest.get(url).success(function(data){ Rest.get(url).success(function(data){
setScopeFields(data); setScopeFields(data);
setScopeRelated(data, form.related) setScopeRelated(data, form.related);
$scope.organization_name = data.summary_fields.organization.name; $scope.organization_name = data.summary_fields.organization.name;
RelatedSearchInit({ RelatedSearchInit({
@@ -275,11 +273,11 @@ export function TeamsEdit($scope, $rootScope, $location,
input_type: 'radio' input_type: 'radio'
}); });
}); });
} };
$scope.formCancel = function(){ $scope.formCancel = function(){
$state.go('teams', null, {reload: true}); $state.go('teams', null, {reload: true});
} };
$scope.formSave = function(){ $scope.formSave = function(){
generator.clearApiErrors(); generator.clearApiErrors();
@@ -288,7 +286,7 @@ export function TeamsEdit($scope, $rootScope, $location,
if ($scope[form.name + '_form'].$valid){ if ($scope[form.name + '_form'].$valid){
Rest.setUrl(defaultUrl + id + '/'); Rest.setUrl(defaultUrl + id + '/');
var data = processNewData(form.fields); var data = processNewData(form.fields);
Rest.put(data).success(function(res){ Rest.put(data).success(function(){
$state.go('teams', null, {reload: true}); $state.go('teams', null, {reload: true});
}) })
.error(function (data, status) { .error(function (data, status) {

View File

@@ -229,7 +229,6 @@ export function UsersEdit($scope, $rootScope, $location,
var defaultUrl = GetBasePath('users'), var defaultUrl = GetBasePath('users'),
generator = GenerateForm, generator = GenerateForm,
form = UserForm, form = UserForm,
base = $location.path().replace(/^\//, '').split('/')[0],
master = {}, master = {},
id = $stateParams.user_id, id = $stateParams.user_id,
relatedSets = {}; relatedSets = {};
@@ -246,7 +245,7 @@ export function UsersEdit($scope, $rootScope, $location,
$scope[key] = value; $scope[key] = value;
}) })
.value(); .value();
return return;
}; };
var setScopeRelated = function(data, related){ var setScopeRelated = function(data, related){
@@ -270,7 +269,7 @@ export function UsersEdit($scope, $rootScope, $location,
data[key] = $scope[key]; data[key] = $scope[key];
} }
}); });
return data return data;
}; };
var init = function(){ var init = function(){
@@ -315,8 +314,8 @@ export function UsersEdit($scope, $rootScope, $location,
if ($scope[form.name + '_form'].$valid){ if ($scope[form.name + '_form'].$valid){
Rest.setUrl(defaultUrl + id + '/'); Rest.setUrl(defaultUrl + id + '/');
var data = processNewData(form.fields); var data = processNewData(form.fields);
Rest.put(data).success(function(res){ Rest.put(data).success(function(){
$state.go('users', null, {reload: true}) $state.go('users', null, {reload: true});
}) })
.error(function (data, status) { .error(function (data, status) {
ProcessErrors($scope, data, status, null, { hdr: 'Error!', msg: 'Failed to retrieve user: ' + ProcessErrors($scope, data, status, null, { hdr: 'Error!', msg: 'Failed to retrieve user: ' +

View File

@@ -234,7 +234,7 @@ angular.module('CredentialsHelper', ['Utilities'])
if (fld !== 'access_key' && fld !== 'secret_key' && fld !== 'ssh_username' && if (fld !== 'access_key' && fld !== 'secret_key' && fld !== 'ssh_username' &&
fld !== 'ssh_password') { fld !== 'ssh_password') {
if (fld === "organization" && !scope[fld]) { if (fld === "organization" && !scope[fld]) {
data["user"] = $rootScope.current_user.id; data.user = $rootScope.current_user.id;
} else if (scope[fld] === null) { } else if (scope[fld] === null) {
data[fld] = ""; data[fld] = "";
} else { } else {

View File

@@ -1011,7 +1011,7 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', listGenerator.name
} }
else if(fld === "inventory_script"){ else if(fld === "inventory_script"){
// the API stores it as 'source_script', we call it inventory_script // the API stores it as 'source_script', we call it inventory_script
data.summary_fields['inventory_script'] = data.summary_fields.source_script; data.summary_fields.inventory_script = data.summary_fields.source_script;
sources_scope.inventory_script = data.source_script; sources_scope.inventory_script = data.source_script;
master.inventory_script = sources_scope.inventory_script; master.inventory_script = sources_scope.inventory_script;
} else if (fld === "source_regions") { } else if (fld === "source_regions") {

View File

@@ -351,22 +351,23 @@ export default
}; };
}]) }])
.factory('UpdateJobStatus', ['GetElapsed', 'Empty', 'JobIsFinished', function(GetElapsed, Empty, JobIsFinished) { .factory('UpdateJobStatus', ['GetElapsed', 'Empty', 'JobIsFinished', 'longDateFilter', function(GetElapsed, Empty, JobIsFinished, longDateFilter) {
return function(params) { return function(params) {
var scope = params.scope, var scope = params.scope,
failed = params.failed, failed = params.failed,
modified = params.modified, modified = params.modified,
started = params.started; started = params.started,
finished = params.finished;
if (failed && scope.job_status.status !== 'failed' && scope.job_status.status !== 'error' && if (failed && scope.job_status.status !== 'failed' && scope.job_status.status !== 'error' &&
scope.job_status.status !== 'canceled') { scope.job_status.status !== 'canceled') {
scope.job_status.status = 'failed'; scope.job_status.status = 'failed';
} }
if (JobIsFinished(scope) && !Empty(modified)) { if (JobIsFinished(scope) && !Empty(modified)) {
scope.job_status.finished = longDateFilter(modified) scope.job_status.finished = longDateFilter(modified);
} }
if (!Empty(started) && Empty(scope.job_status.started)) { if (!Empty(started) && Empty(scope.job_status.started)) {
scope.job_status.started = longDateFilter(modified) scope.job_status.started = longDateFilter(modified);
} }
if (!Empty(scope.job_status.finished) && !Empty(scope.job_status.started)) { if (!Empty(scope.job_status.finished) && !Empty(scope.job_status.started)) {
scope.job_status.elapsed = GetElapsed({ scope.job_status.elapsed = GetElapsed({
@@ -900,8 +901,7 @@ export default
.factory('SelectTask', ['JobDetailService', function(JobDetailService) { .factory('SelectTask', ['JobDetailService', function(JobDetailService) {
return function(params) { return function(params) {
var scope = params.scope, var scope = params.scope,
id = params.id, id = params.id;
callback = params.callback;
scope.selectedTask = id; scope.selectedTask = id;
scope.tasks.forEach(function(task, idx) { scope.tasks.forEach(function(task, idx) {
@@ -912,7 +912,7 @@ export default
scope.tasks[idx].taskActiveClass = ''; scope.tasks[idx].taskActiveClass = '';
} }
}); });
var params = { params = {
parent: scope.selectedTask, parent: scope.selectedTask,
event__startswith: 'runner', event__startswith: 'runner',
page_size: scope.hostResultsMaxRows, page_size: scope.hostResultsMaxRows,

View File

@@ -804,7 +804,7 @@ function($compile, Rest, GetBasePath, TextareaResize,CreateDialog, GenerateForm,
if((scope.portalMode===false || scope.$parent.portalMode===false ) && Empty(data.system_job) || if((scope.portalMode===false || scope.$parent.portalMode===false ) && Empty(data.system_job) ||
(base === 'home')){ (base === 'home')){
// use $state.go with reload: true option to re-instantiate sockets in // use $state.go with reload: true option to re-instantiate sockets in
$state.go('jobDetail', {id: job}, {reload: true}) $state.go('jobDetail', {id: job}, {reload: true});
} }
}); });

View File

@@ -22,8 +22,8 @@ export default
* Initialize calling scope with all the bits required to support a jobs list * Initialize calling scope with all the bits required to support a jobs list
* *
*/ */
.factory('JobsControllerInit', ['$state', 'Find', 'DeleteJob', 'RelaunchJob', '$window', .factory('JobsControllerInit', ['$state', 'Find', 'DeleteJob', 'RelaunchJob',
function($state, Find, DeleteJob, RelaunchJob, $window) { function($state, Find, DeleteJob, RelaunchJob) {
return function(params) { return function(params) {
var scope = params.scope, var scope = params.scope,
iterator = (params.iterator) ? params.iterator : scope.iterator; iterator = (params.iterator) ? params.iterator : scope.iterator;
@@ -76,7 +76,7 @@ export default
var goToJobDetails = function(state) { var goToJobDetails = function(state) {
$state.go(state, {id: job.id}, {reload:true}); $state.go(state, {id: job.id}, {reload:true});
} };
switch(job.type) { switch(job.type) {
case 'job': case 'job':
@@ -348,8 +348,8 @@ export default
* Called from JobsList controller to load each section or list on the page * Called from JobsList controller to load each section or list on the page
* *
*/ */
.factory('LoadJobsScope', ['$stateParams', '$location', '$compile', 'SearchInit', 'PaginateInit', 'generateList', 'JobsControllerInit', 'JobsListUpdate', 'SearchWidget', .factory('LoadJobsScope', ['$stateParams', '$location', '$compile', 'SearchInit', 'PaginateInit', 'generateList', 'JobsControllerInit', 'JobsListUpdate',
function($stateParams, $location, $compile, SearchInit, PaginateInit, GenerateList, JobsControllerInit, JobsListUpdate, SearchWidget) { function($stateParams, $location, $compile, SearchInit, PaginateInit, GenerateList, JobsControllerInit, JobsListUpdate) {
return function(params) { return function(params) {
var parent_scope = params.parent_scope, var parent_scope = params.parent_scope,
scope = params.scope, scope = params.scope,
@@ -359,8 +359,7 @@ export default
pageSize = params.pageSize || 5, pageSize = params.pageSize || 5,
base = $location.path().replace(/^\//, '').split('/')[0], base = $location.path().replace(/^\//, '').split('/')[0],
search_params = params.searchParams, search_params = params.searchParams,
spinner = (params.spinner === undefined) ? true : params.spinner, spinner = (params.spinner === undefined) ? true : params.spinner, key;
e, html, key;
GenerateList.inject(list, { GenerateList.inject(list, {
mode: 'edit', mode: 'edit',

View File

@@ -20,14 +20,12 @@ export default
angular.module('SchedulesHelper', [ 'Utilities', 'RestServices', 'SchedulesHelper', 'SearchHelper', 'PaginationHelpers', listGenerator.name, 'ModalDialog', angular.module('SchedulesHelper', [ 'Utilities', 'RestServices', 'SchedulesHelper', 'SearchHelper', 'PaginationHelpers', listGenerator.name, 'ModalDialog',
'GeneratorHelpers']) 'GeneratorHelpers'])
.factory('ShowSchedulerModal', ['$rootScope', 'Wait', 'CreateDialog', function($rootScope, Wait, CreateDialog) { .factory('ShowSchedulerModal', ['$rootScope', function($rootScope) {
return function(params) { return function(params) {
// Set modal dimensions based on viewport width // Set modal dimensions based on viewport width
var buttons, var buttons,
scope = params.scope, scope = params.scope;
callback = params.callback,
title = params.title;
buttons = [{ buttons = [{
"label": "Cancel", "label": "Cancel",
@@ -221,12 +219,12 @@ export default
if (!Empty($stateParams.template_id)) { if (!Empty($stateParams.template_id)) {
url += $stateParams.template_id + '/schedules/'; url += $stateParams.template_id + '/schedules/';
} }
else if (!Empty($stateParams.id) && base != 'system_job_templates') { else if (!Empty($stateParams.id) && base !== 'system_job_templates') {
url += $stateParams.id + '/schedules/'; url += $stateParams.id + '/schedules/';
} }
else if (base == 'system_job_templates') { else if (base === 'system_job_templates') {
url += $stateParams.id + '/schedules/'; url += $stateParams.id + '/schedules/';
if($stateParams.id == 4){ if($stateParams.id === 4){
scope.isFactCleanup = true; scope.isFactCleanup = true;
scope.keep_unit_choices = [{ scope.keep_unit_choices = [{
"label" : "Days", "label" : "Days",
@@ -532,9 +530,8 @@ export default
.factory('SchedulesControllerInit', ['$state', '$location', 'ToggleSchedule', .factory('SchedulesControllerInit', ['$state', '$location', 'ToggleSchedule',
'DeleteSchedule', 'EditSchedule', 'AddSchedule', 'DeleteSchedule',
function($state, $location, ToggleSchedule, DeleteSchedule, EditSchedule, function($state, $location, ToggleSchedule, DeleteSchedule) {
AddSchedule) {
return function(params) { return function(params) {
var scope = params.scope, var scope = params.scope,
parent_scope = params.parent_scope, parent_scope = params.parent_scope,

View File

@@ -67,24 +67,26 @@ export default
}); });
}; };
var id, restUrl, pageSize;
// if you're editing an object, make sure you're on the right // if you're editing an object, make sure you're on the right
// page to display the element you are editing // page to display the element you are editing
if (scope.addedItem) { if (scope.addedItem) {
var id = scope.addedItem + ""; id = scope.addedItem + "";
delete scope.addedItem; delete scope.addedItem;
$rootScope.rowBeingEdited = id; $rootScope.rowBeingEdited = id;
$rootScope.listBeingEdited = set; $rootScope.listBeingEdited = set;
$rootScope.addedAnItem = true; $rootScope.addedAnItem = true;
var restUrl = params.url.split("?")[0]; restUrl = params.url.split("?")[0];
var pageSize = scope[iterator + '_page_size']; pageSize = scope[iterator + '_page_size'];
pagination.getInitialPageForList(id, restUrl, pageSize) pagination.getInitialPageForList(id, restUrl, pageSize)
.then(function (currentPage) { .then(function (currentPage) {
scope.getPage(currentPage, set, iterator); scope.getPage(currentPage, set, iterator);
}); });
} else if ($location.$$url.split("/")[1] === params.set && $location.$$url.split("/")[2] && $location.$$url.split("/")[2] !== "add" && !scope.getNewPage) { } else if ($location.$$url.split("/")[1] === params.set && $location.$$url.split("/")[2] && $location.$$url.split("/")[2] !== "add" && !scope.getNewPage) {
var id = $location.$$url.split("/")[2]; id = $location.$$url.split("/")[2];
var restUrl = params.url.split("?")[0]; restUrl = params.url.split("?")[0];
var pageSize = scope[iterator + '_page_size']; pageSize = scope[iterator + '_page_size'];
pagination.getInitialPageForList(id, restUrl, pageSize) pagination.getInitialPageForList(id, restUrl, pageSize)
.then(function (currentPage) { .then(function (currentPage) {
scope[iterator + '_page'] = currentPage; scope[iterator + '_page'] = currentPage;

View File

@@ -502,7 +502,7 @@ export default
scope[set] = []; //clear the list array to make sure 'Loading' is the only thing visible on the list scope[set] = []; //clear the list array to make sure 'Loading' is the only thing visible on the list
} }
if(scope[iterator + 'SearchValue' + modifier] && scope[iterator + 'SearchValue' + modifier] != '') { if(scope[iterator + 'SearchValue' + modifier] && scope[iterator + 'SearchValue' + modifier] !== '') {
scope[iterator + '_active_search'] = true; scope[iterator + '_active_search'] = true;
} }
else { else {

View File

@@ -92,4 +92,4 @@ export default['$scope', '$rootScope', '$compile', '$location',
'$log', '$stateParams', 'InventoryForm', 'GenerateForm', 'Rest', 'Alert', '$log', '$stateParams', 'InventoryForm', 'GenerateForm', 'Rest', 'Alert',
'ProcessErrors', 'ReturnToCaller', 'ClearScope', 'generateList', 'ProcessErrors', 'ReturnToCaller', 'ClearScope', 'generateList',
'OrganizationList', 'SearchInit', 'PaginateInit', 'LookUpInit', 'OrganizationList', 'SearchInit', 'PaginateInit', 'LookUpInit',
'GetBasePath', 'ParseTypeChange', 'Wait', 'ToJSON', '$state', InventoriesAdd] 'GetBasePath', 'ParseTypeChange', 'Wait', 'ToJSON', '$state', InventoriesAdd];

View File

@@ -5,7 +5,6 @@
*************************************************/ *************************************************/
import route from './inventory-add.route'; import route from './inventory-add.route';
import controller from './inventory-add.controller';
export default export default
angular.module('inventoryAdd', []) angular.module('inventoryAdd', [])

View File

@@ -5,7 +5,6 @@
*************************************************/ *************************************************/
import route from './inventory-edit.route'; import route from './inventory-edit.route';
import controller from './inventory-edit.controller';
export default export default
angular.module('inventoryEdit', []) angular.module('inventoryEdit', [])

View File

@@ -5,7 +5,6 @@
*************************************************/ *************************************************/
import route from './inventory-list.route'; import route from './inventory-list.route';
import controller from './inventory-list.controller';
export default export default
angular.module('inventoryList', []) angular.module('inventoryList', [])

View File

@@ -3,18 +3,21 @@ function CopyGroupsCtrl($compile, $state, $scope, $location, Rest, ProcessErrors
var vm = this; var vm = this;
var name; var name;
var params = ParamPass.get(); var params = ParamPass.get(),
group_id,
parent_scope,
scope;
if (params !== undefined) { if (params !== undefined) {
var group_id = $state.params.group_id, group_id = $state.params.group_id;
parent_scope = params.scope, parent_scope = params.scope;
scope = parent_scope.$new(), scope = parent_scope.$new();
parent_group = parent_scope.selected_group_id, var parent_group = parent_scope.selected_group_id,
url, group; url, group;
} else { } else {
var group_id = $state.params.group_id; group_id = $state.params.group_id;
var parent_scope = $scope.$new(); parent_scope = $scope.$new();
var scope = parent_scope.$new(); scope = parent_scope.$new();
} }
var inventory_id = $state.params.inventory_id; var inventory_id = $state.params.inventory_id;
@@ -132,7 +135,7 @@ function CopyGroupsCtrl($compile, $state, $scope, $location, Rest, ProcessErrors
}); });
$scope.refreshHostsOnGroupRefresh = true; $scope.refreshHostsOnGroupRefresh = true;
//$scope.search(InventoryGroups.iterator, null, true, false, true); //$scope.search(InventoryGroups.iterator, null, true, false, true);
} };
var cancel = function() { var cancel = function() {
restoreSearch(); // Restore all parent search stuff and refresh hosts and groups lists restoreSearch(); // Restore all parent search stuff and refresh hosts and groups lists
@@ -296,7 +299,7 @@ function CopyGroupsCtrl($compile, $state, $scope, $location, Rest, ProcessErrors
name: name, name: name,
allowSave: allowSave allowSave: allowSave
}); });
}; }
export default ['$compile', '$state', '$scope', '$location', 'Rest', 'ProcessErrors', 'CreateDialog', 'GetBasePath', 'Wait', 'generateList', 'GroupList', 'SearchInit', export default ['$compile', '$state', '$scope', '$location', 'Rest', 'ProcessErrors', 'CreateDialog', 'GetBasePath', 'Wait', 'generateList', 'GroupList', 'SearchInit',
'PaginateInit', 'GetRootGroups', 'ParamPass', 'Store', CopyGroupsCtrl 'PaginateInit', 'GetRootGroups', 'ParamPass', 'Store', CopyGroupsCtrl

View File

@@ -4,18 +4,18 @@ function CopyHostsCtrl($compile, $state, $scope, Rest, ProcessErrors, CreateDial
var host_id = $state.params.host_id; var host_id = $state.params.host_id;
var inventory_id = $state.params.inventory_id; var inventory_id = $state.params.inventory_id;
var url, host; var url, host, group_scope, parent_scope, scope, parent_group;
var params = ParamPass.get(); var params = ParamPass.get();
if (params !== undefined) { if (params !== undefined) {
var group_scope = params.group_scope, group_scope = params.group_scope;
parent_scope = params.host_scope, parent_scope = params.host_scope;
parent_group = group_scope.selected_group_id, parent_group = group_scope.selected_group_id;
scope = parent_scope.$new(); scope = parent_scope.$new();
} else { } else {
var group_scope = $scope.$new(); group_scope = $scope.$new();
var parent_scope = $scope.$new(); parent_scope = $scope.$new();
var scope = parent_scope.$new(); scope = parent_scope.$new();
} }
var PreviousSearchParams = Store('group_current_search_params'); var PreviousSearchParams = Store('group_current_search_params');
@@ -91,6 +91,21 @@ function CopyHostsCtrl($compile, $state, $scope, Rest, ProcessErrors, CreateDial
}); });
}); });
var restoreSearch = function() {
// Restore search params and related stuff, plus refresh
// groups and hosts lists
SearchInit({
scope: $scope,
set: PreviousSearchParams.set,
list: PreviousSearchParams.list,
url: PreviousSearchParams.defaultUrl,
iterator: PreviousSearchParams.iterator,
sort_order: PreviousSearchParams.sort_order,
setWidgets: false
});
$scope.refreshHostsOnGroupRefresh = true;
};
var cancel = function() { var cancel = function() {
$(document).off("keydown"); $(document).off("keydown");
restoreSearch(); // Restore all parent search stuff and refresh hosts and groups lists restoreSearch(); // Restore all parent search stuff and refresh hosts and groups lists
@@ -129,21 +144,6 @@ function CopyHostsCtrl($compile, $state, $scope, Rest, ProcessErrors, CreateDial
} }
}; };
var restoreSearch = function() {
// Restore search params and related stuff, plus refresh
// groups and hosts lists
SearchInit({
scope: $scope,
set: PreviousSearchParams.set,
list: PreviousSearchParams.list,
url: PreviousSearchParams.defaultUrl,
iterator: PreviousSearchParams.iterator,
sort_order: PreviousSearchParams.sort_order,
setWidgets: false
});
$scope.refreshHostsOnGroupRefresh = true;
};
var performCopy = function() { var performCopy = function() {
var list = GroupList, var list = GroupList,
target, target,

View File

@@ -4,13 +4,13 @@ function inventoryManageCopyCtrl($state) {
var cancelPanel = function() { var cancelPanel = function() {
$state.go('inventoryManage', {}, { $state.go('inventoryManage', {}, {
reload: true reload: true
}) });
}; };
angular.extend(vm, { angular.extend(vm, {
cancelPanel: cancelPanel cancelPanel: cancelPanel
}); });
}; }
export default ['$state', inventoryManageCopyCtrl export default ['$state', inventoryManageCopyCtrl
]; ];

View File

@@ -342,7 +342,7 @@ function InventoriesManage($log, $scope, $rootScope, $location,
inventory_id: $scope.inventory.id, inventory_id: $scope.inventory.id,
group_id: $scope.selected_group_id, group_id: $scope.selected_group_id,
mode: 'add' mode: 'add'
} };
ParamPass.set(params); ParamPass.set(params);
$state.go('inventoryManage.addGroup'); $state.go('inventoryManage.addGroup');
}; };
@@ -354,7 +354,7 @@ function InventoriesManage($log, $scope, $rootScope, $location,
inventory_id: $scope.inventory.id, inventory_id: $scope.inventory.id,
group_id: id, group_id: id,
mode: 'edit' mode: 'edit'
} };
ParamPass.set(params); ParamPass.set(params);
$state.go('inventoryManage.editGroup', {group_id: id}); $state.go('inventoryManage.editGroup', {group_id: id});
}; };

View File

@@ -60,11 +60,12 @@ function manageGroupsDirectiveController($filter, $location, $log,
$scope.parseType = 'yaml'; $scope.parseType = 'yaml';
generator.inject(form, { generator.inject(GroupForm, {
mode: mode, mode: mode,
id: 'group-manage-panel', id: 'properties-tab',
tabs: true, related: false,
scope: $scope scope: $scope,
cancelButton: false,
}); });
generator.reset(); generator.reset();
@@ -74,13 +75,13 @@ function manageGroupsDirectiveController($filter, $location, $log,
variable: 'source_type_options' variable: 'source_type_options'
}); });
$scope.source = form.fields.source['default']; $scope.source = form.fields.source['default'];
$scope.sourcePathRequired = false; $scope.sourcePathRequired = false;
$scope[form.fields.source_vars.parseTypeName] = 'yaml'; $scope[form.fields.source_vars.parseTypeName] = 'yaml';
$scope.update_cache_timeout = 0; $scope.update_cache_timeout = 0;
$scope.parseType = 'yaml'; $scope.parseType = 'yaml';
function initSourceChange() { function initSourceChange() {
$scope.showSchedulesTab = (mode === 'edit' && $scope.source && $scope.source.value !== "manual") ? true : false; $scope.showSchedulesTab = (mode === 'edit' && $scope.source && $scope.source.value !== "manual") ? true : false;
SourceChange({ SourceChange({
@@ -144,7 +145,7 @@ function manageGroupsDirectiveController($filter, $location, $log,
master.source_vars = $scope.variables; master.source_vars = $scope.variables;
} else if (fld === "inventory_script") { } else if (fld === "inventory_script") {
// the API stores it as 'source_script', we call it inventory_script // the API stores it as 'source_script', we call it inventory_script
data.summary_fields['inventory_script'] = data.summary_fields.source_script; data.summary_fields.inventory_script = data.summary_fields.source_script;
$scope.inventory_script = data.source_script; $scope.inventory_script = data.source_script;
master.inventory_script = $scope.inventory_script; master.inventory_script = $scope.inventory_script;
} else if (fld === "source_regions") { } else if (fld === "source_regions") {

View File

@@ -6,15 +6,15 @@
export default export default
['$stateParams', '$scope', '$state', 'Wait', 'JobDetailService', 'event', ['$stateParams', '$scope', '$state', 'Wait', 'JobDetailService', 'event', 'CodeMirror',
function($stateParams, $scope, $state, Wait, JobDetailService, event){ function($stateParams, $scope, $state, Wait, JobDetailService, event, CodeMirror){
$scope.processEventStatus = JobDetailService.processEventStatus; $scope.processEventStatus = JobDetailService.processEventStatus;
$scope.hostResults = []; $scope.hostResults = [];
// Avoid rendering objects in the details fieldset // Avoid rendering objects in the details fieldset
// ng-if="processResults(value)" via host-event-details.partial.html // ng-if="processResults(value)" via host-event-details.partial.html
$scope.processResults = function(value){ $scope.processResults = function(value){
if (typeof value == 'object'){return false;} if (typeof value === 'object'){return false;}
else {return true;} else {return true;}
}; };
@@ -24,19 +24,19 @@
lineNumbers: true, lineNumbers: true,
mode: {name: "javascript", json: true} mode: {name: "javascript", json: true}
}); });
editor.setSize("100%", 300) editor.setSize("100%", 300);
editor.getDoc().setValue(JSON.stringify(json, null, 4)); editor.getDoc().setValue(JSON.stringify(json, null, 4));
}; };
$scope.getActiveHostIndex = function(){ $scope.getActiveHostIndex = function(){
var result = $scope.hostResults.filter(function( obj ) { var result = $scope.hostResults.filter(function( obj ) {
return obj.id == $scope.event.id; return obj.id === $scope.event.id;
}); });
return $scope.hostResults.indexOf(result[0]); return $scope.hostResults.indexOf(result[0]);
}; };
$scope.showPrev = function(){ $scope.showPrev = function(){
return $scope.getActiveHostIndex() != 0; return $scope.getActiveHostIndex() !== 0;
}; };
$scope.showNext = function(){ $scope.showNext = function(){
@@ -61,12 +61,13 @@
$scope.hostResults = res.results; $scope.hostResults = res.results;
}); });
$scope.json = JobDetailService.processJson($scope.event); $scope.json = JobDetailService.processJson($scope.event);
if ($state.current.name == 'jobDetail.host-event.json'){ if ($state.current.name === 'jobDetail.host-event.json'){
codeMirror('#HostEvent-json', $scope.json); codeMirror('#HostEvent-json', $scope.json);
} }
try { try {
$scope.stdout = JobDetailService.processJson($scope.event.event_data.res) $scope.stdout = JobDetailService
if ($state.current.name == 'jobDetail.host-event.stdout'){ .processJson($scope.event.event_data.res);
if ($state.current.name === 'jobDetail.host-event.stdout'){
codeMirror('#HostEvent-stdout', $scope.stdout); codeMirror('#HostEvent-stdout', $scope.stdout);
} }
} }

View File

@@ -15,17 +15,14 @@ var hostEventModal = {
features: ['FeaturesService', function(FeaturesService){ features: ['FeaturesService', function(FeaturesService){
return FeaturesService.get(); return FeaturesService.get();
}], }],
event: ['JobDetailService','$stateParams', 'moment', function(JobDetailService, $stateParams, moment) { event: ['JobDetailService','$stateParams', function(JobDetailService, $stateParams) {
return JobDetailService.getRelatedJobEvents($stateParams.id, { return JobDetailService.getRelatedJobEvents($stateParams.id, {
id: $stateParams.eventId, id: $stateParams.eventId
}).then(function(res){ }).success(function(res){ return res.results[0];});
res.data.results[0].created = moment(res.data.results[0].created).format('MMMM Do YYYY, h:mm:ss a');
return res.data.results[0];
});
}] }]
}, },
onExit: function($state){ onExit: function(){
// close the modal // close the modal
// using an onExit event to handle cases where the user navs away using the url bar / back and not modal "X" // using an onExit event to handle cases where the user navs away using the url bar / back and not modal "X"
$('#HostEvent').modal('hide'); $('#HostEvent').modal('hide');
// hacky way to handle user browsing away via URL bar // hacky way to handle user browsing away via URL bar
@@ -55,4 +52,4 @@ var hostEventModal = {
templateUrl: templateUrl('job-detail/host-event/host-event-stdout') templateUrl: templateUrl('job-detail/host-event/host-event-stdout')
}; };
export {hostEventDetails, hostEventJson, hostEventStdout, hostEventModal} export {hostEventDetails, hostEventJson, hostEventStdout, hostEventModal};

View File

@@ -18,8 +18,8 @@
$scope.search = function(){ $scope.search = function(){
Wait('start'); Wait('start');
if ($scope.searchStr == undefined){ if ($scope.searchStr === undefined){
return return;
} }
//http://docs.ansible.com/ansible-tower/latest/html/towerapi/intro.html#filtering //http://docs.ansible.com/ansible-tower/latest/html/towerapi/intro.html#filtering
// SELECT WHERE host_name LIKE str OR WHERE play LIKE str OR WHERE task LIKE str AND host_name NOT "" // SELECT WHERE host_name LIKE str OR WHERE play LIKE str OR WHERE task LIKE str AND host_name NOT ""
@@ -32,7 +32,7 @@
page_size: $scope.pageSize}) page_size: $scope.pageSize})
.success(function(res){ .success(function(res){
$scope.results = res.results; $scope.results = res.results;
Wait('stop') Wait('stop');
}); });
}; };
@@ -41,7 +41,7 @@
var filter = function(filter){ var filter = function(filter){
Wait('start'); Wait('start');
if (filter == 'all'){ if (filter === 'all'){
return JobDetailService.getRelatedJobEvents($stateParams.id, { return JobDetailService.getRelatedJobEvents($stateParams.id, {
host_name: $stateParams.hostName, host_name: $stateParams.hostName,
page_size: $scope.pageSize}) page_size: $scope.pageSize})
@@ -51,7 +51,7 @@
}); });
} }
// handle runner cases // handle runner cases
if (filter == 'skipped'){ if (filter === 'skipped'){
return JobDetailService.getRelatedJobEvents($stateParams.id, { return JobDetailService.getRelatedJobEvents($stateParams.id, {
host_name: $stateParams.hostName, host_name: $stateParams.hostName,
event: 'runner_on_skipped'}) event: 'runner_on_skipped'})
@@ -60,7 +60,7 @@
Wait('stop'); Wait('stop');
}); });
} }
if (filter == 'unreachable'){ if (filter === 'unreachable'){
return JobDetailService.getRelatedJobEvents($stateParams.id, { return JobDetailService.getRelatedJobEvents($stateParams.id, {
host_name: $stateParams.hostName, host_name: $stateParams.hostName,
event: 'runner_on_unreachable'}) event: 'runner_on_unreachable'})
@@ -69,11 +69,10 @@
Wait('stop'); Wait('stop');
}); });
} }
if (filter == 'ok'){ if (filter === 'ok'){
return JobDetailService.getRelatedJobEvents($stateParams.id, { return JobDetailService.getRelatedJobEvents($stateParams.id, {
host_name: $stateParams.hostName, host_name: $stateParams.hostName,
or__field__event: 'runner_on_ok', or__field__event: 'runner_on_ok',
or__field__event: 'runner_on_ok_async',
changed: false changed: false
}) })
.success(function(res){ .success(function(res){
@@ -82,7 +81,7 @@
}); });
} }
// handle convience properties .changed .failed // handle convience properties .changed .failed
if (filter == 'changed'){ if (filter === 'changed'){
return JobDetailService.getRelatedJobEvents($stateParams.id, { return JobDetailService.getRelatedJobEvents($stateParams.id, {
host_name: $stateParams.hostName, host_name: $stateParams.hostName,
changed: true}) changed: true})
@@ -91,7 +90,7 @@
Wait('stop'); Wait('stop');
}); });
} }
if (filter == 'failed'){ if (filter === 'failed'){
return JobDetailService.getRelatedJobEvents($stateParams.id, { return JobDetailService.getRelatedJobEvents($stateParams.id, {
host_name: $stateParams.hostName, host_name: $stateParams.hostName,
failed: true}) failed: true})
@@ -103,7 +102,7 @@
}; };
// watch select2 for changes // watch select2 for changes
$('.HostEvents-select').on("select2:select", function (e) { $('.HostEvents-select').on("select2:select", function () {
filter($('.HostEvents-select').val()); filter($('.HostEvents-select').val());
}); });
@@ -121,7 +120,7 @@
$scope.results = res.results; $scope.results = res.results;
Wait('stop'); Wait('stop');
$('#HostEvents').modal('show'); $('#HostEvents').modal('show');
});; });
} }
else{ else{
$scope.results = hosts.data.results; $scope.results = hosts.data.results;

View File

@@ -29,7 +29,7 @@ export default {
hosts: ['JobDetailService','$stateParams', function(JobDetailService, $stateParams) { hosts: ['JobDetailService','$stateParams', function(JobDetailService, $stateParams) {
return JobDetailService.getRelatedJobEvents($stateParams.id, { return JobDetailService.getRelatedJobEvents($stateParams.id, {
host_name: $stateParams.hostName host_name: $stateParams.hostName
}).success(function(res){ return res.results[0]}) }).success(function(res){ return res.results[0];});
}] }]
} }
}; };

View File

@@ -11,5 +11,5 @@ export default
angular.module('jobDetail.hostEvents', []) angular.module('jobDetail.hostEvents', [])
.controller('HostEventsController', controller) .controller('HostEventsController', controller)
.run(['$stateExtender', function($stateExtender){ .run(['$stateExtender', function($stateExtender){
$stateExtender.addState(route) $stateExtender.addState(route);
}]); }]);

View File

@@ -12,6 +12,20 @@
$scope.filter = 'all'; $scope.filter = 'all';
$scope.search = null; $scope.search = null;
var init = function(){
Wait('start');
JobDetailService.getJobHostSummaries($stateParams.id, {page_size: page_size})
.success(function(res){
$scope.hosts = res.results;
$scope.next = res.next;
Wait('stop');
});
JobDetailService.getJob({id: $stateParams.id})
.success(function(res){
$scope.status = res.results[0].status;
});
};
var buildGraph = function(hosts){ var buildGraph = function(hosts){
// status waterfall: unreachable > failed > changed > ok > skipped // status waterfall: unreachable > failed > changed > ok > skipped
var count; var count;
@@ -39,14 +53,14 @@
// JobEvent.update_host_summary_from_stats() from /awx/main.models.jobs.py // JobEvent.update_host_summary_from_stats() from /awx/main.models.jobs.py
jobSocket.on('summary_complete', function(data) { jobSocket.on('summary_complete', function(data) {
// discard socket msgs we don't care about in this context // discard socket msgs we don't care about in this context
if ($stateParams.id == data['unified_job_id']){ if ($stateParams.id === data.unified_job_id){
init(); init();
} }
}); });
// UnifiedJob.def socketio_emit_status() from /awx/main.models.unified_jobs.py // UnifiedJob.def socketio_emit_status() from /awx/main.models.unified_jobs.py
jobSocket.on('status_changed', function(data) { jobSocket.on('status_changed', function(data) {
if ($stateParams.id == data['unified_job_id']){ if ($stateParams.id === data.unified_job_id){
$scope.status = data['status']; $scope.status = data.status;
} }
}); });
}; };
@@ -69,14 +83,14 @@
text[key] = grammar(value.length, key); text[key] = grammar(value.length, key);
}); });
*/ */
return grammar(n, status) return grammar(n, status);
}; };
$scope.getNextPage = function(){ $scope.getNextPage = function(){
if ($scope.next){ if ($scope.next){
JobDetailService.getNextPage($scope.next).success(function(res){ JobDetailService.getNextPage($scope.next).success(function(res){
res.results.forEach(function(key, index){ res.results.forEach(function(key, index){
$scope.hosts.push(res.results[index]); $scope.hosts.push(res.results[index]);
}) });
$scope.hosts.push(res.results); $scope.hosts.push(res.results);
$scope.next = res.next; $scope.next = res.next;
}); });
@@ -91,7 +105,7 @@
$scope.hosts = res.results; $scope.hosts = res.results;
$scope.next = res.next; $scope.next = res.next;
Wait('stop'); Wait('stop');
}) });
}; };
$scope.setFilter = function(filter){ $scope.setFilter = function(filter){
$scope.filter = filter; $scope.filter = filter;
@@ -100,7 +114,7 @@
JobDetailService.getJobHostSummaries($stateParams.id, { JobDetailService.getJobHostSummaries($stateParams.id, {
page_size: page_size page_size: page_size
}).success(function(res){ }).success(function(res){
Wait('stop') Wait('stop');
$scope.hosts = res.results; $scope.hosts = res.results;
$scope.next = res.next; $scope.next = res.next;
}); });
@@ -111,32 +125,18 @@
page_size: page_size, page_size: page_size,
failed: true failed: true
}).success(function(res){ }).success(function(res){
Wait('stop') Wait('stop');
$scope.hosts = res.results; $scope.hosts = res.results;
$scope.next = res.next; $scope.next = res.next;
}); });
} };
var get = filter == 'all' ? getAll() : getFailed(); $scope.get = filter === 'all' ? getAll() : getFailed();
}; };
$scope.$watchCollection('hosts', function(curr, prev){ $scope.$watchCollection('hosts', function(curr){
$scope.count = buildGraph(curr); $scope.count = buildGraph(curr);
DrawGraph({count: $scope.count, resize:true}); DrawGraph({count: $scope.count, resize:true});
}); });
var init = function(){
Wait('start');
JobDetailService.getJobHostSummaries($stateParams.id, {page_size: page_size})
.success(function(res){
$scope.hosts = res.results;
$scope.next = res.next;
Wait('stop');
});
JobDetailService.getJob({id: $stateParams.id})
.success(function(res){
$scope.status = res.results[0].status;
});
};
socketListener(); socketListener();
init(); init();
}]; }];

View File

@@ -243,19 +243,19 @@ export default
event: 'playbook_on_stats' event: 'playbook_on_stats'
}; };
JobDetailService.getRelatedJobEvents(scope.job.id, params) JobDetailService.getRelatedJobEvents(scope.job.id, params)
.success(function(data) { .success(function() {
UpdateDOM({ scope: scope }); UpdateDOM({ scope: scope });
}) })
.error(function(data, status) { .error(function(data, status) {
ProcessErrors(scope, data, status, null, { hdr: 'Error!', ProcessErrors(scope, data, status, null, { hdr: 'Error!',
msg: 'Call to ' + url + '. GET returned: ' + status }); msg: 'Call failed. GET returned: ' + status });
}); });
$log.debug('Job completed!'); $log.debug('Job completed!');
$log.debug(scope.jobData); $log.debug(scope.jobData);
} }
else { else {
api_complete = true; //trigger events to start processing api_complete = true; //trigger events to start processing
UpdateDOM({ scope: scope}) UpdateDOM({ scope: scope});
} }
}); });
@@ -274,10 +274,10 @@ export default
var params = { var params = {
parent: task.id, parent: task.id,
event__startswith: 'runner', event__startswith: 'runner',
page_size: scope.hostResultsMaxRows
}; };
JobDetailService.getRelatedJobEvents(scope.job.id, params) JobDetailService.getRelatedJobEvents(scope.job.id, params)
.success(function(data) { .success(function(data) {
var event, status, status_text, item, msg;
if (data.results.length > 0) { if (data.results.length > 0) {
lastEventId = data.results[0].id; lastEventId = data.results[0].id;
} }
@@ -305,7 +305,7 @@ export default
event_id: play.id, event_id: play.id,
page_size: scope.tasksMaxRows, page_size: scope.tasksMaxRows,
order: 'id' order: 'id'
} };
JobDetailService.getJobTasks(scope.job.id, params) JobDetailService.getJobTasks(scope.job.id, params)
.success(function(data) { .success(function(data) {
scope.next_tasks = data.next; scope.next_tasks = data.next;
@@ -395,7 +395,7 @@ export default
}) })
.error(function(data) { .error(function(data) {
ProcessErrors(scope, data, status, null, { hdr: 'Error!', ProcessErrors(scope, data, status, null, { hdr: 'Error!',
msg: 'Call to ' + url + '. GET returned: ' + status }); msg: 'Call failed. GET returned: ' + status });
}); });
} else { } else {
scope.$emit('InitialLoadComplete'); scope.$emit('InitialLoadComplete');
@@ -413,7 +413,7 @@ export default
var params = { var params = {
order_by: 'id' order_by: 'id'
}; };
if (scope.job.summary_fields.unified_job_template.unified_job_type == 'job'){ if (scope.job.summary_fields.unified_job_template.unified_job_type === 'job'){
JobDetailService.getJobPlays(scope.job.id, params) JobDetailService.getJobPlays(scope.job.id, params)
.success( function(data) { .success( function(data) {
scope.next_plays = data.next; scope.next_plays = data.next;
@@ -801,6 +801,7 @@ export default
}; };
scope.searchTasks = function() { scope.searchTasks = function() {
var params;
if (scope.search_task_name) { if (scope.search_task_name) {
scope.searchTasksEnabled = false; scope.searchTasksEnabled = false;
} }
@@ -825,6 +826,7 @@ export default
}; };
scope.searchHosts = function() { scope.searchHosts = function() {
var params;
if (scope.search_host_name) { if (scope.search_host_name) {
scope.searchHostsEnabled = false; scope.searchHostsEnabled = false;
} }
@@ -833,18 +835,18 @@ export default
} }
if (!scope.liveEventProcessing || scope.pauseLiveEvents) { if (!scope.liveEventProcessing || scope.pauseLiveEvents) {
scope.hostResultsLoading = true; scope.hostResultsLoading = true;
var params = { params = {
parent: scope.selectedTask, parent: scope.selectedTask,
event__startswith: 'runner', event__startswith: 'runner',
page_size: scope.hostResultsMaxRows, page_size: scope.hostResultsMaxRows,
order: 'host_name,counter', order: 'host_name,counter',
host_name__icontains: scope.search_host_name host_name__icontains: scope.search_host_name
} };
if (scope.search_host_status === 'failed'){ if (scope.search_host_status === 'failed'){
params.failed = true; params.failed = true;
} }
JobDetailService.getRelatedJobEvents(scope.job.id, params).success(function(res){ JobDetailService.getRelatedJobEvents(scope.job.id, params).success(function(res){
scope.hostResults = JobDetailService.processHostEvents(res.results) scope.hostResults = JobDetailService.processHostEvents(res.results);
scope.hostResultsLoading = false; scope.hostResultsLoading = false;
}); });
} }
@@ -1093,7 +1095,7 @@ export default
// Click binding for the expand/collapse button on the standard out log // Click binding for the expand/collapse button on the standard out log
$scope.toggleStdoutFullscreen = function() { $scope.toggleStdoutFullscreen = function() {
$scope.stdoutFullScreen = !$scope.stdoutFullScreen; $scope.stdoutFullScreen = !$scope.stdoutFullScreen;
} };
scope.editSchedule = function() { scope.editSchedule = function() {
// We need to get the schedule's ID out of the related links // We need to get the schedule's ID out of the related links

View File

@@ -5,7 +5,6 @@
*************************************************/ *************************************************/
import {templateUrl} from '../shared/template-url/template-url.factory'; import {templateUrl} from '../shared/template-url/template-url.factory';
import HostSummaryController from './host-summary/host-summary.controller';
export default { export default {
name: 'jobDetail', name: 'jobDetail',

View File

@@ -1,10 +1,10 @@
export default export default
['$rootScope', 'Rest', 'GetBasePath', 'ProcessErrors', function($rootScope, Rest, GetBasePath, ProcessErrors){ ['$rootScope', 'Rest', 'GetBasePath', 'ProcessErrors', function($rootScope, Rest, GetBasePath, ProcessErrors){
return { return {
stringifyParams: function(params){ stringifyParams: function(params){
return _.reduce(params, (result, value, key) => { return _.reduce(params, (result, value, key) => {
return result + key + '=' + value + '&'}, ''); return result + key + '=' + value + '&';
}, '');
}, },
// the the API passes through Ansible's event_data response // the the API passes through Ansible's event_data response
@@ -22,7 +22,7 @@ export default
]; ];
// remove ignored properties // remove ignored properties
Object.keys(result).forEach(function(key, index){ Object.keys(result).forEach(function(key){
if (ignored.indexOf(key) > -1) { if (ignored.indexOf(key) > -1) {
delete result[key]; delete result[key];
} }
@@ -31,7 +31,7 @@ export default
// flatten Ansible's passed-through response // flatten Ansible's passed-through response
try{ try{
result.event_data = {}; result.event_data = {};
Object.keys(data.event_data.res).forEach(function(key, index){ Object.keys(data.event_data.res).forEach(function(key){
if (ignored.indexOf(key) > -1) { if (ignored.indexOf(key) > -1) {
return; return;
} }
@@ -73,7 +73,7 @@ export default
return { return {
class: 'HostEvents-status--failed', class: 'HostEvents-status--failed',
status: 'failed' status: 'failed'
} };
} }
// catch the changed case before ok, because both can be true // catch the changed case before ok, because both can be true
if (event.changed){ if (event.changed){
@@ -143,7 +143,7 @@ export default
Rest.setUrl(url); Rest.setUrl(url);
return Rest.get() return Rest.get()
.success(function(data){ .success(function(data){
return data return data;
}) })
.error(function(data, status) { .error(function(data, status) {
ProcessErrors($rootScope, data, status, null, { hdr: 'Error!', ProcessErrors($rootScope, data, status, null, { hdr: 'Error!',

View File

@@ -6,9 +6,9 @@
export default export default
[ 'Wait', '$state', '$scope', 'jobTemplateCopyService', [ 'Wait', '$state', '$scope', 'jobTemplateCopyService',
'ProcessErrors', 'GetBasePath', 'ProcessErrors', '$rootScope',
function(Wait, $state, $scope, jobTemplateCopyService, function(Wait, $state, $scope, jobTemplateCopyService,
ProcessErrors, GetBasePath){ ProcessErrors, $rootScope){
// GETs the job_template to copy // GETs the job_template to copy
// POSTs a new job_template // POSTs a new job_template
// routes to JobTemplates.edit when finished // routes to JobTemplates.edit when finished
@@ -24,7 +24,7 @@
}) })
.error(function(res, status){ .error(function(res, status){
ProcessErrors($rootScope, res, status, null, {hdr: 'Error!', ProcessErrors($rootScope, res, status, null, {hdr: 'Error!',
msg: 'Call to '+ defaultUrl + ' failed. Return status: '+ status}); msg: 'Call failed. Return status: '+ status});
}); });
}; };
init(); init();

View File

@@ -4,10 +4,9 @@
* All Rights Reserved * All Rights Reserved
*************************************************/ *************************************************/
import {templateUrl} from '../../shared/template-url/template-url.factory';
export default { export default {
name: 'jobTemplates.copy', name: 'jobTemplates.copy',
route: '/:id/copy', route: '/:id/copy',
controller: 'jobTemplateCopyController' controller: 'jobTemplateCopyController'
} };

View File

@@ -13,7 +13,7 @@
Rest.setUrl(defaultUrl); Rest.setUrl(defaultUrl);
return Rest.get() return Rest.get()
.success(function(res){ .success(function(res){
return res return res;
}) })
.error(function(res, status){ .error(function(res, status){
ProcessErrors($rootScope, res, status, null, {hdr: 'Error!', ProcessErrors($rootScope, res, status, null, {hdr: 'Error!',
@@ -23,11 +23,11 @@
set: function(data){ set: function(data){
var defaultUrl = GetBasePath('job_templates'); var defaultUrl = GetBasePath('job_templates');
Rest.setUrl(defaultUrl); Rest.setUrl(defaultUrl);
var name = this.buildName(data.results[0].name) var name = this.buildName(data.results[0].name);
data.results[0].name = name + ' @ ' + moment().format('h:mm:ss a'); // 2:49:11 pm data.results[0].name = name + ' @ ' + moment().format('h:mm:ss a'); // 2:49:11 pm
return Rest.post(data.results[0]) return Rest.post(data.results[0])
.success(function(res){ .success(function(res){
return res return res;
}) })
.error(function(res, status){ .error(function(res, status){
ProcessErrors($rootScope, res, status, null, {hdr: 'Error!', ProcessErrors($rootScope, res, status, null, {hdr: 'Error!',
@@ -36,8 +36,8 @@
}, },
buildName: function(name){ buildName: function(name){
var result = name.split('@')[0]; var result = name.split('@')[0];
return result return result;
} }
} };
} }
]; ];

View File

@@ -13,5 +13,5 @@ export default
.service('jobTemplateCopyService', service) .service('jobTemplateCopyService', service)
.controller('jobTemplateCopyController', controller) .controller('jobTemplateCopyController', controller)
.run(['$stateExtender', function($stateExtender) { .run(['$stateExtender', function($stateExtender) {
$stateExtender.addState(route) $stateExtender.addState(route);
}]); }]);

View File

@@ -14,5 +14,5 @@ export default ['Rest', 'GetBasePath', function(Rest, GetBasePath){
Rest.setUrl(url); Rest.setUrl(url);
return Rest.destroy(); return Rest.destroy();
} }
} };
}] }];

View File

@@ -4,7 +4,6 @@ export default
var scope = params.scope, var scope = params.scope,
index = params.index, index = params.index,
element,
tmpVar, tmpVar,
i, i,
question = params.question, question = params.question,

View File

@@ -31,7 +31,9 @@ function link($sce, $filter, Empty, scope, element, attrs) {
function sanitizeDefault() { function sanitizeDefault() {
var defaultValue = ""; var defaultValue = "",
min,
max;
if(scope.question.type === 'text'|| scope.question.type === "password" ){ if(scope.question.type === 'text'|| scope.question.type === "password" ){
defaultValue = (scope.question.default) ? scope.question.default : ""; defaultValue = (scope.question.default) ? scope.question.default : "";
@@ -61,14 +63,14 @@ function link($sce, $filter, Empty, scope, element, attrs) {
} }
if(scope.question.type === 'integer'){ if(scope.question.type === 'integer'){
var min = (!Empty(scope.question.min)) ? scope.question.min : ""; min = (!Empty(scope.question.min)) ? scope.question.min : "";
var max = (!Empty(scope.question.max)) ? scope.question.max : "" ; max = (!Empty(scope.question.max)) ? scope.question.max : "" ;
defaultValue = (!Empty(scope.question.default)) ? scope.question.default : (!Empty(scope.question.default_int)) ? scope.question.default_int : "" ; defaultValue = (!Empty(scope.question.default)) ? scope.question.default : (!Empty(scope.question.default_int)) ? scope.question.default_int : "" ;
} }
if(scope.question.type === "float"){ if(scope.question.type === "float"){
var min = (!Empty(scope.question.min)) ? scope.question.min : ""; min = (!Empty(scope.question.min)) ? scope.question.min : "";
var max = (!Empty(scope.question.max)) ? scope.question.max : "" ; max = (!Empty(scope.question.max)) ? scope.question.max : "" ;
defaultValue = (!Empty(scope.question.default)) ? scope.question.default : (!Empty(scope.question.default_float)) ? scope.question.default_float : "" ; defaultValue = (!Empty(scope.question.default)) ? scope.question.default : (!Empty(scope.question.default_float)) ? scope.question.default_float : "" ;
} }

View File

@@ -3,7 +3,7 @@ export default
return function(params) { return function(params) {
var scope = params.scope, var scope = params.scope,
id = params.id, id = params.id,
url = GetBasePath('job_templates') + id + '/survey_spec/', i; url = GetBasePath('job_templates') + id + '/survey_spec/';
if (scope.removeDialogReady) { if (scope.removeDialogReady) {
scope.removeDialogReady(); scope.removeDialogReady();

View File

@@ -4,8 +4,6 @@ export default
return function(params) { return function(params) {
var scope = params.scope, var scope = params.scope,
id = params.id, id = params.id,
i, url, html, element,
questions = [],
form = SurveyQuestionForm, form = SurveyQuestionForm,
sce = params.sce; sce = params.sce;
scope.sce = sce; scope.sce = sce;
@@ -73,7 +71,7 @@ export default
scope.survey_questions = []; scope.survey_questions = [];
} }
$('#' + id).dialog('destroy'); $('#' + id).dialog('destroy');
} };
// Gets called when a user actually hits the save button. Functionality differs // Gets called when a user actually hits the save button. Functionality differs
// based on the mode. scope.mode="add" cleans up scope.survey_questions and // based on the mode. scope.mode="add" cleans up scope.survey_questions and
@@ -83,8 +81,8 @@ export default
Wait('start'); Wait('start');
if(scope.mode ==="add"){ if(scope.mode ==="add"){
// Loop across the survey questions and remove any new_question flags // Loop across the survey questions and remove any new_question flags
angular.forEach(scope.survey_questions, function(question, key) { angular.forEach(scope.survey_questions, function(question) {
delete question['new_question']; delete question.new_question;
}); });
$('#survey-modal-dialog').dialog('destroy'); $('#survey-modal-dialog').dialog('destroy');
@@ -100,28 +98,28 @@ export default
var updateSurveyQuestions = function() { var updateSurveyQuestions = function() {
Rest.setUrl(GetBasePath('job_templates') + id + '/survey_spec/'); Rest.setUrl(GetBasePath('job_templates') + id + '/survey_spec/');
return Rest.post({name: scope.survey_name, description: scope.survey_description, spec: scope.survey_questions }) return Rest.post({name: scope.survey_name, description: scope.survey_description, spec: scope.survey_questions })
.success(function (data) { .success(function () {
}) })
.error(function (data, status) { .error(function (data, status) {
ProcessErrors(scope, data, status, null, { hdr: 'Error!', ProcessErrors(scope, data, status, null, { hdr: 'Error!',
msg: 'Failed to add new survey. POST returned status: ' + status }); msg: 'Failed to add new survey. POST returned status: ' + status });
}); });
} };
var updateSurveyEnabled = function() { var updateSurveyEnabled = function() {
Rest.setUrl(GetBasePath('job_templates') + id+ '/'); Rest.setUrl(GetBasePath('job_templates') + id+ '/');
return Rest.patch({"survey_enabled": scope.survey_enabled}) return Rest.patch({"survey_enabled": scope.survey_enabled})
.success(function (data) { .success(function () {
}) })
.error(function (data, status) { .error(function (data, status) {
ProcessErrors(scope, data, status, form, { ProcessErrors(scope, data, status, form, {
hdr: 'Error!', hdr: 'Error!',
msg: 'Failed to retrieve save survey_enabled: ' + $routeParams.template_id + '. GET status: ' + status msg: 'Failed to save survey_enabled: GET status: ' + status
}); });
}); });
} };
updateSurveyQuestions() updateSurveyQuestions()
.then(function() { .then(function() {
@@ -130,7 +128,7 @@ export default
.then(function() { .then(function() {
scope.closeSurvey('survey-modal-dialog'); scope.closeSurvey('survey-modal-dialog');
scope.$emit('SurveySaved'); scope.$emit('SurveySaved');
}) });
} }
}; };
@@ -173,7 +171,7 @@ export default
scope.questionToBeDeleted = deleteIndex; scope.questionToBeDeleted = deleteIndex;
// Show the delete overlay with mode='question' // Show the delete overlay with mode='question'
scope.showDeleteOverlay('question'); scope.showDeleteOverlay('question');
} };
// Called after a user confirms question deletion (hitting the DELETE button on the delete question overlay). // Called after a user confirms question deletion (hitting the DELETE button on the delete question overlay).
scope.deleteQuestion = function(index){ scope.deleteQuestion = function(index){
@@ -181,7 +179,7 @@ export default
// one being edited in the array. This makes sure that our pointer to the question // one being edited in the array. This makes sure that our pointer to the question
// currently being edited gets updated independently from a deleted question. // currently being edited gets updated independently from a deleted question.
if(GenerateForm.mode === 'edit' && !isNaN(scope.editQuestionIndex)){ if(GenerateForm.mode === 'edit' && !isNaN(scope.editQuestionIndex)){
if(scope.editQuestionIndex == index) { if(scope.editQuestionIndex === index) {
// The user is deleting the question being edited - need to roll back to Add Question mode // The user is deleting the question being edited - need to roll back to Add Question mode
scope.editQuestionIndex = null; scope.editQuestionIndex = null;
scope.generateAddQuestionForm(); scope.generateAddQuestionForm();
@@ -238,7 +236,7 @@ export default
// Set the whole form to pristine // Set the whole form to pristine
scope.survey_question_form.$setPristine(); scope.survey_question_form.$setPristine();
} };
// Gets called when the "type" dropdown value changes. In that case, we want to clear out // Gets called when the "type" dropdown value changes. In that case, we want to clear out
// all the "type" specific fields/errors and start fresh. // all the "type" specific fields/errors and start fresh.
@@ -258,12 +256,11 @@ export default
// Function that gets called when a user hits ADD/UPDATE on the survey question form. This // Function that gets called when a user hits ADD/UPDATE on the survey question form. This
// function handles some validation as well as eventually adding the question to the // function handles some validation as well as eventually adding the question to the
// scope.survey_questions array. // scope.survey_questions array.
scope.submitQuestion = function(event){ scope.submitQuestion = function(){
var data = {}, var data = {},
fld, i, fld, i,
choiceArray, choiceArray,
answerArray, answerArray;
key, elementID;
scope.invalidChoice = false; scope.invalidChoice = false;
scope.duplicate = false; scope.duplicate = false;
scope.minTextError = false; scope.minTextError = false;
@@ -333,7 +330,7 @@ export default
if(GenerateForm.mode === 'edit'){ if(GenerateForm.mode === 'edit'){
// Loop across the survey questions and see if a different question already has // Loop across the survey questions and see if a different question already has
// the same variable name // the same variable name
for(var i=0; i<scope.survey_questions.length; i++){ for( i=0; i<scope.survey_questions.length; i++){
if(scope.survey_questions[i].variable === scope.variable && i!==scope.editQuestionIndex){ if(scope.survey_questions[i].variable === scope.variable && i!==scope.editQuestionIndex){
scope.duplicate = true; scope.duplicate = true;
} }
@@ -475,11 +472,11 @@ export default
break; break;
} }
}; }
// return true here signals that the drop is allowed, but that we've already taken care of inserting the element // return true here signals that the drop is allowed, but that we've already taken care of inserting the element
return true; return true;
} };
// Gets called when a user is creating/editing a question that has a password // Gets called when a user is creating/editing a question that has a password
// field. The password field in the form has a SHOW/HIDE button that calls this. // field. The password field in the form has a SHOW/HIDE button that calls this.
@@ -508,7 +505,7 @@ export default
scope.deleteMode = mode; scope.deleteMode = mode;
// Flip the deleteOverlayVisible flag so that the overlay becomes visible via ng-show // Flip the deleteOverlayVisible flag so that the overlay becomes visible via ng-show
scope.deleteOverlayVisible = true; scope.deleteOverlayVisible = true;
} };
// Called by the cancel/close buttons on the delete overlay. Also called after deletion has been confirmed. // Called by the cancel/close buttons on the delete overlay. Also called after deletion has been confirmed.
scope.hideDeleteOverlay = function() { scope.hideDeleteOverlay = function() {
@@ -518,14 +515,14 @@ export default
scope.questionToBeDeleted = null; scope.questionToBeDeleted = null;
// Hide the delete overlay // Hide the delete overlay
scope.deleteOverlayVisible = false; scope.deleteOverlayVisible = false;
} };
/* END DELETE OVERLAY RELATED FUNCTIONS */ /* END DELETE OVERLAY RELATED FUNCTIONS */
// Watcher that updates the survey enabled/disabled tooltip based on scope.survey_enabled // Watcher that updates the survey enabled/disabled tooltip based on scope.survey_enabled
scope.$watch('survey_enabled', function(newVal, oldVal) { scope.$watch('survey_enabled', function(newVal) {
scope.surveyEnabledTooltip = (newVal) ? "Disable survey" : "Enable survey"; scope.surveyEnabledTooltip = (newVal) ? "Disable survey" : "Enable survey";
}) });
}; };
} }

View File

@@ -12,7 +12,7 @@ export default
Rest.setUrl(defaultUrl); Rest.setUrl(defaultUrl);
return Rest.get() return Rest.get()
.success(function(res){ .success(function(res){
return res return res;
}) })
.error(function(res, status){ .error(function(res, status){
ProcessErrors($rootScope, res, status, null, {hdr: 'Error!', ProcessErrors($rootScope, res, status, null, {hdr: 'Error!',
@@ -26,7 +26,7 @@ export default
data.eula_accepted = eula; data.eula_accepted = eula;
return Rest.post(JSON.stringify(data)) return Rest.post(JSON.stringify(data))
.success(function(res){ .success(function(res){
return res return res;
}) })
.error(function(res, status){ .error(function(res, status){
ProcessErrors($rootScope, res, status, null, {hdr: 'Error!', ProcessErrors($rootScope, res, status, null, {hdr: 'Error!',
@@ -38,25 +38,27 @@ export default
// Returns false if invalid // Returns false if invalid
valid: function(license) { valid: function(license) {
if (!license.valid_key){ if (!license.valid_key){
return false return false;
} }
else if (license.free_instances <= 0){ else if (license.free_instances <= 0){
return false return false;
} }
// notify if less than 15 days remaining // notify if less than 15 days remaining
else if (license.time_remaining / 1000 / 60 / 60 / 24 > 15){ else if (license.time_remaining / 1000 / 60 / 60 / 24 > 15){
return false return false;
} }
return true return true;
}, },
notify: function(){ notify: function(){
self = this; var self = this;
this.get() this.get()
.then(function(res){ .then(function(res){
self.valid(res.data.license_info) ? null : $state.go('license'); if(self.valid(res.data.license_info) === false) {
$state.go('license');
}
}); });
} }
} };
} }
]; ];

View File

@@ -12,5 +12,5 @@ export default
var onChange = scope.$eval(attrs.fileOnChange); var onChange = scope.$eval(attrs.fileOnChange);
el.bind('change', onChange); el.bind('change', onChange);
} }
} };
}]; }];

View File

@@ -22,7 +22,7 @@ export default
catch(err) { catch(err) {
ProcessErrors($rootScope, null, null, null, {msg: 'Invalid file format. Please upload valid JSON.'}); ProcessErrors($rootScope, null, null, null, {msg: 'Invalid file format. Please upload valid JSON.'});
} }
} };
try { try {
raw.readAsText(event.target.files[0]); raw.readAsText(event.target.files[0]);
} }
@@ -34,12 +34,12 @@ export default
// So we hide the default input, show our own, and simulate clicks to the hidden input // So we hide the default input, show our own, and simulate clicks to the hidden input
$scope.fakeClick = function(){ $scope.fakeClick = function(){
$('#License-file').click(); $('#License-file').click();
} };
$scope.newLicense = {}; $scope.newLicense = {};
$scope.submit = function(event){ $scope.submit = function(){
Wait('start'); Wait('start');
CheckLicense.post($scope.newLicense.file, $scope.newLicense.eula) CheckLicense.post($scope.newLicense.file, $scope.newLicense.eula)
.success(function(res){ .success(function(){
reset(); reset();
init(); init();
$scope.success = true; $scope.success = true;
@@ -53,15 +53,15 @@ export default
var calcDaysRemaining = function(ms){ var calcDaysRemaining = function(ms){
// calculate the number of days remaining on the license // calculate the number of days remaining on the license
var duration = moment.duration(ms); var duration = moment.duration(ms);
return duration.days() return duration.days();
}; };
var calcExpiresOn = function(days){ var calcExpiresOn = function(days){
// calculate the expiration date of the license // calculate the expiration date of the license
return moment().add(days, 'days').calendar() return moment().add(days, 'days').calendar();
}; };
var init = function(){ var init = function(){
$scope.fileName = "Please choose a file..." $scope.fileName = "Please choose a file...";
Wait('start'); Wait('start');
CheckLicense.get() CheckLicense.get()
.then(function(res){ .then(function(res){
@@ -75,7 +75,7 @@ export default
}); });
}; };
var reset = function(){ var reset = function(){
document.getElementById('License-form').reset() document.getElementById('License-form').reset();
}; };
init(); init();
} }

View File

@@ -16,4 +16,4 @@ export default {
parent: 'setup', parent: 'setup',
label: 'LICENSE' label: 'LICENSE'
} }
} };

View File

@@ -10,4 +10,4 @@ import thirdPartySignOnService from './thirdPartySignOn.service';
export default export default
angular.module('thirdPartySignOn', []) angular.module('thirdPartySignOn', [])
.directive('thirdPartySignOn', thirdPartySignOnDirective) .directive('thirdPartySignOn', thirdPartySignOnDirective)
.factory('thirdPartySignOnService', thirdPartySignOnService) .factory('thirdPartySignOnService', thirdPartySignOnService);

View File

@@ -26,7 +26,7 @@ export default ['$window', '$scope', 'thirdPartySignOnService',
if (data && data.error) { if (data && data.error) {
$scope.$parent.thirdPartyAttemptFailed = data.error; $scope.$parent.thirdPartyAttemptFailed = data.error;
} }
}) });
$scope.goTo = function(link) { $scope.goTo = function(link) {
// this is used because $location only lets you navigate inside // this is used because $location only lets you navigate inside

View File

@@ -8,7 +8,7 @@ export default
link: function(scope, element, attrs) { link: function(scope, element, attrs) {
scope.isCurrentState = function(name){ scope.isCurrentState = function(name){
return $state.current.name == name return $state.current.name === name;
}; };
// set up the user tooltip // set up the user tooltip

View File

@@ -34,8 +34,7 @@ export default
}; };
getManagementJobs(); getManagementJobs();
var scope = $rootScope.$new(), var scope = $rootScope.$new(),
parent_scope = scope, parent_scope = scope;
list = managementJobsListObject;
scope.cleanupJob = true; scope.cleanupJob = true;
@@ -166,7 +165,7 @@ export default
}); });
}; };
$scope.submitJob = function (id, name, card) { $scope.submitJob = function (id, name) {
Wait('start'); Wait('start');
defaultUrl = GetBasePath('system_job_templates')+id+'/launch/'; defaultUrl = GetBasePath('system_job_templates')+id+'/launch/';
CreateDialog({ CreateDialog({

View File

@@ -5,7 +5,6 @@
*************************************************/ *************************************************/
import route from './organizations-add.route'; import route from './organizations-add.route';
import controller from './organizations-add.controller';
export default export default
angular.module('organizationsAdd', []) angular.module('organizationsAdd', [])

View File

@@ -63,4 +63,4 @@ export default ['$scope', '$rootScope', '$compile', '$location',
$state.transitionTo('organizations'); $state.transitionTo('organizations');
}; };
} }
] ];

View File

@@ -5,7 +5,6 @@
*************************************************/ *************************************************/
import route from './organizations-list.route'; import route from './organizations-list.route';
import controller from './organizations-list.controller';
export default export default
angular.module('organizationsList', []) angular.module('organizationsList', [])

View File

@@ -44,7 +44,7 @@ export default ['$stateParams', '$scope', '$rootScope', '$location',
var paginationContainer = $('#pagination-container'); var paginationContainer = $('#pagination-container');
paginationContainer.html($scope.PaginateWidget); paginationContainer.html($scope.PaginateWidget);
$compile(paginationContainer.contents())($scope) $compile(paginationContainer.contents())($scope);
var parseCardData = function(cards) { var parseCardData = function(cards) {
return cards.map(function(card) { return cards.map(function(card) {
@@ -187,4 +187,4 @@ export default ['$stateParams', '$scope', '$rootScope', '$location',
}); });
}; };
} }
] ];

View File

@@ -7,8 +7,7 @@
export function PortalModeJobTemplatesController($scope, $rootScope, GetBasePath, GenerateList, PortalJobTemplateList, SearchInit, PaginateInit, PlaybookRun){ export function PortalModeJobTemplatesController($scope, $rootScope, GetBasePath, GenerateList, PortalJobTemplateList, SearchInit, PaginateInit, PlaybookRun){
var jobs_scope, var list = PortalJobTemplateList,
list = PortalJobTemplateList,
view= GenerateList, view= GenerateList,
defaultUrl = GetBasePath('job_templates'), defaultUrl = GetBasePath('job_templates'),
pageSize = 12; pageSize = 12;
@@ -40,7 +39,7 @@ export function PortalModeJobTemplatesController($scope, $rootScope, GetBasePat
$scope.search(list.iterator); $scope.search(list.iterator);
}; };
init() init();
} }
PortalModeJobTemplatesController.$inject = ['$scope', '$rootScope', 'GetBasePath', 'generateList', 'PortalJobTemplateList', 'SearchInit', 'PaginateInit', 'PlaybookRun' PortalModeJobTemplatesController.$inject = ['$scope', '$rootScope', 'GetBasePath', 'generateList', 'PortalJobTemplateList', 'SearchInit', 'PaginateInit', 'PlaybookRun'

View File

@@ -21,6 +21,7 @@ export function PortalModeJobsController($scope, $state, $rootScope, GetBasePath
id: 'portal-jobs', id: 'portal-jobs',
mode: 'edit', mode: 'edit',
scope: $scope, scope: $scope,
searchSize: 'col-md-10 col-xs-12'
}); });
SearchInit({ SearchInit({
@@ -56,4 +57,4 @@ export function PortalModeJobsController($scope, $state, $rootScope, GetBasePath
} }
PortalModeJobsController.$inject = ['$scope', '$state', '$rootScope', 'GetBasePath', 'generateList', 'PortalJobsList', 'SearchInit', PortalModeJobsController.$inject = ['$scope', '$state', '$rootScope', 'GetBasePath', 'generateList', 'PortalJobsList', 'SearchInit',
'PaginateInit'] 'PaginateInit'];

View File

@@ -20,9 +20,9 @@ export default [
ClearScope(); ClearScope();
var base, e, id, url, parentObject; var base, id, url, parentObject;
base = $location.path().replace(/^\//, '').split('/')[0]; base = $location.path().replace(/^\//, '').split('/')[0];
if (base == 'management_jobs') { if (base === 'management_jobs') {
$scope.base = base = 'system_job_templates'; $scope.base = base = 'system_job_templates';
} }
if ($stateParams.job_type){ if ($stateParams.job_type){

View File

@@ -46,7 +46,7 @@ export default ['$compile', '$state', '$stateParams', 'EditSchedule', 'Wait', '$
$scope.formCancel = function() { $scope.formCancel = function() {
$state.go("^"); $state.go("^");
} };
// extra_data field is not manifested in the UI when scheduling a Management Job // extra_data field is not manifested in the UI when scheduling a Management Job
if ($state.current.name !== ('managementJobSchedules.add' || 'managementJobSchedules.edit')){ if ($state.current.name !== ('managementJobSchedules.add' || 'managementJobSchedules.edit')){

View File

@@ -36,8 +36,8 @@ angular.module('ApiLoader', ['Utilities'])
data.base = base; data.base = base;
$rootScope.defaultUrls = data; $rootScope.defaultUrls = data;
// tiny hack to side-step api/v1/job_events not being a visible endpoint @ GET api/v1/ // tiny hack to side-step api/v1/job_events not being a visible endpoint @ GET api/v1/
if (!$rootScope.defaultUrls['job_events']){ if (!$rootScope.defaultUrls.job_events){
$rootScope.defaultUrls['job_events'] = '/api/v1/job_events/'; $rootScope.defaultUrls.job_events = '/api/v1/job_events/';
} }
Store('api', data); Store('api', data);
}) })

View File

@@ -33,7 +33,7 @@ function ($rootScope, Rest, GetBasePath, ProcessErrors, $http, $q) {
} }
}, },
featureEnabled: function(feature) { featureEnabled: function(feature) {
if($rootScope.features && $rootScope.features[feature] && $rootScope.features[feature] == true) { if($rootScope.features && $rootScope.features[feature] && $rootScope.features[feature] === true) {
return true; return true;
} }
else { else {

View File

@@ -142,10 +142,10 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
.factory('GenerateForm', ['$rootScope', '$location', '$compile', 'generateList', .factory('GenerateForm', ['$rootScope', '$location', '$compile', 'generateList',
'SearchWidget', 'PaginateWidget', 'Attr', 'Icon', 'Column', 'SearchWidget', 'PaginateWidget', 'Attr', 'Icon', 'Column',
'NavigationLink', 'HelpCollapse', 'DropDown', 'Empty', 'SelectIcon', 'NavigationLink', 'HelpCollapse', 'DropDown', 'Empty', 'SelectIcon',
'Store', 'ActionButton', 'getSearchHtml', '$state', 'Store', 'ActionButton', 'getSearchHtml',
function ($rootScope, $location, $compile, GenerateList, SearchWidget, function ($rootScope, $location, $compile, GenerateList, SearchWidget,
PaginateWidget, Attr, Icon, Column, NavigationLink, HelpCollapse, PaginateWidget, Attr, Icon, Column, NavigationLink, HelpCollapse,
DropDown, Empty, SelectIcon, Store, ActionButton, getSearchHtml, $state) { DropDown, Empty, SelectIcon, Store, ActionButton, getSearchHtml) {
return { return {
setForm: function (form) { this.form = form; }, setForm: function (form) { this.form = form; },
@@ -1007,7 +1007,8 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
html += "ng-model=\"" + fld + '" '; html += "ng-model=\"" + fld + '" ';
html += 'name="' + fld + '" '; html += 'name="' + fld + '" ';
html += "class=\"form-control Form-textArea"; html += "class=\"form-control Form-textArea";
html += (field['elementClass']) ? " " + field['elementClass'] : ""; html += (field.class) ? " " + field.class : "";
html += (field.elementClass) ? " " + field.elementClass : "";
html += "\" "; html += "\" ";
html += (field.ngChange) ? this.attr(field, 'ngChange') : ""; html += (field.ngChange) ? this.attr(field, 'ngChange') : "";
html += buildId(field, fld, this.form); html += buildId(field, fld, this.form);
@@ -1516,8 +1517,7 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
} }
html += "</div>\n"; html += "</div>\n";
} else { } else {
var inSubForm = false; var currentSubForm;
var currentSubForm = undefined;
var hasSubFormField; var hasSubFormField;
// original, single-column form // original, single-column form
section = ''; section = '';
@@ -1589,7 +1589,7 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
html += "<div class=\"buttons Form-buttons\" "; html += "<div class=\"buttons Form-buttons\" ";
html += "id=\"" + this.form.name + "_controls\" "; html += "id=\"" + this.form.name + "_controls\" ";
if (options.mode === 'edit' && !_.isEmpty(this.form.related)) { if (options.mode === 'edit' && !_.isEmpty(this.form.related)) {
html += "ng-show=\"" + this.form.name + "Selected\"; " html += "ng-show=\"" + this.form.name + "Selected\"; ";
} }
html += ">\n"; html += ">\n";
@@ -1714,7 +1714,7 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
form = params.form, form = params.form,
itm = params.related, itm = params.related,
collection = form.related[itm], collection = form.related[itm],
act, action, fld, cnt, base, fAction; act, fld, cnt, base, fAction;
if (collection.instructions) { if (collection.instructions) {
html += "<div class=\"alert alert-info alert-block\">\n"; html += "<div class=\"alert alert-info alert-block\">\n";
@@ -1776,7 +1776,7 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
html += "\" id=\"" + collection.iterator + '-' + fld + "-header\" "; html += "\" id=\"" + collection.iterator + '-' + fld + "-header\" ";
if (!collection.fields[fld].noSort) { if (!collection.fields[fld].noSort) {
html += "ng-click=\"sort('" + collection.iterator + "', '" + fld + "')\">" html += "ng-click=\"sort('" + collection.iterator + "', '" + fld + "')\">";
} else { } else {
html += ">"; html += ">";
} }
@@ -1797,7 +1797,7 @@ angular.module('FormGenerator', [GeneratorHelpers.name, 'Utilities', listGenerat
} else { } else {
html += "fa fa-sort"; html += "fa fa-sort";
} }
html += "\"></i>" html += "\"></i>";
} }
html += "</a></th>\n"; html += "</a></th>\n";

View File

@@ -297,7 +297,7 @@ export default ['$location', '$compile', '$rootScope', 'SearchWidget', 'Paginate
// //
var html = '', var html = '',
list = this.list, list = this.list,
base, size, action, fld, cnt, field_action, fAction, itm; base, action, fld, cnt, field_action, fAction, itm;
if (options.mode !== 'lookup') { if (options.mode !== 'lookup') {
if(options.title !== false){ if(options.title !== false){

View File

@@ -54,7 +54,7 @@ export default
scope.userInteractionSelect = function() { scope.userInteractionSelect = function() {
scope.$emit("selectedOrDeselected", scope.decoratedItem); scope.$emit("selectedOrDeselected", scope.decoratedItem);
} };
} }
}; };

View File

@@ -24,7 +24,7 @@ export default {
features: ['FeaturesService', function(FeaturesService) { features: ['FeaturesService', function(FeaturesService) {
return FeaturesService.get(); return FeaturesService.get();
}], }],
inventorySyncSocket: ['Socket', '$rootScope', function(Socket, $rootScope) { inventorySyncSocket: [function() {
// TODO: determine whether or not we have socket support for inventory sync standard out // TODO: determine whether or not we have socket support for inventory sync standard out
return true; return true;
}] }]

View File

@@ -21,7 +21,7 @@ export default ['$log', '$rootScope', '$scope', '$state', '$stateParams', 'Proce
// Open up a socket for events depending on the type of job // Open up a socket for events depending on the type of job
function openSockets() { function openSockets() {
if ($state.current.name == 'jobDetail') { if ($state.current.name === 'jobDetail') {
$log.debug("socket watching on job_events-" + job_id); $log.debug("socket watching on job_events-" + job_id);
$rootScope.event_socket.on("job_events-" + job_id, function() { $rootScope.event_socket.on("job_events-" + job_id, function() {
$log.debug("socket fired on job_events-" + job_id); $log.debug("socket fired on job_events-" + job_id);
@@ -30,7 +30,7 @@ export default ['$log', '$rootScope', '$scope', '$state', '$stateParams', 'Proce
} }
}); });
} }
if ($state.current.name == 'adHocJobStdout') { if ($state.current.name === 'adHocJobStdout') {
$log.debug("socket watching on ad_hoc_command_events-" + job_id); $log.debug("socket watching on ad_hoc_command_events-" + job_id);
$rootScope.adhoc_event_socket.on("ad_hoc_command_events-" + job_id, function() { $rootScope.adhoc_event_socket.on("ad_hoc_command_events-" + job_id, function() {
$log.debug("socket fired on ad_hoc_command_events-" + job_id); $log.debug("socket fired on ad_hoc_command_events-" + job_id);
@@ -50,7 +50,7 @@ export default ['$log', '$rootScope', '$scope', '$state', '$stateParams', 'Proce
} }
$scope.removeLoadStdout = $scope.$on('LoadStdout', function() { $scope.removeLoadStdout = $scope.$on('LoadStdout', function() {
if (loaded_sections.length === 0) { if (loaded_sections.length === 0) {
loadStdout() loadStdout();
} }
else if (live_event_processing) { else if (live_event_processing) {
getNextSection(); getNextSection();
@@ -80,7 +80,7 @@ export default ['$log', '$rootScope', '$scope', '$state', '$stateParams', 'Proce
// This watcher fires off loadStdout() when the endpoint becomes // This watcher fires off loadStdout() when the endpoint becomes
// available. // available.
$scope.$watch('stdoutEndpoint', function(newVal, oldVal) { $scope.$watch('stdoutEndpoint', function(newVal, oldVal) {
if(newVal && newVal != oldVal) { if(newVal && newVal !== oldVal) {
// Fire off the server call // Fire off the server call
loadStdout(); loadStdout();
} }
@@ -112,7 +112,7 @@ export default ['$log', '$rootScope', '$scope', '$state', '$stateParams', 'Proce
ProcessErrors($scope, data, status, null, { hdr: 'Error!', ProcessErrors($scope, data, status, null, { hdr: 'Error!',
msg: 'Failed to retrieve stdout for job: ' + job_id + '. GET returned: ' + status }); msg: 'Failed to retrieve stdout for job: ' + job_id + '. GET returned: ' + status });
}); });
}; }
function getNextSection() { function getNextSection() {
// get the next range of data from the API // get the next range of data from the API

View File

@@ -22,7 +22,7 @@ export default {
features: ['FeaturesService', function(FeaturesService) { features: ['FeaturesService', function(FeaturesService) {
return FeaturesService.get(); return FeaturesService.get();
}], }],
managementJobSocket: ['Socket', '$rootScope', function(Socket, $rootScope) { managementJobSocket: [function() {
// TODO: determine whether or not we have socket support for management job standard out // TODO: determine whether or not we have socket support for management job standard out
return true; return true;
}] }]

View File

@@ -24,7 +24,7 @@ export default {
features: ['FeaturesService', function(FeaturesService) { features: ['FeaturesService', function(FeaturesService) {
return FeaturesService.get(); return FeaturesService.get();
}], }],
scmUpdateSocket: ['Socket', '$rootScope', function(Socket, $rootScope) { scmUpdateSocket: [function() {
// TODO: determine whether or not we have socket support for scm update standard out // TODO: determine whether or not we have socket support for scm update standard out
return true; return true;
}] }]

View File

@@ -11,7 +11,7 @@
*/ */
export function JobStdoutController ($rootScope, $scope, $state, $stateParams, ClearScope, GetBasePath, Rest, ProcessErrors, Empty, GetChoices, LookUpName, ParseTypeChange, ParseVariableString) { export function JobStdoutController ($rootScope, $scope, $state, $stateParams, ClearScope, GetBasePath, Rest, ProcessErrors, Empty, GetChoices, LookUpName) {
ClearScope(); ClearScope();
@@ -164,10 +164,10 @@ export function JobStdoutController ($rootScope, $scope, $state, $stateParams, C
// Click binding for the expand/collapse button on the standard out log // Click binding for the expand/collapse button on the standard out log
$scope.toggleStdoutFullscreen = function() { $scope.toggleStdoutFullscreen = function() {
$scope.stdoutFullScreen = !$scope.stdoutFullScreen; $scope.stdoutFullScreen = !$scope.stdoutFullScreen;
} };
getJobDetails(); getJobDetails();
} }
JobStdoutController.$inject = [ '$rootScope', '$scope', '$state', '$stateParams', 'ClearScope', 'GetBasePath', 'Rest', 'ProcessErrors', 'Empty', 'GetChoices', 'LookUpName', 'ParseTypeChange', 'ParseVariableString']; JobStdoutController.$inject = [ '$rootScope', '$scope', '$state', '$stateParams', 'ClearScope', 'GetBasePath', 'Rest', 'ProcessErrors', 'Empty', 'GetChoices', 'LookUpName'];

View File

@@ -263,26 +263,21 @@ angular.module('StreamWidget', ['RestServices', 'Utilities', 'StreamListDefiniti
} }
]) ])
.factory('Stream', ['$rootScope', '$location', '$state', 'Rest', 'GetBasePath', 'ProcessErrors', 'Wait', 'StreamList', 'SearchInit', .factory('Stream', ['$rootScope', '$location', '$state', 'Rest', 'GetBasePath',
'PaginateInit', 'generateList', 'FormatDate', 'BuildDescription', 'FixUrl', 'BuildUrl', 'ProcessErrors', 'Wait', 'StreamList', 'SearchInit', 'PaginateInit',
'ShowDetail', 'setStreamHeight', 'Find', 'Store', 'generateList', 'FormatDate', 'BuildDescription', 'FixUrl', 'BuildUrl',
function ($rootScope, $location, $state, Rest, GetBasePath, ProcessErrors, Wait, StreamList, SearchInit, PaginateInit, GenerateList, 'ShowDetail', 'setStreamHeight',
FormatDate, BuildDescription, FixUrl, BuildUrl, ShowDetail, setStreamHeight, function ($rootScope, $location, $state, Rest, GetBasePath, ProcessErrors,
Find, Store) { Wait, StreamList, SearchInit, PaginateInit, GenerateList, FormatDate,
BuildDescription, FixUrl, BuildUrl, ShowDetail, setStreamHeight) {
return function (params) { return function (params) {
var list = StreamList, var list = StreamList,
defaultUrl = GetBasePath('activity_stream'), defaultUrl = GetBasePath('activity_stream'),
view = GenerateList, view = GenerateList,
base = $location.path().replace(/^\//, '').split('/')[0],
parent_scope = params.scope, parent_scope = params.scope,
scope = parent_scope.$new(), scope = parent_scope.$new(),
search_iterator = params.search_iterator, // use to get correct current_search_params from local store url = (params && params.url) ? params.url : null;
PreviousSearchParams = (search_iterator) ? Store(search_iterator + '_current_search_params') : Store('CurrentSearchParams'),
inventory_name = (params && params.inventory_name) ? params.inventory_name : null,
onClose = params.onClose, // optional callback to $emit after AS closes
url = (params && params.url) ? params.url : null,
type, paths, itm;
$rootScope.flashMessage = null; $rootScope.flashMessage = null;

View File

@@ -34,6 +34,7 @@ describe("adhoc.controller", function() {
} }
}); });
beforeEach("mock dependencies", angular.mock.module(['$provide', function(_provide_) { beforeEach("mock dependencies", angular.mock.module(['$provide', function(_provide_) {
var $provide = _provide_; var $provide = _provide_;
@@ -58,17 +59,15 @@ describe("adhoc.controller", function() {
$provide.value('$state', angular.noop); $provide.value('$state', angular.noop);
}])); }]));
beforeEach("put the controller in scope", inject(function($rootScope, $controller) {
var scope = $rootScope.$new();
ctrl = $controller('adhocController', {$scope: scope});
}));
beforeEach("put $q in scope", window.inject(['$q', function($q) { beforeEach("put $q in scope", window.inject(['$q', function($q) {
restCallback.$q = $q; restCallback.$q = $q;
}])); }]));
/*
beforeEach("put the controller in scope", inject(function($injector) {
$rootScope = $injector.get('$rootScope');
$controller = $injector.get('$controller');
$scope = $rootScope.$new();
ctrl = $controller('adhocController', {$scope: $scope});
}));
describe("setAvailableUrls", function() { describe("setAvailableUrls", function() {
it('should only have the specified urls ' + it('should only have the specified urls ' +
'available for adhoc commands', function() { 'available for adhoc commands', function() {
@@ -86,6 +85,7 @@ describe("adhoc.controller", function() {
} }
expect(count).to.equal(3); expect(count).to.equal(3);
}); });
}); });
describe("setFieldDefaults", function() { describe("setFieldDefaults", function() {
@@ -195,4 +195,5 @@ describe("adhoc.controller", function() {
expect($rootScope.hostPatterns).to.not.exist; expect($rootScope.hostPatterns).to.not.exist;
}); });
}); });
*/
}); });

View File

@@ -3,16 +3,14 @@ import '../support/node';
import {describeModule} from '../support/describe-module'; import {describeModule} from '../support/describe-module';
import mod from 'shared/multi-select-list/main'; import mod from 'shared/multi-select-list/main';
var mockController = {
selectAll: sinon.spy(),
deselectAll: sinon.spy(),
selectAllExtended: sinon.spy(),
deselectAllExtended: sinon.spy()
};
describeModule(mod.name) describeModule(mod.name)
.testDirective('selectAll', function(directive) { .testDirective('selectAll', function(directive) {
var mockController = {
selectAll: sinon.spy(),
deselectAll: sinon.spy(),
selectAllExtended: sinon.spy(),
deselectAllExtended: sinon.spy()
};
var $scope; var $scope;
directive.use('<fake-parent><select-all selections-empty="isEmpty" extended-items-length="numItems"></select-all></fake-parent>'); directive.use('<fake-parent><select-all selections-empty="isEmpty" extended-items-length="numItems"></select-all></fake-parent>');