hunk.code_window:   $scope.connect = function() {
       $('#loadConsoleSpinner').show();
       var termWidth = Math.round($('#terminal-container').width() / 8.2);
       var termHeight = 30;
       var command = $scope.formValues.isCustomCommand ?
                       $scope.formValues.customCommand : $scope.formValues.command;
       var execConfig = {
         id: $stateParams.id,
  
hunk.labels: keep keep keep replace keep keep keep keep keep
hunk.after_edit:     var termWidth = Math.floor(($('#terminal-container').width() - 20) / 8.39);
  
hunk.file_path: app/components/containerConsole/containerConsoleController.js
hunk.type: replace
file: angular.module('portainer.services')
  .factory('TaskService', ['$q', 'Task', function TaskServiceFactory($q, Task) {
    'use strict';
    var service = {};
  
    service.task = function(id) {
      var deferred = $q.defer();
  
      Task.get({ id: id }).$promise
      .then(function success(data) {
        var task = new TaskViewModel(data);
        deferred.resolve(task);
      })
      .catch(function error(err) {
        deferred.reject({ msg: 'Unable to retrieve task details', err: err });
      });
  
      return deferred.promise;
    };
  
    service.serviceTasks = function(serviceName) {
      var deferred = $q.defer();
  
      Task.query({ filters: { service: [serviceName] } }).$promise
      .then(function success(data) {
        var tasks = data.map(function (item) {
          return new TaskViewModel(item);
        });
        deferred.resolve(tasks);
      })
      .catch(function error(err) {
        deferred.reject({ msg: 'Unable to retrieve tasks associated to the service', err: err });
      });
  
      return deferred.promise;
    };
  
    return service;
  }]);
  