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

index.vue « pages « branches « jira_connect « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3b92ace694c70dec4b6340579a7387d23576f4ba (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
<!-- eslint-disable vue/multi-word-component-names -->
<script>
import { GlEmptyState } from '@gitlab/ui';
import { sprintf } from '~/locale';
import NewBranchForm from '../components/new_branch_form.vue';
import {
  I18N_PAGE_TITLE_WITH_BRANCH_NAME,
  I18N_PAGE_TITLE_DEFAULT,
  I18N_NEW_BRANCH_SUCCESS_TITLE,
  I18N_NEW_BRANCH_SUCCESS_MESSAGE,
} from '../constants';

export default {
  components: {
    GlEmptyState,
    NewBranchForm,
  },
  inject: ['initialBranchName', 'successStateSvgPath'],
  data() {
    return {
      showForm: true,
    };
  },
  computed: {
    pageTitle() {
      return this.initialBranchName
        ? sprintf(this.$options.i18n.I18N_PAGE_TITLE_WITH_BRANCH_NAME, {
            jiraIssue: this.initialBranchName,
          })
        : this.$options.i18n.I18N_PAGE_TITLE_DEFAULT;
    },
  },
  methods: {
    onNewBranchFormSuccess() {
      // light-weight toggle to hide the form and show the success state
      this.showForm = false;
    },
  },
  i18n: {
    I18N_PAGE_TITLE_WITH_BRANCH_NAME,
    I18N_PAGE_TITLE_DEFAULT,
    I18N_NEW_BRANCH_SUCCESS_TITLE,
    I18N_NEW_BRANCH_SUCCESS_MESSAGE,
  },
};
</script>
<template>
  <div>
    <div class="gl-border-1 gl-border-b-solid gl-border-gray-100 gl-mb-5 gl-mt-7">
      <h1 data-testid="page-title" class="page-title gl-font-size-h-display">{{ pageTitle }}</h1>
    </div>

    <new-branch-form v-if="showForm" @success="onNewBranchFormSuccess" />
    <gl-empty-state
      v-else
      :title="$options.i18n.I18N_NEW_BRANCH_SUCCESS_TITLE"
      :description="$options.i18n.I18N_NEW_BRANCH_SUCCESS_MESSAGE"
      :svg-path="successStateSvgPath"
      :svg-height="null"
    />
  </div>
</template>