mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-03-26 17:51:54 +01:00
Force users to provide access token before creating connector for Github/Confluence
This commit is contained in:
parent
1d9a9a60c8
commit
3863ee3ce1
@ -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,103 +139,127 @@ 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>
|
||||
<p className="text-sm mb-4">
|
||||
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 && (
|
||||
{confluenceCredential ? (
|
||||
<>
|
||||
<p className="text-sm mb-2">
|
||||
We pull the latest pages and comments from each space listed below
|
||||
every <b>10</b> minutes.
|
||||
<p className="text-sm mb-4">
|
||||
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>
|
||||
<div className="mb-2">
|
||||
<ConnectorsTable<ConfluenceConfig, ConfluenceCredentialJson>
|
||||
connectorIndexingStatuses={confluenceConnectorIndexingStatuses}
|
||||
liveCredential={confluenceCredential}
|
||||
getCredential={(credential) => {
|
||||
return (
|
||||
<div>
|
||||
<p>{credential.credential_json.confluence_access_token}</p>
|
||||
</div>
|
||||
);
|
||||
|
||||
{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.
|
||||
</p>
|
||||
<div className="mb-2">
|
||||
<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) => {
|
||||
if (confluenceCredential) {
|
||||
await linkCredential(connectorId, confluenceCredential.id);
|
||||
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");
|
||||
}
|
||||
}}
|
||||
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>
|
||||
</>
|
||||
) : (
|
||||
<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">
|
||||
<h2 className="font-bold mb-3">Connect to a New Repository</h2>
|
||||
<ConnectorForm<GithubConfig>
|
||||
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");
|
||||
{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>
|
||||
nameBuilder={(values) =>
|
||||
`GithubConnector-${values.repo_owner}/${values.repo_name}`
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
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");
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</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>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user