summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/environments
diff options
context:
space:
mode:
authorFilipa Lacerda <filipa@gitlab.com>2017-04-04 14:14:15 +0100
committerFilipa Lacerda <filipa@gitlab.com>2017-04-04 14:14:15 +0100
commit5197b011a97a86b1c57cff8d8de73c30914c8c76 (patch)
tree152615892e07cba594faabeb3170d7fd86c695c2 /app/assets/javascripts/environments
parentd037a2e998b807d01585a48af90a3b3182eeebc5 (diff)
downloadgitlab-ce-5197b011a97a86b1c57cff8d8de73c30914c8c76.tar.gz
Fixes broken lints
Adds js unit tests
Diffstat (limited to 'app/assets/javascripts/environments')
-rw-r--r--app/assets/javascripts/environments/components/environment_actions.js23
1 files changed, 18 insertions, 5 deletions
diff --git a/app/assets/javascripts/environments/components/environment_actions.js b/app/assets/javascripts/environments/components/environment_actions.js
index b88b1c6556e..4bb7920bb5e 100644
--- a/app/assets/javascripts/environments/components/environment_actions.js
+++ b/app/assets/javascripts/environments/components/environment_actions.js
@@ -45,6 +45,14 @@ export default {
new Flash('An error occured while making the request.');
});
},
+
+ isActionDisabled(action) {
+ if (action.playable === undefined) {
+ return false;
+ }
+
+ return !action.playable;
+ },
},
template: `
@@ -59,18 +67,23 @@ export default {
:disabled="isLoading">
<span>
<span v-html="playIconSvg"></span>
- <i class="fa fa-caret-down" aria-hidden="true"></i>
- <i v-if="isLoading" class="fa fa-spinner fa-spin" aria-hidden="true"></i>
+ <i
+ class="fa fa-caret-down"
+ aria-hidden="true"/>
+ <i
+ v-if="isLoading"
+ class="fa fa-spinner fa-spin"
+ aria-hidden="true"/>
</span>
<ul class="dropdown-menu dropdown-menu-align-right">
<li v-for="action in actions">
<button
type="button"
- @click="onClickAction(action.play_path)"
class="js-manual-action-link no-btn btn"
- :class="{ 'disabled': !action.playable }"
- :disabled="!action.playable">
+ @click="onClickAction(action.play_path)"
+ :class="{ 'disabled': isActionDisabled(action) }"
+ :disabled="isActionDisabled(action)">
${playIconSvg}
<span>
{{action.name}}