Welcome to mirror list, hosted at ThFree Co, Russian Federation.

deploy_board_wrapper.vue « components « environments « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d9d77088ad36c05a9c8d812c3b3f649bd88d162d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<script>
import { GlCollapse, GlButton } from '@gitlab/ui';
import { __, s__ } from '~/locale';
import setEnvironmentToChangeCanaryMutation from '../graphql/mutations/set_environment_to_change_canary.mutation.graphql';
import DeployBoard from './deploy_board.vue';

export default {
  components: {
    DeployBoard,
    GlButton,
    GlCollapse,
  },
  props: {
    rolloutStatus: {
      required: true,
      type: Object,
    },
    environment: {
      required: true,
      type: Object,
    },
  },
  data() {
    return { visible: false };
  },
  computed: {
    icon() {
      return this.visible ? 'angle-down' : 'angle-right';
    },
    label() {
      return this.visible ? this.$options.i18n.collapse : this.$options.i18n.expand;
    },
    isLoading() {
      return this.rolloutStatus.status === 'loading';
    },
    isEmpty() {
      return this.rolloutStatus.status === 'not_found';
    },
  },
  methods: {
    toggleCollapse() {
      this.visible = !this.visible;
    },
    changeCanaryWeight(weight) {
      this.$apollo.mutate({
        mutation: setEnvironmentToChangeCanaryMutation,
        variables: {
          environment: this.environment,
          weight,
        },
      });
    },
  },
  i18n: {
    collapse: __('Collapse'),
    expand: __('Expand'),
    pods: s__('DeployBoard|Kubernetes Pods'),
  },
};
</script>
<template>
  <div>
    <div>
      <gl-button
        class="gl-mr-4 gl-min-w-fit-content"
        :icon="icon"
        :aria-label="label"
        size="small"
        category="tertiary"
        @click="toggleCollapse"
      />
      <span>{{ $options.i18n.pods }}</span>
    </div>
    <gl-collapse :visible="visible">
      <deploy-board
        :deploy-board-data="rolloutStatus"
        :is-loading="isLoading"
        :is-empty="isEmpty"
        :environment="environment"
        graphql
        class="gl-reset-bg!"
        @changeCanaryWeight="changeCanaryWeight"
      />
    </gl-collapse>
  </div>
</template>