Revision 6560f8e3
Added by Ondřej Pražák about 8 years ago
app/assets/javascripts/foreman_pipeline/jobs/details/job-details-environments.controller.js | ||
---|---|---|
1 |
angular.module('ForemanPipeline.jobs').controller('JobDetailsEnvironmentsController', |
|
2 |
['$scope', '$q', 'translate', 'Nutupane', 'Job', 'CurrentOrganization', 'Organization', |
|
3 |
function ($scope, $q, translate, Nutupane, Job, CurrentOrganization, Organization) { |
|
4 |
|
|
5 |
$scope.successMessages = []; |
|
6 |
$scope.errorMessages = []; |
|
7 |
|
|
8 |
$scope.job = $scope.job || Job.get({id: $scope.$stateParams.jobId}, function () { |
|
9 |
$scope.panel.loading = false; |
|
10 |
}); |
|
11 |
|
|
12 |
var params = { |
|
13 |
id: CurrentOrganization |
|
14 |
}; |
|
15 |
$scope.loading = true; |
|
16 |
|
|
17 |
$scope.chosenEnvironment = $scope.job.environment; |
|
18 |
|
|
19 |
$scope.environments = Organization.readableEnvironments(params, function () { |
|
20 |
$scope.loading = false; |
|
21 |
}); |
|
22 |
|
|
23 |
$scope.setEnvironment = function () { |
|
24 |
var success, |
|
25 |
error, |
|
26 |
deferred = $q.defer(); |
|
27 |
data = {environment_id: $scope.chosenEnvironment.id}; |
|
28 |
|
|
29 |
success = function (response) { |
|
30 |
deferred.resolve(response); |
|
31 |
$scope.successMessages.push(translate("New Lifecycle Environmnet successfully set.")) |
|
32 |
$scope.working = false; |
|
33 |
$scope.job.environment = $scope.chosenEnvironment; |
|
34 |
}; |
|
35 |
|
|
36 |
error = function (response) { |
|
37 |
deferred.reject(response); |
|
38 |
angular.forEach(response.data.errors, function (errorMessage, key) { |
|
39 |
if (angular.isString(key)) { |
|
40 |
errorMessage = [key, errorMessage].join(' '); |
|
41 |
} |
|
42 |
$scope.errorMessages.push(translate('Error occured while saving the Job: ' + errorMessage)); |
|
43 |
}); |
|
44 |
$scope.working = false; |
|
45 |
}; |
|
46 |
|
|
47 |
$scope.working = true; |
|
48 |
Job.setEnvironment({id: $scope.job.id}, data, success, error); |
|
49 |
return deferred.promise; |
|
50 |
}; |
|
51 |
|
|
52 |
// $scope.removePaths = function () { |
|
53 |
// var success, |
|
54 |
// error, |
|
55 |
// deferred = $q.defer(), |
|
56 |
// path_ids = _.map($scope.pathsTable.getSelected(), function (item) { |
|
57 |
// return item[1].id; |
|
58 |
// }); |
|
59 |
// data = { |
|
60 |
// 'path_ids': path_ids |
|
61 |
// } |
|
62 |
|
|
63 |
// success = function (response) { |
|
64 |
// $scope.successMessages.push(translate('Removed %x Environment Paths from job %y.') |
|
65 |
// .replace('%x', $scope.pathsTable.numSelected) |
|
66 |
// .replace('%y', $scope.job.name)); |
|
67 |
// if (response.environment === null) { |
|
68 |
// $scope.$emit('envNull') |
|
69 |
// } |
|
70 |
// $scope.job.paths = _.difference($scope.job.paths, $scope.pathsTable.getSelected()); |
|
71 |
// $scope.pathsTable.rows = _.difference($scope.pathsTable.rows, $scope.pathsTable.getSelected()); |
|
72 |
// $scope.pathsTable.working = false; |
|
73 |
// $scope.pathsTable.selectAll(false); |
|
74 |
// deferred.resolve(response); |
|
75 |
// }; |
|
76 |
|
|
77 |
// error = function (response) { |
|
78 |
// deferred.reject(response.data.errors); |
|
79 |
// angular.forEach(response.data.errors, function (errorMessage, key) { |
|
80 |
// if (angular.isString(key)) { |
|
81 |
// errorMessage = [key, errorMessage].join(' '); |
|
82 |
// } |
|
83 |
// $scope.errorMessages.push(translate('Error occured while Removing Paths: ') + errorMessage); |
|
84 |
// }); |
|
85 |
// $scope.pathsTable.working = false; |
|
86 |
// }; |
|
87 |
|
|
88 |
// $scope.pathsTable.working = true; |
|
89 |
// Job.removePaths({id: $scope.job.id}, data, success, error); |
|
90 |
// return deferred.promise; |
|
91 |
// }; |
|
92 |
|
|
93 |
} |
|
94 |
]) |
app/assets/javascripts/foreman_pipeline/jobs/details/job-details-paths.controller.js | ||
---|---|---|
1 |
angular.module('ForemanPipeline.jobs').controller('JobDetailsPathsController', |
|
2 |
['$scope', '$q', 'translate', 'Nutupane', 'Job', 'CurrentOrganization', |
|
3 |
function ($scope, $q, translate, Nutupane, Job, CurrentOrganization) { |
|
4 |
|
|
5 |
$scope.successMessages = []; |
|
6 |
$scope.errorMessages = []; |
|
7 |
|
|
8 |
$scope.job = $scope.job || Job.get({id: $scope.$stateParams.jobId}, function () { |
|
9 |
$scope.panel.loading = false; |
|
10 |
}); |
|
11 |
|
|
12 |
var params = { |
|
13 |
id: $scope.$stateParams.jobId |
|
14 |
}; |
|
15 |
|
|
16 |
var nutupane = new Nutupane(Job, params, 'currentPaths'); |
|
17 |
$scope.nutupane = nutupane; |
|
18 |
$scope.pathsTable = nutupane.table; |
|
19 |
|
|
20 |
|
|
21 |
$scope.removePaths = function () { |
|
22 |
var success, |
|
23 |
error, |
|
24 |
deferred = $q.defer(), |
|
25 |
path_ids = _.map($scope.pathsTable.getSelected(), function (item) { |
|
26 |
return item[1].id; |
|
27 |
}); |
|
28 |
data = { |
|
29 |
'path_ids': path_ids |
|
30 |
} |
|
31 |
|
|
32 |
success = function (response) { |
|
33 |
$scope.successMessages.push(translate('Removed %x Environment Paths from job %y.') |
|
34 |
.replace('%x', $scope.pathsTable.numSelected) |
|
35 |
.replace('%y', $scope.job.name)); |
|
36 |
if (response.environment === null) { |
|
37 |
$scope.$emit('envNull') |
|
38 |
} |
|
39 |
$scope.job.paths = _.difference($scope.job.paths, $scope.pathsTable.getSelected()); |
|
40 |
$scope.pathsTable.rows = _.difference($scope.pathsTable.rows, $scope.pathsTable.getSelected()); |
|
41 |
$scope.pathsTable.working = false; |
|
42 |
$scope.pathsTable.selectAll(false); |
|
43 |
deferred.resolve(response); |
|
44 |
}; |
|
45 |
|
|
46 |
error = function (response) { |
|
47 |
deferred.reject(response.data.errors); |
|
48 |
angular.forEach(response.data.errors, function (errorMessage, key) { |
|
49 |
if (angular.isString(key)) { |
|
50 |
errorMessage = [key, errorMessage].join(' '); |
|
51 |
} |
|
52 |
$scope.errorMessages.push(translate('Error occured while Removing Paths: ') + errorMessage); |
|
53 |
}); |
|
54 |
$scope.pathsTable.working = false; |
|
55 |
}; |
|
56 |
|
|
57 |
$scope.pathsTable.working = true; |
|
58 |
Job.removePaths({id: $scope.job.id}, data, success, error); |
|
59 |
return deferred.promise; |
|
60 |
}; |
|
61 |
|
|
62 |
} |
|
63 |
]) |
app/assets/javascripts/foreman_pipeline/jobs/details/job-details-to-environment.controller.js | ||
---|---|---|
1 |
angular.module('ForemanPipeline.jobs').controller('JobDetailsToEnvironmentController', |
|
2 |
['$scope', '$q', 'Job', 'translate', 'CurrentOrganization', |
|
3 |
function ($scope, $q, Job, translate, CurrentOrganization) { |
|
4 |
|
|
5 |
$scope.successMessages = []; |
|
6 |
$scope.errorMessages = []; |
|
7 |
$scope.environments = []; |
|
8 |
|
|
9 |
$scope.job = $scope.job || Job.$get({id: $scope.$stateParams.jobId}, function () { |
|
10 |
$scope.panel.loading = false; |
|
11 |
}); |
|
12 |
|
|
13 |
$scope.chosenEnvironment = $scope.job.environment; |
|
14 |
|
|
15 |
$scope.loading = true; |
|
16 |
|
|
17 |
$scope.environments = Job.availableEnvironments({id: $scope.$stateParams.jobId}, function () { |
|
18 |
$scope.loading = false; |
|
19 |
}); |
|
20 |
|
|
21 |
$scope.setEnvironment = function () { |
|
22 |
var success, |
|
23 |
error, |
|
24 |
deferred = $q.defer(); |
|
25 |
data = {environment_id: $scope.chosenEnvironment.id}; |
|
26 |
|
|
27 |
success = function (response) { |
|
28 |
deferred.resolve(response); |
|
29 |
$scope.successMessages.push(translate("New Lifecycle Environmnet successfully set.")) |
|
30 |
$scope.working = false; |
|
31 |
$scope.job.environment = $scope.chosenEnvironment; |
|
32 |
}; |
|
33 |
|
|
34 |
error = function (response) { |
|
35 |
deferred.reject(response); |
|
36 |
angular.forEach(response.data.errors, function (errorMessage, key) { |
|
37 |
if (angular.isString(key)) { |
|
38 |
errorMessage = [key, errorMessage].join(' '); |
|
39 |
} |
|
40 |
$scope.errorMessages.push(translate('Error occured while saving the Job: ' + errorMessage)); |
|
41 |
}); |
|
42 |
$scope.working = false; |
|
43 |
}; |
|
44 |
|
|
45 |
$scope.working = true; |
|
46 |
Job.setEnvironment({id: $scope.job.id}, data, success, error); |
|
47 |
return deferred.promise; |
|
48 |
}; |
|
49 |
}] |
|
50 |
); |
app/assets/javascripts/foreman_pipeline/jobs/details/job-details-to-environments.controller.js | ||
---|---|---|
1 |
angular.module('ForemanPipeline.jobs').controller('JobDetailsToEnvironmentsController', |
|
2 |
['$scope', '$q', 'Job', 'translate', 'CurrentOrganization', |
|
3 |
function ($scope, $q, Job, translate, CurrentOrganization) { |
|
4 |
|
|
5 |
$scope.successMessages = []; |
|
6 |
$scope.errorMessages = []; |
|
7 |
$scope.environments = []; |
|
8 |
|
|
9 |
$scope.job = $scope.job || Job.$get({id: $scope.$stateParams.jobId}, function () { |
|
10 |
$scope.panel.loading = false; |
|
11 |
}); |
|
12 |
|
|
13 |
$scope.chosenEnvironment = $scope.job.environment; |
|
14 |
|
|
15 |
$scope.loading = true; |
|
16 |
|
|
17 |
$scope.environments = Job.availableEnvironments({id: $scope.$stateParams.jobId}, function () { |
|
18 |
$scope.loading = false; |
|
19 |
}); |
|
20 |
|
|
21 |
$scope.setEnvironment = function () { |
|
22 |
var success, |
|
23 |
error, |
|
24 |
deferred = $q.defer(); |
|
25 |
data = {environment_id: $scope.chosenEnvironment.id}; |
|
26 |
|
|
27 |
success = function (response) { |
|
28 |
deferred.resolve(response); |
|
29 |
$scope.successMessages.push(translate("New Lifecycle Environmnet successfully set.")) |
|
30 |
$scope.working = false; |
|
31 |
$scope.job.environment = $scope.chosenEnvironment; |
|
32 |
}; |
|
33 |
|
|
34 |
error = function (response) { |
|
35 |
deferred.reject(response); |
|
36 |
angular.forEach(response.data.errors, function (errorMessage, key) { |
|
37 |
if (angular.isString(key)) { |
|
38 |
errorMessage = [key, errorMessage].join(' '); |
|
39 |
} |
|
40 |
$scope.errorMessages.push(translate('Error occured while saving the Job: ' + errorMessage)); |
|
41 |
}); |
|
42 |
$scope.working = false; |
|
43 |
}; |
|
44 |
|
|
45 |
$scope.working = true; |
|
46 |
Job.setEnvironment({id: $scope.job.id}, data, success, error); |
|
47 |
return deferred.promise; |
|
48 |
}; |
|
49 |
}] |
|
50 |
); |
app/assets/javascripts/foreman_pipeline/jobs/details/views/job-details-environments.html | ||
---|---|---|
1 |
<span page-title ng-model="job">{{ 'Path selection fo Job:' | translate }} {{ job.name }}</span> |
|
2 |
|
|
3 |
<h4 translate>Lifecycle Environment selection: Select watched environment</h4> |
|
4 |
|
|
5 |
<div class="row"> |
|
6 |
<div class="fr select-action"> |
|
7 |
<button class="btn btn-default" |
|
8 |
ui-sref="jobs.details.environments.to-environments"> |
|
9 |
{{ 'To Environments' | translate }} |
|
10 |
</button> |
|
11 |
</div> |
|
12 |
</div> |
|
13 |
|
|
14 |
<section class="nutupane-sub-section"> |
|
15 |
<div bst-alert success-messages="successMessages" error-messages="errorMessages"></div> |
|
16 |
|
|
17 |
<div class="loading-mask loading-mask-panel" ng-show="loading"> |
|
18 |
<i class="icon-spinner icon-spin"></i> |
|
19 |
{{ "Loading..." | translate }} |
|
20 |
</div> |
|
21 |
|
|
22 |
|
|
23 |
<section ng-hide="loading || environments.length === 0"> |
|
24 |
<span path-selector="environments" |
|
25 |
ng-model="chosenEnvironment" |
|
26 |
mode="singleSelect" |
|
27 |
disabled="denied('edit_jobs', job)" |
|
28 |
disable-trigger="disableEnvironmentSelection"> |
|
29 |
</span> |
|
30 |
|
|
31 |
<br/> |
|
32 |
|
|
33 |
<button class="btn btn-default" |
|
34 |
ng-hide="denied('edit_jobs')" |
|
35 |
ng-disabled="!chosenEnvironment || working" |
|
36 |
ng-click="setEnvironment()"> |
|
37 |
<i class="icon-pencil" ng-hide="working"></i> |
|
38 |
<i class="icon-spinner icon-spin" ng-show="working"></i> |
|
39 |
<span translate>Set Environment</span> |
|
40 |
</button> |
|
41 |
</section> |
|
42 |
|
|
43 |
|
|
44 |
<div ng-show="environments.length === 0 && !loading" > |
|
45 |
<p class="alert alert-info" |
|
46 |
ng-hide="loading" |
|
47 |
translate> No Lifecycle Environments to show. |
|
48 |
</p> |
|
49 |
</div> |
|
50 |
|
|
51 |
</section> |
app/assets/javascripts/foreman_pipeline/jobs/details/views/job-details-paths.html | ||
---|---|---|
1 |
<span page-title ng-model="job">{{ 'Path selection fo Job:' | translate }} {{ job.name }}</span> |
|
2 |
|
|
3 |
<h4 translate>Environment Paths selection</h4> |
|
4 |
|
|
5 |
<div class="row"> |
|
6 |
<div class="fr select-action"> |
|
7 |
<button class="btn btn-default" |
|
8 |
ui-sref="jobs.details.to-environment.environments"> |
|
9 |
{{ 'To Environments' | translate }} |
|
10 |
</button> |
|
11 |
</div> |
|
12 |
</div> |
|
13 |
|
|
14 |
<nav> |
|
15 |
<ul class="nav nav-tabs"> |
|
16 |
<li ng-class="{active: isState('jobs.details.to-environment.paths.list')}"> |
|
17 |
<a ui-sref="jobs.details.to-environment.paths.list"> |
|
18 |
<span translate>List/Remove</span> |
|
19 |
</a> |
|
20 |
</li> |
|
21 |
|
|
22 |
<li ng-class="{active: isState('jobs.details.to-environment.paths.add')}" |
|
23 |
ng-show="permitted('edit_jobs', job)"> |
|
24 |
<a ui-sref="jobs.details.to-environment.paths.add"> |
|
25 |
<span translate>Add</span> |
|
26 |
</a> |
|
27 |
</li> |
|
28 |
</ul> |
|
29 |
</nav> |
|
30 |
|
|
31 |
<div ui-view></div> |
app/assets/javascripts/foreman_pipeline/jobs/details/views/job-details-to-environment.html | ||
---|---|---|
1 |
<span page-title ng-model="job">{{ 'Job: ' | translate }}{{ job.name }}</span> |
|
2 |
|
|
3 |
<section class="nutupane-sub-section"> |
|
4 |
<div bst-alert success-messages="successMessages" error-messages="errorMessages"></div> |
|
5 |
|
|
6 |
<div class="row"> |
|
7 |
<div class="col-sm-5"> |
|
8 |
<a href="" ui-sref="jobs.details.to-environment.paths.list({jobId: job.id})"> |
|
9 |
<i class="icon-double-angle-left"></i> |
|
10 |
{{ "Back" | translate }} |
|
11 |
</a> |
|
12 |
</div> |
|
13 |
</div> |
|
14 |
<h4 translate>Lifecycle Environment selection</h4> |
|
15 |
|
|
16 |
<div class="loading-mask loading-mask-panel" ng-show="loading"> |
|
17 |
<i class="icon-spinner icon-spin"></i> |
|
18 |
{{ "Loading..." | translate }} |
|
19 |
</div> |
|
20 |
|
|
21 |
|
|
22 |
<section ng-hide="loading || environments.length === 0"> |
|
23 |
<span path-selector="environments" |
|
24 |
ng-model="chosenEnvironment" |
|
25 |
mode="singleSelect" |
|
26 |
disabled="denied('edit_jobs', job)" |
|
27 |
disable-trigger="disableEnvironmentSelection"> |
|
28 |
</span> |
|
29 |
|
|
30 |
<br/> |
|
31 |
|
|
32 |
<button class="btn btn-default" |
|
33 |
ng-hide="denied('edit_jobs')" |
|
34 |
ng-disabled="!chosenEnvironment || working" |
|
35 |
ng-click="setEnvironment()"> |
|
36 |
<i class="icon-pencil" ng-hide="working"></i> |
|
37 |
<i class="icon-spinner icon-spin" ng-show="working"></i> |
|
38 |
<span translate>Set Environment</span> |
|
39 |
</button> |
|
40 |
</section> |
|
41 |
|
|
42 |
|
|
43 |
<div ng-show="environments.length === 0" > |
|
44 |
<p class="alert alert-info" |
|
45 |
ng-hide="loading" |
|
46 |
translate> No Lifecycle Environments to show. |
|
47 |
</p> |
|
48 |
</div> |
|
49 |
|
|
50 |
</section> |
|
51 |
|
|
52 |
|
|
53 |
|
app/assets/javascripts/foreman_pipeline/jobs/details/views/job-details-to-environments.html | ||
---|---|---|
1 |
<span page-title ng-model="job">{{ 'Job: ' | translate }}{{ job.name }}</span> |
|
2 |
|
|
3 |
<div class="row"> |
|
4 |
<div class="col-sm-5"> |
|
5 |
<a href="" ui-sref="jobs.details.environments.from-environment({jobId: job.id})"> |
|
6 |
<i class="icon-double-angle-left"></i> |
|
7 |
{{ "Back" | translate }} |
|
8 |
</a> |
|
9 |
</div> |
|
10 |
</div> |
|
11 |
<h4 translate>Lifecycle Environment selection: select target environment</h4> |
|
12 |
<section class="nutupane-sub-section"> |
|
13 |
|
|
14 |
<div bst-alert success-messages="successMessages" error-messages="errorMessages"></div> |
|
15 |
|
|
16 |
<div class="loading-mask loading-mask-panel" ng-show="loading"> |
|
17 |
<i class="icon-spinner icon-spin"></i> |
|
18 |
{{ "Loading..." | translate }} |
|
19 |
</div> |
|
20 |
|
|
21 |
|
|
22 |
<section ng-hide="loading || environments.length === 0"> |
|
23 |
<span path-selector="environments" |
|
24 |
ng-model="chosenEnvironment" |
|
25 |
mode="singleSelect" |
|
26 |
disabled="denied('edit_jobs', job)" |
|
27 |
disable-trigger="disableEnvironmentSelection"> |
|
28 |
</span> |
|
29 |
|
|
30 |
<br/> |
|
31 |
|
|
32 |
<button class="btn btn-default" |
|
33 |
ng-hide="denied('edit_jobs')" |
|
34 |
ng-disabled="!chosenEnvironment || working" |
|
35 |
ng-click="setEnvironment()"> |
|
36 |
<i class="icon-pencil" ng-hide="working"></i> |
|
37 |
<i class="icon-spinner icon-spin" ng-show="working"></i> |
|
38 |
<span translate>Set Environment</span> |
|
39 |
</button> |
|
40 |
</section> |
|
41 |
|
|
42 |
|
|
43 |
<div ng-show="environments.length === 0" > |
|
44 |
<p class="alert alert-info" |
|
45 |
ng-hide="loading" |
|
46 |
translate> No Lifecycle Environments to show. |
|
47 |
</p> |
|
48 |
</div> |
|
49 |
|
|
50 |
</section> |
|
51 |
|
|
52 |
|
|
53 |
|
app/assets/javascripts/foreman_pipeline/jobs/details/views/job-details.html | ||
---|---|---|
62 | 62 |
</a> |
63 | 63 |
</li> |
64 | 64 |
|
65 |
<li ng-class="{active: stateIncludes('jobs.details.to-environment')}">
|
|
66 |
<a ui-sref="jobs.details.to-environment.paths.list">
|
|
65 |
<li ng-class="{active: stateIncludes('jobs.details.environments')}">
|
|
66 |
<a ui-sref="jobs.details.environments.from-environment">
|
|
67 | 67 |
<span translate>Environment</span> |
68 | 68 |
</a> |
69 | 69 |
</li> |
app/assets/javascripts/foreman_pipeline/jobs/jobs.module.js | ||
---|---|---|
84 | 84 |
templateUrl: 'foreman_pipeline/jobs/details/views/job-details-resources.html' |
85 | 85 |
}) |
86 | 86 |
|
87 |
.state('jobs.details.to-environment', {
|
|
87 |
.state('jobs.details.environments', {
|
|
88 | 88 |
abstract: true, |
89 | 89 |
collapsed: true, |
90 | 90 |
template: '<div ui-view></div>' |
91 | 91 |
}) |
92 |
.state('jobs.details.to-environment.paths', { |
|
93 |
abstract: true, |
|
94 |
collapsed: true, |
|
95 |
templateUrl: 'foreman_pipeline/jobs/details/views/job-details-paths.html' |
|
96 |
}) |
|
97 |
.state('jobs.details.to-environment.paths.list', { |
|
98 |
url: '/paths', |
|
92 |
.state('jobs.details.environments.from-environment', { |
|
93 |
url: '/environments', |
|
99 | 94 |
collapsed: true, |
100 | 95 |
permission: 'edit_jobs', |
101 |
controller: 'JobDetailsPathsController', |
|
102 |
templateUrl: 'foreman_pipeline/jobs/details/views/job-details-paths-list.html' |
|
103 |
}) |
|
104 |
.state('jobs.details.to-environment.paths.add', { |
|
105 |
url: '/paths/add', |
|
106 |
collapsed: true, |
|
107 |
permission: 'edit_jobs', |
|
108 |
controller: 'JobDetailsAddPathsController', |
|
109 |
templateUrl: 'foreman_pipeline/jobs/details/views/job-details-paths-list.html' |
|
96 |
controller: 'JobDetailsEnvironmentsController', |
|
97 |
templateUrl: 'foreman_pipeline/jobs/details/views/job-details-environments.html' |
|
110 | 98 |
}) |
111 | 99 |
|
112 |
.state('jobs.details.to-environment.environments', {
|
|
113 |
url: '/paths/to_environment',
|
|
100 |
.state('jobs.details.environments.to-environments', {
|
|
101 |
url: '/environments/to_environments',
|
|
114 | 102 |
collapsed: true, |
115 | 103 |
permission: 'edit_jobs', |
116 |
controller: 'JobDetailsToEnvironmentController', |
|
117 |
templateUrl: 'foreman_pipeline/jobs/details/views/job-details-to-environment.html' |
|
104 |
controller: 'JobDetailsToEnvironmentsController',
|
|
105 |
templateUrl: 'foreman_pipeline/jobs/details/views/job-details-to-environments.html'
|
|
118 | 106 |
}) |
119 | 107 |
|
120 | 108 |
.state('jobs.details.jenkins-instances', { |
app/controllers/foreman_pipeline/api/jobs_controller.rb | ||
---|---|---|
109 | 109 |
param_group :job_id |
110 | 110 |
param :environment_id, :number, :desc => N_("Environment id which will be set"), :required => true |
111 | 111 |
def set_environment |
112 |
if @job.environment_in_paths? params[:environment_id] |
|
113 |
@job.environment = Katello::KTEnvironment.find(params[:environment_id]) |
|
114 |
@job.save! |
|
115 |
respond_for_show |
|
116 |
else |
|
117 |
fail Katello::HttpErrors::Conflict, "Cannot add an Environment that is not in Job's Environment paths." |
|
118 |
end |
|
112 |
@job.environment = Katello::KTEnvironment.find(params[:environment_id]) |
|
113 |
@job.save! |
|
114 |
respond_for_show |
|
119 | 115 |
end |
120 | 116 |
|
121 | 117 |
api :PUT, "/organizations/:organization_id/jobs/:id/set_resource", N_("Set compute resource for job") |
db/migrate/20150408143011_remove_cv_promote_from_job.rb | ||
---|---|---|
1 |
class RemoveCvPromoteFromJob < ActiveRecord::Migration |
|
2 |
def up |
|
3 |
remove_column :foreman_pipeline_jobs, :promote |
|
4 |
end |
|
5 |
|
|
6 |
def down |
|
7 |
add_column :foreman_pipeline_jobs, :promote, :boolean, :default => false |
|
8 |
end |
|
9 |
end |
Also available in: Unified diff
progress