mirror of
https://github.com/frappe/books.git
synced 2025-01-03 15:17:30 +00:00
fix: period selector issue, version issue
This commit is contained in:
parent
98bcbf20f9
commit
1c8a70819e
1
main.ts
1
main.ts
@ -144,7 +144,6 @@ export class Main {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.mainWindow.webContents.send(IPC_CHANNELS.STORE_ON_WINDOW, {
|
this.mainWindow.webContents.send(IPC_CHANNELS.STORE_ON_WINDOW, {
|
||||||
appVersion: app.getVersion(),
|
|
||||||
isDevelopment: this.isDevelopment,
|
isDevelopment: this.isDevelopment,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { dialog, ipcMain } from 'electron';
|
import { app, dialog, ipcMain } from 'electron';
|
||||||
import { autoUpdater } from 'electron-updater';
|
import { autoUpdater } from 'electron-updater';
|
||||||
import fs from 'fs/promises';
|
import fs from 'fs/promises';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
@ -112,4 +112,8 @@ export default function registerIpcMainActionListeners(main: Main) {
|
|||||||
ipcMain.handle(IPC_ACTIONS.GET_CREDS, async (event) => {
|
ipcMain.handle(IPC_ACTIONS.GET_CREDS, async (event) => {
|
||||||
return await getUrlAndTokenString();
|
return await getUrlAndTokenString();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ipcMain.handle(IPC_ACTIONS.GET_VERSION, (_) => {
|
||||||
|
return app.getVersion();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ import App from './App';
|
|||||||
import FeatherIcon from './components/FeatherIcon';
|
import FeatherIcon from './components/FeatherIcon';
|
||||||
import config, { ConfigKeys } from './config';
|
import config, { ConfigKeys } from './config';
|
||||||
import { getErrorHandled, handleError } from './errorHandling';
|
import { getErrorHandled, handleError } from './errorHandling';
|
||||||
|
import { IPC_ACTIONS } from './messages';
|
||||||
import { incrementOpenCount } from './renderer/helpers';
|
import { incrementOpenCount } from './renderer/helpers';
|
||||||
import registerIpcRendererListeners from './renderer/registerIpcRendererListeners';
|
import registerIpcRendererListeners from './renderer/registerIpcRendererListeners';
|
||||||
import router from './router';
|
import router from './router';
|
||||||
@ -88,6 +89,7 @@ import { setLanguageMap, stringifyCircular } from './utils';
|
|||||||
console.error(err, vm, info);
|
console.error(err, vm, info);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
frappe.store.appVersion = await ipcRenderer.invoke(IPC_ACTIONS.GET_VERSION);
|
||||||
incrementOpenCount();
|
incrementOpenCount();
|
||||||
app.mount('body');
|
app.mount('body');
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@ export const IPC_ACTIONS = {
|
|||||||
CHECK_FOR_UPDATES: 'check-for-updates',
|
CHECK_FOR_UPDATES: 'check-for-updates',
|
||||||
GET_FILE: 'get-file',
|
GET_FILE: 'get-file',
|
||||||
GET_CREDS: 'get-creds',
|
GET_CREDS: 'get-creds',
|
||||||
|
GET_VERSION: 'get-version',
|
||||||
};
|
};
|
||||||
|
|
||||||
// ipcMain.send(...)
|
// ipcMain.send(...)
|
||||||
|
@ -1,11 +1,3 @@
|
|||||||
<script setup>
|
|
||||||
const periodSelectorMap = {
|
|
||||||
'This Year': t`This Year`,
|
|
||||||
'This Quarter': t`This Quarter`,
|
|
||||||
'This Month': t`This Month`,
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Dropdown ref="dropdown" class="text-sm" :items="periodOptions" right>
|
<Dropdown ref="dropdown" class="text-sm" :items="periodOptions" right>
|
||||||
<template
|
<template
|
||||||
@ -36,7 +28,7 @@ const periodSelectorMap = {
|
|||||||
@keydown.up="highlightItemUp"
|
@keydown.up="highlightItemUp"
|
||||||
@keydown.enter="selectHighlightedItem"
|
@keydown.enter="selectHighlightedItem"
|
||||||
>
|
>
|
||||||
{{ periodSelectorMap[value] }}
|
{{ periodSelectorMap?.[value] ?? value }}
|
||||||
<feather-icon name="chevron-down" class="ml-1 w-3 h-3" />
|
<feather-icon name="chevron-down" class="ml-1 w-3 h-3" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -60,18 +52,29 @@ export default {
|
|||||||
components: {
|
components: {
|
||||||
Dropdown,
|
Dropdown,
|
||||||
},
|
},
|
||||||
|
mounted() {
|
||||||
|
this.periodSelectorMap = {
|
||||||
|
'This Year': t`This Year`,
|
||||||
|
'This Quarter': t`This Quarter`,
|
||||||
|
'This Month': t`This Month`,
|
||||||
|
};
|
||||||
|
|
||||||
|
this.periodOptions = this.options.map((option) => {
|
||||||
|
return {
|
||||||
|
label: this.periodSelectorMap[option] ?? option,
|
||||||
|
action: () => this.selectOption(option),
|
||||||
|
};
|
||||||
|
});
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
periodOptions: this.options.map((option) => {
|
periodSelectorMap: {},
|
||||||
return {
|
periodOptions: [],
|
||||||
label: this.periodSelectorMap[option],
|
|
||||||
action: () => this.selectOption(option),
|
|
||||||
};
|
|
||||||
}),
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
selectOption(value) {
|
selectOption(value) {
|
||||||
|
console.log(value);
|
||||||
this.$emit('change', value);
|
this.$emit('change', value);
|
||||||
this.$refs.dropdown.toggleDropdown(false);
|
this.$refs.dropdown.toggleDropdown(false);
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user