feat(container-console): add ability to specify the user (#976)

pull/983/head
Konstantin Azizov 8 years ago committed by Anthony Lapenna
parent c5ce45f588
commit 54c8872d25

@ -16,10 +16,12 @@
</div> </div>
</rd-widget-header> </rd-widget-header>
<rd-widget-body> <rd-widget-body>
<form> <form class="form-horizontal">
<div class="row"> <div ng-if="!state.connected">
<!-- command-list --> <!-- command-list -->
<div class="col-sm-4"> <div class="form-group">
<label for="command" class="col-lg-1 text-left col-sm-2 control-label">Command</label>
<div class="col-lg-11 col-sm-10">
<div class="input-group"> <div class="input-group">
<span class="input-group-addon"> <span class="input-group-addon">
<i class="fa fa-linux" aria-hidden="true" ng-if="imageOS == 'linux'"></i> <i class="fa fa-linux" aria-hidden="true" ng-if="imageOS == 'linux'"></i>
@ -33,11 +35,26 @@
</select> </select>
</div> </div>
</div> </div>
</div>
<!-- !command-list --> <!-- !command-list -->
<div class="col-sm-8"> <div class="form-group">
<button type="button" class="btn btn-primary" ng-click="connect()" ng-disabled="state.connected">Connect</button> <label for="username" class="col-lg-1 text-left col-sm-2 control-label">
<button type="button" class="btn btn-default" ng-click="disconnect()" ng-disabled="!state.connected">Disconnect</button> User
<portainer-tooltip position="bottom" message="Format is one of: user, user:group, uid or uid:gid"></portainer-tooltip>
</label>
<div class="col-lg-11 col-sm-10">
<input class="form-control" type="text" name="username" ng-model="state.user" placeholder="root">
</div>
</div>
<div class="form-group">
<div class="col-lg-offset-1 col-sm-offset-2 col-lg-11 col-sm-10">
<button type="button" class="btn btn-primary" ng-click="connect()">Connect</button>
</div>
</div>
</div> </div>
<div ng-if="state.connected">
<label>Connected as {{::state.user || 'root'}}</label>
<button type="button" class="btn btn-default" ng-click="disconnect()">Disconnect</button>
</div> </div>
</form> </form>
</rd-widget-body> </rd-widget-body>

@ -45,6 +45,7 @@ function ($scope, $stateParams, Container, Image, Exec, $timeout, EndpointProvid
AttachStdout: true, AttachStdout: true,
AttachStderr: true, AttachStderr: true,
Tty: true, Tty: true,
User: $scope.state.user,
Cmd: $scope.state.command.replace(' ', ',').split(',') Cmd: $scope.state.command.replace(' ', ',').split(',')
}; };

@ -6,7 +6,7 @@ angular
message: '@', message: '@',
position: '@' position: '@'
}, },
template: '<span class="interactive" tooltip-placement="{{position}}" tooltip-class="portainer-tooltip" uib-tooltip="{{message}}"><i class="fa fa-question-circle tooltip-icon" aria-hidden="true"></i></span>', template: '<span class="interactive" tooltip-append-to-body="true" tooltip-placement="{{position}}" tooltip-class="portainer-tooltip" uib-tooltip="{{message}}"><i class="fa fa-question-circle tooltip-icon" aria-hidden="true"></i></span>',
restrict: 'E' restrict: 'E'
}; };
return directive; return directive;

Loading…
Cancel
Save