summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/ci/pipeline_editor/components/editor/ci_config_merged_preview.vue
blob: 42e2d34fa3a0af3d5e2e481f4ed67a37ca874496 (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
<script>
import { GlIcon } from '@gitlab/ui';
import { uniqueId } from 'lodash';
import { s__ } from '~/locale';
import SourceEditor from '~/vue_shared/components/source_editor.vue';

export default {
  i18n: {
    viewOnlyMessage: s__('Pipelines|Merged YAML is view only'),
  },
  components: {
    SourceEditor,
    GlIcon,
  },
  inject: ['ciConfigPath'],
  props: {
    ciConfigData: {
      type: Object,
      required: true,
    },
  },
  data() {
    return {
      failureType: null,
    };
  },
  computed: {
    fileGlobalId() {
      return `${this.ciConfigPath}-${uniqueId()}`;
    },
    mergedYaml() {
      return this.ciConfigData.mergedYaml;
    },
  },
};
</script>
<template>
  <div>
    <div class="gl-display-flex gl-align-items-center">
      <gl-icon :size="16" name="lock" class="gl-text-gray-500 gl-mr-3" />
      {{ $options.i18n.viewOnlyMessage }}
    </div>
    <div class="gl-mt-3 gl-border-solid gl-border-gray-100 gl-border-1">
      <source-editor
        ref="editor"
        :value="mergedYaml"
        :file-name="ciConfigPath"
        :file-global-id="fileGlobalId"
        :editor-options="/* eslint-disable @gitlab/vue-no-new-non-primitive-in-template */ {
          readOnly: true,
        } /* eslint-enable @gitlab/vue-no-new-non-primitive-in-template */"
        v-on="$listeners"
      />
    </div>
  </div>
</template>