diff --git a/src/khoj/interface/web/config.html b/src/khoj/interface/web/config.html index 1410f20b..5a2089ca 100644 --- a/src/khoj/interface/web/config.html +++ b/src/khoj/interface/web/config.html @@ -8,11 +8,13 @@
Computer -

+

Files - {% if current_model_state.computer == True %} - Configured - {% endif %} + Configured

@@ -28,22 +30,23 @@
- {% if current_model_state.computer %} -
- -
- {% endif %} +
+ +
Github

Github - {% if current_model_state.github == True %} - Configured - {% endif %} + Configured

@@ -59,22 +62,24 @@
- {% if current_model_state.github %} -
- -
- {% endif %} +
+ +
Notion

Notion - {% if current_model_state.notion == True %} - Configured - {% endif %} + Configured

@@ -90,13 +95,13 @@
- {% if current_model_state.notion %} -
- -
- {% endif %} +
+ +
@@ -208,18 +213,11 @@ .then(response => response.json()) .then(data => { if (data.status == "ok") { - var contentTypeClearButton = document.getElementById("clear-" + content_source); - contentTypeClearButton.style.display = "none"; - - var configuredIcon = document.getElementById("configured-icon-" + content_source); - if (configuredIcon) { - configuredIcon.style.display = "none"; - } - - var misconfiguredIcon = document.getElementById("misconfigured-icon-" + content_source); - if (misconfiguredIcon) { - misconfiguredIcon.style.display = "none"; - } + document.getElementById("configured-icon-" + content_source).style.display = "none"; + document.getElementById("clear-" + content_source).style.display = "none"; + } else { + document.getElementById("configured-icon-" + content_source).style.display = ""; + document.getElementById("clear-" + content_source).style.display = ""; } }) }; @@ -265,6 +263,7 @@ if (data.detail != null) { throw new Error(data.detail); } + document.getElementById("status").innerHTML = emoji + " " + successText; document.getElementById("status").style.display = "block"; button.disabled = false; @@ -277,6 +276,26 @@ button.disabled = false; button.innerHTML = '⚠️ Unsuccessful'; }); + + content_sources = ["computer", "github", "notion"]; + content_sources.forEach(content_source => { + fetch(`/api/config/data/${content_source}`, { + method: 'GET', + headers: { + 'Content-Type': 'application/json', + } + }) + .then(response => response.json()) + .then(data => { + if (data.length > 0) { + document.getElementById("configured-icon-" + content_source).style.display = ""; + document.getElementById("clear-" + content_source).style.display = ""; + } else { + document.getElementById("configured-icon-" + content_source).style.display = "none"; + document.getElementById("clear-" + content_source).style.display = "none"; + } + }); + }); } // Setup the results count slider