diff options
Diffstat (limited to 'app/assets/javascripts/runner/components/runner_type_badge.vue')
-rw-r--r-- | app/assets/javascripts/runner/components/runner_type_badge.vue | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/app/assets/javascripts/runner/components/runner_type_badge.vue b/app/assets/javascripts/runner/components/runner_type_badge.vue new file mode 100644 index 00000000000..dd4fff3a77a --- /dev/null +++ b/app/assets/javascripts/runner/components/runner_type_badge.vue @@ -0,0 +1,45 @@ +<script> +import { GlBadge } from '@gitlab/ui'; +import { s__ } from '~/locale'; +import { INSTANCE_TYPE, GROUP_TYPE, PROJECT_TYPE } from '../constants'; + +const badge = { + [INSTANCE_TYPE]: { + variant: 'success', + text: s__('Runners|shared'), + }, + [GROUP_TYPE]: { + variant: 'success', + text: s__('Runners|group'), + }, + [PROJECT_TYPE]: { + variant: 'info', + text: s__('Runners|specific'), + }, +}; + +export default { + components: { + GlBadge, + }, + props: { + type: { + type: String, + required: true, + }, + }, + computed: { + variant() { + return badge[this.type]?.variant; + }, + text() { + return badge[this.type]?.text; + }, + }, +}; +</script> +<template> + <gl-badge v-if="text" :variant="variant" v-bind="$attrs"> + {{ text }} + </gl-badge> +</template> |