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
commit 9d97ce6dff
73 changed files with 383 additions and 400 deletions

View File

@ -3,7 +3,7 @@ export default
var processVersion = function(version){
// prettify version & calculate padding
// 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),
paddedStr = "";
for(var i=0; i<=spaces; i++){
@ -13,7 +13,7 @@ export default
for(var j = paddedStr.length; j<16; j++){
paddedStr = paddedStr + " ";
}
return paddedStr
return paddedStr;
};
var init = function(){
CheckLicense.get()
@ -28,4 +28,4 @@ export default
});
init();
}
];
];

View File

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

View File

@ -22,6 +22,10 @@ function adhocController($q, $scope, $rootScope, $location, $stateParams,
var 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!!!!
privateFn.setAvailableUrls = function() {
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
privateFn.setFieldDefaults = function(verbosity_options, forks_default) {
var verbosity;
@ -164,7 +164,7 @@ function adhocController($q, $scope, $rootScope, $location, $stateParams,
$scope.formCancel = function(){
$state.go('inventoryManage');
}
};
// remove all data input into the form and reset the form back to defaults
$scope.formReset = function () {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1011,7 +1011,7 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', listGenerator.name
}
else if(fld === "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;
master.inventory_script = sources_scope.inventory_script;
} else if (fld === "source_regions") {

View File

@ -351,29 +351,30 @@ 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) {
var scope = params.scope,
failed = params.failed,
modified = params.modified,
started = params.started;
started = params.started,
finished = params.finished;
if (failed && scope.job_status.status !== 'failed' && scope.job_status.status !== 'error' &&
scope.job_status.status !== 'canceled') {
scope.job_status.status = 'failed';
}
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)) {
scope.job_status.started = longDateFilter(modified)
scope.job_status.started = longDateFilter(modified);
}
if (!Empty(scope.job_status.finished) && !Empty(scope.job_status.started)) {
scope.job_status.elapsed = GetElapsed({
start: started,
end: finished
});
}
}
};
}])
@ -900,8 +901,7 @@ export default
.factory('SelectTask', ['JobDetailService', function(JobDetailService) {
return function(params) {
var scope = params.scope,
id = params.id,
callback = params.callback;
id = params.id;
scope.selectedTask = id;
scope.tasks.forEach(function(task, idx) {
@ -912,11 +912,11 @@ export default
scope.tasks[idx].taskActiveClass = '';
}
});
var params = {
params = {
parent: scope.selectedTask,
event__startswith: 'runner',
page_size: scope.hostResultsMaxRows,
order: 'host_name,counter',
order: 'host_name,counter',
};
JobDetailService.getRelatedJobEvents(scope.job.id, params).success(function(res){
scope.hostResults = JobDetailService.processHostEvents(res.results);

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

View File

@ -20,14 +20,12 @@ export default
angular.module('SchedulesHelper', [ 'Utilities', 'RestServices', 'SchedulesHelper', 'SearchHelper', 'PaginationHelpers', listGenerator.name, 'ModalDialog',
'GeneratorHelpers'])
.factory('ShowSchedulerModal', ['$rootScope', 'Wait', 'CreateDialog', function($rootScope, Wait, CreateDialog) {
.factory('ShowSchedulerModal', ['$rootScope', function($rootScope) {
return function(params) {
// Set modal dimensions based on viewport width
var buttons,
scope = params.scope,
callback = params.callback,
title = params.title;
scope = params.scope;
buttons = [{
"label": "Cancel",
@ -221,12 +219,12 @@ export default
if (!Empty($stateParams.template_id)) {
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/';
}
else if (base == 'system_job_templates') {
else if (base === 'system_job_templates') {
url += $stateParams.id + '/schedules/';
if($stateParams.id == 4){
if($stateParams.id === 4){
scope.isFactCleanup = true;
scope.keep_unit_choices = [{
"label" : "Days",
@ -532,9 +530,8 @@ export default
.factory('SchedulesControllerInit', ['$state', '$location', 'ToggleSchedule',
'DeleteSchedule', 'EditSchedule', 'AddSchedule',
function($state, $location, ToggleSchedule, DeleteSchedule, EditSchedule,
AddSchedule) {
'DeleteSchedule',
function($state, $location, ToggleSchedule, DeleteSchedule) {
return function(params) {
var scope = params.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
// page to display the element you are editing
if (scope.addedItem) {
var id = scope.addedItem + "";
id = scope.addedItem + "";
delete scope.addedItem;
$rootScope.rowBeingEdited = id;
$rootScope.listBeingEdited = set;
$rootScope.addedAnItem = true;
var restUrl = params.url.split("?")[0];
var pageSize = scope[iterator + '_page_size'];
restUrl = params.url.split("?")[0];
pageSize = scope[iterator + '_page_size'];
pagination.getInitialPageForList(id, restUrl, pageSize)
.then(function (currentPage) {
scope.getPage(currentPage, set, iterator);
});
} 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];
var restUrl = params.url.split("?")[0];
var pageSize = scope[iterator + '_page_size'];
id = $location.$$url.split("/")[2];
restUrl = params.url.split("?")[0];
pageSize = scope[iterator + '_page_size'];
pagination.getInitialPageForList(id, restUrl, pageSize)
.then(function (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
}
if(scope[iterator + 'SearchValue' + modifier] && scope[iterator + 'SearchValue' + modifier] != '') {
if(scope[iterator + 'SearchValue' + modifier] && scope[iterator + 'SearchValue' + modifier] !== '') {
scope[iterator + '_active_search'] = true;
}
else {

View File

@ -92,4 +92,4 @@ export default['$scope', '$rootScope', '$compile', '$location',
'$log', '$stateParams', 'InventoryForm', 'GenerateForm', 'Rest', 'Alert',
'ProcessErrors', 'ReturnToCaller', 'ClearScope', 'generateList',
'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 controller from './inventory-add.controller';
export default
angular.module('inventoryAdd', [])

View File

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

View File

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

View File

@ -3,18 +3,21 @@ function CopyGroupsCtrl($compile, $state, $scope, $location, Rest, ProcessErrors
var vm = this;
var name;
var params = ParamPass.get();
var params = ParamPass.get(),
group_id,
parent_scope,
scope;
if (params !== undefined) {
var group_id = $state.params.group_id,
parent_scope = params.scope,
scope = parent_scope.$new(),
parent_group = parent_scope.selected_group_id,
group_id = $state.params.group_id;
parent_scope = params.scope;
scope = parent_scope.$new();
var parent_group = parent_scope.selected_group_id,
url, group;
} else {
var group_id = $state.params.group_id;
var parent_scope = $scope.$new();
var scope = parent_scope.$new();
group_id = $state.params.group_id;
parent_scope = $scope.$new();
scope = parent_scope.$new();
}
var inventory_id = $state.params.inventory_id;
@ -132,7 +135,7 @@ function CopyGroupsCtrl($compile, $state, $scope, $location, Rest, ProcessErrors
});
$scope.refreshHostsOnGroupRefresh = true;
//$scope.search(InventoryGroups.iterator, null, true, false, true);
}
};
var cancel = function() {
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,
allowSave: allowSave
});
};
}
export default ['$compile', '$state', '$scope', '$location', 'Rest', 'ProcessErrors', 'CreateDialog', 'GetBasePath', 'Wait', 'generateList', 'GroupList', 'SearchInit',
'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 inventory_id = $state.params.inventory_id;
var url, host;
var url, host, group_scope, parent_scope, scope, parent_group;
var params = ParamPass.get();
if (params !== undefined) {
var group_scope = params.group_scope,
parent_scope = params.host_scope,
parent_group = group_scope.selected_group_id,
scope = parent_scope.$new();
group_scope = params.group_scope;
parent_scope = params.host_scope;
parent_group = group_scope.selected_group_id;
scope = parent_scope.$new();
} else {
var group_scope = $scope.$new();
var parent_scope = $scope.$new();
var scope = parent_scope.$new();
group_scope = $scope.$new();
parent_scope = $scope.$new();
scope = parent_scope.$new();
}
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() {
$(document).off("keydown");
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 list = GroupList,
target,

View File

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

View File

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

View File

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

View File

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

View File

@ -15,17 +15,14 @@ var hostEventModal = {
features: ['FeaturesService', function(FeaturesService){
return FeaturesService.get();
}],
event: ['JobDetailService','$stateParams', 'moment', function(JobDetailService, $stateParams, moment) {
return JobDetailService.getRelatedJobEvents($stateParams.id, {
id: $stateParams.eventId,
}).then(function(res){
res.data.results[0].created = moment(res.data.results[0].created).format('MMMM Do YYYY, h:mm:ss a');
return res.data.results[0];
});
event: ['JobDetailService','$stateParams', function(JobDetailService, $stateParams) {
return JobDetailService.getRelatedJobEvents($stateParams.id, {
id: $stateParams.eventId
}).success(function(res){ return res.results[0];});
}]
},
onExit: function($state){
// close the modal
onExit: function(){
// close the modal
// using an onExit event to handle cases where the user navs away using the url bar / back and not modal "X"
$('#HostEvent').modal('hide');
// 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')
};
export {hostEventDetails, hostEventJson, hostEventStdout, hostEventModal}
export {hostEventDetails, hostEventJson, hostEventStdout, hostEventModal};

View File

@ -4,7 +4,7 @@
* All Rights Reserved
*************************************************/
export default
export default
['$stateParams', '$scope', '$rootScope', '$state', 'Wait',
'JobDetailService', 'CreateSelect2', 'hosts',
function($stateParams, $scope, $rootScope, $state, Wait,
@ -18,8 +18,8 @@
$scope.search = function(){
Wait('start');
if ($scope.searchStr == undefined){
return
if ($scope.searchStr === undefined){
return;
}
//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 ""
@ -32,7 +32,7 @@
page_size: $scope.pageSize})
.success(function(res){
$scope.results = res.results;
Wait('stop')
Wait('stop');
});
};
@ -41,7 +41,7 @@
var filter = function(filter){
Wait('start');
if (filter == 'all'){
if (filter === 'all'){
return JobDetailService.getRelatedJobEvents($stateParams.id, {
host_name: $stateParams.hostName,
page_size: $scope.pageSize})
@ -51,59 +51,58 @@
});
}
// handle runner cases
if (filter == 'skipped'){
if (filter === 'skipped'){
return JobDetailService.getRelatedJobEvents($stateParams.id, {
host_name: $stateParams.hostName,
host_name: $stateParams.hostName,
event: 'runner_on_skipped'})
.success(function(res){
$scope.results = res.results;
Wait('stop');
});
}
if (filter == 'unreachable'){
if (filter === 'unreachable'){
return JobDetailService.getRelatedJobEvents($stateParams.id, {
host_name: $stateParams.hostName,
host_name: $stateParams.hostName,
event: 'runner_on_unreachable'})
.success(function(res){
$scope.results = res.results;
Wait('stop');
});
}
if (filter == 'ok'){
if (filter === 'ok'){
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_async',
changed: false
})
.success(function(res){
$scope.results = res.results;
Wait('stop');
});
});
}
// handle convience properties .changed .failed
if (filter == 'changed'){
if (filter === 'changed'){
return JobDetailService.getRelatedJobEvents($stateParams.id, {
host_name: $stateParams.hostName,
host_name: $stateParams.hostName,
changed: true})
.success(function(res){
$scope.results = res.results;
Wait('stop');
});
});
}
if (filter == 'failed'){
if (filter === 'failed'){
return JobDetailService.getRelatedJobEvents($stateParams.id, {
host_name: $stateParams.hostName,
failed: true})
.success(function(res){
$scope.results = res.results;
Wait('stop');
});
}
});
}
};
// watch select2 for changes
$('.HostEvents-select').on("select2:select", function (e) {
$('.HostEvents-select').on("select2:select", function () {
filter($('.HostEvents-select').val());
});
@ -121,15 +120,15 @@
$scope.results = res.results;
Wait('stop');
$('#HostEvents').modal('show');
});;
});
}
else{
$scope.results = hosts.data.results;
$('#HostEvents').modal('show');
}
}
};
init();
}];
}];

View File

@ -29,7 +29,7 @@ export default {
hosts: ['JobDetailService','$stateParams', function(JobDetailService, $stateParams) {
return JobDetailService.getRelatedJobEvents($stateParams.id, {
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', [])
.controller('HostEventsController', controller)
.run(['$stateExtender', function($stateExtender){
$stateExtender.addState(route)
}]);
$stateExtender.addState(route);
}]);

View File

@ -12,6 +12,20 @@
$scope.filter = 'all';
$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){
// status waterfall: unreachable > failed > changed > ok > skipped
var count;
@ -30,23 +44,23 @@
}),
changed : _.filter(hosts, function(o){
return o.changed > 0;
})
})
};
return count;
};
var socketListener = function(){
// emitted by the API in the same function used to persist host summary data
// 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) {
// 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();
}
});
// 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) {
if ($stateParams.id == data['unified_job_id']){
$scope.status = data['status'];
if ($stateParams.id === data.unified_job_id){
$scope.status = data.status;
}
});
};
@ -69,14 +83,14 @@
text[key] = grammar(value.length, key);
});
*/
return grammar(n, status)
return grammar(n, status);
};
$scope.getNextPage = function(){
if ($scope.next){
JobDetailService.getNextPage($scope.next).success(function(res){
res.results.forEach(function(key, index){
$scope.hosts.push(res.results[index]);
})
$scope.hosts.push(res.results[index]);
});
$scope.hosts.push(res.results);
$scope.next = res.next;
});
@ -91,7 +105,7 @@
$scope.hosts = res.results;
$scope.next = res.next;
Wait('stop');
})
});
};
$scope.setFilter = function(filter){
$scope.filter = filter;
@ -100,7 +114,7 @@
JobDetailService.getJobHostSummaries($stateParams.id, {
page_size: page_size
}).success(function(res){
Wait('stop')
Wait('stop');
$scope.hosts = res.results;
$scope.next = res.next;
});
@ -111,32 +125,18 @@
page_size: page_size,
failed: true
}).success(function(res){
Wait('stop')
Wait('stop');
$scope.hosts = res.results;
$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);
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();
init();
}];
}];

