Fix Linux Desktop Application (#491)

* Use separate functions for adding files and folders to configuration for indexing
* Add a loading bar while data is syncing
* Bump the minor version for the application
This commit is contained in:
sabaimran
2023-10-03 11:43:19 -07:00
committed by GitHub
parent 63b3696af0
commit 3f962a55c3
6 changed files with 70 additions and 16 deletions

View File

@@ -193,8 +193,13 @@ function pushDataToKhoj (regenerate = false) {
pushDataToKhoj();
async function handleFileOpen (event, key) {
const { canceled, filePaths } = await dialog.showOpenDialog({properties: ['openFile', 'openDirectory'], filters: [{ name: "Valid Khoj Files", extensions: validFileTypes}] });
async function handleFileOpen (type) {
let { canceled, filePaths } = {canceled: true, filePaths: []};
if (type === 'file') {
({ canceled, filePaths } = await dialog.showOpenDialog({properties: ['openFile' ], filters: [{ name: "Valid Khoj Files", extensions: validFileTypes}] }));
} else if (type === 'folder') {
({ canceled, filePaths } = await dialog.showOpenDialog({properties: ['openDirectory' ]}));
}
if (!canceled) {
const files = store.get('files') || [];
const folders = store.get('folders') || [];
@@ -310,7 +315,9 @@ const createWindow = () => {
app.whenReady().then(() => {
ipcMain.on('set-title', handleSetTitle);
ipcMain.handle('getStoreValue', handleFileOpen);
ipcMain.handle('handleFileOpen', (event, type) => {
return handleFileOpen(type);
});
ipcMain.on('update-state', (event, arg) => {
console.log(arg);