debian-mirror-gitlab/app/assets/javascripts/registry/components/app.vue

154 lines
4.1 KiB
Vue
Raw Normal View History

2018-03-17 18:26:18 +05:30
<script>
2018-12-13 13:39:08 +05:30
import { mapGetters, mapActions } from 'vuex';
2019-12-04 20:38:33 +05:30
import { GlLoadingIcon, GlEmptyState } from '@gitlab/ui';
2018-12-13 13:39:08 +05:30
import store from '../stores';
2019-02-15 15:39:39 +05:30
import CollapsibleContainer from './collapsible_container.vue';
2019-12-21 20:55:43 +05:30
import ProjectEmptyState from './project_empty_state.vue';
import GroupEmptyState from './group_empty_state.vue';
2019-09-30 21:07:59 +05:30
import { s__, sprintf } from '../../locale';
2018-03-17 18:26:18 +05:30
2018-12-13 13:39:08 +05:30
export default {
name: 'RegistryListApp',
components: {
2019-02-15 15:39:39 +05:30
CollapsibleContainer,
2019-12-04 20:38:33 +05:30
GlEmptyState,
2018-12-13 13:39:08 +05:30
GlLoadingIcon,
2019-12-21 20:55:43 +05:30
ProjectEmptyState,
GroupEmptyState,
2018-12-13 13:39:08 +05:30
},
props: {
2019-09-30 21:07:59 +05:30
characterError: {
type: Boolean,
required: false,
default: false,
},
2019-12-21 20:55:43 +05:30
containersErrorImage: {
type: String,
required: true,
},
endpoint: {
type: String,
required: true,
},
2019-09-30 21:07:59 +05:30
helpPagePath: {
type: String,
required: true,
},
noContainersImage: {
type: String,
required: true,
},
2019-12-21 20:55:43 +05:30
personalAccessTokensHelpLink: {
2019-09-30 21:07:59 +05:30
type: String,
2019-12-21 20:55:43 +05:30
required: false,
default: null,
},
registryHostUrlWithPort: {
type: String,
required: false,
default: null,
2019-09-30 21:07:59 +05:30
},
repositoryUrl: {
type: String,
required: true,
},
2019-12-21 20:55:43 +05:30
isGroupPage: {
type: Boolean,
default: false,
required: false,
},
twoFactorAuthHelpLink: {
type: String,
required: false,
default: null,
},
2018-12-13 13:39:08 +05:30
},
store,
computed: {
...mapGetters(['isLoading', 'repos']),
2019-09-30 21:07:59 +05:30
dockerConnectionErrorText() {
return sprintf(
s__(`ContainerRegistry|We are having trouble connecting to Docker, which could be due to an
2019-12-21 20:55:43 +05:30
issue with your project name or path.
2019-09-30 21:07:59 +05:30
%{docLinkStart}More Information%{docLinkEnd}`),
{
docLinkStart: `<a href="${this.helpPagePath}#docker-connection-error" target="_blank">`,
docLinkEnd: '</a>',
},
false,
);
},
introText() {
return sprintf(
2019-12-21 20:55:43 +05:30
s__(`ContainerRegistry|With the Docker Container Registry integrated into GitLab, every
project can have its own space to store its Docker images.
2019-09-30 21:07:59 +05:30
%{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,
);
},
2018-12-13 13:39:08 +05:30
},
created() {
this.setMainEndpoint(this.endpoint);
2019-12-21 20:55:43 +05:30
this.setIsDeleteDisabled(this.isGroupPage);
2018-12-13 13:39:08 +05:30
},
mounted() {
2019-12-04 20:38:33 +05:30
if (!this.characterError) {
this.fetchRepos();
}
2018-12-13 13:39:08 +05:30
},
methods: {
2019-12-21 20:55:43 +05:30
...mapActions(['setMainEndpoint', 'fetchRepos', 'setIsDeleteDisabled']),
2018-12-13 13:39:08 +05:30
},
};
2018-03-17 18:26:18 +05:30
</script>
<template>
<div>
2019-12-04 20:38:33 +05:30
<gl-empty-state
v-if="characterError"
:title="s__('ContainerRegistry|Docker connection error')"
:svg-path="containersErrorImage"
>
<template #description>
2019-12-21 20:55:43 +05:30
<p class="js-character-error-text" v-html="dockerConnectionErrorText"></p>
2019-12-04 20:38:33 +05:30
</template>
</gl-empty-state>
2019-09-30 21:07:59 +05:30
2019-12-04 20:38:33 +05:30
<gl-loading-icon v-else-if="isLoading" size="md" class="prepend-top-16" />
2019-09-30 21:07:59 +05:30
2019-12-04 20:38:33 +05:30
<div v-else-if="!isLoading && repos.length">
2019-09-30 21:07:59 +05:30
<h4>{{ s__('ContainerRegistry|Container Registry') }}</h4>
<p v-html="introText"></p>
<collapsible-container v-for="item in repos" :key="item.id" :repo="item" />
</div>
2019-12-21 20:55:43 +05:30
<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"
/>
2018-03-17 18:26:18 +05:30
</div>
</template>