View File

@ -13,7 +13,7 @@
export default
[ '$location', '$rootScope', '$filter', '$scope', '$compile',
'$stateParams', '$log', 'ClearScope', 'GetBasePath', 'Wait',
'ProcessErrors', 'SelectPlay', 'SelectTask', 'Socket', 'GetElapsed',
'ProcessErrors', 'SelectPlay', 'SelectTask', 'Socket', 'GetElapsed',
'JobIsFinished', 'SetTaskStyles', 'DigestEvent', 'UpdateDOM', 'DeleteJob', 'PlaybookRun',
'LoadPlays', 'LoadTasks', 'HostsEdit',
'ParseVariableString', 'GetChoices', 'fieldChoices', 'fieldLabels',
@ -42,7 +42,7 @@ export default
scope.parseType = 'yaml';
scope.previousTaskFailed = false;
$scope.stdoutFullScreen = false;
scope.$watch('job_status', function(job_status) {
if (job_status && job_status.explanation && job_status.explanation.split(":")[0] === "Previous Task Failed") {
scope.previousTaskFailed = true;
@ -243,19 +243,19 @@ export default
event: 'playbook_on_stats'
};
JobDetailService.getRelatedJobEvents(scope.job.id, params)
.success(function(data) {
.success(function() {
UpdateDOM({ scope: scope });
})
.error(function(data, status) {
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(scope.jobData);
}
else {
api_complete = true; //trigger events to start processing
UpdateDOM({ scope: scope})
UpdateDOM({ scope: scope});
}
});
@ -274,10 +274,10 @@ export default
var params = {
parent: task.id,
event__startswith: 'runner',
page_size: scope.hostResultsMaxRows
};
JobDetailService.getRelatedJobEvents(scope.job.id, params)
.success(function(data) {
var event, status, status_text, item, msg;
if (data.results.length > 0) {
lastEventId = data.results[0].id;
}
@ -305,7 +305,7 @@ export default
event_id: play.id,
page_size: scope.tasksMaxRows,
order: 'id'
}
};
JobDetailService.getJobTasks(scope.job.id, params)
.success(function(data) {
scope.next_tasks = data.next;
@ -395,7 +395,7 @@ export default
})
.error(function(data) {
ProcessErrors(scope, data, status, null, { hdr: 'Error!',
msg: 'Call to ' + url + '. GET returned: ' + status });
msg: 'Call failed. GET returned: ' + status });
});
} else {
scope.$emit('InitialLoadComplete');
@ -413,7 +413,7 @@ export default
var params = {
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)
.success( function(data) {
scope.next_plays = data.next;
@ -501,7 +501,7 @@ export default
});
}
});
if (scope.removeLoadJob) {
scope.removeLoadJob();
@ -517,7 +517,7 @@ export default
// Load the job record
JobDetailService.getJob({id: job_id})
.success(function(res) {
var i,
var i,
data = res.results[0];
scope.job = data;
scope.job_template_name = data.name;
@ -801,6 +801,7 @@ export default
};
scope.searchTasks = function() {
var params;
if (scope.search_task_name) {
scope.searchTasksEnabled = false;
}
@ -825,6 +826,7 @@ export default
};
scope.searchHosts = function() {
var params;
if (scope.search_host_name) {
scope.searchHostsEnabled = false;
}
@ -833,18 +835,18 @@ export default
}
if (!scope.liveEventProcessing || scope.pauseLiveEvents) {
scope.hostResultsLoading = true;
var params = {
params = {
parent: scope.selectedTask,
event__startswith: 'runner',
page_size: scope.hostResultsMaxRows,
order: 'host_name,counter',
host_name__icontains: scope.search_host_name
}
host_name__icontains: scope.search_host_name
};
if (scope.search_host_status === 'failed'){
params.failed = true;
}
JobDetailService.getRelatedJobEvents(scope.job.id, params).success(function(res){
scope.hostResults = JobDetailService.processHostEvents(res.results)
scope.hostResults = JobDetailService.processHostEvents(res.results);
scope.hostResultsLoading = false;
});
}
@ -1093,7 +1095,7 @@ export default
// Click binding for the expand/collapse button on the standard out log
$scope.toggleStdoutFullscreen = function() {
$scope.stdoutFullScreen = !$scope.stdoutFullScreen;
}
};
scope.editSchedule = function() {
// 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 HostSummaryController from './host-summary/host-summary.controller';
export default {
name: 'jobDetail',

View File

@ -1,10 +1,10 @@
export default
['$rootScope', 'Rest', 'GetBasePath', 'ProcessErrors', function($rootScope, Rest, GetBasePath, ProcessErrors){
return {
stringifyParams: function(params){
return _.reduce(params, (result, value, key) => {
return result + key + '=' + value + '&'}, '');
return result + key + '=' + value + '&';
}, '');
},
// the the API passes through Ansible's event_data response
@ -14,15 +14,15 @@ export default
var result = $.extend(true, {}, data);
// configure fields to ignore
var ignored = [
'event_data',
'related',
'summary_fields',
'url',
'event_data',
'related',
'summary_fields',
'url',
'ansible_facts',
];
// remove ignored properties
Object.keys(result).forEach(function(key, index){
Object.keys(result).forEach(function(key){
if (ignored.indexOf(key) > -1) {
delete result[key];
}
@ -31,7 +31,7 @@ export default
// flatten Ansible's passed-through response
try{
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) {
return;
}
@ -46,7 +46,7 @@ export default
},
// Return Ansible's passed-through response msg on a job_event
processEventMsg: function(event){
return typeof event.event_data.res === 'object' ? event.event_data.res.msg : event.event_data.res;
return typeof event.event_data.res === 'object' ? event.event_data.res.msg : event.event_data.res;
},
// Return only Ansible's passed-through response item on a job_event
processEventItem: function(event){
@ -59,7 +59,7 @@ export default
// Generate a helper class for job_event statuses
// the stack for which status to display is
// unreachable > failed > changed > ok
// uses the API's runner events and convenience properties .failed .changed to determine status.
// uses the API's runner events and convenience properties .failed .changed to determine status.
// see: job_event_callback.py for more filters to support
processEventStatus: function(event){
if (event.event === 'runner_on_unreachable'){
@ -73,7 +73,7 @@ export default
return {
class: 'HostEvents-status--failed',
status: 'failed'
}
};
}
// catch the changed case before ok, because both can be true
if (event.changed){
@ -121,7 +121,7 @@ export default
return results;
},
// GET events related to a job run
// e.g.
// e.g.
// ?event=playbook_on_stats
// ?parent=206&event__startswith=runner&page_size=200&order=host_name,counter
getRelatedJobEvents: function(id, params){
@ -135,7 +135,7 @@ export default
.error(function(data, status) {
ProcessErrors($rootScope, data, status, null, { hdr: 'Error!',
msg: 'Call to ' + url + '. GET returned: ' + status });
});
});
},
getJobEventChildren: function(id){
var url = GetBasePath('job_events');
@ -143,12 +143,12 @@ export default
Rest.setUrl(url);
return Rest.get()
.success(function(data){
return data
return data;
})
.error(function(data, status) {
ProcessErrors($rootScope, data, status, null, { hdr: 'Error!',
msg: 'Call to ' + url + '. GET returned: ' + status });
});
});
},
// GET job host summaries related to a job run
// e.g. ?page_size=200&order=host_name
@ -163,7 +163,7 @@ export default
.error(function(data, status) {
ProcessErrors($rootScope, data, status, null, { hdr: 'Error!',
msg: 'Call to ' + url + '. GET returned: ' + status });
});
});
},
// GET job plays related to a job run
// e.g. ?page_size=200
@ -178,7 +178,7 @@ export default
.error(function(data, status) {
ProcessErrors($rootScope, data, status, null, { hdr: 'Error!',
msg: 'Call to ' + url + '. GET returned: ' + status });
});
});
},
getJobTasks: function(id, params){
var url = GetBasePath('jobs');
@ -191,7 +191,7 @@ export default
.error(function(data, status) {
ProcessErrors($rootScope, data, status, null, { hdr: 'Error!',
msg: 'Call to ' + url + '. GET returned: ' + status });
});
});
},
getJob: function(params){
var url = GetBasePath('unified_jobs') + '?' + this.stringifyParams(params);
@ -203,7 +203,7 @@ export default
.error(function(data, status) {
ProcessErrors($rootScope, data, status, null, { hdr: 'Error!',
msg: 'Call to ' + url + '. GET returned: ' + status });
});
});
},
// GET next set of paginated results
// expects 'next' param returned by the API e.g.
@ -217,7 +217,7 @@ export default
.error(function(data, status) {
ProcessErrors($rootScope, data, status, null, { hdr: 'Error!',
msg: 'Call to ' + url + '. GET returned: ' + status });
});
});
}
};
}];
}];

