mirror of https://github.com/portainer/portainer
refactor(docker): remove EndpointProvider from exec [EE-6462] (#10840)
parent
76e49ed9a8
commit
de473fc10e
|
@ -3,13 +3,12 @@ import { genericHandler } from './response/handlers';
|
||||||
angular.module('portainer.docker').factory('Exec', [
|
angular.module('portainer.docker').factory('Exec', [
|
||||||
'$resource',
|
'$resource',
|
||||||
'API_ENDPOINT_ENDPOINTS',
|
'API_ENDPOINT_ENDPOINTS',
|
||||||
'EndpointProvider',
|
function ExecFactory($resource, API_ENDPOINT_ENDPOINTS) {
|
||||||
function ExecFactory($resource, API_ENDPOINT_ENDPOINTS, EndpointProvider) {
|
|
||||||
'use strict';
|
'use strict';
|
||||||
return $resource(
|
return $resource(
|
||||||
API_ENDPOINT_ENDPOINTS + '/:endpointId/docker/exec/:id/:action',
|
API_ENDPOINT_ENDPOINTS + '/:environmentId/docker/exec/:id/:action',
|
||||||
{
|
{
|
||||||
endpointId: EndpointProvider.endpointID,
|
environmentId: '@environmentId',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
resize: {
|
resize: {
|
||||||
|
|
|
@ -6,11 +6,11 @@ angular.module('portainer.docker').factory('ExecService', [
|
||||||
'use strict';
|
'use strict';
|
||||||
var service = {};
|
var service = {};
|
||||||
|
|
||||||
service.resizeTTY = function (execId, width, height, timeout) {
|
service.resizeTTY = function (environmentId, execId, width, height, timeout) {
|
||||||
var deferred = $q.defer();
|
var deferred = $q.defer();
|
||||||
|
|
||||||
$timeout(function () {
|
$timeout(function () {
|
||||||
Exec.resize({}, { id: execId, height: height, width: width })
|
Exec.resize({ environmentId }, { id: execId, height: height, width: width })
|
||||||
.$promise.then(function success(data) {
|
.$promise.then(function success(data) {
|
||||||
if (data.message) {
|
if (data.message) {
|
||||||
deferred.reject({ msg: 'Unable to resize tty of exec', err: data.message });
|
deferred.reject({ msg: 'Unable to resize tty of exec', err: data.message });
|
||||||
|
|
|
@ -121,7 +121,7 @@ angular.module('portainer.docker').controller('ContainerConsoleController', [
|
||||||
.map((k) => k + '=' + params[k])
|
.map((k) => k + '=' + params[k])
|
||||||
.join('&');
|
.join('&');
|
||||||
|
|
||||||
initTerm(url, ExecService.resizeTTY.bind(this, params.id));
|
initTerm(url, ExecService.resizeTTY.bind(this, endpoint.Id, params.id));
|
||||||
})
|
})
|
||||||
.catch(function error(err) {
|
.catch(function error(err) {
|
||||||
Notifications.error('Failure', err, 'Unable to exec into container');
|
Notifications.error('Failure', err, 'Unable to exec into container');
|
||||||
|
|
Loading…
Reference in New Issue