mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-07-21 18:43:30 +02:00
Force users to provide access token before creating connector for Github/Confluence
This commit is contained in:
@ -65,7 +65,7 @@ const Main = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<h2 className="font-bold mb-2 mt-6 ml-auto mr-auto">
|
<h2 className="font-bold mb-2 mt-6 ml-auto mr-auto">
|
||||||
Step 1: Provide your Credentials
|
Step 1: Provide your access token
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
{confluenceCredential ? (
|
{confluenceCredential ? (
|
||||||
@ -139,103 +139,127 @@ const Main = () => {
|
|||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* TODO: make this periodic */}
|
|
||||||
<h2 className="font-bold mb-2 mt-6 ml-auto mr-auto">
|
<h2 className="font-bold mb-2 mt-6 ml-auto mr-auto">
|
||||||
Step 2: Which spaces do you want to make searchable?
|
Step 2: Which spaces do you want to make searchable?
|
||||||
</h2>
|
</h2>
|
||||||
<p className="text-sm mb-4">
|
{confluenceCredential ? (
|
||||||
To use the Confluence connector, you must first follow the guide
|
|
||||||
described{" "}
|
|
||||||
<a
|
|
||||||
className="text-blue-500"
|
|
||||||
href="https://docs.danswer.dev/connectors/slack#setting-up"
|
|
||||||
>
|
|
||||||
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
|
|
||||||
"Index" 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">
|
<p className="text-sm mb-4">
|
||||||
We pull the latest pages and comments from each space listed below
|
To use the Confluence connector, you must first follow the guide
|
||||||
every <b>10</b> minutes.
|
described{" "}
|
||||||
|
<a
|
||||||
|
className="text-blue-500"
|
||||||
|
href="https://docs.danswer.dev/connectors/slack#setting-up"
|
||||||
|
>
|
||||||
|
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
|
||||||
|
"Index" 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>
|
</p>
|
||||||
<div className="mb-2">
|
|
||||||
<ConnectorsTable<ConfluenceConfig, ConfluenceCredentialJson>
|
{confluenceConnectorIndexingStatuses.length > 0 && (
|
||||||
connectorIndexingStatuses={confluenceConnectorIndexingStatuses}
|
<>
|
||||||
liveCredential={confluenceCredential}
|
<p className="text-sm mb-2">
|
||||||
getCredential={(credential) => {
|
We pull the latest pages and comments from each space listed
|
||||||
return (
|
below every <b>10</b> minutes.
|
||||||
<div>
|
</p>
|
||||||
<p>{credential.credential_json.confluence_access_token}</p>
|
<div className="mb-2">
|
||||||
</div>
|
<ConnectorsTable<ConfluenceConfig, ConfluenceCredentialJson>
|
||||||
);
|
connectorIndexingStatuses={
|
||||||
|
confluenceConnectorIndexingStatuses
|
||||||
|
}
|
||||||
|
liveCredential={confluenceCredential}
|
||||||
|
getCredential={(credential) => {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<p>
|
||||||
|
{credential.credential_json.confluence_access_token}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
onCredentialLink={async (connectorId) => {
|
||||||
|
if (confluenceCredential) {
|
||||||
|
await linkCredential(
|
||||||
|
connectorId,
|
||||||
|
confluenceCredential.id
|
||||||
|
);
|
||||||
|
mutate("/api/manage/admin/connector/indexing-status");
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
specialColumns={[
|
||||||
|
{
|
||||||
|
header: "Url",
|
||||||
|
key: "url",
|
||||||
|
getValue: (connector) => (
|
||||||
|
<a
|
||||||
|
className="text-blue-500"
|
||||||
|
href={
|
||||||
|
connector.connector_specific_config.wiki_page_url
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{connector.connector_specific_config.wiki_page_url}
|
||||||
|
</a>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
onUpdate={() =>
|
||||||
|
mutate("/api/manage/admin/connector/indexing-status")
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<div className="border-solid border-gray-600 border rounded-md p-6 mt-4">
|
||||||
|
<h2 className="font-bold mb-3">Add a New Space</h2>
|
||||||
|
<ConnectorForm<ConfluenceConfig>
|
||||||
|
nameBuilder={(values) =>
|
||||||
|
`ConfluenceConnector-${values.wiki_page_url}`
|
||||||
|
}
|
||||||
|
source="confluence"
|
||||||
|
inputType="load_state"
|
||||||
|
formBody={
|
||||||
|
<>
|
||||||
|
<TextFormField name="wiki_page_url" label="Confluence URL:" />
|
||||||
|
</>
|
||||||
|
}
|
||||||
|
validationSchema={Yup.object().shape({
|
||||||
|
wiki_page_url: Yup.string().required(
|
||||||
|
"Please enter any link to your confluence e.g. https://danswer.atlassian.net/wiki/spaces/Engineering/overview"
|
||||||
|
),
|
||||||
|
})}
|
||||||
|
initialValues={{
|
||||||
|
wiki_page_url: "",
|
||||||
}}
|
}}
|
||||||
onCredentialLink={async (connectorId) => {
|
refreshFreq={10 * 60} // 10 minutes
|
||||||
if (confluenceCredential) {
|
onSubmit={async (isSuccess, responseJson) => {
|
||||||
await linkCredential(connectorId, confluenceCredential.id);
|
if (isSuccess && responseJson) {
|
||||||
|
await linkCredential(
|
||||||
|
responseJson.id,
|
||||||
|
confluenceCredential.id
|
||||||
|
);
|
||||||
mutate("/api/manage/admin/connector/indexing-status");
|
mutate("/api/manage/admin/connector/indexing-status");
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
specialColumns={[
|
|
||||||
{
|
|
||||||
header: "Url",
|
|
||||||
key: "url",
|
|
||||||
getValue: (connector) => (
|
|
||||||
<a
|
|
||||||
className="text-blue-500"
|
|
||||||
href={connector.connector_specific_config.wiki_page_url}
|
|
||||||
>
|
|
||||||
{connector.connector_specific_config.wiki_page_url}
|
|
||||||
</a>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
onUpdate={() =>
|
|
||||||
mutate("/api/manage/admin/connector/indexing-status")
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</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>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<div className="border-solid border-gray-600 border rounded-md p-6 mt-4">
|
|
||||||
<h2 className="font-bold mb-3">Add a New Space</h2>
|
|
||||||
<ConnectorForm<ConfluenceConfig>
|
|
||||||
nameBuilder={(values) =>
|
|
||||||
`ConfluenceConnector-${values.wiki_page_url}`
|
|
||||||
}
|
|
||||||
source="confluence"
|
|
||||||
inputType="load_state"
|
|
||||||
formBody={
|
|
||||||
<>
|
|
||||||
<TextFormField name="wiki_page_url" label="Confluence URL:" />
|
|
||||||
</>
|
|
||||||
}
|
|
||||||
validationSchema={Yup.object().shape({
|
|
||||||
wiki_page_url: Yup.string().required(
|
|
||||||
"Please enter any link to your confluence e.g. https://danswer.atlassian.net/wiki/spaces/Engineering/overview"
|
|
||||||
),
|
|
||||||
})}
|
|
||||||
initialValues={{
|
|
||||||
wiki_page_url: "",
|
|
||||||
}}
|
|
||||||
refreshFreq={10 * 60} // 10 minutes
|
|
||||||
onSubmit={async (isSuccess, responseJson) => {
|
|
||||||
if (isSuccess && responseJson) {
|
|
||||||
await linkCredential(responseJson.id, confluenceCredential.id);
|
|
||||||
mutate("/api/manage/admin/connector/indexing-status");
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -168,41 +168,49 @@ const Main = () => {
|
|||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<div className="border-solid border-gray-600 border rounded-md p-6 mt-4">
|
{githubCredential ? (
|
||||||
<h2 className="font-bold mb-3">Connect to a New Repository</h2>
|
<div className="border-solid border-gray-600 border rounded-md p-6 mt-4">
|
||||||
<ConnectorForm<GithubConfig>
|
<h2 className="font-bold mb-3">Connect to a New Repository</h2>
|
||||||
nameBuilder={(values) =>
|
<ConnectorForm<GithubConfig>
|
||||||
`GithubConnector-${values.repo_owner}/${values.repo_name}`
|
nameBuilder={(values) =>
|
||||||
}
|
`GithubConnector-${values.repo_owner}/${values.repo_name}`
|
||||||
source="github"
|
|
||||||
inputType="load_state"
|
|
||||||
formBody={
|
|
||||||
<>
|
|
||||||
<TextFormField name="repo_owner" label="Repository Owner:" />
|
|
||||||
<TextFormField name="repo_name" label="Repository Name:" />
|
|
||||||
</>
|
|
||||||
}
|
|
||||||
validationSchema={Yup.object().shape({
|
|
||||||
repo_owner: Yup.string().required(
|
|
||||||
"Please enter the owner of the repository to index e.g. danswer-ai"
|
|
||||||
),
|
|
||||||
repo_name: Yup.string().required(
|
|
||||||
"Please enter the name of the repository to index e.g. danswer "
|
|
||||||
),
|
|
||||||
})}
|
|
||||||
initialValues={{
|
|
||||||
repo_owner: "",
|
|
||||||
repo_name: "",
|
|
||||||
}}
|
|
||||||
refreshFreq={10 * 60} // 10 minutes
|
|
||||||
onSubmit={async (isSuccess, responseJson) => {
|
|
||||||
if (isSuccess && responseJson) {
|
|
||||||
await linkCredential(responseJson.id, githubCredential.id);
|
|
||||||
mutate("/api/manage/admin/connector/indexing-status");
|
|
||||||
}
|
}
|
||||||
}}
|
source="github"
|
||||||
/>
|
inputType="load_state"
|
||||||
</div>
|
formBody={
|
||||||
|
<>
|
||||||
|
<TextFormField name="repo_owner" label="Repository Owner:" />
|
||||||
|
<TextFormField name="repo_name" label="Repository Name:" />
|
||||||
|
</>
|
||||||
|
}
|
||||||
|
validationSchema={Yup.object().shape({
|
||||||
|
repo_owner: Yup.string().required(
|
||||||
|
"Please enter the owner of the repository to index e.g. danswer-ai"
|
||||||
|
),
|
||||||
|
repo_name: Yup.string().required(
|
||||||
|
"Please enter the name of the repository to index e.g. danswer "
|
||||||
|
),
|
||||||
|
})}
|
||||||
|
initialValues={{
|
||||||
|
repo_owner: "",
|
||||||
|
repo_name: "",
|
||||||
|
}}
|
||||||
|
refreshFreq={10 * 60} // 10 minutes
|
||||||
|
onSubmit={async (isSuccess, responseJson) => {
|
||||||
|
if (isSuccess && responseJson) {
|
||||||
|
await linkCredential(responseJson.id, githubCredential.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 Github repositories you want to make
|
||||||
|
searchable.
|
||||||
|
</p>
|
||||||
|
)}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user