View File

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

View File

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

View File

@ -13,7 +13,7 @@
Rest.setUrl(defaultUrl);
return Rest.get()
.success(function(res){
return res
return res;
})
.error(function(res, status){
ProcessErrors($rootScope, res, status, null, {hdr: 'Error!',
@ -23,21 +23,21 @@
set: function(data){
var defaultUrl = GetBasePath('job_templates');
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
return Rest.post(data.results[0])
.success(function(res){
return res
return res;
})
.error(function(res, status){
.error(function(res, status){
ProcessErrors($rootScope, res, status, null, {hdr: 'Error!',
msg: 'Call to '+ defaultUrl + ' failed. Return status: '+ status});
});
},
buildName: function(name){
var result = name.split('@')[0];
return result
return result;
}
}
};
}
];
];

View File

@ -13,5 +13,5 @@ export default
.service('jobTemplateCopyService', service)
.controller('jobTemplateCopyController', controller)
.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);
return Rest.destroy();
}
}
}]
};
}];

View File

@ -4,7 +4,6 @@ export default
var scope = params.scope,
index = params.index,
element,
tmpVar,
i,
question = params.question,
@ -12,7 +11,7 @@ export default
// Update the index so that we know which question is being edited.
scope.editQuestionIndex = index;
scope.text_min = null;
scope.text_max = null;
scope.int_min = null;

