You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by mi...@apache.org on 2024/01/04 07:41:29 UTC
(incubator-devlake) branch main updated: refactor(config-ui): move redux hook to hooks dir (#6727)
This is an automated email from the ASF dual-hosted git repository.
mintsweet pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/main by this push:
new 05037b3c7 refactor(config-ui): move redux hook to hooks dir (#6727)
05037b3c7 is described below
commit 05037b3c7a21daf3e586ff6daaa4e8fad70ea831
Author: 青湛 <0x...@gmail.com>
AuthorDate: Thu Jan 4 20:41:25 2024 +1300
refactor(config-ui): move redux hook to hooks dir (#6727)
---
config-ui/src/features/connections/components/name.tsx | 2 +-
config-ui/src/{app/hook.ts => hooks/extend-redux.ts} | 3 ++-
config-ui/src/hooks/index.ts | 1 +
.../pages/blueprint/detail/components/add-connection-dialog/index.tsx | 2 +-
config-ui/src/plugins/components/connection-form/index.tsx | 2 +-
config-ui/src/plugins/components/connection-list/index.tsx | 2 +-
config-ui/src/plugins/components/connection-status/index.tsx | 2 +-
config-ui/src/plugins/register/webhook/components/create-dialog.tsx | 2 +-
config-ui/src/plugins/register/webhook/components/delete-dialog.tsx | 2 +-
config-ui/src/plugins/register/webhook/components/edit-dialog.tsx | 2 +-
config-ui/src/plugins/register/webhook/components/selector-dialog.tsx | 2 +-
config-ui/src/plugins/register/webhook/components/view-dialog.tsx | 2 +-
config-ui/src/plugins/register/webhook/connection.tsx | 2 +-
config-ui/src/routes/connection/connection.tsx | 2 +-
config-ui/src/routes/connection/connections.tsx | 2 +-
config-ui/src/routes/layout/layout.tsx | 2 +-
16 files changed, 17 insertions(+), 15 deletions(-)
diff --git a/config-ui/src/features/connections/components/name.tsx b/config-ui/src/features/connections/components/name.tsx
index 313e77f1e..a8bcf9ded 100644
--- a/config-ui/src/features/connections/components/name.tsx
+++ b/config-ui/src/features/connections/components/name.tsx
@@ -16,7 +16,7 @@
*
*/
-import { useAppSelector } from '@/app/hook';
+import { useAppSelector } from '@/hooks';
import { selectConnection, selectWebhook } from '../slice';
diff --git a/config-ui/src/app/hook.ts b/config-ui/src/hooks/extend-redux.ts
similarity index 94%
rename from config-ui/src/app/hook.ts
rename to config-ui/src/hooks/extend-redux.ts
index c945a1986..cc5bb98fb 100644
--- a/config-ui/src/app/hook.ts
+++ b/config-ui/src/hooks/extend-redux.ts
@@ -17,7 +17,8 @@
*/
import { TypedUseSelectorHook, useDispatch, useSelector } from 'react-redux';
-import type { RootState, AppDispatch } from './store';
+
+import type { RootState, AppDispatch } from '@/app/store';
type DispatchFunc = () => AppDispatch;
export const useAppDispatch: DispatchFunc = useDispatch;
diff --git a/config-ui/src/hooks/index.ts b/config-ui/src/hooks/index.ts
index 7f38b5d6f..1fd63d10a 100644
--- a/config-ui/src/hooks/index.ts
+++ b/config-ui/src/hooks/index.ts
@@ -16,6 +16,7 @@
*
*/
+export * from './extend-redux';
export * from './use-auto-refresh';
export * from './use-refresh-data';
export * from './use-tips';
diff --git a/config-ui/src/pages/blueprint/detail/components/add-connection-dialog/index.tsx b/config-ui/src/pages/blueprint/detail/components/add-connection-dialog/index.tsx
index 98e1a01c0..abb2084f6 100644
--- a/config-ui/src/pages/blueprint/detail/components/add-connection-dialog/index.tsx
+++ b/config-ui/src/pages/blueprint/detail/components/add-connection-dialog/index.tsx
@@ -19,7 +19,7 @@
import { useState, useMemo } from 'react';
import { Modal, Form, Select, Space, Button } from 'antd';
-import { useAppSelector } from '@/app/hook';
+import { useAppSelector } from '@/hooks';
import { selectAllConnections } from '@/features';
import { DataScopeSelect } from '@/plugins';
import { IConnection } from '@/types';
diff --git a/config-ui/src/plugins/components/connection-form/index.tsx b/config-ui/src/plugins/components/connection-form/index.tsx
index 6f44e3e98..4f6582e05 100644
--- a/config-ui/src/plugins/components/connection-form/index.tsx
+++ b/config-ui/src/plugins/components/connection-form/index.tsx
@@ -21,7 +21,7 @@ import { isEqual, pick } from 'lodash';
import { Flex, Alert, Button } from 'antd';
import API from '@/api';
-import { useAppDispatch, useAppSelector } from '@/app/hook';
+import { useAppDispatch, useAppSelector } from '@/hooks';
import { ExternalLink } from '@/components';
import { addConnection, updateConnection } from '@/features';
import { selectConnection } from '@/features/connections';
diff --git a/config-ui/src/plugins/components/connection-list/index.tsx b/config-ui/src/plugins/components/connection-list/index.tsx
index 25aa80ebb..b5fdd3a09 100644
--- a/config-ui/src/plugins/components/connection-list/index.tsx
+++ b/config-ui/src/plugins/components/connection-list/index.tsx
@@ -22,7 +22,7 @@ import { EyeOutlined, EditOutlined, PlusOutlined } from '@ant-design/icons';
import { theme, Table, Button, Modal } from 'antd';
import styled from 'styled-components';
-import { useAppSelector } from '@/app/hook';
+import { useAppSelector } from '@/hooks';
import { selectConnections } from '@/features/connections';
import { getPluginConfig, ConnectionStatus, ConnectionForm } from '@/plugins';
import { WebHookConnection } from '@/plugins/register/webhook';
diff --git a/config-ui/src/plugins/components/connection-status/index.tsx b/config-ui/src/plugins/components/connection-status/index.tsx
index e71011b5f..eb4c2e424 100644
--- a/config-ui/src/plugins/components/connection-status/index.tsx
+++ b/config-ui/src/plugins/components/connection-status/index.tsx
@@ -20,7 +20,7 @@ import { RedoOutlined } from '@ant-design/icons';
import { Button } from 'antd';
import styled from 'styled-components';
-import { useAppDispatch } from '@/app/hook';
+import { useAppDispatch } from '@/hooks';
import { testConnection } from '@/features/connections';
import { IConnection, IConnectionStatus } from '@/types';
import { operator } from '@/utils';
diff --git a/config-ui/src/plugins/register/webhook/components/create-dialog.tsx b/config-ui/src/plugins/register/webhook/components/create-dialog.tsx
index f065d8e5c..233ee908f 100644
--- a/config-ui/src/plugins/register/webhook/components/create-dialog.tsx
+++ b/config-ui/src/plugins/register/webhook/components/create-dialog.tsx
@@ -20,7 +20,7 @@ import { useState, useMemo } from 'react';
import { CheckCircleOutlined } from '@ant-design/icons';
import { Modal, Input } from 'antd';
-import { useAppDispatch } from '@/app/hook';
+import { useAppDispatch } from '@/hooks';
import { Block, CopyText, ExternalLink } from '@/components';
import { addWebhook } from '@/features';
import { operator } from '@/utils';
diff --git a/config-ui/src/plugins/register/webhook/components/delete-dialog.tsx b/config-ui/src/plugins/register/webhook/components/delete-dialog.tsx
index 54b0abaa0..846d51eca 100644
--- a/config-ui/src/plugins/register/webhook/components/delete-dialog.tsx
+++ b/config-ui/src/plugins/register/webhook/components/delete-dialog.tsx
@@ -19,7 +19,7 @@
import { useState } from 'react';
import { Modal } from 'antd';
-import { useAppDispatch } from '@/app/hook';
+import { useAppDispatch } from '@/hooks';
import { Message } from '@/components';
import { removeWebhook } from '@/features';
import { operator } from '@/utils';
diff --git a/config-ui/src/plugins/register/webhook/components/edit-dialog.tsx b/config-ui/src/plugins/register/webhook/components/edit-dialog.tsx
index cef7bb72a..eec2dd129 100644
--- a/config-ui/src/plugins/register/webhook/components/edit-dialog.tsx
+++ b/config-ui/src/plugins/register/webhook/components/edit-dialog.tsx
@@ -19,7 +19,7 @@
import { useState, useEffect } from 'react';
import { Modal, Input } from 'antd';
-import { useAppDispatch, useAppSelector } from '@/app/hook';
+import { useAppDispatch, useAppSelector } from '@/hooks';
import { Block } from '@/components';
import { updateWebhook, selectWebhook } from '@/features';
import { operator } from '@/utils';
diff --git a/config-ui/src/plugins/register/webhook/components/selector-dialog.tsx b/config-ui/src/plugins/register/webhook/components/selector-dialog.tsx
index ed242f246..f5f9bb29f 100644
--- a/config-ui/src/plugins/register/webhook/components/selector-dialog.tsx
+++ b/config-ui/src/plugins/register/webhook/components/selector-dialog.tsx
@@ -20,7 +20,7 @@ import { useState } from 'react';
import { Modal } from 'antd';
import MillerColumnsSelect from 'miller-columns-select';
-import { useAppSelector } from '@/app/hook';
+import { useAppSelector } from '@/hooks';
import { Block, Loading } from '@/components';
import { selectWebhooks } from '@/features';
import { IWebhook } from '@/types';
diff --git a/config-ui/src/plugins/register/webhook/components/view-dialog.tsx b/config-ui/src/plugins/register/webhook/components/view-dialog.tsx
index a3a21c176..342f701e8 100644
--- a/config-ui/src/plugins/register/webhook/components/view-dialog.tsx
+++ b/config-ui/src/plugins/register/webhook/components/view-dialog.tsx
@@ -19,7 +19,7 @@
import { useState, useMemo } from 'react';
import { Modal, Button } from 'antd';
-import { useAppDispatch, useAppSelector } from '@/app/hook';
+import { useAppDispatch, useAppSelector } from '@/hooks';
import { Block, CopyText, ExternalLink, Message } from '@/components';
import { selectWebhook, renewWebhookApiKey } from '@/features';
import { IWebhook } from '@/types';
diff --git a/config-ui/src/plugins/register/webhook/connection.tsx b/config-ui/src/plugins/register/webhook/connection.tsx
index cf5e35d6f..4ad661db3 100644
--- a/config-ui/src/plugins/register/webhook/connection.tsx
+++ b/config-ui/src/plugins/register/webhook/connection.tsx
@@ -20,7 +20,7 @@ import { useState } from 'react';
import { EyeOutlined, FormOutlined, DeleteOutlined, PlusOutlined } from '@ant-design/icons';
import { Flex, Table, Space, Button } from 'antd';
-import { useAppSelector } from '@/app/hook';
+import { useAppSelector } from '@/hooks';
import { selectWebhooks } from '@/features/connections';
import { IWebhook } from '@/types';
diff --git a/config-ui/src/routes/connection/connection.tsx b/config-ui/src/routes/connection/connection.tsx
index 3e0a4aeec..6fabafbdc 100644
--- a/config-ui/src/routes/connection/connection.tsx
+++ b/config-ui/src/routes/connection/connection.tsx
@@ -22,7 +22,7 @@ import { DeleteOutlined, PlusOutlined, NodeIndexOutlined, LinkOutlined, ClearOut
import { theme, Table, Button, Modal, message, Space } from 'antd';
import API from '@/api';
-import { useAppDispatch, useAppSelector } from '@/app/hook';
+import { useAppDispatch, useAppSelector } from '@/hooks';
import { PageHeader, Message } from '@/components';
import { selectConnection, removeConnection } from '@/features';
import { useTips, useRefreshData } from '@/hooks';
diff --git a/config-ui/src/routes/connection/connections.tsx b/config-ui/src/routes/connection/connections.tsx
index 4d5901954..5e464bb90 100644
--- a/config-ui/src/routes/connection/connections.tsx
+++ b/config-ui/src/routes/connection/connections.tsx
@@ -21,7 +21,7 @@ import { useNavigate } from 'react-router-dom';
import { theme, Badge, Modal } from 'antd';
import { chunk } from 'lodash';
-import { useAppSelector } from '@/app/hook';
+import { useAppSelector } from '@/hooks';
import { selectPlugins, selectAllConnections, selectWebhooks } from '@/features/connections';
import { getPluginConfig, ConnectionList, ConnectionForm } from '@/plugins';
diff --git a/config-ui/src/routes/layout/layout.tsx b/config-ui/src/routes/layout/layout.tsx
index 779961f6c..84f66cd2c 100644
--- a/config-ui/src/routes/layout/layout.tsx
+++ b/config-ui/src/routes/layout/layout.tsx
@@ -22,7 +22,7 @@ import { CSSTransition } from 'react-transition-group';
import { CloseOutlined } from '@ant-design/icons';
import { Layout as AntdLayout, Menu, Divider, Button } from 'antd';
-import { useAppDispatch, useAppSelector } from '@/app/hook';
+import { useAppDispatch, useAppSelector } from '@/hooks';
import { PageLoading, Logo, ExternalLink } from '@/components';
import { init, selectError, selectStatus } from '@/features';
import { TipsContextProvider, TipsContextConsumer } from '@/store';