2018-06-01 12:35:51 +00:00
|
|
|
<template>
|
2019-10-04 17:55:28 +00:00
|
|
|
<div id="app" class="h-screen flex flex-col bg-white font-sans">
|
2019-10-03 13:46:12 +00:00
|
|
|
<Desk class="flex-1" v-if="showDesk" />
|
2018-10-23 12:42:36 +00:00
|
|
|
<database-selector v-if="showDatabaseSelector" @file="connectToDBFile" />
|
|
|
|
<setup-wizard v-if="showSetupWizard" />
|
2018-06-01 12:35:51 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2019-10-03 13:46:12 +00:00
|
|
|
import './styles/index.css';
|
2018-10-22 18:02:47 +00:00
|
|
|
import frappe from 'frappejs';
|
2018-10-23 12:42:36 +00:00
|
|
|
import Desk from './pages/Desk';
|
2018-10-05 05:35:20 +00:00
|
|
|
import SetupWizard from './pages/SetupWizard/SetupWizard';
|
2018-10-23 12:42:36 +00:00
|
|
|
import DatabaseSelector from './pages/DatabaseSelector';
|
2018-06-01 12:35:51 +00:00
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'App',
|
2018-06-11 09:46:25 +00:00
|
|
|
data() {
|
|
|
|
return {
|
2018-10-23 12:42:36 +00:00
|
|
|
showDatabaseSelector: false,
|
|
|
|
showDesk: false,
|
|
|
|
showSetupWizard: false
|
2019-08-20 08:57:27 +00:00
|
|
|
};
|
2018-06-11 09:46:25 +00:00
|
|
|
},
|
2018-06-01 12:35:51 +00:00
|
|
|
components: {
|
2018-10-23 12:42:36 +00:00
|
|
|
Desk,
|
2018-10-22 18:10:22 +00:00
|
|
|
SetupWizard,
|
2019-08-20 08:57:27 +00:00
|
|
|
DatabaseSelector
|
2018-06-11 09:46:25 +00:00
|
|
|
},
|
2018-10-23 12:42:36 +00:00
|
|
|
mounted() {
|
|
|
|
if (!localStorage.dbPath) {
|
|
|
|
this.showDatabaseSelector = true;
|
|
|
|
} else {
|
|
|
|
frappe.events.trigger('connect-database', localStorage.dbPath);
|
|
|
|
}
|
|
|
|
|
2018-10-22 18:02:47 +00:00
|
|
|
frappe.events.on('show-setup-wizard', () => {
|
2018-10-23 12:42:36 +00:00
|
|
|
this.showSetupWizard = true;
|
2018-10-05 05:35:20 +00:00
|
|
|
this.showDesk = false;
|
2018-10-23 12:42:36 +00:00
|
|
|
this.showDatabaseSelector = false;
|
|
|
|
});
|
2018-10-05 05:35:20 +00:00
|
|
|
|
2018-10-22 18:02:47 +00:00
|
|
|
frappe.events.on('show-desk', () => {
|
2018-10-05 05:35:20 +00:00
|
|
|
this.showDesk = true;
|
2018-10-23 12:42:36 +00:00
|
|
|
this.showSetupWizard = false;
|
|
|
|
this.showDatabaseSelector = false;
|
2019-08-20 08:57:27 +00:00
|
|
|
});
|
2018-10-23 12:42:36 +00:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
connectToDBFile(filePath) {
|
|
|
|
frappe.events.trigger('DatabaseSelector:file-selected', filePath);
|
|
|
|
}
|
2018-06-01 12:35:51 +00:00
|
|
|
}
|
2019-08-20 08:57:27 +00:00
|
|
|
};
|
2018-06-01 12:35:51 +00:00
|
|
|
</script>
|