mirror of
https://github.com/khoj-ai/khoj.git
synced 2025-02-17 08:04:21 +00:00
Make out of space errors in the desktop client more obvious
This commit is contained in:
parent
956dd71d91
commit
c8194a7364
3 changed files with 4 additions and 7 deletions
|
@ -101,9 +101,6 @@
|
|||
<div class="card-description-row">
|
||||
<div id="sync-status"></div>
|
||||
</div>
|
||||
<div id="needs-subscription" style="display: none;">
|
||||
Looks like you're out of space to sync your files. <a href="https://app.khoj.dev/config">Upgrade your plan</a> to unlock more space.
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
|
|
|
@ -215,8 +215,10 @@ function pushDataToKhoj (regenerate = false) {
|
|||
.catch(error => {
|
||||
console.error(error);
|
||||
state["completed"] = false;
|
||||
if (error?.response?.status === 429 && (win = BrowserWindow.getAllWindows()[0])) {
|
||||
if (error?.response?.status === 429 && (BrowserWindow.getAllWindows().find(win => win.webContents.getURL().includes('config')))) {
|
||||
state["error"] = `Looks like you're out of space to sync your files. <a href="https://app.khoj.dev/config">Upgrade your plan</a> to unlock more space.`;
|
||||
const win = BrowserWindow.getAllWindows().find(win => win.webContents.getURL().includes('config'));
|
||||
if (win) win.webContents.send('needsSubscription', true);
|
||||
} else if (error?.code === 'ECONNREFUSED') {
|
||||
state["error"] = `Could not connect to Khoj server. Ensure you can connect to it at ${error.address}:${error.port}.`;
|
||||
} else {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
const setFolderButton = document.getElementById('update-folder');
|
||||
const setFileButton = document.getElementById('update-file');
|
||||
const loadingBar = document.getElementById('loading-bar');
|
||||
const needsSubscriptionElement = document.getElementById('needs-subscription');
|
||||
|
||||
async function removeFile(filePath) {
|
||||
const updatedFiles = await window.removeFileAPI.removeFile(filePath);
|
||||
|
@ -168,9 +167,8 @@ window.updateStateAPI.onUpdateState((event, state) => {
|
|||
window.needsSubscriptionAPI.onNeedsSubscription((event, needsSubscription) => {
|
||||
console.log("needs subscription", needsSubscription);
|
||||
if (needsSubscription) {
|
||||
window.alert("Looks like you're out of space to sync your files. Upgrade your plan to unlock more space here: https://app.khoj.dev/config");
|
||||
needsSubscriptionElement.style.display = 'block';
|
||||
} else {
|
||||
needsSubscriptionElement.style.display = 'none';
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue