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

61 lines
1.3 KiB
Vue
Raw Normal View History

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