fix(templates): replace volume input with a select (#3853)

* prevent non admins to create volume which they do not have access

* fix(volumes): replace volume input by a select
pull/3857/head
Maxime Bajeux 2020-05-22 01:35:34 +02:00 committed by GitHub
parent 10772a3ecd
commit ecbee3ee3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 12 deletions

View File

@ -86,7 +86,7 @@
<rd-widget> <rd-widget>
<rd-widget-custom-header icon="state.selectedTemplate.Logo" title-text="state.selectedTemplate.Image"></rd-widget-custom-header> <rd-widget-custom-header icon="state.selectedTemplate.Logo" title-text="state.selectedTemplate.Image"></rd-widget-custom-header>
<rd-widget-body classes="padding"> <rd-widget-body classes="padding">
<form class="form-horizontal"> <form class="form-horizontal" name="selectedTemplateType1">
<!-- description --> <!-- description -->
<div ng-if="state.selectedTemplate.Note"> <div ng-if="state.selectedTemplate.Note">
<div class="col-sm-12 form-section-title"> <div class="col-sm-12 form-section-title">
@ -236,16 +236,14 @@
<i class="fa fa-long-arrow-alt-right" aria-hidden="true"></i> <i class="fa fa-long-arrow-alt-right" aria-hidden="true"></i>
<!-- volume --> <!-- volume -->
<div class="input-group input-group-sm col-sm-6" ng-if="volume.type === 'volume'"> <div class="input-group input-group-sm col-sm-6" ng-if="volume.type === 'volume'">
<div class="col-sm-12 input-group">
<span class="input-group-addon">volume</span> <span class="input-group-addon">volume</span>
<input <div class="col-sm-12 input-group">
type="text" <select class="form-control" ng-model="volume.bind" ng-options="vol.Name as vol.Name for vol in availableVolumes">
ng-model="volume.bind" <option value="" disabled selected>Select a volume</option>
id="container_volumes" </select>
class="form-control" </div>
placeholder="Select a volume" </div>
typeahead-min-length="0"
uib-typeahead="vol.Name as vol.Name for vol in availableVolumes | filter:$viewValue"
/>
</div> </div>
<!-- !volume --> <!-- !volume -->
<!-- bind --> <!-- bind -->

View File

@ -295,7 +295,7 @@ angular.module('portainer.app').controller('TemplatesController', [
.then(function success(data) { .then(function success(data) {
var templates = data.templates; var templates = data.templates;
$scope.templates = templates; $scope.templates = templates;
$scope.availableVolumes = data.volumes.Volumes; $scope.availableVolumes = _.orderBy(data.volumes.Volumes, [(volume) => volume.Name.toLowerCase()], ['asc']);
var networks = data.networks; var networks = data.networks;
$scope.availableNetworks = networks; $scope.availableNetworks = networks;
var settings = data.settings; var settings = data.settings;