Skip to content
Snippets Groups Projects
Commit 16cca3a0 authored by Toon Claes's avatar Toon Claes
Browse files

Expose if action is playable in JSON

To avoid a manual build action being played (resulting in a 404),
expose `playable?` in the JSON so the frontend can disable/hide the
play button if it's not playable.
parent 7a623907
No related branches found
No related tags found
1 merge request!10052Disable pipeline & environment actions that are not playable
Pipeline #
Loading
Loading
@@ -141,6 +141,7 @@ export default {
const parsedAction = {
name: gl.text.humanize(action.name),
play_path: action.play_path,
playable: action.playable,
};
return parsedAction;
});
Loading
Loading
Loading
Loading
@@ -11,4 +11,6 @@ class BuildActionEntity < Grape::Entity
build.project,
build)
end
expose :playable?, as: :playable
end
Loading
Loading
@@ -16,6 +16,7 @@ class BuildEntity < Grape::Entity
path_to(:play_namespace_project_build, build)
end
 
expose :playable?, as: :playable
expose :created_at
expose :updated_at
 
Loading
Loading
Loading
Loading
@@ -17,5 +17,9 @@ describe BuildActionEntity do
it 'contains path to the action play' do
expect(subject[:path]).to include "builds/#{build.id}/play"
end
it 'contains whether it is playable' do
expect(subject[:playable]).to eq build.playable?
end
end
end
Loading
Loading
@@ -18,6 +18,10 @@ describe BuildEntity do
expect(subject).not_to include(/variables/)
end
 
it 'contains whether it is playable' do
expect(subject[:playable]).to eq build.playable?
end
it 'contains timestamps' do
expect(subject).to include(:created_at, :updated_at)
end
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment