You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by kl...@apache.org on 2023/07/04 03:54:00 UTC
[incubator-devlake] branch release-v0.17 updated: fix(config-ui): missed initial version field in jira (#5619)
This is an automated email from the ASF dual-hosted git repository.
klesh pushed a commit to branch release-v0.17
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/release-v0.17 by this push:
new 521965553 fix(config-ui): missed initial version field in jira (#5619)
521965553 is described below
commit 521965553f0d14ac88b599c2438d15016df807ef
Author: 青湛 <0x...@gmail.com>
AuthorDate: Tue Jul 4 15:53:57 2023 +1200
fix(config-ui): missed initial version field in jira (#5619)
---
config-ui/src/plugins/register/jira/connection-fields/auth.tsx | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/config-ui/src/plugins/register/jira/connection-fields/auth.tsx b/config-ui/src/plugins/register/jira/connection-fields/auth.tsx
index 76ec2417b..ceba4eb7a 100644
--- a/config-ui/src/plugins/register/jira/connection-fields/auth.tsx
+++ b/config-ui/src/plugins/register/jira/connection-fields/auth.tsx
@@ -23,6 +23,8 @@ import { ExternalLink } from '@/components';
import * as S from './styled';
+const JIRA_CLOUD_REGEX = /^https:\/\/\w+.atlassian.net\/rest\/$/;
+
type Method = 'BasicAuth' | 'AccessToken';
interface Props {
@@ -33,9 +35,15 @@ interface Props {
setErrors: (value: any) => void;
}
-export const Auth = ({ initialValues, values, errors, setValues, setErrors }: Props) => {
+export const Auth = ({ initialValues, values, setValues, setErrors }: Props) => {
const [version, setVersion] = useState('cloud');
+ useEffect(() => {
+ if (initialValues.endpoint && !JIRA_CLOUD_REGEX.test(initialValues.endpoint)) {
+ setVersion('server');
+ }
+ }, [initialValues.endpoint]);
+
useEffect(() => {
setValues({
endpoint: initialValues.endpoint,