* 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
pull/2210/head
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

@ -141,7 +141,10 @@ rules:
no-undef-init: error
no-undef: off
no-undefined: off
no-unused-vars: off
no-unused-vars:
- warn
-
vars: local
no-use-before-define: off
# Node.js and CommonJS

View File

@ -48,7 +48,7 @@ function initAnalytics(Analytics, $rootScope) {
Analytics.offline(false);
Analytics.registerScriptTags();
Analytics.registerTrackers();
$rootScope.$on('$stateChangeSuccess', function (event, toState, toParams, fromState, fromParams) {
$rootScope.$on('$stateChangeSuccess', function (event, toState) {
Analytics.trackPage(toState.url);
Analytics.pageView();
});

View File

@ -15,7 +15,7 @@ function ContainerGroupDefaultModel() {
this.Memory = 1;
}
function ContainerGroupViewModel(data, subscriptionId, resourceGroupName) {
function ContainerGroupViewModel(data) {
this.Id = data.id;
this.Name = data.name;
this.Location = data.location;

View File

@ -30,7 +30,7 @@ function AzureServiceFactory($q, Azure, SubscriptionService, ResourceGroupServic
service.aggregate = function(resourcesBySubcription) {
var aggregatedResources = [];
Object.keys(resourcesBySubcription).forEach(function(key, index) {
Object.keys(resourcesBySubcription).forEach(function(key) {
aggregatedResources = aggregatedResources.concat(resourcesBySubcription[key]);
});
return aggregatedResources;

View File

@ -31,7 +31,7 @@ function ($q, $scope, $state, AzureService, Notifications) {
$scope.state.actionInProgress = true;
AzureService.createContainerGroup(model, subscriptionId, resourceGroupName)
.then(function success(data) {
.then(function success() {
Notifications.success('Container successfully created', model.Name);
$state.go('azure.containerinstances');
})

View File

@ -141,7 +141,7 @@ function (PaginationService, DatatableService, EndpointProvider) {
PaginationService.setPaginationLimit(this.tableKey, this.state.paginatedItemLimit);
};
this.applyFilters = function(value, index, array) {
this.applyFilters = function(value) {
var container = value;
var filters = ctrl.filters;
for (var i = 0; i < filters.state.values.length; i++) {

View File

@ -52,7 +52,7 @@ function (PaginationService, DatatableService) {
PaginationService.setPaginationLimit(this.tableKey, this.state.paginatedItemLimit);
};
this.applyFilters = function(value, index, array) {
this.applyFilters = function(value) {
var image = value;
var filters = ctrl.filters;
if ((image.ContainerCount === 0 && filters.usage.showUnusedImages)

View File

@ -15,7 +15,7 @@ function (DatatableService) {
}
};
this.applyFilters = function(item, index, array) {
this.applyFilters = function(item) {
var filters = ctrl.filters;
for (var i = 0; i < filters.state.values.length; i++) {
var filter = filters.state.values[i];

View File

@ -6,7 +6,7 @@ function ($state, ServiceService, ServiceHelper, Notifications, ModalService, Im
var config = ServiceHelper.serviceToConfig(service.Model);
config.Mode.Replicated.Replicas = service.Replicas;
ServiceService.update(service, config)
.then(function success(data) {
.then(function success() {
Notifications.success('Service successfully scaled', 'New replica count: ' + service.Replicas);
$state.reload();
})
@ -53,7 +53,7 @@ function ($state, ServiceService, ServiceHelper, Notifications, ModalService, Im
// value or an increment of the counter value to force an update.
config.TaskTemplate.ForceUpdate++;
ServiceService.update(service, config)
.then(function success(data) {
.then(function success() {
Notifications.success('Service successfully updated', service.Name);
})
.catch(function error(err) {

View File

@ -52,7 +52,7 @@ function (PaginationService, DatatableService) {
PaginationService.setPaginationLimit(this.tableKey, this.state.paginatedItemLimit);
};
this.applyFilters = function(value, index, array) {
this.applyFilters = function(value) {
var volume = value;
var filters = ctrl.filters;
if ((volume.dangling && filters.usage.showUnusedVolumes)

View File

@ -1,7 +1,6 @@
angular.module('portainer.docker')
.controller('LogViewerController', ['clipboard',
function (clipboard) {
var ctrl = this;
this.state = {
copySupported: clipboard.supported,

View File

@ -35,12 +35,6 @@ angular.module('portainer.docker')
for (var v in container.Mounts) {
if ({}.hasOwnProperty.call(container.Mounts, v)) {
var mount = container.Mounts[v];
var volume = {
'type': mount.Type,
'name': mount.Name || mount.Source,
'containerPath': mount.Destination,
'readOnly': mount.RW === false
};
var name = mount.Name || mount.Source;
var containerPath = mount.Destination;
if (name && containerPath) {

View File

@ -1,4 +1,4 @@
function ServiceViewModel(data, runningTasks, allTasks, nodes) {
function ServiceViewModel(data, runningTasks, allTasks) {
this.Model = data;
this.Id = data.ID;
this.Tasks = [];

View File

@ -1,5 +1,5 @@
angular.module('portainer.docker')
.factory('VolumeService', ['$q', 'Volume', 'VolumeHelper', 'ResourceControlService', 'UserService', 'TeamService', function VolumeServiceFactory($q, Volume, VolumeHelper, ResourceControlService, UserService, TeamService) {
.factory('VolumeService', ['$q', 'Volume', 'VolumeHelper', 'ResourceControlService', function VolumeServiceFactory($q, Volume, VolumeHelper, ResourceControlService) {
'use strict';
var service = {};

View File

@ -4,7 +4,7 @@ function ($scope, $transition$, $state, ConfigService, Notifications) {
$scope.removeConfig = function removeConfig(configId) {
ConfigService.remove(configId)
.then(function success(data) {
.then(function success() {
Notifications.success('Config successfully removed');
$state.go('docker.configs', {});
})

View File

@ -12,7 +12,7 @@ function ($scope, $transition$, ContainerService, ImageService, EndpointProvider
$scope.containerCommands = [];
// Ensure the socket is closed before leaving the view
$scope.$on('$stateChangeStart', function (event, next, current) {
$scope.$on('$stateChangeStart', function () {
if (socket && socket !== null) {
socket.close();
}
@ -69,7 +69,7 @@ function ($scope, $transition$, ContainerService, ImageService, EndpointProvider
socket = new WebSocket(url);
$scope.state.connected = true;
socket.onopen = function(evt) {
socket.onopen = function() {
term = new Terminal();
term.on('data', function (data) {
@ -88,10 +88,10 @@ function ($scope, $transition$, ContainerService, ImageService, EndpointProvider
socket.onmessage = function (e) {
term.write(e.data);
};
socket.onerror = function (error) {
socket.onerror = function () {
$scope.state.connected = false;
};
socket.onclose = function(evt) {
socket.onclose = function() {
$scope.state.connected = false;
};
};

View File

@ -282,8 +282,8 @@ function ($q, $scope, $state, $timeout, $transition$, $filter, Container, Contai
return config;
}
function loadFromContainerCmd(d) {
function loadFromContainerCmd() {
if ($scope.config.Cmd) {
$scope.config.Cmd = ContainerHelper.commandArrayToString($scope.config.Cmd);
} else {
@ -291,7 +291,7 @@ function ($q, $scope, $state, $timeout, $transition$, $filter, Container, Contai
}
}
function loadFromContainerPortBindings(d) {
function loadFromContainerPortBindings() {
var bindings = [];
for (var p in $scope.config.HostConfig.PortBindings) {
if ({}.hasOwnProperty.call($scope.config.HostConfig.PortBindings, p)) {
@ -386,7 +386,7 @@ function ($q, $scope, $state, $timeout, $transition$, $filter, Container, Contai
}
}
function loadFromContainerEnvironmentVariables(d) {
function loadFromContainerEnvironmentVariables() {
var envArr = [];
for (var e in $scope.config.Env) {
if ({}.hasOwnProperty.call($scope.config.Env, e)) {
@ -397,7 +397,7 @@ function ($q, $scope, $state, $timeout, $transition$, $filter, Container, Contai
$scope.config.Env = envArr;
}
function loadFromContainerLabels(d) {
function loadFromContainerLabels() {
for (var l in $scope.config.Labels) {
if ({}.hasOwnProperty.call($scope.config.Labels, l)) {
$scope.formValues.Labels.push({ name: l, value: $scope.config.Labels[l]});
@ -405,7 +405,7 @@ function ($q, $scope, $state, $timeout, $transition$, $filter, Container, Contai
}
}
function loadFromContainerConsole(d) {
function loadFromContainerConsole() {
if ($scope.config.OpenStdin && $scope.config.Tty) {
$scope.formValues.Console = 'both';
} else if (!$scope.config.OpenStdin && $scope.config.Tty) {
@ -417,7 +417,7 @@ function ($q, $scope, $state, $timeout, $transition$, $filter, Container, Contai
}
}
function loadFromContainerDevices(d) {
function loadFromContainerDevices() {
var path = [];
for (var dev in $scope.config.HostConfig.Devices) {
if ({}.hasOwnProperty.call($scope.config.HostConfig.Devices, dev)) {
@ -428,7 +428,7 @@ function ($q, $scope, $state, $timeout, $transition$, $filter, Container, Contai
$scope.config.HostConfig.Devices = path;
}
function loadFromContainerImageConfig(d) {
function loadFromContainerImageConfig() {
var imageInfo = ImageHelper.extractImageAndRegistryFromRepository($scope.config.Image);
RegistryService.retrieveRegistryFromRepository($scope.config.Image)
.then(function success(data) {

View File

@ -56,7 +56,7 @@ function ($q, $scope, $state, $transition$, $filter, Commit, ContainerHelper, Co
function executeContainerAction(id, action, successMessage, errorMessage) {
action(id)
.then(function success(data) {
.then(function success() {
Notifications.success(successMessage, id);
update();
})
@ -104,7 +104,7 @@ function ($q, $scope, $state, $transition$, $filter, Commit, ContainerHelper, Co
$scope.renameContainer = function () {
var container = $scope.container;
ContainerService.renameContainer($transition$.params().id, container.newContainerName)
.then(function success(data) {
.then(function success() {
container.Name = container.newContainerName;
Notifications.success('Container successfully renamed', container.Name);
})
@ -120,7 +120,7 @@ function ($q, $scope, $state, $transition$, $filter, Commit, ContainerHelper, Co
$scope.containerLeaveNetwork = function containerLeaveNetwork(container, networkId) {
$scope.state.leaveNetworkInProgress = true;
NetworkService.disconnectContainer(networkId, container.Id, false)
.then(function success(data) {
.then(function success() {
Notifications.success('Container left network', container.Id);
$state.reload();
})
@ -135,7 +135,7 @@ function ($q, $scope, $state, $transition$, $filter, Commit, ContainerHelper, Co
$scope.containerJoinNetwork = function containerJoinNetwork(container, networkId) {
$scope.state.joinNetworkInProgress = true;
NetworkService.connectContainer(networkId, container.Id)
.then(function success(data) {
.then(function success() {
Notifications.success('Container joined network', container.Id);
$state.reload();
})
@ -151,7 +151,7 @@ function ($q, $scope, $state, $transition$, $filter, Commit, ContainerHelper, Co
var image = $scope.config.Image;
var registry = $scope.config.Registry;
var imageConfig = ImageHelper.createImageConfigForCommit(image, registry.URL);
Commit.commitContainer({id: $transition$.params().id, tag: imageConfig.tag, repo: imageConfig.repo}, function (d) {
Commit.commitContainer({id: $transition$.params().id, tag: imageConfig.tag, repo: imageConfig.repo}, function () {
update();
Notifications.success('Container commited', $transition$.params().id);
}, function (e) {

View File

@ -27,10 +27,6 @@ function ($scope, $transition$, $interval, ContainerService, Notifications, Http
}
}
function update(logs) {
$scope.logs = logs;
}
function setUpdateRepeater(skipHeaders) {
var refreshRate = $scope.state.refreshRate;
$scope.repeater = $interval(function() {

View File

@ -29,7 +29,7 @@ function ($q, $scope, $transition$, $state, $timeout, ImageService, RegistryServ
var registry = $scope.formValues.Registry;
ImageService.tagImage($transition$.params().id, image, registry.URL)
.then(function success(data) {
.then(function success() {
Notifications.success('Image successfully tagged');
$state.go('docker.images.image', {id: $transition$.params().id}, {reload: true});
})
@ -45,7 +45,7 @@ function ($q, $scope, $transition$, $state, $timeout, ImageService, RegistryServ
var registry = data;
return ImageService.pushImage(repository, registry);
})
.then(function success(data) {
.then(function success() {
Notifications.success('Image successfully pushed', repository);
})
.catch(function error(err) {
@ -63,7 +63,7 @@ function ($q, $scope, $transition$, $state, $timeout, ImageService, RegistryServ
var registry = data;
return ImageService.pullImage(repository, registry, false);
})
.then(function success(data) {
.then(function success() {
Notifications.success('Image successfully pulled', repository);
})
.catch(function error(err) {

View File

@ -21,7 +21,7 @@ function ($scope, $state, ImageService, Notifications, ModalService, HttpRequest
$scope.state.actionInProgress = true;
ImageService.pullImage(image, registry, false)
.then(function success(data) {
.then(function success() {
Notifications.success('Image successfully pulled', image);
$state.reload();
})

View File

@ -1,10 +1,10 @@
angular.module('portainer.docker')
.controller('NetworkController', ['$scope', '$state', '$transition$', '$filter', 'NetworkService', 'Container', 'ContainerHelper', 'Notifications', 'HttpRequestHelper',
function ($scope, $state, $transition$, $filter, NetworkService, Container, ContainerHelper, Notifications, HttpRequestHelper) {
.controller('NetworkController', ['$scope', '$state', '$transition$', '$filter', 'NetworkService', 'Container', 'Notifications', 'HttpRequestHelper',
function ($scope, $state, $transition$, $filter, NetworkService, Container, Notifications, HttpRequestHelper) {
$scope.removeNetwork = function removeNetwork(networkId) {
$scope.removeNetwork = function removeNetwork() {
NetworkService.remove($transition$.params().id, $transition$.params().id)
.then(function success(data) {
.then(function success() {
Notifications.success('Network removed', $transition$.params().id);
$state.go('docker.networks', {});
})
@ -16,7 +16,7 @@ function ($scope, $state, $transition$, $filter, NetworkService, Container, Cont
$scope.containerLeaveNetwork = function containerLeaveNetwork(network, container) {
HttpRequestHelper.setPortainerAgentTargetHeader(container.NodeName);
NetworkService.disconnectContainer($transition$.params().id, container.Id, false)
.then(function success(data) {
.then(function success() {
Notifications.success('Container left network', $transition$.params().id);
$state.go('docker.networks.network', { id: network.Id }, { reload: true });
})

View File

@ -52,7 +52,7 @@ function ($scope, $state, $transition$, LabelHelper, Node, NodeHelper, Task, Not
config.Role = node.Role;
config.Labels = LabelHelper.fromKeyValueToLabelHash(node.Labels);
Node.update({ id: node.Id, version: node.Version }, config, function (data) {
Node.update({ id: node.Id, version: node.Version }, config, function () {
Notifications.success('Node successfully updated', 'Node updated');
$state.go('docker.nodes.node', {id: node.Id}, {reload: true});
}, function (e) {

View File

@ -4,7 +4,7 @@ function ($scope, $transition$, $state, SecretService, Notifications) {
$scope.removeSecret = function removeSecret(secretId) {
SecretService.remove(secretId)
.then(function success(data) {
.then(function success() {
Notifications.success('Secret successfully removed');
$state.go('docker.secrets', {});
})

View File

@ -142,7 +142,7 @@ function ($q, $scope, $state, $timeout, Service, ServiceHelper, ConfigService, C
$scope.formValues.ContainerLabels.splice(index, 1);
};
$scope.addLogDriverOpt = function(value) {
$scope.addLogDriverOpt = function() {
$scope.formValues.LogDriverOpts.push({ name: '', value: ''});
};
@ -492,7 +492,6 @@ function ($q, $scope, $state, $timeout, Service, ServiceHelper, ConfigService, C
function initView() {
var apiVersion = $scope.applicationState.endpoint.apiVersion;
var provider = $scope.applicationState.endpoint.mode.provider;
$q.all({
volumes: VolumeService.volumes(),

View File

@ -125,7 +125,7 @@ function ($q, $scope, $transition$, $state, $location, $timeout, $anchorScroll,
updateServiceArray(service, 'ServiceMounts', service.ServiceMounts);
}
};
$scope.updateMount = function updateMount(service, mount) {
$scope.updateMount = function updateMount(service) {
updateServiceArray(service, 'ServiceMounts', service.ServiceMounts);
};
$scope.addPlacementConstraint = function addPlacementConstraint(service) {
@ -138,7 +138,7 @@ function ($q, $scope, $transition$, $state, $location, $timeout, $anchorScroll,
updateServiceArray(service, 'ServiceConstraints', service.ServiceConstraints);
}
};
$scope.updatePlacementConstraint = function(service, constraint) {
$scope.updatePlacementConstraint = function(service) {
updateServiceArray(service, 'ServiceConstraints', service.ServiceConstraints);
};
@ -152,7 +152,7 @@ function ($q, $scope, $transition$, $state, $location, $timeout, $anchorScroll,
updateServiceArray(service, 'ServicePreferences', service.ServicePreferences);
}
};
$scope.updatePlacementPreference = function(service, constraint) {
$scope.updatePlacementPreference = function(service) {
updateServiceArray(service, 'ServicePreferences', service.ServicePreferences);
};
@ -162,7 +162,7 @@ function ($q, $scope, $transition$, $state, $location, $timeout, $anchorScroll,
}
service.Ports.push({ PublishedPort: '', TargetPort: '', Protocol: 'tcp', PublishMode: 'ingress' });
};
$scope.updatePublishedPort = function updatePublishedPort(service, portMapping) {
$scope.updatePublishedPort = function updatePublishedPort(service) {
updateServiceArray(service, 'Ports', service.Ports);
};
$scope.removePortPublishedBinding = function removePortPublishedBinding(service, index) {
@ -203,7 +203,7 @@ function ($q, $scope, $transition$, $state, $location, $timeout, $anchorScroll,
updateServiceArray(service, 'Hosts', service.Hosts);
}
};
$scope.updateHostsEntry = function(service, entry) {
$scope.updateHostsEntry = function(service) {
updateServiceArray(service, 'Hosts', service.Hosts);
};
@ -340,7 +340,7 @@ function ($q, $scope, $transition$, $state, $location, $timeout, $anchorScroll,
function removeService() {
$scope.state.deletionInProgress = true;
ServiceService.remove($scope.service)
.then(function success(data) {
.then(function success() {
Notifications.success('Service successfully deleted');
$state.go('docker.services', {});
})
@ -377,7 +377,7 @@ function ($q, $scope, $transition$, $state, $location, $timeout, $anchorScroll,
config.TaskTemplate.ForceUpdate++;
$scope.state.updateInProgress = true;
ServiceService.update(service, config)
.then(function success(data) {
.then(function success() {
Notifications.success('Service successfully updated', service.Name);
$scope.cancelChanges({});
initView();

View File

@ -82,7 +82,7 @@ function ($q, $scope, $state, VolumeService, PluginService, ResourceControlServi
var userId = userDetails.ID;
return ResourceControlService.applyResourceControl('volume', volumeIdentifier, userId, accessControlData, []);
})
.then(function success(data) {
.then(function success() {
Notifications.success('Volume successfully created');
$state.go('docker.volumes', {}, {reload: true});
})

View File

@ -4,7 +4,7 @@ function ($scope, $state, $transition$, VolumeService, ContainerService, Notific
$scope.removeVolume = function removeVolume() {
VolumeService.remove($scope.volume)
.then(function success(data) {
.then(function success() {
Notifications.success('Volume successfully removed', $transition$.params().id);
$state.go('docker.volumes', {});
})

View File

@ -178,7 +178,7 @@ angular.module('extension.storidge')
return label + ': ' + processedValue + '/s';
}
function bytePerSecBasedAxisLabel(value, index, values) {
function bytePerSecBasedAxisLabel(value) {
if (value > 5) {
return filesize(value, {base: 10, round: 1});
}

View File

@ -1,6 +1,6 @@
angular.module('extension.storidge')
.controller('StoridgeMonitorController', ['$q', '$scope', '$interval', '$document', 'Notifications', 'StoridgeClusterService', 'StoridgeChartService', 'ModalService',
function ($q, $scope, $interval, $document, Notifications, StoridgeClusterService, StoridgeChartService, ModalService) {
.controller('StoridgeMonitorController', ['$q', '$scope', '$interval', '$document', 'Notifications', 'StoridgeClusterService', 'StoridgeChartService',
function ($q, $scope, $interval, $document, Notifications, StoridgeClusterService, StoridgeChartService) {
$scope.$on('$destroy', function() {
stopRepeater();

View File

@ -30,7 +30,7 @@ function ($scope, $state, $transition$, Notifications, StoridgeProfileService) {
$scope.state.actionInProgress = true;
StoridgeProfileService.create(profile)
.then(function success(data) {
.then(function success() {
Notifications.success('Profile successfully created');
$state.go('storidge.profiles');
})

View File

@ -31,7 +31,7 @@ function ($scope, $state, $transition$, Notifications, StoridgeProfileService, M
$scope.state.updateInProgress = true;
StoridgeProfileService.update(profile)
.then(function success(data) {
.then(function success() {
Notifications.success('Profile successfully updated');
$state.go('storidge.profiles');
})
@ -58,7 +58,7 @@ function ($scope, $state, $transition$, Notifications, StoridgeProfileService, M
$scope.state.deleteInProgress = true;
StoridgeProfileService.delete(profile.Name)
.then(function success(data) {
.then(function success() {
Notifications.success('Profile successfully deleted');
$state.go('storidge.profiles');
})

View File

@ -38,7 +38,7 @@ function ($q, $scope, $state, Notifications, StoridgeProfileService) {
$scope.state.actionInProgress = true;
StoridgeProfileService.create(model)
.then(function success(data) {
.then(function success() {
Notifications.success('Profile successfully created');
$state.reload();
})

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();
})

View File

@ -106,7 +106,6 @@ module.exports = function (grunt) {
var autoprefixer = require('autoprefixer');
var cssnano = require('cssnano');
var fs = require('fs');
gruntfile_cfg.config = {
dev: { options: { variables: { 'environment': 'development' }}},