2018-10-15 14:42:47 +05:30
|
|
|
<script>
|
|
|
|
import { mapState, mapGetters, mapActions } from 'vuex';
|
2018-11-18 11:00:15 +05:30
|
|
|
import Icon from '~/vue_shared/components/icon.vue';
|
2018-10-15 14:42:47 +05:30
|
|
|
import IdeTreeList from './ide_tree_list.vue';
|
2018-11-18 11:00:15 +05:30
|
|
|
import Upload from './new_dropdown/upload.vue';
|
|
|
|
import NewEntryButton from './new_dropdown/button.vue';
|
2018-10-15 14:42:47 +05:30
|
|
|
|
|
|
|
export default {
|
|
|
|
components: {
|
2018-11-18 11:00:15 +05:30
|
|
|
Icon,
|
|
|
|
Upload,
|
2018-10-15 14:42:47 +05:30
|
|
|
IdeTreeList,
|
2018-11-18 11:00:15 +05:30
|
|
|
NewEntryButton,
|
2018-10-15 14:42:47 +05:30
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
...mapState(['currentBranchId']),
|
|
|
|
...mapGetters(['currentProject', 'currentTree', 'activeFile']),
|
|
|
|
},
|
|
|
|
mounted() {
|
2018-11-18 11:00:15 +05:30
|
|
|
if (!this.activeFile) return;
|
|
|
|
|
|
|
|
if (this.activeFile.pending && !this.activeFile.deleted) {
|
2018-10-15 14:42:47 +05:30
|
|
|
this.$router.push(`/project${this.activeFile.url}`, () => {
|
|
|
|
this.updateViewer('editor');
|
|
|
|
});
|
2018-11-18 11:00:15 +05:30
|
|
|
} else if (this.activeFile.deleted) {
|
|
|
|
this.resetOpenFiles();
|
2018-10-15 14:42:47 +05:30
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
2018-11-18 11:00:15 +05:30
|
|
|
...mapActions(['updateViewer', 'openNewEntryModal', 'createTempEntry', 'resetOpenFiles']),
|
2018-10-15 14:42:47 +05:30
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2019-02-15 15:39:39 +05:30
|
|
|
<ide-tree-list viewer-type="editor">
|
|
|
|
<template slot="header">
|
2018-10-15 14:42:47 +05:30
|
|
|
{{ __('Edit') }}
|
2018-11-18 11:00:15 +05:30
|
|
|
<div class="ide-tree-actions ml-auto d-flex">
|
|
|
|
<new-entry-button
|
|
|
|
:label="__('New file')"
|
|
|
|
:show-label="false"
|
2018-12-13 13:39:08 +05:30
|
|
|
class="d-flex border-0 p-0 mr-3 qa-new-file"
|
2018-11-18 11:00:15 +05:30
|
|
|
icon="doc-new"
|
2019-02-15 15:39:39 +05:30
|
|
|
@click="openNewEntryModal({ type: 'blob' });"
|
2018-11-18 11:00:15 +05:30
|
|
|
/>
|
|
|
|
<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"
|
2019-02-15 15:39:39 +05:30
|
|
|
@click="openNewEntryModal({ type: 'tree' });"
|
2018-11-18 11:00:15 +05:30
|
|
|
/>
|
|
|
|
</div>
|
2018-10-15 14:42:47 +05:30
|
|
|
</template>
|
|
|
|
</ide-tree-list>
|
|
|
|
</template>
|