gitlab-org--gitlab-foss/app/assets/javascripts/registry/components/app.vue

55 lines
1.2 KiB
Vue
Raw Normal View History

<script>
2018-10-10 06:49:24 +00:00
import { mapGetters, mapActions } from 'vuex';
2018-11-16 19:29:11 +00:00
import { GlLoadingIcon } from '@gitlab/ui';
2018-10-10 06:49:24 +00:00
import Flash from '../../flash';
import store from '../stores';
import collapsibleContainer from './collapsible_container.vue';
import { errorMessages, errorMessagesTypes } from '../constants';
2018-10-10 06:49:24 +00:00
export default {
name: 'RegistryListApp',
components: {
collapsibleContainer,
GlLoadingIcon,
2018-10-10 06:49:24 +00:00
},
props: {
endpoint: {
type: String,
required: true,
2018-01-05 00:18:35 +00:00
},
2018-10-10 06:49:24 +00:00
},
store,
computed: {
...mapGetters(['isLoading', 'repos']),
},
created() {
this.setMainEndpoint(this.endpoint);
},
mounted() {
this.fetchRepos().catch(() => Flash(errorMessages[errorMessagesTypes.FETCH_REPOS]));
},
methods: {
...mapActions(['setMainEndpoint', 'fetchRepos']),
},
};
</script>
<template>
<div>
2018-11-16 20:07:38 +00:00
<gl-loading-icon v-if="isLoading" :size="3" />
<collapsible-container
v-for="(item, index) in repos"
2018-06-11 09:49:47 +00:00
v-else-if="!isLoading && repos.length"
:key="index"
:repo="item"
2018-01-05 00:18:35 +00:00
/>
<p v-else-if="!isLoading && !repos.length">
2018-11-16 20:07:38 +00:00
{{
__(`No container images stored for this project.
Add one by following the instructions above.`)
}}
</p>
</div>
</template>