diff options
author | Phil Hughes <me@iamphill.com> | 2017-05-12 13:44:02 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2017-05-12 13:44:02 +0300 |
commit | aa6f44328ed22ebab51440a5a04f6b62d6471b78 (patch) | |
tree | 56d12b6737bc061322a1e0f28b9894b2b12dc708 /app/assets/javascripts/vue_shared | |
parent | 6ecfe0f987fe99426d3ef28d71a542db56e8fbf7 (diff) | |
parent | ba6f263dd28a9cec6a4834106bc420b4a8e45209 (diff) |
Merge branch '32073-improve-function' into 'master'
Improve ci action icon function
Closes #32073
See merge request !11291
Diffstat (limited to 'app/assets/javascripts/vue_shared')
-rw-r--r-- | app/assets/javascripts/vue_shared/ci_action_icons.js | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/app/assets/javascripts/vue_shared/ci_action_icons.js b/app/assets/javascripts/vue_shared/ci_action_icons.js index ee41dc95beb..b21f0ab49fd 100644 --- a/app/assets/javascripts/vue_shared/ci_action_icons.js +++ b/app/assets/javascripts/vue_shared/ci_action_icons.js @@ -3,24 +3,19 @@ import retrySVG from 'icons/_icon_action_retry.svg'; import playSVG from 'icons/_icon_action_play.svg'; import stopSVG from 'icons/_icon_action_stop.svg'; +/** + * For the provided action returns the respective SVG + * + * @param {String} action + * @return {SVG|String} + */ export default function getActionIcon(action) { - let icon; - switch (action) { - case 'icon_action_cancel': - icon = cancelSVG; - break; - case 'icon_action_retry': - icon = retrySVG; - break; - case 'icon_action_play': - icon = playSVG; - break; - case 'icon_action_stop': - icon = stopSVG; - break; - default: - icon = ''; - } + const icons = { + icon_action_cancel: cancelSVG, + icon_action_play: playSVG, + icon_action_retry: retrySVG, + icon_action_stop: stopSVG, + }; - return icon; + return icons[action] || ''; } |