Merge branch 'release/1.13.4'

pull/965/merge 1.13.4
Anthony Lapenna 2017-06-29 16:37:28 +02:00
commit 034e29cd74
15 changed files with 145 additions and 19 deletions

46
CODE_OF_CONDUCT.md Normal file
View File

@ -0,0 +1,46 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at anthony.lapenna@portainer.io. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/

View File

@ -305,7 +305,7 @@ type (
const ( const (
// APIVersion is the version number of the Portainer API. // APIVersion is the version number of the Portainer API.
APIVersion = "1.13.3" APIVersion = "1.13.4"
// DBVersion is the version number of the Portainer database. // DBVersion is the version number of the Portainer database.
DBVersion = 2 DBVersion = 2
// DefaultTemplatesURL represents the default URL for the templates definitions. // DefaultTemplatesURL represents the default URL for the templates definitions.

View File

@ -290,6 +290,22 @@
<div class="pagination-controls"> <div class="pagination-controls">
<dir-pagination-controls></dir-pagination-controls> <dir-pagination-controls></dir-pagination-controls>
</div> </div>
<hr />
<form class="form-horizontal">
<!-- network-input -->
<div class="row">
<label for="container_network" class="col-sm-3 col-lg-2 control-label text-left">Join a Network</label>
<div class="col-sm-5 col-lg-4">
<select class="form-control" ng-model="selectedNetwork" id="container_network">
<option selected disabled hidden value="">Select a network</option>
<option ng-repeat="net in availableNetworks" ng-value="net.Id">{{ net.Name }}</option>
</select>
</div>
<div class="col-sm-1">
<button type="button" class="btn btn-primary btn-sm" ng-disabled="!selectedNetwork" ng-click="containerJoinNetwork(container, selectedNetwork)">Join Network</button>
</div>
</div>
</form>
</rd-widget-body> </rd-widget-body>
</rd-widget> </rd-widget>
</div> </div>

View File

@ -197,5 +197,42 @@ function ($scope, $state, $stateParams, $filter, Container, ContainerCommit, Con
}); });
}; };
$scope.containerJoinNetwork = function containerJoinNetwork(container, networkId) {
$('#joinNetworkSpinner').show();
Network.connect({id: networkId}, { Container: $stateParams.id }, function (d) {
if (container.message) {
$('#joinNetworkSpinner').hide();
Notifications.error('Error', d, 'Unable to connect container to network');
} else {
$('#joinNetworkSpinner').hide();
Notifications.success('Container joined network', $stateParams.id);
$state.go('container', {id: $stateParams.id}, {reload: true});
}
}, function (e) {
$('#joinNetworkSpinner').hide();
Notifications.error('Failure', e, 'Unable to connect container to network');
});
};
Network.query({}, function (d) {
var networks = d;
if ($scope.applicationState.endpoint.mode.provider === 'DOCKER_SWARM' || $scope.applicationState.endpoint.mode.provider === 'DOCKER_SWARM_MODE') {
networks = d.filter(function (network) {
if (network.Scope === 'global') {
return network;
}
});
networks.push({Name: 'bridge'});
networks.push({Name: 'host'});
networks.push({Name: 'none'});
}
$scope.availableNetworks = networks;
if (!_.find(networks, {'Name': 'bridge'})) {
networks.push({Name: 'nat'});
}
}, function (e) {
Notifications.error('Failure', e, 'Unable to retrieve networks');
});
update(); update();
}]); }]);

View File

