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

View File

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