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

container.vue « file_tree « components « pipeline_editor « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 280cd729a435673ae25684f003dd5efc4db2771e (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
<script>
import { GlAlert, GlTooltipDirective } from '@gitlab/ui';
import { __, s__ } from '~/locale';
import FileIcon from '~/vue_shared/components/file_icon.vue';
import { FILE_TREE_TIP_DISMISSED_KEY } from '../../constants';
import FileItem from './file_item.vue';

const i18n = {
  tipBtn: __('Learn more'),
  tipDescription: s__(
    'PipelineEditorFileTree|When you use the include keyword to add pipeline configuration from files in the project, those files will be listed here.',
  ),
  tipTitle: s__('PipelineEditorFileTree|Configuration files added with the include keyword'),
};

export default {
  i18n,
  name: 'PipelineEditorFileTreeContainer',
  components: {
    FileIcon,
    FileItem,
    GlAlert,
  },
  directives: {
    GlTooltip: GlTooltipDirective,
  },
  inject: ['ciConfigPath', 'includesHelpPagePath'],
  props: {
    includes: {
      type: Array,
      required: true,
    },
  },
  data() {
    return {
      canShowTip: localStorage.getItem(FILE_TREE_TIP_DISMISSED_KEY) !== 'true',
    };
  },
  computed: {
    showTip() {
      return this.includes.length === 0 && this.canShowTip;
    },
  },
  methods: {
    dismissTip() {
      this.canShowTip = false;
      localStorage.setItem(FILE_TREE_TIP_DISMISSED_KEY, 'true');
    },
  },
};
</script>
<template>
  <aside class="file-tree-container gl-mr-5 gl-mb-5">
    <div
      v-gl-tooltip
      :title="ciConfigPath"
      class="gl-bg-gray-50 gl-py-2 gl-px-3 gl-mb-3 gl-rounded-base"
    >
      <span class="file-row-name gl-str-truncated" :title="ciConfigPath">
        <file-icon class="file-row-icon" :file-name="ciConfigPath" />
        <span data-testid="current-config-filename">{{ ciConfigPath }}</span>
      </span>
    </div>
    <gl-alert
      v-if="showTip"
      variant="tip"
      :title="$options.i18n.tipTitle"
      :secondary-button-text="$options.i18n.tipBtn"
      :secondary-button-link="includesHelpPagePath"
      @dismiss="dismissTip"
    >
      {{ $options.i18n.tipDescription }}
    </gl-alert>
    <div class="gl-overflow-y-auto">
      <file-item v-for="file in includes" :key="file.location" :file="file" />
    </div>
  </aside>
</template>