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

new_environment_folder.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: 0615bdef53767ee245de389f1f6aa9839f514dbd (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
<script>
import { GlCollapse, GlIcon, GlBadge, GlLink } from '@gitlab/ui';
import folderQuery from '../graphql/queries/folder.query.graphql';

export default {
  components: {
    GlCollapse,
    GlIcon,
    GlBadge,
    GlLink,
  },
  props: {
    nestedEnvironment: {
      type: Object,
      required: true,
    },
  },
  data() {
    return { visible: false };
  },
  apollo: {
    folder: {
      query: folderQuery,
      variables() {
        return { environment: this.nestedEnvironment.latest };
      },
    },
  },
  computed: {
    icons() {
      return this.visible
        ? { caret: 'angle-down', folder: 'folder-open' }
        : { caret: 'angle-right', folder: 'folder-o' };
    },
    count() {
      return this.folder?.availableCount ?? 0;
    },
    folderClass() {
      return { 'gl-font-weight-bold': this.visible };
    },
    folderPath() {
      return this.nestedEnvironment.latest.folderPath;
    },
  },
  methods: {
    toggleCollapse() {
      this.visible = !this.visible;
    },
  },
};
</script>
<template>
  <div class="gl-border-b-solid gl-border-gray-100 gl-border-1 gl-px-3 gl-pt-3 gl-pb-5">
    <div class="gl-w-full gl-display-flex gl-align-items-center" @click="toggleCollapse">
      <gl-icon
        class="gl-mr-2 gl-fill-current-color gl-text-gray-500"
        :name="icons.caret"
        :size="12"
      />
      <gl-icon class="gl-mr-2 gl-fill-current-color gl-text-gray-500" :name="icons.folder" />
      <div class="gl-mr-2 gl-text-gray-500" :class="folderClass">
        {{ nestedEnvironment.name }}
      </div>
      <gl-badge size="sm" class="gl-mr-auto">{{ count }}</gl-badge>
      <gl-link v-if="visible" :href="folderPath">{{ s__('Environments|Show all') }}</gl-link>
    </div>
    <gl-collapse :visible="visible" />
  </div>
</template>