2017-09-15 09:10:08 -04:00
|
|
|
<script>
|
2017-09-26 07:02:03 -04:00
|
|
|
/* globals Flash */
|
2017-09-25 07:29:55 -04:00
|
|
|
import { mapActions } from 'vuex';
|
2017-09-26 07:02:03 -04:00
|
|
|
import '../../flash';
|
2017-09-15 12:05:46 -04:00
|
|
|
import clipboardButton from '../../vue_shared/components/clipboard_button.vue';
|
2017-09-19 11:38:55 -04:00
|
|
|
import loadingIcon from '../../vue_shared/components/loading_icon.vue';
|
|
|
|
import tooltip from '../../vue_shared/directives/tooltip';
|
2017-09-25 13:00:39 -04:00
|
|
|
import tableRegistry from './table_registry.vue';
|
2017-09-25 07:29:55 -04:00
|
|
|
import { errorMessages, errorMessagesTypes } from '../constants';
|
2017-09-15 12:05:46 -04:00
|
|
|
|
2017-09-15 09:10:08 -04:00
|
|
|
export default {
|
|
|
|
name: 'collapsibeContainerRegisty',
|
|
|
|
props: {
|
2017-09-19 11:38:55 -04:00
|
|
|
repo: {
|
2017-09-15 12:05:46 -04:00
|
|
|
type: Object,
|
|
|
|
required: true,
|
|
|
|
},
|
2017-09-15 09:10:08 -04:00
|
|
|
},
|
|
|
|
components: {
|
2017-09-15 12:05:46 -04:00
|
|
|
clipboardButton,
|
2017-09-19 11:38:55 -04:00
|
|
|
loadingIcon,
|
2017-09-25 13:00:39 -04:00
|
|
|
tableRegistry,
|
2017-09-19 11:38:55 -04:00
|
|
|
},
|
|
|
|
directives: {
|
|
|
|
tooltip,
|
2017-09-15 09:10:08 -04:00
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
isOpen: false,
|
|
|
|
};
|
|
|
|
},
|
2017-09-27 07:10:01 -04:00
|
|
|
computed: {
|
|
|
|
clipboardText() {
|
|
|
|
return `docker pull ${this.repo.location}`;
|
|
|
|
},
|
|
|
|
},
|
2017-09-15 09:10:08 -04:00
|
|
|
methods: {
|
2017-09-25 07:29:55 -04:00
|
|
|
...mapActions([
|
2017-09-25 13:00:39 -04:00
|
|
|
'fetchRepos',
|
2017-09-25 07:29:55 -04:00
|
|
|
'fetchList',
|
|
|
|
'deleteRepo',
|
|
|
|
]),
|
|
|
|
|
2017-09-19 11:38:55 -04:00
|
|
|
toggleRepo() {
|
2017-09-25 07:39:16 -04:00
|
|
|
this.isOpen = !this.isOpen;
|
2017-09-26 07:02:03 -04:00
|
|
|
|
2017-09-25 07:39:16 -04:00
|
|
|
if (this.isOpen) {
|
2017-09-25 07:29:55 -04:00
|
|
|
this.fetchList({ repo: this.repo })
|
|
|
|
.catch(() => this.showError(errorMessagesTypes.FETCH_REGISTRY));
|
2017-09-19 11:38:55 -04:00
|
|
|
}
|
|
|
|
},
|
2017-09-20 14:03:53 -04:00
|
|
|
|
2017-09-19 11:38:55 -04:00
|
|
|
handleDeleteRepository() {
|
2017-09-25 07:29:55 -04:00
|
|
|
this.deleteRepo(this.repo)
|
|
|
|
.then(() => this.fetchRepos())
|
|
|
|
.catch(() => this.showError(errorMessagesTypes.DELETE_REPO));
|
2017-09-19 11:38:55 -04:00
|
|
|
},
|
2017-09-20 14:03:53 -04:00
|
|
|
|
2017-09-25 07:29:55 -04:00
|
|
|
showError(message) {
|
|
|
|
Flash((errorMessages[message]));
|
2017-09-22 06:46:55 -04:00
|
|
|
},
|
2017-09-19 11:38:55 -04:00
|
|
|
},
|
|
|
|
};
|
2017-09-15 09:10:08 -04:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<div class="container-image">
|
2017-09-19 11:38:55 -04:00
|
|
|
<div
|
|
|
|
class="container-image-head">
|
2017-09-25 07:29:55 -04:00
|
|
|
<button
|
|
|
|
type="button"
|
2017-09-20 14:03:53 -04:00
|
|
|
@click="toggleRepo"
|
2017-09-25 07:29:55 -04:00
|
|
|
class="js-toggle-repo btn-link">
|
2017-09-19 11:38:55 -04:00
|
|
|
<i
|
|
|
|
class="fa"
|
|
|
|
:class="{
|
|
|
|
'fa-chevron-right': !isOpen,
|
|
|
|
'fa-chevron-up': isOpen,
|
|
|
|
}"
|
|
|
|
aria-hidden="true">
|
|
|
|
</i>
|
|
|
|
{{repo.name}}
|
2017-09-25 07:29:55 -04:00
|
|
|
</button>
|
2017-09-19 11:38:55 -04:00
|
|
|
|
2017-09-20 14:03:53 -04:00
|
|
|
<clipboard-button
|
|
|
|
v-if="repo.location"
|
2017-09-27 07:10:01 -04:00
|
|
|
:text="clipboardText"
|
2017-09-20 14:03:53 -04:00
|
|
|
:title="repo.location"
|
|
|
|
/>
|
2017-09-19 11:38:55 -04:00
|
|
|
|
|
|
|
<div class="controls hidden-xs pull-right">
|
|
|
|
<button
|
|
|
|
v-if="repo.canDelete"
|
|
|
|
type="button"
|
2017-09-25 07:29:55 -04:00
|
|
|
class="js-remove-repo btn btn-danger"
|
|
|
|
:title="s__('ContainerRegistry|Remove repository')"
|
|
|
|
:aria-label="s__('ContainerRegistry|Remove repository')"
|
2017-09-19 11:38:55 -04:00
|
|
|
v-tooltip
|
|
|
|
@click="handleDeleteRepository">
|
|
|
|
<i
|
|
|
|
class="fa fa-trash"
|
|
|
|
aria-hidden="true">
|
|
|
|
</i>
|
|
|
|
</button>
|
|
|
|
</div>
|
2017-09-15 12:05:46 -04:00
|
|
|
|
|
|
|
</div>
|
2017-09-19 11:38:55 -04:00
|
|
|
|
|
|
|
<loading-icon
|
|
|
|
v-if="repo.isLoading"
|
|
|
|
/>
|
|
|
|
|
2017-09-15 12:05:46 -04:00
|
|
|
<div
|
2017-09-19 11:38:55 -04:00
|
|
|
v-else-if="!repo.isLoading && isOpen"
|
|
|
|
class="container-image-tags">
|
2017-09-15 12:05:46 -04:00
|
|
|
|
2017-09-25 13:00:39 -04:00
|
|
|
<table-registry
|
|
|
|
v-if="repo.list.length"
|
|
|
|
:repo="repo"
|
|
|
|
/>
|
2017-09-22 06:46:55 -04:00
|
|
|
|
2017-09-15 12:05:46 -04:00
|
|
|
<div
|
|
|
|
v-else
|
|
|
|
class="nothing-here-block">
|
2017-09-25 07:29:55 -04:00
|
|
|
{{s__("ContainerRegistry|No tags in Container Registry for this container image.")}}
|
2017-09-15 12:05:46 -04:00
|
|
|
</div>
|
|
|
|
</div>
|
2017-09-15 09:10:08 -04:00
|
|
|
</div>
|
|
|
|
</template>
|