2017-09-15 09:10:08 -04:00
|
|
|
<script>
|
2017-09-25 07:29:55 -04:00
|
|
|
import { mapActions } from 'vuex';
|
2018-01-04 19:18:35 -05:00
|
|
|
import Flash from '../../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 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';
|
2018-09-06 02:33:30 -04:00
|
|
|
import { __ } from '../../locale';
|
2017-09-15 12:05:46 -04:00
|
|
|
|
2017-09-15 09:10:08 -04:00
|
|
|
export default {
|
2018-01-04 19:18:35 -05:00
|
|
|
name: 'CollapsibeContainerRegisty',
|
2017-09-15 09:10:08 -04:00
|
|
|
components: {
|
2017-09-15 12:05:46 -04:00
|
|
|
clipboardButton,
|
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
|
|
|
},
|
2018-01-04 19:18:35 -05:00
|
|
|
props: {
|
|
|
|
repo: {
|
|
|
|
type: Object,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
},
|
2017-09-15 09:10:08 -04:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
isOpen: false,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
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)
|
2018-09-06 02:33:30 -04:00
|
|
|
.then(() => {
|
|
|
|
Flash(__('This container registry has been scheduled for deletion.'), 'notice');
|
|
|
|
this.fetchRepos();
|
|
|
|
})
|
2017-09-25 07:29:55 -04:00
|
|
|
.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) {
|
2017-10-19 00:02:19 -04:00
|
|
|
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">
|
2018-01-04 19:18:35 -05:00
|
|
|
<div class="container-image-head">
|
2017-09-25 07:29:55 -04:00
|
|
|
<button
|
|
|
|
type="button"
|
2018-01-04 19:18:35 -05:00
|
|
|
class="js-toggle-repo btn-link"
|
2018-06-11 05:49:47 -04:00
|
|
|
@click="toggleRepo"
|
2018-01-04 19:18:35 -05:00
|
|
|
>
|
2017-09-19 11:38:55 -04:00
|
|
|
<i
|
|
|
|
:class="{
|
|
|
|
'fa-chevron-right': !isOpen,
|
|
|
|
'fa-chevron-up': isOpen,
|
|
|
|
}"
|
2018-06-11 05:49:47 -04:00
|
|
|
class="fa"
|
2018-01-04 19:18:35 -05:00
|
|
|
aria-hidden="true"
|
|
|
|
>
|
2017-09-19 11:38:55 -04:00
|
|
|
</i>
|
2018-01-04 19:18:35 -05:00
|
|
|
{{ 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"
|
2018-05-16 06:19:41 -04:00
|
|
|
:text="repo.location"
|
2017-09-20 14:03:53 -04:00
|
|
|
:title="repo.location"
|
2018-05-10 15:22:56 -04:00
|
|
|
css-class="btn-default btn-transparent btn-clipboard"
|
2018-01-04 19:18:35 -05:00
|
|
|
/>
|
2017-09-19 11:38:55 -04:00
|
|
|
|
2018-04-09 17:50:40 -04:00
|
|
|
<div class="controls d-none d-sm-block float-right">
|
2017-09-19 11:38:55 -04:00
|
|
|
<button
|
|
|
|
v-if="repo.canDelete"
|
2018-09-20 02:13:50 -04:00
|
|
|
v-tooltip
|
2017-09-25 07:29:55 -04:00
|
|
|
:title="s__('ContainerRegistry|Remove repository')"
|
|
|
|
:aria-label="s__('ContainerRegistry|Remove repository')"
|
2018-06-11 05:49:47 -04:00
|
|
|
type="button"
|
|
|
|
class="js-remove-repo btn btn-danger"
|
2018-01-04 19:18:35 -05:00
|
|
|
@click="handleDeleteRepository"
|
|
|
|
>
|
2017-09-19 11:38:55 -04:00
|
|
|
<i
|
|
|
|
class="fa fa-trash"
|
2018-01-04 19:18:35 -05:00
|
|
|
aria-hidden="true"
|
|
|
|
>
|
2017-09-19 11:38:55 -04:00
|
|
|
</i>
|
|
|
|
</button>
|
|
|
|
</div>
|
2017-09-15 12:05:46 -04:00
|
|
|
</div>
|
2017-09-19 11:38:55 -04:00
|
|
|
|
2018-09-11 18:19:21 -04:00
|
|
|
<gl-loading-icon
|
2017-09-19 11:38:55 -04:00
|
|
|
v-if="repo.isLoading"
|
2018-09-11 18:19:21 -04:00
|
|
|
:size="2"
|
2017-09-28 06:47:24 -04:00
|
|
|
class="append-bottom-20"
|
2018-01-04 19:18:35 -05:00
|
|
|
/>
|
2017-09-19 11:38:55 -04:00
|
|
|
|
2017-09-15 12:05:46 -04:00
|
|
|
<div
|
2017-09-19 11:38:55 -04:00
|
|
|
v-else-if="!repo.isLoading && isOpen"
|
2018-01-04 19:18:35 -05:00
|
|
|
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"
|
2018-01-04 19:18:35 -05:00
|
|
|
/>
|
2017-09-22 06:46:55 -04:00
|
|
|
|
2017-09-15 12:05:46 -04:00
|
|
|
<div
|
|
|
|
v-else
|
2018-01-04 19:18:35 -05:00
|
|
|
class="nothing-here-block"
|
|
|
|
>
|
|
|
|
{{ 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>
|