Skip to content

Commit

Permalink
feat(containers): add browse button to each volume listed in the cont…
Browse files Browse the repository at this point in the history
…ainer view
  • Loading branch information
diegovilar committed Feb 8, 2020
1 parent 278558a commit 86cb2b8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
9 changes: 8 additions & 1 deletion app/docker/views/containers/edit/container.html
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,14 @@
<tbody>
<tr ng-repeat="vol in container.Mounts">
<td ng-if="vol.Type === 'bind'">{{ vol.Source }}</td>
<td ng-if="vol.Type === 'volume'"><a ui-sref="docker.volumes.volume({ id: vol.Name, nodeName: nodeName })">{{ vol.Name }}</a></td>
<td ng-if="vol.Type === 'volume'"><a ui-sref="docker.volumes.volume({ id: vol.Name, nodeName: nodeName })">{{ vol.Name }}</a>
<a authorization="DockerAgentBrowseList"
ui-sref="docker.volumes.volume.browse({ id: vol.Name, nodeName: nodeName })"
class="btn btn-xs btn-primary space-left"
ng-if="showBrowseAction">
<i class="fa fa-search"></i> browse</a>
</a>
</td>
<td>{{ vol.Destination }}</td>
</tr>
</tbody>
Expand Down
20 changes: 15 additions & 5 deletions app/docker/views/containers/edit/containerController.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import moment from 'moment';
import { PorImageRegistryModel } from 'Docker/models/porImageRegistry';

angular.module('portainer.docker')
.controller('ContainerController', ['$q', '$scope', '$state','$transition$', '$filter', '$async', 'ExtensionService', 'Commit', 'ContainerHelper', 'ContainerService', 'ImageHelper', 'NetworkService', 'Notifications', 'ModalService', 'ResourceControlService', 'RegistryService', 'ImageService', 'HttpRequestHelper', 'Authentication',
function ($q, $scope, $state, $transition$, $filter, $async, ExtensionService, Commit, ContainerHelper, ContainerService, ImageHelper, NetworkService, Notifications, ModalService, ResourceControlService, RegistryService, ImageService, HttpRequestHelper, Authentication) {
.controller('ContainerController', ['$q', '$scope', '$state','$transition$', '$filter', '$async', 'ExtensionService', 'Commit', 'ContainerHelper', 'ContainerService', 'ImageHelper', 'NetworkService', 'Notifications', 'ModalService', 'ResourceControlService', 'RegistryService', 'ImageService', 'HttpRequestHelper', 'Authentication', 'StateManager', 'EndpointProvider',
function ($q, $scope, $state, $transition$, $filter, $async, ExtensionService, Commit, ContainerHelper, ContainerService, ImageHelper, NetworkService, Notifications, ModalService, ResourceControlService, RegistryService, ImageService, HttpRequestHelper, Authentication, StateManager, EndpointProvider) {
$scope.activityTime = 0;
$scope.portBindings = [];
$scope.displayRecreateButton = false;
Expand All @@ -22,9 +22,19 @@ function ($q, $scope, $state, $transition$, $filter, $async, ExtensionService, C
$scope.updateRestartPolicy = updateRestartPolicy;

var update = function () {
var nodeName = $transition$.params().nodeName;
HttpRequestHelper.setPortainerAgentTargetHeader(nodeName);
$scope.nodeName = nodeName;
$scope.nodeName = $transition$.params().nodeName;
HttpRequestHelper.setPortainerAgentTargetHeader($scope.nodeName);

$scope.showBrowseAction = !EndpointProvider.offlineMode() && StateManager.getState().endpoint.mode.agentProxy;
ExtensionService.extensionEnabled(ExtensionService.EXTENSIONS.RBAC)
.then(function success(extensionEnabled) {
if (!extensionEnabled) {
var isAdmin = Authentication.isAdmin();
if (!$scope.applicationState.application.enableVolumeBrowserForNonAdminUsers && !isAdmin) {
$scope.showBrowseAction = false;
}
}
});

ContainerService.container($transition$.params().id)
.then(function success(data) {
Expand Down

0 comments on commit 86cb2b8

Please sign in to comment.