BigW Consortium Gitlab

ci_icon.vue 1.13 KB
Newer Older
1
<script>
Tim Zallmann committed
2
  import icon from '../../vue_shared/components/icon.vue';
3

4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
  /**
   * Renders CI icon based on API response shared between all places where it is used.
   *
   * Receives status object containing:
   * status: {
   *   details_path: "/gitlab-org/gitlab-ce/pipelines/8150156" // url
   *   group:"running" // used for CSS class
   *   icon: "icon_status_running" // used to render the icon
   *   label:"running" // used for potential tooltip
   *   text:"running" // text rendered
   * }
   *
   * Used in:
   * - Pipelines table Badge
   * - Pipelines table mini graph
   * - Pipeline graph
   * - Pipeline show view badge
   * - Jobs table
   * - Jobs show view header
   * - Jobs show view sidebar
   */
25 26 27 28 29 30 31 32
  export default {
    props: {
      status: {
        type: Object,
        required: true,
      },
    },

Tim Zallmann committed
33 34 35
    components: {
      icon,
    },
36

Tim Zallmann committed
37
    computed: {
38
      cssClass() {
39
        const status = this.status.group;
40 41 42 43 44 45 46
        return `ci-status-icon ci-status-icon-${status} js-ci-status-icon-${status}`;
      },
    },
  };
</script>
<template>
  <span
Tim Zallmann committed
47 48 49
    :class="cssClass">
    <icon
      :name="status.icon"/>
50 51
  </span>
</template>