You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by wa...@apache.org on 2022/07/18 10:39:10 UTC

[incubator-devlake] 01/03: fix: don't send jira issue request when set other type plugin

This is an automated email from the ASF dual-hosted git repository.

warren pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git

commit 8645bafcbe1c07a5365d55f17ccbf79ef45491ce
Author: linyh <ya...@meri.co>
AuthorDate: Mon Jul 18 17:50:19 2022 +0800

    fix: don't send jira issue request when set other type plugin
---
 config-ui/src/hooks/useJIRA.jsx | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/config-ui/src/hooks/useJIRA.jsx b/config-ui/src/hooks/useJIRA.jsx
index 1fb2b9a1..9c4ba64a 100644
--- a/config-ui/src/hooks/useJIRA.jsx
+++ b/config-ui/src/hooks/useJIRA.jsx
@@ -18,6 +18,7 @@
 import { useEffect, useState, useCallback } from 'react'
 import request from '@/utils/request'
 import { ToastNotification } from '@/components/Toast'
+import { Providers } from "@/data/Providers";
 
 const useJIRA = ({ apiProxyPath, issuesEndpoint, fieldsEndpoint, boardsEndpoint }, activeConnection = null) => {
   const [isFetching, setIsFetching] = useState(false)
@@ -30,6 +31,9 @@ const useJIRA = ({ apiProxyPath, issuesEndpoint, fieldsEndpoint, boardsEndpoint
   const [error, setError] = useState()
 
   const fetchIssueTypes = useCallback(() => {
+    if (activeConnection.plugin !== Providers.JIRA) {
+      return
+    }
     try {
       if (apiProxyPath.includes('null')) {
         throw new Error('Connection ID is Null')
@@ -55,6 +59,9 @@ const useJIRA = ({ apiProxyPath, issuesEndpoint, fieldsEndpoint, boardsEndpoint
   }, [issuesEndpoint, activeConnection, apiProxyPath])
 
   const fetchFields = useCallback(() => {
+    if (activeConnection.plugin !== Providers.JIRA) {
+      return
+    }
     try {
       if (apiProxyPath.includes('null')) {
         throw new Error('Connection ID is Null')
@@ -80,6 +87,9 @@ const useJIRA = ({ apiProxyPath, issuesEndpoint, fieldsEndpoint, boardsEndpoint
   }, [fieldsEndpoint, activeConnection, apiProxyPath])
 
   const fetchBoards = useCallback(() => {
+    if (activeConnection.plugin !== Providers.JIRA) {
+      return
+    }
     try {
       if (apiProxyPath.includes('null')) {
         throw new Error('Connection ID is Null')