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

56 lines
1.2 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-01-03 12:48:30 +05:30
import { GlLoadingIcon } from '@gitlab-org/gitlab-ui';
import Flash from '../../flash';
2018-12-13 13:39:08 +05:30
import store from '../stores';
2019-01-03 12:48:30 +05:30
import collapsibleContainer from './collapsible_container.vue';
import { errorMessages, errorMessagesTypes } from '../constants';
2018-03-17 18:26:18 +05:30
2018-12-13 13:39:08 +05:30
export default {
name: 'RegistryListApp',
components: {
2019-01-03 12:48:30 +05:30
collapsibleContainer,
2018-12-13 13:39:08 +05:30
GlLoadingIcon,
},
props: {
endpoint: {
type: String,
required: true,
2018-03-17 18:26:18 +05:30
},
2018-12-13 13:39:08 +05:30
},
store,
computed: {
...mapGetters(['isLoading', 'repos']),
},
created() {
this.setMainEndpoint(this.endpoint);
},
mounted() {
2019-01-03 12:48:30 +05:30
this.fetchRepos().catch(() => Flash(errorMessages[errorMessagesTypes.FETCH_REPOS]));
2018-12-13 13:39:08 +05:30
},
methods: {
...mapActions(['setMainEndpoint', 'fetchRepos']),
},
};
2018-03-17 18:26:18 +05:30
</script>
<template>
<div>
2019-01-03 12:48:30 +05:30
<gl-loading-icon
v-if="isLoading"
:size="3"
/>
2018-03-17 18:26:18 +05:30
<collapsible-container
2019-01-03 12:48:30 +05:30
v-for="(item, index) in repos"
2018-11-08 19:23:39 +05:30
v-else-if="!isLoading && repos.length"
2019-01-03 12:48:30 +05:30
:key="index"
2018-03-17 18:26:18 +05:30
:repo="item"
/>
<p v-else-if="!isLoading && !repos.length">
2019-01-03 12:48:30 +05:30
{{ __(`No container images stored for this project.
Add one by following the instructions above.`) }}
2018-03-17 18:26:18 +05:30
</p>
</div>
</template>