2018-04-20 09:34:57 +00:00
|
|
|
<script>
|
|
|
|
import { mapActions, mapGetters, mapState } from 'vuex';
|
|
|
|
import Icon from '~/vue_shared/components/icon.vue';
|
|
|
|
import SkeletonLoadingContainer from '~/vue_shared/components/skeleton_loading_container.vue';
|
|
|
|
import RepoFile from './repo_file.vue';
|
|
|
|
import NewDropdown from './new_dropdown/index.vue';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
Icon,
|
|
|
|
RepoFile,
|
|
|
|
SkeletonLoadingContainer,
|
|
|
|
NewDropdown,
|
|
|
|
},
|
|
|
|
props: {
|
|
|
|
viewerType: {
|
|
|
|
type: String,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
headerClass: {
|
|
|
|
type: String,
|
|
|
|
required: false,
|
|
|
|
default: null,
|
|
|
|
},
|
|
|
|
disableActionDropdown: {
|
|
|
|
type: Boolean,
|
|
|
|
required: false,
|
|
|
|
default: false,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
...mapState(['currentBranchId']),
|
|
|
|
...mapGetters(['currentProject', 'currentTree']),
|
2018-05-02 14:30:51 +00:00
|
|
|
showLoading() {
|
|
|
|
return !this.currentTree || this.currentTree.loading;
|
|
|
|
},
|
2018-04-20 09:34:57 +00:00
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
this.updateViewer(this.viewerType);
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
...mapActions(['updateViewer']),
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<div
|
|
|
|
class="ide-file-list"
|
|
|
|
>
|
2018-05-02 14:30:51 +00:00
|
|
|
<template v-if="showLoading">
|
2018-04-20 09:34:57 +00:00
|
|
|
<div
|
|
|
|
v-for="n in 3"
|
|
|
|
:key="n"
|
2018-06-11 09:49:47 +00:00
|
|
|
class="multi-file-loading-container"
|
2018-04-20 09:34:57 +00:00
|
|
|
>
|
|
|
|
<skeleton-loading-container />
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<template v-else>
|
|
|
|
<header
|
|
|
|
:class="headerClass"
|
2018-06-11 09:49:47 +00:00
|
|
|
class="ide-tree-header"
|
2018-04-20 09:34:57 +00:00
|
|
|
>
|
|
|
|
<slot name="header"></slot>
|
|
|
|
</header>
|
|
|
|
<repo-file
|
|
|
|
v-for="file in currentTree.tree"
|
|
|
|
:key="file.key"
|
|
|
|
:file="file"
|
|
|
|
:level="0"
|
|
|
|
:disable-action-dropdown="disableActionDropdown"
|
|
|
|
/>
|
|
|
|
</template>
|
|
|
|
</div>
|
|
|
|
</template>
|