summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/registry/explorer/components/project_empty_state.vue
blob: 53853b4b9fbba806fc341de8586f88d56d3e9755 (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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<script>
import { GlEmptyState, GlSprintf, GlLink } from '@gitlab/ui';
import ClipboardButton from '~/vue_shared/components/clipboard_button.vue';
import { mapState } from 'vuex';

export default {
  name: 'ProjectEmptyState',
  components: {
    ClipboardButton,
    GlEmptyState,
    GlSprintf,
    GlLink,
  },
  computed: {
    ...mapState(['config']),
    dockerBuildCommand() {
      // eslint-disable-next-line @gitlab/i18n/no-non-i18n-strings
      return `docker build -t ${this.config.repositoryUrl} .`;
    },
    dockerPushCommand() {
      // eslint-disable-next-line @gitlab/i18n/no-non-i18n-strings
      return `docker push ${this.config.repositoryUrl}`;
    },
    dockerLoginCommand() {
      // eslint-disable-next-line @gitlab/i18n/no-non-i18n-strings
      return `docker login ${this.config.registryHostUrlWithPort}`;
    },
  },
};
</script>
<template>
  <gl-empty-state
    :title="s__('ContainerRegistry|There are no container images stored for this project')"
    :svg-path="config.noContainersImage"
    class="container-message"
  >
    <template #description>
      <p class="js-no-container-images-text">
        <gl-sprintf
          :message="
            s__(`ContainerRegistry|With the Container Registry, every project can have its own space to
            store its Docker images. %{docLinkStart}More Information%{docLinkEnd}`)
          "
        >
          <template #docLink="{content}">
            <gl-link :href="config.helpPagePath" target="_blank">{{ content }}</gl-link>
          </template>
        </gl-sprintf>
      </p>
      <h5>{{ s__('ContainerRegistry|Quick Start') }}</h5>
      <p class="js-not-logged-in-to-registry-text">
        <gl-sprintf
          :message="
            s__(`ContainerRegistry|If you are not already logged in, you need to authenticate to
             the Container Registry by using your GitLab username and password. If you have
             %{twofaDocLinkStart}Two-Factor Authentication%{twofaDocLinkEnd} enabled, use a
             %{personalAccessTokensDocLinkStart}Personal Access Token%{personalAccessTokensDocLinkEnd}
            instead of a password.`)
          "
        >
          <template #twofaDocLink="{content}">
            <gl-link :href="config.twoFactorAuthHelpLink" target="_blank">{{ content }}</gl-link>
          </template>
          <template #personalAccessTokensDocLink="{content}">
            <gl-link :href="config.personalAccessTokensHelpLink" target="_blank">{{
              content
            }}</gl-link>
          </template>
        </gl-sprintf>
      </p>
      <div class="input-group append-bottom-10">
        <input :value="dockerLoginCommand" type="text" class="form-control monospace" readonly />
        <span class="input-group-append">
          <clipboard-button
            :text="dockerLoginCommand"
            :title="s__('ContainerRegistry|Copy login command')"
            class="input-group-text"
          />
        </span>
      </div>
      <p></p>
      <p>
        {{
          s__(
            'ContainerRegistry|You can add an image to this registry with the following commands:',
          )
        }}
      </p>

      <div class="input-group append-bottom-10">
        <input :value="dockerBuildCommand" type="text" class="form-control monospace" readonly />
        <span class="input-group-append">
          <clipboard-button
            :text="dockerBuildCommand"
            :title="s__('ContainerRegistry|Copy build command')"
            class="input-group-text"
          />
        </span>
      </div>

      <div class="input-group">
        <input :value="dockerPushCommand" type="text" class="form-control monospace" readonly />
        <span class="input-group-append">
          <clipboard-button
            :text="dockerPushCommand"
            :title="s__('ContainerRegistry|Copy push command')"
            class="input-group-text"
          />
        </span>
      </div>
    </template>
  </gl-empty-state>
</template>