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

app.vue « components « list « registry « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c555c2b04d11dffe9ea1256477c4ca8e95e38f10 (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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<script>
import { mapGetters, mapActions } from 'vuex';
import { GlLoadingIcon, GlEmptyState } from '@gitlab/ui';
import store from '../stores';
import CollapsibleContainer from './collapsible_container.vue';
import ProjectEmptyState from './project_empty_state.vue';
import GroupEmptyState from './group_empty_state.vue';
import { s__, sprintf } from '~/locale';

export default {
  name: 'RegistryListApp',
  components: {
    CollapsibleContainer,
    GlEmptyState,
    GlLoadingIcon,
    ProjectEmptyState,
    GroupEmptyState,
  },
  props: {
    characterError: {
      type: Boolean,
      required: false,
      default: false,
    },
    containersErrorImage: {
      type: String,
      required: true,
    },
    endpoint: {
      type: String,
      required: true,
    },
    helpPagePath: {
      type: String,
      required: true,
    },
    noContainersImage: {
      type: String,
      required: true,
    },
    personalAccessTokensHelpLink: {
      type: String,
      required: false,
      default: null,
    },
    registryHostUrlWithPort: {
      type: String,
      required: false,
      default: null,
    },
    repositoryUrl: {
      type: String,
      required: true,
    },
    isGroupPage: {
      type: Boolean,
      default: false,
      required: false,
    },
    twoFactorAuthHelpLink: {
      type: String,
      required: false,
      default: null,
    },
  },
  store,
  computed: {
    ...mapGetters(['isLoading', 'repos']),
    dockerConnectionErrorText() {
      return sprintf(
        s__(`ContainerRegistry|We are having trouble connecting to Docker, which could be due to an
            issue with your project name or path.
            %{docLinkStart}More Information%{docLinkEnd}`),
        {
          docLinkStart: `<a href="${this.helpPagePath}#docker-connection-error" target="_blank">`,
          docLinkEnd: '</a>',
        },
        false,
      );
    },
    introText() {
      return sprintf(
        s__(`ContainerRegistry|With the Docker Container Registry integrated into GitLab, every
            project can have its own space to store its Docker images.
            %{docLinkStart}More Information%{docLinkEnd}`),
        {
          docLinkStart: `<a href="${this.helpPagePath}" target="_blank">`,
          docLinkEnd: '</a>',
        },
        false,
      );
    },
    noContainerImagesText() {
      return sprintf(
        s__(`ContainerRegistry|With the Container Registry, every project can have its own space to
            store its Docker images. %{docLinkStart}More Information%{docLinkEnd}`),
        {
          docLinkStart: `<a href="${this.helpPagePath}" target="_blank">`,
          docLinkEnd: '</a>',
        },
        false,
      );
    },
  },
  created() {
    this.setMainEndpoint(this.endpoint);
    this.setIsDeleteDisabled(this.isGroupPage);
  },
  mounted() {
    if (!this.characterError) {
      this.fetchRepos();
    }
  },
  methods: {
    ...mapActions(['setMainEndpoint', 'fetchRepos', 'setIsDeleteDisabled']),
  },
};
</script>
<template>
  <div>
    <gl-empty-state
      v-if="characterError"
      :title="s__('ContainerRegistry|Docker connection error')"
      :svg-path="containersErrorImage"
    >
      <template #description>
        <p class="js-character-error-text" v-html="dockerConnectionErrorText"></p>
      </template>
    </gl-empty-state>

    <gl-loading-icon v-else-if="isLoading" size="md" class="prepend-top-16" />

    <div v-else-if="!isLoading && repos.length">
      <h4>{{ s__('ContainerRegistry|Container Registry') }}</h4>
      <p v-html="introText"></p>
      <collapsible-container v-for="item in repos" :key="item.id" :repo="item" />
    </div>
    <project-empty-state
      v-else-if="!isGroupPage"
      :no-containers-image="noContainersImage"
      :help-page-path="helpPagePath"
      :repository-url="repositoryUrl"
      :two-factor-auth-help-link="twoFactorAuthHelpLink"
      :personal-access-tokens-help-link="personalAccessTokensHelpLink"
      :registry-host-url-with-port="registryHostUrlWithPort"
    />
    <group-empty-state
      v-else-if="isGroupPage"
      :no-containers-image="noContainersImage"
      :help-page-path="helpPagePath"
    />
  </div>
</template>