2017-09-19 11:38:55 -04:00
|
|
|
<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';
|
2017-09-19 11:38:55 -04:00
|
|
|
|
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']),
|
|
|
|
},
|
|
|
|
};
|
2017-09-19 11:38:55 -04:00
|
|
|
</script>
|
|
|
|
<template>
|
|
|
|
<div>
|
2018-09-11 18:19:21 -04:00
|
|
|
<gl-loading-icon
|
2017-09-19 11:38:55 -04:00
|
|
|
v-if="isLoading"
|
2018-09-11 18:19:21 -04:00
|
|
|
:size="3"
|
2018-01-04 19:18:35 -05:00
|
|
|
/>
|
2017-09-19 11:38:55 -04:00
|
|
|
|
|
|
|
<collapsible-container
|
|
|
|
v-for="(item, index) in repos"
|
2018-06-11 05:49:47 -04:00
|
|
|
v-else-if="!isLoading && repos.length"
|
2017-09-19 11:38:55 -04:00
|
|
|
:key="index"
|
|
|
|
:repo="item"
|
2018-01-04 19:18:35 -05:00
|
|
|
/>
|
2017-09-19 11:38:55 -04: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.`) }}
|
2017-09-19 11:38:55 -04:00
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</template>
|