mirror of
https://github.com/frappe/books.git
synced 2024-11-08 14:50:56 +00:00
fix: init with schemas even if no db
- ux: show reload dialog on settings save
This commit is contained in:
parent
ee29f8d564
commit
afe04cccaf
@ -18,7 +18,11 @@ export class DatabaseManager extends DatabaseDemuxBase {
|
||||
}
|
||||
|
||||
getSchemaMap() {
|
||||
return this.db?.schemaMap ?? {};
|
||||
if (this.#isInitialized) {
|
||||
return this.db?.schemaMap ?? getSchemas();
|
||||
}
|
||||
|
||||
return getSchemas();
|
||||
}
|
||||
|
||||
async createNewDatabase(dbPath: string, countryCode: string) {
|
||||
|
@ -167,7 +167,7 @@ export class Fyo {
|
||||
}
|
||||
|
||||
getField(schemaName: string, fieldname: string) {
|
||||
return this.fieldMap[schemaName][fieldname];
|
||||
return this.fieldMap[schemaName]?.[fieldname];
|
||||
}
|
||||
|
||||
async getValue(
|
||||
|
@ -78,14 +78,14 @@ import FormHeader from 'src/components/FormHeader.vue';
|
||||
import { handleErrorWithDialog } from 'src/errorHandling';
|
||||
import { getErrorMessage } from 'src/utils';
|
||||
import { evaluateHidden } from 'src/utils/doc';
|
||||
import { showToast } from 'src/utils/interactive';
|
||||
import { shortcutsKey } from 'src/utils/injectionKeys';
|
||||
import { showDialog } from 'src/utils/interactive';
|
||||
import { reloadWindow } from 'src/utils/ipcCalls';
|
||||
import { docsPathMap } from 'src/utils/misc';
|
||||
import { docsPathRef } from 'src/utils/refs';
|
||||
import { UIGroupedFields } from 'src/utils/types';
|
||||
import { computed, defineComponent, inject } from 'vue';
|
||||
import CommonFormSection from '../CommonForm/CommonFormSection.vue';
|
||||
import { shortcutsKey } from 'src/utils/injectionKeys';
|
||||
|
||||
const COMPONENT_NAME = 'Settings';
|
||||
|
||||
@ -165,11 +165,22 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
this.update();
|
||||
await showToast({
|
||||
message: this.t`Changes will be visible on reload`,
|
||||
actionText: this.t`Reload App`,
|
||||
showDialog({
|
||||
title: this.t`Reload Frappe Books?`,
|
||||
detail: this.t`Changes made to settings will be visible on reload.`,
|
||||
type: 'info',
|
||||
buttons: [
|
||||
{
|
||||
label: this.t`Yes`,
|
||||
isPrimary: true,
|
||||
action: reloadWindow,
|
||||
},
|
||||
{
|
||||
label: this.t`No`,
|
||||
action() {},
|
||||
isEscape: true,
|
||||
},
|
||||
],
|
||||
});
|
||||
},
|
||||
async syncDoc(doc: Doc): Promise<void> {
|
||||
|
@ -109,6 +109,9 @@ export default defineComponent({
|
||||
},
|
||||
async mounted() {
|
||||
this.docOrNull = getSetupWizardDoc();
|
||||
if (!this.fyo.db.isConnected) {
|
||||
await this.fyo.db.init();
|
||||
}
|
||||
|
||||
if (this.fyo.store.isDevelopment) {
|
||||
// @ts-ignore
|
||||
|
Loading…
Reference in New Issue
Block a user