-
-
Notifications
You must be signed in to change notification settings - Fork 1k
/
App.vue
114 lines (102 loc) · 2.86 KB
/
App.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<template>
<div class="style-wrapper">
<div class="beekeeper-studio-wrapper">
<titlebar v-if="$config.isMac || menuStyle === 'client' || (runningWayland)" />
<template v-if="storeInitialized">
<connection-interface v-if="!connection" />
<core-interface
@databaseSelected="databaseSelected"
v-else
:connection="connection"
/>
<auto-updater />
<state-manager />
<notification-manager />
<upgrade-required-modal />
</template>
</div>
<portal-target
name="menus"
multiple
/>
<portal-target
name="modals"
multiple
/>
<data-manager />
<confirmation-modal />
</div>
</template>
<script lang="ts">
import Vue from 'vue'
import { ipcRenderer } from 'electron'
import { mapGetters, mapState } from 'vuex'
import Titlebar from './components/Titlebar.vue'
import CoreInterface from './components/CoreInterface.vue'
import ConnectionInterface from './components/ConnectionInterface.vue'
import AutoUpdater from './components/AutoUpdater.vue'
import StateManager from './components/quicksearch/StateManager.vue'
import DataManager from './components/data/DataManager.vue'
import querystring from 'query-string'
import NotificationManager from './components/NotificationManager.vue'
import UpgradeRequiredModal from './components/common/UpgradeRequiredModal.vue'
import ConfirmationModal from '@/components/common/modals/ConfirmationModal.vue'
export default Vue.extend({
name: 'App',
components: {
CoreInterface, ConnectionInterface, Titlebar, AutoUpdater, NotificationManager,
StateManager, DataManager, UpgradeRequiredModal, ConfirmationModal
},
data() {
return {
url: null,
runningWayland: false
}
},
computed: {
connection() {
return this.$store.state.connection
},
...mapState(['storeInitialized']),
...mapGetters({
'themeValue': 'settings/themeValue',
'menuStyle': 'settings/menuStyle'
})
},
watch: {
themeValue() {
document.body.className = `theme-${this.themeValue}`
}
},
async mounted() {
await this.$store.dispatch('fetchUsername')
const query = querystring.parse(global.location.search, { parseBooleans: true })
if (query) {
this.url = query.url || null
this.runningWayland = !!query.runningWayland
}
this.$nextTick(() => {
ipcRenderer.send('ready')
})
if (this.themeValue) {
document.body.className = `theme-${this.themeValue}`
}
if (this.url) {
try {
await this.$store.dispatch('openUrl', this.url)
} catch (error) {
console.error(error)
this.$noty.error(`Error opening ${this.url}: ${error}`)
throw error
}
}
},
methods: {
databaseSelected(_db) {
// TODO: do something here if needed
},
}
})
</script>
<style>
</style>