-
Notifications
You must be signed in to change notification settings - Fork 77
/
Sidebar.vue
67 lines (63 loc) · 2.09 KB
/
Sidebar.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<template lang="pug">
el-row(class="sidebar")
SidebarDatabases(
v-if="!currentDb"
:databaseList="database.list"
:removeHandler="removeDbFromStorage"
:elementHandler="getCurrentDb"
)
SidebarTables(
v-if="currentDb"
:currentDb="currentDb"
:getCurrentDb="getCurrentDb"
:getDbTables="getDbTables"
:databaseList="database.list"
:tableList="filteredTables"
:switchTable="getCurrentTable"
:currentTable="currentTable"
:filterTextChange="filterTextChange"
:filterText="filterText"
:initialState="initialState"
:toggleCreateModal="toggleCreateModal"
:toggleDeleteModal="toggleDeleteModal"
)
</template>
<script lang="ts">
import { Vue, Component } from 'vue-property-decorator';
import { Getter, Action, Mutation, State } from 'vuex-class';
import { RootState } from '../store/types';
import SidebarDatabases from '../components/SidebarDatabases.vue';
import SidebarTables from '../components/SidebarTables.vue';
const namespace: string = 'database';
@Component({
components: {
SidebarDatabases,
SidebarTables,
},
})
export default class Sidebar extends Vue {
@Getter private currentDb!: string;
@Getter private currentTable!: string;
@Getter private filteredTables!: string[];
@Getter private filterText!: string;
@Action private getCurrentDb: any;
@Action private getDbTables: any;
@Action private getCurrentTable: any;
@Mutation private filterTextChange: any;
@Mutation private initialState: any;
@State(namespace) private database!: RootState;
@Action('removeDbFromStorage', { namespace }) private removeDbFromStorage: any;
@Action('getDbList', { namespace }) private getDbList: any;
@Mutation('toggleCreateModal', { namespace: 'table' }) private toggleCreateModal: any;
@Mutation('toggleDeleteModal', { namespace: 'table' }) private toggleDeleteModal: any;
private created() {
this.getDbList();
}
}
</script>
<style lang="stylus" scoped>
.sidebar
height 100%
width 100%
min-width 150px
</style>