1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-07 23:05:26 +02:00

* chore(eslint): update esllint and remove unused variables

* chore(eslint-config): change no-unused-vars to warn

* chore(eslint): remove unused variables

* chore(eslint): allow unused globals

* fixup! chore(eslint): allow unused globals

* chore(eslint): remove commented unused vars

* fixup! chore(eslint): remove commented unused vars
This commit is contained in:
Chaim Lev-Ari 2018-08-22 18:33:06 +03:00 committed by Anthony Lapenna
parent 46da95ecfb
commit e58acd7dd6
67 changed files with 121 additions and 146 deletions

View file

@ -22,7 +22,7 @@ function ($q, $state, UserService, TeamService, ResourceControlService, Notifica
ctrl.authorizedTeams = [];
ctrl.availableTeams = [];
ctrl.confirmUpdateOwnership = function (force) {
ctrl.confirmUpdateOwnership = function () {
if (!validateForm()) {
return;
}
@ -77,7 +77,7 @@ function ($q, $state, UserService, TeamService, ResourceControlService, Notifica
ResourceControlService.applyResourceControlChange(ctrl.resourceType, resourceId,
ctrl.resourceControl, ownershipParameters)
.then(function success(data) {
.then(function success() {
Notifications.success('Access control successfully updated');
$state.reload();
})

View file

@ -52,7 +52,7 @@ function (AccessService, Notifications) {
}
ctrl.updateAccess({ userAccesses: authorizedUserIDs, teamAccesses: authorizedTeamIDs })
.then(function success(data) {
.then(function success() {
removeFromAccesses(access, ctrl.accesses);
ctrl.authorizedAccesses.push(access);
Notifications.success('Accesses successfully updated');
@ -74,7 +74,7 @@ function (AccessService, Notifications) {
}
ctrl.updateAccess({ userAccesses: authorizedUserIDs, teamAccesses: authorizedTeamIDs })
.then(function success(data) {
.then(function success() {
removeFromAccesses(access, ctrl.authorizedAccesses);
ctrl.accesses.push(access);
Notifications.success('Accesses successfully updated');
@ -96,7 +96,7 @@ function (AccessService, Notifications) {
ctrl.unauthorizeAllAccesses = function() {
ctrl.updateAccess({ userAccesses: [], teamAccesses: [] })
.then(function success(data) {
.then(function success() {
moveAccesses(ctrl.authorizedAccesses, ctrl.accesses);
Notifications.success('Accesses successfully updated');
})
@ -111,7 +111,7 @@ function (AccessService, Notifications) {
var authorizedTeamIDs = accessData.teamIDs;
ctrl.updateAccess({ userAccesses: authorizedUserIDs, teamAccesses: authorizedTeamIDs })
.then(function success(data) {
.then(function success() {
moveAccesses(ctrl.accesses, ctrl.authorizedAccesses);
Notifications.success('Accesses successfully updated');
})

View file

@ -1,8 +1,6 @@
angular.module('portainer.app').component('endpointList', {
templateUrl: 'app/portainer/components/endpoint-list/endpointList.html',
controller: function() {
var ctrl = this;
this.state = {
textFilter: ''
};

View file

@ -3,7 +3,7 @@ angular.module('portainer.app')
var directive = {
requires: '^rdHeader',
transclude: true,
link: function (scope, iElement, iAttrs) {
link: function (scope) {
scope.username = Authentication.getUserDetails().username;
},
template: '<div class="breadcrumb-links"><div class="pull-left" ng-transclude></div><div class="pull-right" ng-if="username"><a ui-sref="portainer.account" style="margin-right: 5px;"><u><i class="fa fa-wrench" aria-hidden="true"></i> my account </u></a><a ui-sref="portainer.auth({logout: true})" class="text-danger" style="margin-right: 25px;"><u><i class="fa fa-sign-out-alt" aria-hidden="true"></i> log out</u></a></div></div>',

View file

@ -1,11 +1,11 @@
angular.module('portainer.app')
.directive('rdHeaderTitle', ['Authentication', 'StateManager', function rdHeaderTitle(Authentication, StateManager) {
.directive('rdHeaderTitle', ['Authentication', function rdHeaderTitle(Authentication) {
var directive = {
requires: '^rdHeader',
scope: {
titleText: '@'
},
link: function (scope, iElement, iAttrs) {
link: function (scope) {
scope.username = Authentication.getUserDetails().username;
},
transclude: true,

View file

@ -1,8 +1,6 @@
angular.module('portainer.app')
.controller('TagSelectorController', function () {
var ctrl = this;
this.$onChanges = function(changes) {
if(angular.isDefined(changes.tags.currentValue)) {
this.tags = _.difference(changes.tags.currentValue, this.model);
@ -14,7 +12,7 @@ angular.module('portainer.app')
noResult: false
};
this.selectTag = function($item, $model, $label) {
this.selectTag = function($item) {
this.state.selectedValue = '';
this.model.push($item);
this.tags = _.remove(this.tags, function(item) {

View file

@ -1,5 +1,5 @@
angular.module('portainer.app')
.factory('TemplateHelper', ['$filter', function TemplateHelperFactory($filter) {
.factory('TemplateHelper', [function TemplateHelperFactory() {
'use strict';
var helper = {};
@ -57,7 +57,7 @@ angular.module('portainer.app')
return labels;
};
helper.EnvToStringArray = function(templateEnvironment, containerMapping) {
helper.EnvToStringArray = function(templateEnvironment) {
var env = [];
templateEnvironment.forEach(function(envvar) {
if (envvar.value || envvar.set) {

View file

@ -48,7 +48,7 @@ function StackServiceFactory($q, Stack, ResourceControlService, FileUploadServic
return Stack.migrate({ id: stack.Id, endpointId: stack.EndpointId }, { EndpointID: targetEndpointId, SwarmID: swarm.Id }).$promise;
})
.then(function success(data) {
.then(function success() {
deferred.resolve();
})
.catch(function error(err) {
@ -67,7 +67,7 @@ function StackServiceFactory($q, Stack, ResourceControlService, FileUploadServic
EndpointProvider.setEndpointID(targetEndpointId);
Stack.migrate({ id: stack.Id, endpointId: stack.EndpointId }, { EndpointID: targetEndpointId }).$promise
.then(function success(data) {
.then(function success() {
deferred.resolve();
})
.catch(function error(err) {
@ -204,7 +204,7 @@ function StackServiceFactory($q, Stack, ResourceControlService, FileUploadServic
var deferred = $q.defer();
Stack.remove({ id: stack.Id ? stack.Id : stack.Name, external: external, endpointId: endpointId }).$promise
.then(function success(data) {
.then(function success() {
if (stack.ResourceControl && stack.ResourceControl.Id) {
return ResourceControlService.deleteResourceControl(stack.ResourceControl.Id);
}

View file

@ -58,7 +58,7 @@ angular.module('portainer.app')
return Teams.remove({id: id}).$promise;
};
service.updateTeam = function(id, name, members, leaders) {
service.updateTeam = function(id, name) {
var payload = {
Name: name
};

View file

@ -83,7 +83,7 @@ angular.module('portainer.app')
return service.updateUser(id, newPassword, undefined);
}
})
.then(function success(data) {
.then(function success() {
deferred.resolve();
})
.catch(function error(err) {
@ -142,7 +142,7 @@ angular.module('portainer.app')
var deferred = $q.defer();
Users.checkAdminUser({}).$promise
.then(function success(data) {
.then(function success() {
deferred.resolve(true);
})
.catch(function error(err) {

View file

@ -139,14 +139,14 @@ angular.module('portainer.app')
return label + ': ' + processedValue;
}
function byteBasedAxisLabel(value, index, values) {
function byteBasedAxisLabel(value) {
if (value > 5) {
return filesize(value, {base: 10, round: 1});
}
return value.toFixed(1) + 'B';
}
function percentageBasedAxisLabel(value, index, values) {
function percentageBasedAxisLabel(value) {
if (value > 1) {
return Math.round(value) + '%';
}

View file

@ -21,7 +21,7 @@ angular.module('portainer.app')
dockerfile: path
},
ignoreLoadingBar: true,
transformResponse: function(data, headers) {
transformResponse: function(data) {
return jsonObjectsToArrayHandler(data);
}
});

View file

@ -59,7 +59,7 @@ angular.module('portainer.app')
box.find('.bootbox-input-checkbox').prop('checked', optionToggled);
};
service.confirmAccessControlUpdate = function(callback, msg) {
service.confirmAccessControlUpdate = function(callback) {
service.confirm({
title: 'Are you sure ?',
message: 'Changing the ownership of this resource will potentially restrict its management to some users.',

View file

@ -97,7 +97,7 @@ function StateManagerFactory($q, SystemService, InfoHelper, LocalStorage, Settin
var cacheValidity = now - applicationState.validity;
if (cacheValidity > APPLICATION_CACHE_VALIDITY) {
loadApplicationState()
.then(function success(data) {
.then(function success() {
deferred.resolve(state);
})
.catch(function error(err) {
@ -110,7 +110,7 @@ function StateManagerFactory($q, SystemService, InfoHelper, LocalStorage, Settin
}
} else {
loadApplicationState()
.then(function success(data) {
.then(function success() {
deferred.resolve(state);
})
.catch(function error(err) {

View file

@ -60,8 +60,6 @@ function ($q, $scope, $state, $filter, EndpointService, GroupService, TagService
};
function createAzureEndpoint(name, applicationId, tenantId, authenticationKey, groupId, tags) {
var endpoint;
$scope.state.actionInProgress = true;
EndpointService.createAzureEndpoint(name, applicationId, tenantId, authenticationKey, groupId, tags)
.then(function success() {

View file

@ -45,7 +45,7 @@ function ($q, $scope, $state, $transition$, $filter, EndpointService, GroupServi
$scope.state.actionInProgress = true;
EndpointService.updateEndpoint(endpoint.Id, payload)
.then(function success(data) {
.then(function success() {
Notifications.success('Endpoint updated', $scope.endpoint.Name);
EndpointProvider.setEndpointPublicURL(endpoint.PublicURL);
$state.go('portainer.endpoints', {}, {reload: true});

View file

@ -17,7 +17,7 @@ function ($q, $scope, $state, $transition$, GroupService, EndpointService, TagSe
$scope.state.actionInProgress = true;
GroupService.updateGroup(model, associatedEndpoints)
.then(function success(data) {
.then(function success() {
Notifications.success('Group successfully updated');
$state.go('portainer.groups', {}, {reload: true});
})

View file

@ -22,7 +22,7 @@ function ($q, $scope, $state, Authentication, EndpointService, EndpointHelper, G
function triggerSnapshot() {
EndpointService.snapshot()
.then(function success(data) {
.then(function success() {
Notifications.success('Success', 'Endpoints updated');
$state.reload();
})

View file

@ -29,13 +29,9 @@ function ($scope, $state, EndpointService, StateManager, Notifications) {
};
$scope.createLocalEndpoint = function() {
var name = 'local';
var URL = '';
var endpoint;
$scope.state.actionInProgress = true;
EndpointService.createLocalEndpoint()
.then(function success(data) {
.then(function success() {
$state.go('portainer.home');
})
.catch(function error(err) {
@ -78,11 +74,9 @@ function ($scope, $state, EndpointService, StateManager, Notifications) {
};
function createAzureEndpoint(name, applicationId, tenantId, authenticationKey) {
var endpoint;
$scope.state.actionInProgress = true;
EndpointService.createAzureEndpoint(name, applicationId, tenantId, authenticationKey, 1, [])
.then(function success(data) {
.then(function success() {
$state.go('portainer.home');
})
.catch(function error(err) {
@ -94,10 +88,9 @@ function ($scope, $state, EndpointService, StateManager, Notifications) {
}
function createRemoteEndpoint(name, type, URL, PublicURL, TLS, TLSSkipVerify, TLSSKipClientVerify, TLSCAFile, TLSCertFile, TLSKeyFile) {
var endpoint;
$scope.state.actionInProgress = true;
EndpointService.createRemoteEndpoint(name, type, URL, PublicURL, 1, [], TLS, TLSSkipVerify, TLSSKipClientVerify, TLSCAFile, TLSCertFile, TLSKeyFile)
.then(function success(data) {
.then(function success() {
$state.go('portainer.home');
})
.catch(function error(err) {

View file

@ -12,7 +12,7 @@ function ($scope, $cookieStore, StateManager) {
$scope.applicationState = StateManager.getState();
$scope.$watch($scope.getWidth, function(newValue, oldValue) {
$scope.$watch($scope.getWidth, function(newValue) {
if (newValue >= mobileView) {
if (angular.isDefined($cookieStore.get('toggle'))) {
$scope.toggle = ! $cookieStore.get('toggle') ? false : true;

View file

@ -36,7 +36,7 @@ function ($scope, $state, RegistryService, Notifications) {
$scope.state.actionInProgress = true;
RegistryService.createRegistry(registryName, registryURL, authentication, username, password)
.then(function success(data) {
.then(function success() {
Notifications.success('Registry successfully created');
$state.go('portainer.registries');
})

View file

@ -15,7 +15,7 @@ function ($scope, $state, $transition$, $filter, RegistryService, Notifications)
registry.Password = $scope.formValues.Password;
$scope.state.actionInProgress = true;
RegistryService.updateRegistry(registry)
.then(function success(data) {
.then(function success() {
Notifications.success('Registry successfully updated');
$state.go('portainer.registries');
})

View file

@ -1,6 +1,6 @@
angular.module('portainer.app')
.controller('RegistriesController', ['$q', '$scope', '$state', 'RegistryService', 'DockerHubService', 'ModalService', 'Notifications', 'PaginationService',
function ($q, $scope, $state, RegistryService, DockerHubService, ModalService, Notifications, PaginationService) {
.controller('RegistriesController', ['$q', '$scope', '$state', 'RegistryService', 'DockerHubService', 'ModalService', 'Notifications',
function ($q, $scope, $state, RegistryService, DockerHubService, ModalService, Notifications) {
$scope.state = {
actionInProgress: false
@ -15,7 +15,7 @@ function ($q, $scope, $state, RegistryService, DockerHubService, ModalService, N
dockerhub.Password = $scope.formValues.dockerHubPassword;
$scope.state.actionInProgress = true;
DockerHubService.update(dockerhub)
.then(function success(data) {
.then(function success() {
Notifications.success('DockerHub registry updated');
})
.catch(function error(err) {

View file

@ -39,11 +39,11 @@ function ($q, $scope, Notifications, SettingsService, FileUploadService) {
$scope.state.connectivityCheckInProgress = true;
$q.when(!uploadRequired || FileUploadService.uploadLDAPTLSFiles(TLSCAFile, null, null))
.then(function success(data) {
.then(function success() {
addLDAPDefaultPort(settings, $scope.LDAPSettings.TLSConfig.TLS);
return SettingsService.checkLDAPConnectivity(settings);
})
.then(function success(data) {
.then(function success() {
$scope.state.failedConnectivityCheck = false;
$scope.state.successfulConnectivityCheck = true;
Notifications.success('Connection to LDAP successful');
@ -68,11 +68,11 @@ function ($q, $scope, Notifications, SettingsService, FileUploadService) {
$scope.state.actionInProgress = true;
$q.when(!uploadRequired || FileUploadService.uploadLDAPTLSFiles(TLSCAFile, null, null))
.then(function success(data) {
.then(function success() {
addLDAPDefaultPort(settings, $scope.LDAPSettings.TLSConfig.TLS);
return SettingsService.update(settings);
})
.then(function success(data) {
.then(function success() {
Notifications.success('Authentication settings updated');
})
.catch(function error(err) {

View file

@ -1,6 +1,6 @@
angular.module('portainer.app')
.controller('SettingsController', ['$scope', '$state', 'Notifications', 'SettingsService', 'StateManager', 'DEFAULT_TEMPLATES_URL',
function ($scope, $state, Notifications, SettingsService, StateManager, DEFAULT_TEMPLATES_URL) {
.controller('SettingsController', ['$scope', '$state', 'Notifications', 'SettingsService', 'StateManager',
function ($scope, $state, Notifications, SettingsService, StateManager) {
$scope.state = {
actionInProgress: false
@ -53,7 +53,7 @@ function ($scope, $state, Notifications, SettingsService, StateManager, DEFAULT_
function updateSettings(settings) {
SettingsService.update(settings)
.then(function success(data) {
.then(function success() {
Notifications.success('Settings updated');
StateManager.updateLogo(settings.LogoURL);
StateManager.updateSnapshotInterval(settings.SnapshotInterval);

View file

@ -114,7 +114,7 @@ function ($scope, $state, StackService, Authentication, Notifications, FormValid
}
$scope.state.actionInProgress = true;
action(name, method)
.then(function success(data) {
.then(function success() {
return ResourceControlService.applyResourceControl('stack', name, userId, accessControlData, []);
})
.then(function success() {

View file

@ -65,7 +65,7 @@ function ($q, $scope, $state, $transition$, StackService, NodeService, ServiceSe
$scope.state.migrationInProgress = true;
migrateRequest(stack, targetEndpointId)
.then(function success(data) {
.then(function success() {
Notifications.success('Stack successfully migrated', stack.Name);
$state.go('portainer.stacks', {}, {reload: true});
})
@ -108,7 +108,7 @@ function ($q, $scope, $state, $transition$, StackService, NodeService, ServiceSe
$scope.state.actionInProgress = true;
StackService.updateStack(stack, stackFile, env, prune)
.then(function success(data) {
.then(function success() {
Notifications.success('Stack successfully deployed');
$state.reload();
})

View file

@ -45,7 +45,7 @@ function ($scope, $state, TagService, Notifications) {
$scope.createTag = function() {
var tagName = $scope.formValues.Name;
TagService.createTag(tagName)
.then(function success(data) {
.then(function success() {
Notifications.success('Tag successfully created', tagName);
$state.reload();
})

View file

@ -45,7 +45,7 @@ function ($q, $scope, $state, $transition$, TeamService, UserService, TeamMember
$scope.promoteToLeader = function(user) {
TeamMembershipService.updateMembership(user.MembershipId, user.Id, $scope.team.Id, 1)
.then(function success(data) {
.then(function success() {
$scope.leaderCount++;
user.TeamRole = 'Leader';
Notifications.success('User is now team leader', user.Username);
@ -57,7 +57,7 @@ function ($q, $scope, $state, $transition$, TeamService, UserService, TeamMember
$scope.demoteToMember = function(user) {
TeamMembershipService.updateMembership(user.MembershipId, user.Id, $scope.team.Id, 2)
.then(function success(data) {
.then(function success() {
user.TeamRole = 'Member';
$scope.leaderCount--;
Notifications.success('User is now team member', user.Username);
@ -109,7 +109,7 @@ function ($q, $scope, $state, $transition$, TeamService, UserService, TeamMember
teamMembershipQueries.push(TeamMembershipService.deleteMembership(user.MembershipId));
});
$q.all(teamMembershipQueries)
.then(function success(data) {
.then(function success() {
$scope.users = $scope.users.concat($scope.teamMembers);
$scope.teamMembers = [];
Notifications.success('All users successfully removed');
@ -133,7 +133,7 @@ function ($q, $scope, $state, $transition$, TeamService, UserService, TeamMember
function deleteTeam() {
TeamService.deleteTeam($scope.team.Id)
.then(function success(data) {
.then(function success() {
Notifications.success('Team successfully deleted', $scope.team.Name);
$state.go('portainer.teams');
})

View file

@ -30,7 +30,7 @@ function ($q, $scope, $state, TeamService, UserService, ModalService, Notificati
$scope.state.actionInProgress = true;
TeamService.createTeam(teamName, leaderIds)
.then(function success(data) {
.then(function success() {
Notifications.success('Team successfully created', teamName);
$state.reload();
})

View file

@ -65,7 +65,6 @@ function ($scope, $q, $state, $transition$, $anchorScroll, ContainerService, Ima
var generatedVolumeIds = [];
VolumeService.createXAutoGeneratedLocalVolumes(generatedVolumeCount)
.then(function success(data) {
var volumeResourceControlQueries = [];
angular.forEach(data, function (volume) {
var volumeId = volume.Id;
generatedVolumeIds.push(volumeId);
@ -73,7 +72,7 @@ function ($scope, $q, $state, $transition$, $anchorScroll, ContainerService, Ima
TemplateService.updateContainerConfigurationWithVolumes(templateConfiguration, template, data);
return ImageService.pullImage(template.Image, { URL: template.Registry }, true);
})
.then(function success(data) {
.then(function success() {
return ContainerService.createAndStartContainer(templateConfiguration);
})
.then(function success(data) {
@ -109,7 +108,7 @@ function ($scope, $q, $state, $transition$, $anchorScroll, ContainerService, Ima
var endpointId = EndpointProvider.endpointID();
StackService.createComposeStackFromGitRepository(stackName, repositoryOptions, template.Env, endpointId)
.then(function success(data) {
.then(function success() {
return ResourceControlService.applyResourceControl('stack', stackName, userId, accessControlData, []);
})
.then(function success() {
@ -141,7 +140,7 @@ function ($scope, $q, $state, $transition$, $anchorScroll, ContainerService, Ima
var endpointId = EndpointProvider.endpointID();
StackService.createSwarmStackFromGitRepository(stackName, repositoryOptions, template.Env, endpointId)
.then(function success(data) {
.then(function success() {
return ResourceControlService.applyResourceControl('stack', stackName, userId, accessControlData, []);
})
.then(function success() {
@ -167,7 +166,6 @@ function ($scope, $q, $state, $transition$, $anchorScroll, ContainerService, Ima
}
var template = $scope.state.selectedTemplate;
var templatesKey = $scope.templatesKey;
$scope.state.actionInProgress = true;
if (template.Type === 2) {

View file

@ -25,7 +25,7 @@ function ($q, $scope, $state, $transition$, UserService, ModalService, Notificat
$scope.updatePermissions = function() {
var role = $scope.formValues.Administrator ? 1 : 2;
UserService.updateUser($scope.user.Id, undefined, role)
.then(function success(data) {
.then(function success() {
var newRole = role === 1 ? 'administrator' : 'user';
Notifications.success('Permissions successfully updated', $scope.user.Username + ' is now ' + newRole);
$state.reload();
@ -37,7 +37,7 @@ function ($q, $scope, $state, $transition$, UserService, ModalService, Notificat
$scope.updatePassword = function() {
UserService.updateUser($scope.user.Id, $scope.formValues.newPassword, undefined)
.then(function success(data) {
.then(function success() {
Notifications.success('Password successfully updated');
$state.reload();
})
@ -48,7 +48,7 @@ function ($q, $scope, $state, $transition$, UserService, ModalService, Notificat
function deleteUser() {
UserService.deleteUser($scope.user.Id)
.then(function success(data) {
.then(function success() {
Notifications.success('User successfully deleted', $scope.user.Username);
$state.go('portainer.users');
})

View file

@ -38,7 +38,7 @@ function ($q, $scope, $state, $sanitize, UserService, TeamService, TeamMembershi
teamIds.push(team.Id);
});
UserService.createUser(username, password, role, teamIds)
.then(function success(data) {
.then(function success() {
Notifications.success('User successfully created', username);
$state.reload();
})