Force users to provide access token before creating connector for Github/Confluence

This commit is contained in:
Weves
2023-06-19 11:55:57 -06:00
committed by Chris Weaver
parent 1d9a9a60c8
commit 3863ee3ce1
2 changed files with 151 additions and 119 deletions

View File

@ -65,7 +65,7 @@ const Main = () => {
return (
<>
<h2 className="font-bold mb-2 mt-6 ml-auto mr-auto">
Step 1: Provide your Credentials
Step 1: Provide your access token
</h2>
{confluenceCredential ? (
@ -139,10 +139,11 @@ const Main = () => {
</>
)}
{/* TODO: make this periodic */}
<h2 className="font-bold mb-2 mt-6 ml-auto mr-auto">
Step 2: Which spaces do you want to make searchable?
</h2>
{confluenceCredential ? (
<>
<p className="text-sm mb-4">
To use the Confluence connector, you must first follow the guide
described{" "}
@ -152,35 +153,45 @@ const Main = () => {
>
here
</a>{" "}
to give the Danswer backend read access to your documents. Once that is
setup, specify any link to a Confluence page below and click
&quot;Index&quot; to Index. Based on the provided link, we will index
the ENTIRE SPACE, not just the specified page. For example, entering{" "}
<i>https://danswer.atlassian.net/wiki/spaces/Engineering/overview</i>{" "}
and clicking the Index button will index the whole <i>Engineering</i>{" "}
Confluence space.
to give the Danswer backend read access to your documents. Once that
is setup, specify any link to a Confluence page below and click
&quot;Index&quot; to Index. Based on the provided link, we will
index the ENTIRE SPACE, not just the specified page. For example,
entering{" "}
<i>
https://danswer.atlassian.net/wiki/spaces/Engineering/overview
</i>{" "}
and clicking the Index button will index the whole{" "}
<i>Engineering</i> Confluence space.
</p>
{confluenceConnectorIndexingStatuses.length > 0 && (
<>
<p className="text-sm mb-2">
We pull the latest pages and comments from each space listed below
every <b>10</b> minutes.
We pull the latest pages and comments from each space listed
below every <b>10</b> minutes.
</p>
<div className="mb-2">
<ConnectorsTable<ConfluenceConfig, ConfluenceCredentialJson>
connectorIndexingStatuses={confluenceConnectorIndexingStatuses}
connectorIndexingStatuses={
confluenceConnectorIndexingStatuses
}
liveCredential={confluenceCredential}
getCredential={(credential) => {
return (
<div>
<p>{credential.credential_json.confluence_access_token}</p>
<p>
{credential.credential_json.confluence_access_token}
</p>
</div>
);
}}
onCredentialLink={async (connectorId) => {
if (confluenceCredential) {
await linkCredential(connectorId, confluenceCredential.id);
await linkCredential(
connectorId,
confluenceCredential.id
);
mutate("/api/manage/admin/connector/indexing-status");
}
}}
@ -191,7 +202,9 @@ const Main = () => {
getValue: (connector) => (
<a
className="text-blue-500"
href={connector.connector_specific_config.wiki_page_url}
href={
connector.connector_specific_config.wiki_page_url
}
>
{connector.connector_specific_config.wiki_page_url}
</a>
@ -230,13 +243,24 @@ const Main = () => {
refreshFreq={10 * 60} // 10 minutes
onSubmit={async (isSuccess, responseJson) => {
if (isSuccess && responseJson) {
await linkCredential(responseJson.id, confluenceCredential.id);
await linkCredential(
responseJson.id,
confluenceCredential.id
);
mutate("/api/manage/admin/connector/indexing-status");
}
}}
/>
</div>
</>
) : (
<p className="text-sm">
Please provide your access token in Step 1 first! Once done with that,
you can then specify which Confluence spaces you want to make
searchable.
</p>
)}
</>
);
};

View File

@ -168,6 +168,7 @@ const Main = () => {
</>
)}
{githubCredential ? (
<div className="border-solid border-gray-600 border rounded-md p-6 mt-4">
<h2 className="font-bold mb-3">Connect to a New Repository</h2>
<ConnectorForm<GithubConfig>
@ -203,6 +204,13 @@ const Main = () => {
}}
/>
</div>
) : (
<p className="text-sm">
Please provide your access token in Step 1 first! Once done with that,
you can then specify which Github repositories you want to make
searchable.
</p>
)}
</>
);
};