export default ['$scope', '$http', '$uibModalInstance', function($scope, $http, $uibModalInstance) {

  console.log('scope', $scope)

  $http
    .get('/api/stage-types')
    .then(res => $scope.stages = res.data.data)

  $scope.ok = () => {
    $http
      .post('api/stages/', {
        stage_id: $scope.stage_id
      })
      .then(res => {
        console.log('res', res)
      })

    $uibModalInstance.close()
  }

  $scope.cancel = () => {
    $uibModalInstance.dismiss('cancel')
  }

}]

export default ['$scope', '$http', '$uibModalInstance', function($scope, $http, $uibModalInstance) {

  // get stages in parent controller
  console.log('create-stage scope', $scope.$parent.$stages)

  $http
    .get('/api/stage-types')
    .then(res => $scope.stages = res.data.data)

  $scope.ok = () => {

    let sort = $scope.$parent.$stages
      ? $scope.$parent.$stages.length + 1
      : 0;

    $http
      .post('/api/stage/config', {
        pipeline_config_id: $scope.$parent.$id,
        type: $scope.stage_id,
        sort: sort,
        // options: {}
      })
      .then(res => {
        console.log(res)
      })
      .catch(err => {
        console.error(err)
      })

    $uibModalInstance.close()
  }

  $scope.cancel = () => {
    $uibModalInstance.dismiss('cancel')
  }

}]

Create stage config from modal
Create stage config from modal
