diff options
author | Filipa Lacerda <filipa@gitlab.com> | 2017-05-11 12:33:05 +0100 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2017-05-11 12:33:05 +0100 |
commit | ba6f263dd28a9cec6a4834106bc420b4a8e45209 (patch) | |
tree | ad0382e4a92a6f2001a8e62c1261c88c0895330d /app/assets/javascripts | |
parent | 2e92c5c458cededd4f51a00b3849bf3cbb326b6b (diff) | |
download | gitlab-ce-ba6f263dd28a9cec6a4834106bc420b4a8e45209.tar.gz |
Improve ci action icon function32073-improve-function
Diffstat (limited to 'app/assets/javascripts')
-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] || ''; } |