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

54 lines
1.1 KiB
Vue
Raw Normal View History

<script>
2018-10-10 02:49:24 -04:00
import { mapGetters, mapActions } from 'vuex';
import Flash from '../../flash';
import store from '../stores';
import collapsibleContainer from './collapsible_container.vue';
import { errorMessages, errorMessagesTypes } from '../constants';
2018-10-10 02:49:24 -04:00
export default {
name: 'RegistryListApp',
components: {
collapsibleContainer,
},
props: {
endpoint: {
type: String,
required: true,
2018-01-04 19:18:35 -05:00
},
2018-10-10 02:49:24 -04: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-09-11 18:19:21 -04:00
<gl-loading-icon
v-if="isLoading"
2018-09-11 18:19:21 -04:00
:size="3"
2018-01-04 19:18:35 -05:00
/>
<collapsible-container
v-for="(item, index) in repos"
2018-06-11 05:49:47 -04:00
v-else-if="!isLoading && repos.length"
:key="index"
:repo="item"
2018-01-04 19:18:35 -05:00
/>
<p v-else-if="!isLoading && !repos.length">
2018-01-08 15:01:49 -05:00
{{ __(`No container images stored for this project.
Add one by following the instructions above.`) }}
</p>
</div>
</template>