@ -299,7 +299,7 @@ function ($q, $scope, $state, $stateParams, $filter, Container, ContainerHelper,
}; };
function createContainer(config, accessControlData) { function createContainer(config, accessControlData) {
$q.when(!$scope.formValues.alwaysPull || ImageService.pullImage($scope.config.Image, $scope.formValues.Registry)) $q.when(!$scope.formValues.alwaysPull || ImageService.pullImage($scope.config.Image, $scope.formValues.Registry, true))
.finally(function final() { .finally(function final() {
ContainerService.createAndStartContainer(config) ContainerService.createAndStartContainer(config)
.then(function success(data) { .then(function success(data) {

View File

@ -222,7 +222,9 @@ function ($q, $scope, $state, Service, ServiceHelper, SecretHelper, SecretServic
var secrets = []; var secrets = [];
angular.forEach(input.Secrets, function(secret) { angular.forEach(input.Secrets, function(secret) {
if (secret.model) { if (secret.model) {
secrets.push(SecretHelper.secretConfig(secret.model)); var s = SecretHelper.secretConfig(secret.model);
s.File.Name = s.SecretName;
secrets.push(s);
} }
}); });
config.TaskTemplate.ContainerSpec.Secrets = secrets; config.TaskTemplate.ContainerSpec.Secrets = secrets;

View File

@ -242,7 +242,7 @@
<span class="input-group-addon">volume</span> <span class="input-group-addon">volume</span>
<select class="form-control" ng-model="volume.Source"> <select class="form-control" ng-model="volume.Source">
<option selected disabled hidden value="">Select a volume</option> <option selected disabled hidden value="">Select a volume</option>
<option ng-repeat="vol in availableVolumes" ng-value="vol.Name">{{ vol.Name|truncate:30}}</option> <option ng-repeat="vol in availableVolumes" ng-value="vol.Id">{{ vol.Id|truncate:30 }}</option>
</select> </select>
</div> </div>
<!-- !volume --> <!-- !volume -->

View File

@ -47,7 +47,7 @@ function ($scope, $stateParams, $state, $timeout, ImageService, RegistryService,
RegistryService.retrieveRegistryFromRepository(repository) RegistryService.retrieveRegistryFromRepository(repository)
.then(function success(data) { .then(function success(data) {
var registry = data; var registry = data;
return ImageService.pullImage(repository, registry); return ImageService.pullImage(repository, registry, false);
}) })
.then(function success(data) { .then(function success(data) {
Notifications.success('Image successfully pulled', repository); Notifications.success('Image successfully pulled', repository);

View File

@ -42,7 +42,7 @@ function ($scope, $state, ImageService, Notifications, Pagination, ModalService)
$('#pullImageSpinner').show(); $('#pullImageSpinner').show();
var image = $scope.formValues.Image; var image = $scope.formValues.Image;
var registry = $scope.formValues.Registry; var registry = $scope.formValues.Registry;
ImageService.pullImage(image, registry) ImageService.pullImage(image, registry, false)
.then(function success(data) { .then(function success(data) {
Notifications.success('Image successfully pulled', image); Notifications.success('Image successfully pulled', image);
$state.reload(); $state.reload();

View File

@ -69,7 +69,7 @@ function ($scope, $q, $state, $stateParams, $anchorScroll, $filter, ContainerSer
generatedVolumeIds.push(volumeId); generatedVolumeIds.push(volumeId);
}); });
TemplateService.updateContainerConfigurationWithVolumes(templateConfiguration, template, data); TemplateService.updateContainerConfigurationWithVolumes(templateConfiguration, template, data);
return ImageService.pullImage(template.Image, template.Registry); return ImageService.pullImage(template.Image, { URL: template.Registry }, true);
}) })
.then(function success(data) { .then(function success(data) {
return ContainerService.createAndStartContainer(templateConfiguration); return ContainerService.createAndStartContainer(templateConfiguration);

View File

@ -53,6 +53,13 @@
<span ng-show="sortType == 'Driver' && sortReverse" class="glyphicon glyphicon-chevron-up"></span> <span ng-show="sortType == 'Driver' && sortReverse" class="glyphicon glyphicon-chevron-up"></span>
</a> </a>
</th> </th>
<th>
<a ui-sref="volumes" ng-click="order('Mountpoint')">
Mount point
<span ng-show="sortType == 'Mountpoint' && !sortReverse" class="glyphicon glyphicon-chevron-down"></span>
<span ng-show="sortType == 'Mountpoint' && sortReverse" class="glyphicon glyphicon-chevron-up"></span>
</a>
</th>
<th ng-if="applicationState.application.authentication"> <th ng-if="applicationState.application.authentication">
<a ui-sref="volumes" ng-click="order('ResourceControl.Ownership')"> <a ui-sref="volumes" ng-click="order('ResourceControl.Ownership')">
Ownership Ownership
@ -65,8 +72,9 @@
<tbody> <tbody>
<tr dir-paginate="volume in (state.filteredVolumes = (volumes | filter:state.filter | orderBy:sortType:sortReverse | itemsPerPage: state.pagination_count))"> <tr dir-paginate="volume in (state.filteredVolumes = (volumes | filter:state.filter | orderBy:sortType:sortReverse | itemsPerPage: state.pagination_count))">
<td><input type="checkbox" ng-model="volume.Checked" ng-change="selectItem(volume)"/></td> <td><input type="checkbox" ng-model="volume.Checked" ng-change="selectItem(volume)"/></td>
<td><a ui-sref="volume({id: volume.Id})">{{ volume.Id|truncate:50 }}</a></td> <td><a ui-sref="volume({id: volume.Id})">{{ volume.Id|truncate:25 }}</a></td>
<td>{{ volume.Driver }}</td> <td>{{ volume.Driver }}</td>
<td>{{ volume.Mountpoint | truncate:52 }}</td>
<td ng-if="applicationState.application.authentication"> <td ng-if="applicationState.application.authentication">
<span> <span>
<i ng-class="volume.ResourceControl.Ownership | ownershipicon" aria-hidden="true"></i> <i ng-class="volume.ResourceControl.Ownership | ownershipicon" aria-hidden="true"></i>
@ -75,10 +83,10 @@
</td> </td>
</tr> </tr>
<tr ng-if="!volumes"> <tr ng-if="!volumes">
<td colspan="6" class="text-center text-muted">Loading...</td> <td colspan="5" class="text-center text-muted">Loading...</td>
</tr> </tr>
<tr ng-if="volumes.length == 0"> <tr ng-if="volumes.length == 0">
<td colspan="6" class="text-center text-muted">No volumes available.</td> <td colspan="5" class="text-center text-muted">No volumes available.</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>

View File

@ -21,7 +21,7 @@ angular.module('portainer.helpers')
SecretID: secret.Id, SecretID: secret.Id,
SecretName: secret.Name, SecretName: secret.Name,
File: { File: {
Name: secret.Name, Name: secret.FileName,
UID: '0', UID: '0',
GID: '0', GID: '0',
Mode: 444 Mode: 444

View File

@ -54,14 +54,19 @@ angular.module('portainer.services')
return deferred.promise; return deferred.promise;
}; };
function pullImageAndIgnoreErrors(imageConfiguration) {
service.pullImage = function(image, registry) {
var deferred = $q.defer(); var deferred = $q.defer();
var imageDetails = ImageHelper.extractImageAndRegistryFromRepository(image); Image.create({}, imageConfiguration).$promise
var imageConfiguration = ImageHelper.createImageConfigForContainer(imageDetails.image, registry.URL); .finally(function final() {
var authenticationDetails = registry.Authentication ? RegistryService.encodedCredentials(registry) : ''; deferred.resolve();
HttpRequestHelper.setRegistryAuthenticationHeader(authenticationDetails); });
return deferred.promise;
}
function pullImageAndAcknowledgeErrors(imageConfiguration) {
var deferred = $q.defer();
Image.create({}, imageConfiguration).$promise Image.create({}, imageConfiguration).$promise
.then(function success(data) { .then(function success(data) {
@ -78,6 +83,18 @@ angular.module('portainer.services')
}); });
return deferred.promise; return deferred.promise;
}
service.pullImage = function(image, registry, ignoreErrors) {
var imageDetails = ImageHelper.extractImageAndRegistryFromRepository(image);
var imageConfiguration = ImageHelper.createImageConfigForContainer(imageDetails.image, registry.URL);
var authenticationDetails = registry.Authentication ? RegistryService.encodedCredentials(registry) : '';
HttpRequestHelper.setRegistryAuthenticationHeader(authenticationDetails);
if (ignoreErrors) {
return pullImageAndIgnoreErrors(imageConfiguration);
}
return pullImageAndAcknowledgeErrors(imageConfiguration);
}; };
service.tagImage = function(id, image, registry) { service.tagImage = function(id, image, registry) {

View File

@ -1,6 +1,6 @@
{ {
"name": "portainer", "name": "portainer",
"version": "1.13.3", "version": "1.13.4",
"homepage": "https://github.com/portainer/portainer", "homepage": "https://github.com/portainer/portainer",
"authors": [ "authors": [
"Anthony Lapenna <anthony.lapenna at gmail dot com>" "Anthony Lapenna <anthony.lapenna at gmail dot com>"

View File

@ -2,7 +2,7 @@
"author": "Portainer.io", "author": "Portainer.io",
"name": "portainer", "name": "portainer",
"homepage": "http://portainer.io", "homepage": "http://portainer.io",
"version": "1.13.3", "version": "1.13.4",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git@github.com:portainer/portainer.git" "url": "git@github.com:portainer/portainer.git"