mirror of
https://github.com/portainer/portainer.git
synced 2025-08-04 05:15:25 +02:00
#592 feat(container-details): rename console to exec and add attach console
This commit is contained in:
parent
ff59f2d85f
commit
f2deaee110
13 changed files with 258 additions and 25 deletions
27
app/docker/services/attachService.js
Normal file
27
app/docker/services/attachService.js
Normal file
|
@ -0,0 +1,27 @@
|
|||
angular.module('portainer.docker')
|
||||
.factory('AttachService', ['$q', '$timeout', 'Container', function AttachServiceFactory($q, $timeout, Container) {
|
||||
'use strict';
|
||||
var service = {};
|
||||
|
||||
service.resizeTTY = function(execId, height, width, timeout) {
|
||||
var deferred = $q.defer();
|
||||
|
||||
$timeout(function() {
|
||||
Container.resize({}, { id: execId, height: height, width: width }).$promise
|
||||
.then(function success(data) {
|
||||
if (data.message) {
|
||||
deferred.reject({ msg: 'Unable to attach to container', err: data.message });
|
||||
} else {
|
||||
deferred.resolve(data);
|
||||
}
|
||||
})
|
||||
.catch(function error(err) {
|
||||
deferred.reject({ msg: 'Unable to attach to container', err: err });
|
||||
});
|
||||
}, timeout);
|
||||
|
||||
return deferred.promise;
|
||||
};
|
||||
|
||||
return service;
|
||||
}]);
|
Loading…
Add table
Add a link
Reference in a new issue