summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorToon Claes <toon@gitlab.com>2017-03-17 17:25:17 +0100
committerToon Claes <toon@gitlab.com>2017-03-20 14:39:37 +0100
commit16cca3a0ea7f4b95e99d7b3e8d4953334fa7bec7 (patch)
treed45d895d35ab796b2d5f705bdd3554098c949395 /app
parent7a623907528a77187e070c9721469df8bdd00ec8 (diff)
downloadgitlab-ce-16cca3a0ea7f4b95e99d7b3e8d4953334fa7bec7.tar.gz
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.
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/environments/components/environment_item.js1
-rw-r--r--app/serializers/build_action_entity.rb2
-rw-r--r--app/serializers/build_entity.rb1
3 files changed, 4 insertions, 0 deletions
diff --git a/app/assets/javascripts/environments/components/environment_item.js b/app/assets/javascripts/environments/components/environment_item.js
index 93919d41c60..9d753b4f808 100644
--- a/app/assets/javascripts/environments/components/environment_item.js
+++ b/app/assets/javascripts/environments/components/environment_item.js
@@ -141,6 +141,7 @@ export default {
const parsedAction = {
name: gl.text.humanize(action.name),
play_path: action.play_path,
+ playable: action.playable,
};
return parsedAction;
});
diff --git a/app/serializers/build_action_entity.rb b/app/serializers/build_action_entity.rb
index 184f5fd4b52..184b4b7a681 100644
--- a/app/serializers/build_action_entity.rb
+++ b/app/serializers/build_action_entity.rb
@@ -11,4 +11,6 @@ class BuildActionEntity < Grape::Entity
build.project,
build)
end
+
+ expose :playable?, as: :playable
end
diff --git a/app/serializers/build_entity.rb b/app/serializers/build_entity.rb
index 5bcbe285052..2c116102888 100644
--- a/app/serializers/build_entity.rb
+++ b/app/serializers/build_entity.rb
@@ -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