View File

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

View File

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

View File

@ -4,8 +4,6 @@ export default
return function(params) {
var scope = params.scope,
id = params.id,
i, url, html, element,
questions = [],
form = SurveyQuestionForm,
sce = params.sce;
scope.sce = sce;
@ -73,7 +71,7 @@ export default
scope.survey_questions = [];
}
$('#' + id).dialog('destroy');
}
};
// 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
@ -83,8 +81,8 @@ export default
Wait('start');
if(scope.mode ==="add"){
// Loop across the survey questions and remove any new_question flags
angular.forEach(scope.survey_questions, function(question, key) {
delete question['new_question'];
angular.forEach(scope.survey_questions, function(question) {
delete question.new_question;
});
$('#survey-modal-dialog').dialog('destroy');
@ -100,28 +98,28 @@ export default
var updateSurveyQuestions = function() {
Rest.setUrl(GetBasePath('job_templates') + id + '/survey_spec/');
return Rest.post({name: scope.survey_name, description: scope.survey_description, spec: scope.survey_questions })
.success(function (data) {
.success(function () {
})
.error(function (data, status) {
ProcessErrors(scope, data, status, null, { hdr: 'Error!',
msg: 'Failed to add new survey. POST returned status: ' + status });
});
}
};
var updateSurveyEnabled = function() {
Rest.setUrl(GetBasePath('job_templates') + id+ '/');
return Rest.patch({"survey_enabled": scope.survey_enabled})
.success(function (data) {
.success(function () {
})
.error(function (data, status) {
ProcessErrors(scope, data, status, form, {
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()
.then(function() {
@ -130,7 +128,7 @@ export default
.then(function() {
scope.closeSurvey('survey-modal-dialog');
scope.$emit('SurveySaved');
})
});
}
};
@ -173,7 +171,7 @@ export default
scope.questionToBeDeleted = deleteIndex;
// Show the delete overlay with mode='question'
scope.showDeleteOverlay('question');
}
};
// Called after a user confirms question deletion (hitting the DELETE button on the delete question overlay).
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
// currently being edited gets updated independently from a deleted question.
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
scope.editQuestionIndex = null;
scope.generateAddQuestionForm();
@ -238,7 +236,7 @@ export default
// Set the whole form to pristine
scope.survey_question_form.$setPristine();
}
};
// 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.
@ -258,12 +256,11 @@ export default
// 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
// scope.survey_questions array.
scope.submitQuestion = function(event){
scope.submitQuestion = function(){
var data = {},
fld, i,
choiceArray,
answerArray,
key, elementID;
answerArray;
scope.invalidChoice = false;
scope.duplicate = false;
scope.minTextError = false;
@ -333,7 +330,7 @@ export default
if(GenerateForm.mode === 'edit'){
// Loop across the survey questions and see if a different question already has
// 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){
scope.duplicate = true;
}
@ -475,11 +472,11 @@ export default
break;
}
};
}
// return true here signals that the drop is allowed, but that we've already taken care of inserting the element
return true;
}
};
// 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.
@ -508,7 +505,7 @@ export default
scope.deleteMode = mode;
// Flip the deleteOverlayVisible flag so that the overlay becomes visible via ng-show
scope.deleteOverlayVisible = true;
}
};
// Called by the cancel/close buttons on the delete overlay. Also called after deletion has been confirmed.
scope.hideDeleteOverlay = function() {
@ -518,14 +515,14 @@ export default
scope.questionToBeDeleted = null;
// Hide the delete overlay
scope.deleteOverlayVisible = false;
}
};
/* END DELETE OVERLAY RELATED FUNCTIONS */
// 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";
})
});
};
}

View File

@ -12,7 +12,7 @@ export default
Rest.setUrl(defaultUrl);
return Rest.get()
.success(function(res){
return res
return res;
})
.error(function(res, status){
ProcessErrors($rootScope, res, status, null, {hdr: 'Error!',
@ -26,7 +26,7 @@ export default
data.eula_accepted = eula;
return Rest.post(JSON.stringify(data))
.success(function(res){
return res
return res;
})
.error(function(res, status){
ProcessErrors($rootScope, res, status, null, {hdr: 'Error!',
@ -38,25 +38,27 @@ export default
// Returns false if invalid
valid: function(license) {
if (!license.valid_key){
return false
return false;
}
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){
return false
return false;
}
return true
return true;
},
notify: function(){
self = this;
var self = this;
this.get()
.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);
el.bind('change', onChange);
}
}
}];
};
}];

View File

@ -22,7 +22,7 @@ export default
catch(err) {
ProcessErrors($rootScope, null, null, null, {msg: 'Invalid file format. Please upload valid JSON.'});
}
}
};
try {
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
$scope.fakeClick = function(){
$('#License-file').click();
}
};
$scope.newLicense = {};
$scope.submit = function(event){
$scope.submit = function(){
Wait('start');
CheckLicense.post($scope.newLicense.file, $scope.newLicense.eula)
.success(function(res){
.success(function(){
reset();
init();
$scope.success = true;
@ -53,15 +53,15 @@ export default
var calcDaysRemaining = function(ms){
// calculate the number of days remaining on the license
var duration = moment.duration(ms);
return duration.days()
return duration.days();
};
var calcExpiresOn = function(days){
// calculate the expiration date of the license
return moment().add(days, 'days').calendar()
return moment().add(days, 'days').calendar();
};
var init = function(){
$scope.fileName = "Please choose a file..."
$scope.fileName = "Please choose a file...";
Wait('start');
CheckLicense.get()
.then(function(res){
@ -70,13 +70,13 @@ export default
$scope.time = {};
$scope.time.remaining = calcDaysRemaining($scope.license.license_info.time_remaining);
$scope.time.expiresOn = calcExpiresOn($scope.time.remaining);
$scope.valid = CheckLicense.valid($scope.license.license_info);
$scope.valid = CheckLicense.valid($scope.license.license_info);
Wait('stop');
});
};
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',
label: 'LICENSE'
}
}
};

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -44,7 +44,7 @@ export default ['$stateParams', '$scope', '$rootScope', '$location',
var paginationContainer = $('#pagination-container');
paginationContainer.html($scope.PaginateWidget);
$compile(paginationContainer.contents())($scope)
$compile(paginationContainer.contents())($scope);
var parseCardData = function(cards) {
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){
var jobs_scope,
list = PortalJobTemplateList,
var list = PortalJobTemplateList,
view= GenerateList,
defaultUrl = GetBasePath('job_templates'),
pageSize = 12;
@ -40,7 +39,7 @@ export function PortalModeJobTemplatesController($scope, $rootScope, GetBasePat
$scope.search(list.iterator);
};
init()
init();
}
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',
mode: 'edit',
scope: $scope,
searchSize: 'col-md-10 col-xs-12'
});
SearchInit({
@ -56,4 +57,4 @@ export function PortalModeJobsController($scope, $state, $rootScope, GetBasePath
}
PortalModeJobsController.$inject = ['$scope', '$state', '$rootScope', 'GetBasePath', 'generateList', 'PortalJobsList', 'SearchInit',
'PaginateInit']
'PaginateInit'];

View File

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

View File

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

View File

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

View File

@ -33,7 +33,7 @@ function ($rootScope, Rest, GetBasePath, ProcessErrors, $http, $q) {
}
},
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;
}
else {

View File

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

View File

@ -297,7 +297,7 @@ export default ['$location', '$compile', '$rootScope', 'SearchWidget', 'Paginate
//
var html = '',
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.title !== false){

View File

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

View File

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

View File

@ -22,7 +22,7 @@ export default {
features: ['FeaturesService', function(FeaturesService) {
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
return true;
}]

View File

@ -24,7 +24,7 @@ export default {
features: ['FeaturesService', function(FeaturesService) {
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
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();
@ -164,10 +164,10 @@ export function JobStdoutController ($rootScope, $scope, $state, $stateParams, C
// Click binding for the expand/collapse button on the standard out log
$scope.toggleStdoutFullscreen = function() {
$scope.stdoutFullScreen = !$scope.stdoutFullScreen;
}
};
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',
'PaginateInit', 'generateList', 'FormatDate', 'BuildDescription', 'FixUrl', 'BuildUrl',
'ShowDetail', 'setStreamHeight', 'Find', 'Store',
function ($rootScope, $location, $state, Rest, GetBasePath, ProcessErrors, Wait, StreamList, SearchInit, PaginateInit, GenerateList,
FormatDate, BuildDescription, FixUrl, BuildUrl, ShowDetail, setStreamHeight,
Find, Store) {
.factory('Stream', ['$rootScope', '$location', '$state', 'Rest', 'GetBasePath',
'ProcessErrors', 'Wait', 'StreamList', 'SearchInit', 'PaginateInit',
'generateList', 'FormatDate', 'BuildDescription', 'FixUrl', 'BuildUrl',
'ShowDetail', 'setStreamHeight',
function ($rootScope, $location, $state, Rest, GetBasePath, ProcessErrors,
Wait, StreamList, SearchInit, PaginateInit, GenerateList, FormatDate,
BuildDescription, FixUrl, BuildUrl, ShowDetail, setStreamHeight) {
return function (params) {
var list = StreamList,
defaultUrl = GetBasePath('activity_stream'),
view = GenerateList,
base = $location.path().replace(/^\//, '').split('/')[0],
parent_scope = params.scope,
scope = parent_scope.$new(),
search_iterator = params.search_iterator, // use to get correct current_search_params from local store
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;
url = (params && params.url) ? params.url : null;
$rootScope.flashMessage = null;

View File

@ -34,6 +34,7 @@ describe("adhoc.controller", function() {
}
});
beforeEach("mock dependencies", angular.mock.module(['$provide', function(_provide_) {
var $provide = _provide_;
@ -58,17 +59,15 @@ describe("adhoc.controller", function() {
$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) {
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() {
it('should only have the specified urls ' +
'available for adhoc commands', function() {
@ -86,6 +85,7 @@ describe("adhoc.controller", function() {
}
expect(count).to.equal(3);
});
});
describe("setFieldDefaults", function() {
@ -195,4 +195,5 @@ describe("adhoc.controller", function() {
expect($rootScope.hostPatterns).to.not.exist;
});
});
*/
});

View File

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