Revision a7978929
Added by Ondřej Pražák almost 8 years ago
README.md | ||
---|---|---|
21 | 21 |
|
22 | 22 |
* [Katello](https://github.com/Katello/katello) |
23 | 23 |
* [Foreman](https://github.com/theforeman/foreman) |
24 |
* [Bastion](https://github.com/Katello/bastion), 0.1.13
|
|
24 |
* [Bastion](https://github.com/Katello/bastion), < 1.0.0, currently 0.3.1
|
|
25 | 25 |
* [Staypuft](https://github.com/theforeman/staypuft), this dependency will be probably removed in the future as soon as 2 dyflow action clases are moved into foreman-tasks |
26 | 26 |
* [Jenkins API client](https://github.com/arangamani/jenkins_api_client), 0.14.1 |
27 | 27 |
|
app/assets/javascripts/foreman_pipeline/jobs/jobs.factory.js | ||
---|---|---|
39 | 39 |
return {results: transformPaths(response)}; |
40 | 40 |
}}, |
41 | 41 |
availableEnvironments: {method: 'GET', |
42 |
params: {action: 'current_paths'},
|
|
42 |
params: {action: 'available_paths'},
|
|
43 | 43 |
isArray: true, |
44 |
transformResponse: function (response) { |
|
45 |
return transformPaths(response); |
|
46 |
}}, |
|
44 |
transformResponse: function (data) { |
|
45 |
return transformPaths(data); |
|
46 |
} |
|
47 |
}, |
|
47 | 48 |
}); |
48 | 49 |
}] |
49 | 50 |
); |
app/controllers/foreman_pipeline/api/jobs_controller.rb | ||
---|---|---|
146 | 146 |
respond_for_show |
147 | 147 |
end |
148 | 148 |
|
149 |
api :GET, "/organizations/:organization_id/jobs/:id/current_paths", N_("List environment paths of a job") |
|
150 |
param_group :job_id |
|
151 |
def current_paths |
|
152 |
paths = @job.paths.map(&:full_path) |
|
153 |
|
|
154 |
current = paths.inject([]) do |result, path| |
|
155 |
result << { :environments => path } |
|
156 |
end |
|
157 |
|
|
158 |
collection = { |
|
159 |
:results => current, |
|
160 |
:total => current.size, |
|
161 |
:subtotal => current.size |
|
162 |
} |
|
163 |
respond_for_index(:collection => collection) |
|
164 |
end |
|
149 |
# api :GET, "/organizations/:organization_id/jobs/:id/current_paths", N_("List environment paths of a job")
|
|
150 |
# param_group :job_id
|
|
151 |
# def current_paths
|
|
152 |
# paths = @job.paths.map(&:full_path)
|
|
153 |
|
|
154 |
# current = paths.inject([]) do |result, path|
|
|
155 |
# result << { :environments => path }
|
|
156 |
# end
|
|
157 |
|
|
158 |
# collection = {
|
|
159 |
# :results => current,
|
|
160 |
# :total => current.size,
|
|
161 |
# :subtotal => current.size
|
|
162 |
# }
|
|
163 |
# respond_for_index(:collection => collection)
|
|
164 |
# end
|
|
165 | 165 |
|
166 | 166 |
api :GET, "/organizations/:organization_id/jobs/:id/available_paths", N_("List environment paths available for a job") |
167 | 167 |
param_group :job_id |
168 | 168 |
def available_paths |
169 |
all_paths = @organization.promotion_paths.map(&:shift) |
|
170 |
available = (all_paths - @job.paths).map(&:full_path) |
|
169 |
available = [@job.environment.full_path] rescue [] |
|
171 | 170 |
|
172 | 171 |
paths = available.inject([]) do |result, path| |
173 | 172 |
result << { :environments => path } |
174 | 173 |
end |
174 |
paths = [{ :environments => [] }] if paths.empty? |
|
175 | 175 |
|
176 | 176 |
collection = { |
177 | 177 |
:results => paths, |
178 | 178 |
:total => paths.size, |
179 | 179 |
:subtotal => paths.size |
180 | 180 |
} |
181 |
|
|
181 | 182 |
respond_for_index(:collection => collection) |
182 | 183 |
end |
183 | 184 |
|
Also available in: Unified diff
progress