2018-03-20 14:12:48 +00:00
|
|
|
<script>
|
2018-05-03 08:44:08 +00:00
|
|
|
import { mapState, mapGetters, mapActions } from 'vuex';
|
2018-07-10 13:56:50 +00:00
|
|
|
import Icon from '~/vue_shared/components/icon.vue';
|
2018-04-20 09:34:57 +00:00
|
|
|
import IdeTreeList from './ide_tree_list.vue';
|
2018-07-10 13:56:50 +00:00
|
|
|
import Upload from './new_dropdown/upload.vue';
|
|
|
|
import NewEntryButton from './new_dropdown/button.vue';
|
2018-03-20 14:12:48 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
components: {
|
2018-07-10 13:56:50 +00:00
|
|
|
Icon,
|
|
|
|
Upload,
|
2018-04-20 09:34:57 +00:00
|
|
|
IdeTreeList,
|
2018-07-10 13:56:50 +00:00
|
|
|
NewEntryButton,
|
2018-03-20 14:12:48 +00:00
|
|
|
},
|
2018-04-17 15:27:46 +00:00
|
|
|
computed: {
|
|
|
|
...mapState(['currentBranchId']),
|
2018-05-02 10:47:36 +00:00
|
|
|
...mapGetters(['currentProject', 'currentTree', 'activeFile']),
|
|
|
|
},
|
|
|
|
mounted() {
|
|
|
|
if (this.activeFile && this.activeFile.pending) {
|
|
|
|
this.$router.push(`/project${this.activeFile.url}`, () => {
|
|
|
|
this.updateViewer('editor');
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
2018-07-10 13:56:50 +00:00
|
|
|
...mapActions(['updateViewer', 'openNewEntryModal', 'createTempEntry']),
|
2018-03-20 14:12:48 +00:00
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2018-04-20 09:34:57 +00:00
|
|
|
<ide-tree-list
|
2018-07-10 13:56:50 +00:00
|
|
|
header-class="d-flex w-100"
|
2018-04-20 09:34:57 +00:00
|
|
|
viewer-type="editor"
|
2018-03-20 14:12:48 +00:00
|
|
|
>
|
2018-04-20 09:34:57 +00:00
|
|
|
<template
|
|
|
|
slot="header"
|
|
|
|
>
|
|
|
|
{{ __('Edit') }}
|
2018-07-10 13:56:50 +00:00
|
|
|
<div class="ml-auto d-flex">
|
|
|
|
<new-entry-button
|
|
|
|
:label="__('New file')"
|
|
|
|
:show-label="false"
|
|
|
|
class="d-flex border-0 p-0 mr-3"
|
|
|
|
icon="doc-new"
|
|
|
|
@click="openNewEntryModal({ type: 'blob' })"
|
|
|
|
/>
|
|
|
|
<upload
|
|
|
|
:show-label="false"
|
|
|
|
class="d-flex mr-3"
|
|
|
|
button-css-classes="border-0 p-0"
|
|
|
|
@create="createTempEntry"
|
|
|
|
/>
|
|
|
|
<new-entry-button
|
|
|
|
:label="__('New directory')"
|
|
|
|
:show-label="false"
|
|
|
|
class="d-flex border-0 p-0"
|
|
|
|
icon="folder-new"
|
|
|
|
@click="openNewEntryModal({ type: 'tree' })"
|
|
|
|
/>
|
|
|
|
</div>
|
2018-03-20 14:12:48 +00:00
|
|
|
</template>
|
2018-04-20 09:34:57 +00:00
|
|
|
</ide-tree-list>
|
2018-03-20 14:12:48 +00:00
|
|
|
</template>
|