Add minimum code needed to open new file modal
This commit is contained in:
parent
d280a91115
commit
2c73991f2b
3 changed files with 57 additions and 3 deletions
|
@ -27,7 +27,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="context-row">
|
||||
<div class="context-row" v-on:click="openNewFileModal">
|
||||
<div class="icon">
|
||||
<Icon name="file-plus" class="h-4"/>
|
||||
</div>
|
||||
|
@ -73,6 +73,11 @@
|
|||
this.$emit('close');
|
||||
},
|
||||
|
||||
openNewFileModal: function () {
|
||||
window.events.$emit('server:files:open-new-file-modal');
|
||||
this.$emit('close');
|
||||
},
|
||||
|
||||
triggerAction: function (action: string) {
|
||||
this.$emit(`action:${action}`);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
<template>
|
||||
<Modal :show="isVisible" v-on:close="isVisible = false" :dismissable="!isLoading">
|
||||
<MessageBox class="alert error mb-8" title="Error" :message="error" v-if="error"/>
|
||||
</Modal>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import Vue from 'vue';
|
||||
import MessageBox from "@/components/MessageBox.vue";
|
||||
import Modal from "@/components/core/Modal.vue";
|
||||
import {ApplicationState} from '@/store/types';
|
||||
import {mapState} from "vuex";
|
||||
|
||||
export default Vue.extend({
|
||||
name: 'NewFileModal',
|
||||
|
||||
components: {MessageBox, Modal},
|
||||
|
||||
data: function (): { error: string | null, isVisible: boolean, isLoading: boolean } {
|
||||
return {
|
||||
error: null,
|
||||
isVisible: false,
|
||||
isLoading: false,
|
||||
};
|
||||
},
|
||||
|
||||
computed: mapState({
|
||||
fm: (state: ApplicationState) => state.server.fm,
|
||||
}),
|
||||
|
||||
mounted: function () {
|
||||
window.events.$on('server:files:open-new-file-modal', () => {
|
||||
this.isVisible = true;
|
||||
});
|
||||
},
|
||||
|
||||
methods: {
|
||||
submit: function () {
|
||||
|
||||
},
|
||||
}
|
||||
})
|
||||
</script>
|
Reference in a new issue