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 f3cfbc1b6 refactor(config-ui): clean up unused code (#5362)
f3cfbc1b6 is described below
commit f3cfbc1b6e6670bc79f4547fd3ae5b3e3a29fc43
Author: 青湛 <[email protected]>
AuthorDate: Tue Jun 6 09:44:31 2023 +0800
refactor(config-ui): clean up unused code (#5362)
* fix(config-ui): missed content about data scope
* refactor(config-ui): adjust the content about component
* refactor(config-ui): clean up import react
---
.../src/components/action/external-link/index.tsx | 2 -
.../src/components/action/icon-button/index.tsx | 13 ++-
config-ui/src/components/alert/index.tsx | 7 +-
config-ui/src/components/buttons/index.tsx | 2 +-
config-ui/src/components/dialog/index.tsx | 1 -
config-ui/src/components/index.ts | 1 -
config-ui/src/components/inspector/index.tsx | 1 -
config-ui/src/components/loading/loading.tsx | 2 -
config-ui/src/components/loading/page-loading.tsx | 2 -
config-ui/src/components/logo/index.tsx | 2 -
config-ui/src/components/no-data/index.tsx | 2 -
config-ui/src/components/page-header/index.tsx | 1 -
.../components/selector/multi-selector/index.tsx | 2 +-
.../src/components/selector/selector/index.tsx | 2 +-
config-ui/src/components/table/table.tsx | 2 -
.../src/components/tooltip/help-tooltip/index.tsx | 1 -
.../src/components/tooltip/text-tooltip/index.tsx | 1 -
config-ui/src/components/workflow/index.tsx | 39 ---------
config-ui/src/components/workflow/styled.ts | 95 ----------------------
config-ui/src/layouts/base/base.tsx | 1 -
.../pages/blueprint/connection-detail/index.tsx | 19 ++++-
.../components/add-connection-dialog/index.tsx | 2 +-
.../detail/components/advanced-editor/index.tsx | 1 -
.../detail/components/sync-policy/index.tsx | 2 +-
.../components/sync-policy/start-from-selector.tsx | 2 +-
.../detail/components/update-name-dialog/index.tsx | 2 +-
.../pages/blueprint/detail/configuration-panel.tsx | 2 +-
config-ui/src/pages/connection/detail/index.tsx | 49 ++++++-----
.../pages/pipeline/components/historical/index.tsx | 2 +-
.../src/pages/pipeline/components/status/index.tsx | 1 -
.../src/pages/pipeline/components/task/index.tsx | 2 +-
.../src/pages/pipeline/components/tasks/index.tsx | 2 +-
.../src/pages/project/detail/settings-panel.tsx | 4 +-
.../src/pages/project/detail/webhooks-panel.tsx | 27 +++---
.../components/connection-form/fields/app-id.tsx | 2 +-
.../components/connection-form/fields/endpoint.tsx | 2 +-
.../components/connection-form/fields/index.tsx | 2 -
.../components/connection-form/fields/name.tsx | 2 +-
.../components/connection-form/fields/password.tsx | 2 +-
.../components/connection-form/fields/proxy.tsx | 2 +-
.../connection-form/fields/rate-limit.tsx | 2 +-
.../connection-form/fields/secret-key.tsx | 2 +-
.../components/connection-form/fields/token.tsx | 2 +-
.../components/connection-form/fields/username.tsx | 2 +-
.../components/data-scope-miller-columns/index.tsx | 2 +-
.../plugins/components/data-scope-search/index.tsx | 2 +-
.../components/data-scope-select-remote/index.tsx | 42 ++++------
.../plugins/components/data-scope-select/index.tsx | 10 ++-
.../plugins/components/scope-config-form/index.tsx | 24 +++---
.../components/scope-config-select/index.tsx | 26 +++---
.../register/azure/connection-fields/base-url.tsx | 1 -
.../src/plugins/register/azure/transformation.tsx | 2 +-
.../plugins/register/bitbucket/transformation.tsx | 2 +-
.../github/components/miller-columns/index.tsx | 2 +-
.../github/connection-fields/authentication.tsx | 2 +-
.../github/connection-fields/githubapp.tsx | 2 +-
.../register/github/connection-fields/graphql.tsx | 2 +-
.../src/plugins/register/github/transformation.tsx | 2 +-
.../src/plugins/register/gitlab/transformation.tsx | 2 +-
.../jenkins/components/miller-columns/index.tsx | 2 +-
.../plugins/register/jenkins/transformation.tsx | 2 +-
.../jira/components/miller-columns/index.tsx | 2 +-
.../register/jira/connection-fields/auth.tsx | 2 +-
.../jira/transformation-fields/cross-domain.tsx | 2 +-
.../src/plugins/register/jira/transformation.tsx | 2 +-
.../src/plugins/register/tapd/transformation.tsx | 2 +-
.../teambition/connection-fields/tenant-id.tsx | 2 +-
.../teambition/connection-fields/tenant-type.tsx | 2 +-
.../webook/components/miller-columns/index.tsx | 2 +-
.../register/webook/delete-dialog/index.tsx | 2 -
.../register/webook/selector-dialog/index.tsx | 2 +-
.../register/webook/view-or-edit-dialog/index.tsx | 1 -
72 files changed, 172 insertions(+), 292 deletions(-)
diff --git a/config-ui/src/components/action/external-link/index.tsx
b/config-ui/src/components/action/external-link/index.tsx
index 6888c56f0..058a010ef 100644
--- a/config-ui/src/components/action/external-link/index.tsx
+++ b/config-ui/src/components/action/external-link/index.tsx
@@ -16,8 +16,6 @@
*
*/
-import React from 'react';
-
interface Props {
link: string;
children: React.ReactNode;
diff --git a/config-ui/src/components/action/icon-button/index.tsx
b/config-ui/src/components/action/icon-button/index.tsx
index 45441018a..89ba6143f 100644
--- a/config-ui/src/components/action/icon-button/index.tsx
+++ b/config-ui/src/components/action/icon-button/index.tsx
@@ -20,6 +20,7 @@ import { Button, Intent, Position, IconName } from
'@blueprintjs/core';
import { Tooltip2 } from '@blueprintjs/popover2';
interface Props {
+ style?: React.CSSProperties;
icon: IconName;
tooltip: string;
loading?: boolean;
@@ -27,10 +28,18 @@ interface Props {
onClick?: () => void;
}
-export const IconButton = ({ icon, tooltip, loading, disabled, onClick }:
Props) => {
+export const IconButton = ({ style, icon, tooltip, loading, disabled, onClick
}: Props) => {
return (
<Tooltip2 intent={Intent.PRIMARY} position={Position.TOP}
content={tooltip}>
- <Button loading={loading} disabled={disabled} minimal
intent={Intent.PRIMARY} icon={icon} onClick={onClick} />
+ <Button
+ style={style}
+ loading={loading}
+ disabled={disabled}
+ minimal
+ intent={Intent.PRIMARY}
+ icon={icon}
+ onClick={onClick}
+ />
</Tooltip2>
);
};
diff --git a/config-ui/src/components/alert/index.tsx
b/config-ui/src/components/alert/index.tsx
index 87a74ed2a..20bab99d0 100644
--- a/config-ui/src/components/alert/index.tsx
+++ b/config-ui/src/components/alert/index.tsx
@@ -27,10 +27,9 @@ const Wrapper = styled.div`
interface Props {
style?: React.CSSProperties;
- content?: React.ReactNode;
- children?: React.ReactNode;
+ content: React.ReactNode;
}
-export const Alert = ({ style, content, children }: Props) => {
- return <Wrapper style={style}>{content ?? children}</Wrapper>;
+export const Alert = ({ style, content }: Props) => {
+ return <Wrapper style={style}>{content}</Wrapper>;
};
diff --git a/config-ui/src/components/buttons/index.tsx
b/config-ui/src/components/buttons/index.tsx
index 1c411f2d3..4fd3473f9 100644
--- a/config-ui/src/components/buttons/index.tsx
+++ b/config-ui/src/components/buttons/index.tsx
@@ -57,7 +57,7 @@ interface Props {
children: React.ReactNode;
}
-export const Buttons = ({ position = 'bottom', align = 'right', children }:
Props) => {
+export const Buttons = ({ position = 'top', align = 'left', children }: Props)
=> {
return (
<Wrapper position={position} align={align}>
{children}
diff --git a/config-ui/src/components/dialog/index.tsx
b/config-ui/src/components/dialog/index.tsx
index 290b96cfd..a5d79f2b5 100644
--- a/config-ui/src/components/dialog/index.tsx
+++ b/config-ui/src/components/dialog/index.tsx
@@ -16,7 +16,6 @@
*
*/
-import React from 'react';
import { Button, Icon, Intent, Classes } from '@blueprintjs/core';
import * as S from './styled';
diff --git a/config-ui/src/components/index.ts
b/config-ui/src/components/index.ts
index bad168aef..07bb29f0f 100644
--- a/config-ui/src/components/index.ts
+++ b/config-ui/src/components/index.ts
@@ -34,4 +34,3 @@ export * from './selector';
export * from './table';
export * from './toast';
export * from './tooltip';
-export * from './workflow';
diff --git a/config-ui/src/components/inspector/index.tsx
b/config-ui/src/components/inspector/index.tsx
index 17c75ca50..91eb53992 100644
--- a/config-ui/src/components/inspector/index.tsx
+++ b/config-ui/src/components/inspector/index.tsx
@@ -16,7 +16,6 @@
*
*/
-import React from 'react';
import { Drawer, DrawerSize, Classes, IconName } from '@blueprintjs/core';
import * as S from './styled';
diff --git a/config-ui/src/components/loading/loading.tsx
b/config-ui/src/components/loading/loading.tsx
index 7ade08bb5..65130deff 100644
--- a/config-ui/src/components/loading/loading.tsx
+++ b/config-ui/src/components/loading/loading.tsx
@@ -16,8 +16,6 @@
*
*/
-import React from 'react';
-
import * as S from './styled';
interface Props {
diff --git a/config-ui/src/components/loading/page-loading.tsx
b/config-ui/src/components/loading/page-loading.tsx
index 2f09ab861..b0747fb78 100644
--- a/config-ui/src/components/loading/page-loading.tsx
+++ b/config-ui/src/components/loading/page-loading.tsx
@@ -16,8 +16,6 @@
*
*/
-import React from 'react';
-
import { Loading } from './loading';
import * as S from './styled';
diff --git a/config-ui/src/components/logo/index.tsx
b/config-ui/src/components/logo/index.tsx
index 71b277dff..6b5af0595 100644
--- a/config-ui/src/components/logo/index.tsx
+++ b/config-ui/src/components/logo/index.tsx
@@ -16,8 +16,6 @@
*
*/
-import React from 'react';
-
import LogoImg from '@/images/devlake-logo.svg';
import LogoTextImg from '@/images/devlake-textmark.svg';
diff --git a/config-ui/src/components/no-data/index.tsx
b/config-ui/src/components/no-data/index.tsx
index 39fa744d7..ba7d45f64 100644
--- a/config-ui/src/components/no-data/index.tsx
+++ b/config-ui/src/components/no-data/index.tsx
@@ -16,8 +16,6 @@
*
*/
-import React from 'react';
-
import Img from '@/images/no-data.svg';
import { Card } from '@/components';
diff --git a/config-ui/src/components/page-header/index.tsx
b/config-ui/src/components/page-header/index.tsx
index adcb3103c..ec4e08cb5 100644
--- a/config-ui/src/components/page-header/index.tsx
+++ b/config-ui/src/components/page-header/index.tsx
@@ -16,7 +16,6 @@
*
*/
-import React from 'react';
import { Link } from 'react-router-dom';
import { Icon } from '@blueprintjs/core';
diff --git a/config-ui/src/components/selector/multi-selector/index.tsx
b/config-ui/src/components/selector/multi-selector/index.tsx
index 65a9f22d9..fc186918a 100644
--- a/config-ui/src/components/selector/multi-selector/index.tsx
+++ b/config-ui/src/components/selector/multi-selector/index.tsx
@@ -16,7 +16,7 @@
*
*/
-import React, { useState, useEffect } from 'react';
+import { useState, useEffect } from 'react';
import { MenuItem, Checkbox, Intent } from '@blueprintjs/core';
import { MultiSelect2 } from '@blueprintjs/select';
diff --git a/config-ui/src/components/selector/selector/index.tsx
b/config-ui/src/components/selector/selector/index.tsx
index e27fb1332..a73b13f52 100644
--- a/config-ui/src/components/selector/selector/index.tsx
+++ b/config-ui/src/components/selector/selector/index.tsx
@@ -16,7 +16,7 @@
*
*/
-import React, { useState, useEffect, useMemo } from 'react';
+import { useState, useEffect, useMemo } from 'react';
import { MenuItem, Button, Alignment } from '@blueprintjs/core';
import { Select2 } from '@blueprintjs/select';
diff --git a/config-ui/src/components/table/table.tsx
b/config-ui/src/components/table/table.tsx
index f4188d5a3..2f8e2fdf7 100644
--- a/config-ui/src/components/table/table.tsx
+++ b/config-ui/src/components/table/table.tsx
@@ -16,8 +16,6 @@
*
*/
-import React from 'react';
-
import type { TableContentProps } from './components';
import { TableLoading, TableNoData, TableContent } from './components';
diff --git a/config-ui/src/components/tooltip/help-tooltip/index.tsx
b/config-ui/src/components/tooltip/help-tooltip/index.tsx
index 905a24af6..699dc90e4 100644
--- a/config-ui/src/components/tooltip/help-tooltip/index.tsx
+++ b/config-ui/src/components/tooltip/help-tooltip/index.tsx
@@ -16,7 +16,6 @@
*
*/
-import React from 'react';
import { Icon, Position } from '@blueprintjs/core';
import { Tooltip2 } from '@blueprintjs/popover2';
import styled from 'styled-components';
diff --git a/config-ui/src/components/tooltip/text-tooltip/index.tsx
b/config-ui/src/components/tooltip/text-tooltip/index.tsx
index 16acafb23..ff0ba7001 100644
--- a/config-ui/src/components/tooltip/text-tooltip/index.tsx
+++ b/config-ui/src/components/tooltip/text-tooltip/index.tsx
@@ -16,7 +16,6 @@
*
*/
-import React from 'react';
import type { IntentProps } from '@blueprintjs/core';
import { Position } from '@blueprintjs/core';
import { Tooltip2 } from '@blueprintjs/popover2';
diff --git a/config-ui/src/components/workflow/index.tsx
b/config-ui/src/components/workflow/index.tsx
deleted file mode 100644
index f44b45de4..000000000
--- a/config-ui/src/components/workflow/index.tsx
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-import { Icon } from '@blueprintjs/core';
-
-import * as S from './styled';
-
-interface Props {
- steps: string[];
- activeStep: number;
-}
-
-export const Workflow = ({ steps, activeStep }: Props) => {
- return (
- <S.List>
- {steps.map((step, i) => (
- <S.Item key={i} actived={i + 1 === activeStep} passed={activeStep > i
+ 1}>
- <span className="step">{activeStep > i + 1 ? <Icon icon="tick" /> :
i + 1}</span>
- <span className="name">{step}</span>
- </S.Item>
- ))}
- </S.List>
- );
-};
diff --git a/config-ui/src/components/workflow/styled.ts
b/config-ui/src/components/workflow/styled.ts
deleted file mode 100644
index 1c88a5e15..000000000
--- a/config-ui/src/components/workflow/styled.ts
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-import styled from 'styled-components';
-
-export const List = styled.ul`
- display: flex;
- align-items: center;
-`;
-
-export const Item = styled.li<{ actived: boolean; passed: boolean }>`
- position: relative;
- flex: 1;
- display: flex;
- flex-direction: column;
- align-items: center;
-
- &::before {
- content: '';
- position: absolute;
- top: 15px;
- left: -15px;
- width: 50%;
- height: 2px;
- background-color: #bdcefb;
- }
-
- &::after {
- content: '';
- position: absolute;
- top: 15px;
- right: -15px;
- width: 50%;
- height: 2px;
- background-color: #bdcefb;
- }
-
- &:first-child::before {
- display: none;
- }
-
- &:last-child::after {
- display: none;
- }
-
- span.step {
- display: flex;
- align-items: center;
- justify-content: center;
- margin-bottom: 8px;
- width: 30px;
- height: 30px;
- font-size: 16px;
- color: #7497f7;
- font-weight: 600;
- background-color: #f0f4fe;
- border-radius: 50%;
-
- ${({ actived }) =>
- actived
- ? `
- color: #fff;
- background-color: #7497f7;
- `
- : ''}
-
- ${({ passed }) =>
- passed
- ? `
- color: #fff;
- background-color: #4DB764;
- `
- : ''}
- }
-
- span.name {
- color: #70727f;
- font-weight: 600;
- }
-`;
diff --git a/config-ui/src/layouts/base/base.tsx
b/config-ui/src/layouts/base/base.tsx
index b612b1496..104163b73 100644
--- a/config-ui/src/layouts/base/base.tsx
+++ b/config-ui/src/layouts/base/base.tsx
@@ -16,7 +16,6 @@
*
*/
-import React from 'react';
import { useLocation } from 'react-router-dom';
import { Menu, MenuItem, Tag, Navbar, Intent, Alignment, Button } from
'@blueprintjs/core';
diff --git a/config-ui/src/pages/blueprint/connection-detail/index.tsx
b/config-ui/src/pages/blueprint/connection-detail/index.tsx
index 6ab122f9e..6218669f2 100644
--- a/config-ui/src/pages/blueprint/connection-detail/index.tsx
+++ b/config-ui/src/pages/blueprint/connection-detail/index.tsx
@@ -166,13 +166,28 @@ export const BlueprintConnectionDetailPage = () => {
</Button>
</Popover2>
</S.Top>
- <Buttons position="top" align="left">
+ <Buttons>
<Button intent={Intent.PRIMARY} icon="annotation" text="Manage Data
Scope" onClick={handleShowDataScope} />
<ExternalLink style={{ marginLeft: 8 }}
link={`/connections/${connection.plugin}/${connection.id}`}>
<Button intent={Intent.PRIMARY} icon="annotation" text="Edit Scope
Config" />
</ExternalLink>
</Buttons>
- <Table columns={[{ title: 'Data Scope', dataIndex: 'name', key: 'name'
}]} dataSource={scopes} />
+ <Table
+ columns={[
+ {
+ title: 'Data Scope',
+ dataIndex: 'name',
+ key: 'name',
+ },
+ {
+ title: 'Scope Config',
+ dataIndex: 'scopeConfig',
+ key: 'scopeConfig',
+ render: (_, row) => (row.scopeConfigId ? 'Configured' : 'N/A'),
+ },
+ ]}
+ dataSource={scopes}
+ />
<Dialog
isOpen={isOpen}
title="Manage Data Scope"
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 cf06480c3..359cddfa1 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
@@ -66,7 +66,7 @@ export const AddConnectionDialog = ({ disabled = [],
onCancel, onSubmit }: Props
selectedItem={selectedConnection}
onChangeItem={(selectedItem) =>
setSelectedConnection(selectedItem)}
/>
- <Buttons>
+ <Buttons position="bottom" align="right">
<Button outlined intent={Intent.PRIMARY} text="Cancel"
onClick={onCancel} />
<Button disabled={!selectedConnection} intent={Intent.PRIMARY}
text="Next" onClick={() => setStep(2)} />
</Buttons>
diff --git
a/config-ui/src/pages/blueprint/detail/components/advanced-editor/index.tsx
b/config-ui/src/pages/blueprint/detail/components/advanced-editor/index.tsx
index 5a69e29c4..ce8a50fd3 100644
--- a/config-ui/src/pages/blueprint/detail/components/advanced-editor/index.tsx
+++ b/config-ui/src/pages/blueprint/detail/components/advanced-editor/index.tsx
@@ -16,7 +16,6 @@
*
*/
-import React from 'react';
import { TextArea, ButtonGroup, Button, Menu, MenuItem, Position } from
'@blueprintjs/core';
import { Popover2 } from '@blueprintjs/popover2';
import styled from 'styled-components';
diff --git
a/config-ui/src/pages/blueprint/detail/components/sync-policy/index.tsx
b/config-ui/src/pages/blueprint/detail/components/sync-policy/index.tsx
index a25de0f5b..feacbb1a4 100644
--- a/config-ui/src/pages/blueprint/detail/components/sync-policy/index.tsx
+++ b/config-ui/src/pages/blueprint/detail/components/sync-policy/index.tsx
@@ -16,7 +16,7 @@
*
*/
-import React, { useMemo } from 'react';
+import { useMemo } from 'react';
import dayjs from 'dayjs';
import { Checkbox, FormGroup, InputGroup, Radio, RadioGroup } from
'@blueprintjs/core';
diff --git
a/config-ui/src/pages/blueprint/detail/components/sync-policy/start-from-selector.tsx
b/config-ui/src/pages/blueprint/detail/components/sync-policy/start-from-selector.tsx
index 0b984f6d8..fbf25efa8 100644
---
a/config-ui/src/pages/blueprint/detail/components/sync-policy/start-from-selector.tsx
+++
b/config-ui/src/pages/blueprint/detail/components/sync-policy/start-from-selector.tsx
@@ -15,7 +15,7 @@
* limitations under the License.
*
*/
-import React, { useCallback, useMemo } from 'react';
+import { useCallback, useMemo } from 'react';
import { Tag } from '@blueprintjs/core';
import { TimePrecision } from '@blueprintjs/datetime';
import { DateInput2 } from '@blueprintjs/datetime2';
diff --git
a/config-ui/src/pages/blueprint/detail/components/update-name-dialog/index.tsx
b/config-ui/src/pages/blueprint/detail/components/update-name-dialog/index.tsx
index 742f7d464..ee14a1683 100644
---
a/config-ui/src/pages/blueprint/detail/components/update-name-dialog/index.tsx
+++
b/config-ui/src/pages/blueprint/detail/components/update-name-dialog/index.tsx
@@ -16,7 +16,7 @@
*
*/
-import React, { useState, useEffect } from 'react';
+import { useState, useEffect } from 'react';
import { InputGroup } from '@blueprintjs/core';
import { Dialog } from '@/components';
diff --git a/config-ui/src/pages/blueprint/detail/configuration-panel.tsx
b/config-ui/src/pages/blueprint/detail/configuration-panel.tsx
index ef15ae14a..ef84bcdc5 100644
--- a/config-ui/src/pages/blueprint/detail/configuration-panel.tsx
+++ b/config-ui/src/pages/blueprint/detail/configuration-panel.tsx
@@ -178,7 +178,7 @@ export const ConfigurationPanel = ({ from, blueprint,
onRefresh }: Props) => {
/>
) : (
<>
- <Buttons position="top" align="left">
+ <Buttons>
<Button
intent={Intent.PRIMARY}
icon="add"
diff --git a/config-ui/src/pages/connection/detail/index.tsx
b/config-ui/src/pages/connection/detail/index.tsx
index a7c096ddb..2330dd6e8 100644
--- a/config-ui/src/pages/connection/detail/index.tsx
+++ b/config-ui/src/pages/connection/detail/index.tsx
@@ -36,6 +36,16 @@ import * as API from './api';
import * as S from './styled';
export const ConnectionDetailPage = () => {
+ const { plugin, id } = useParams<{ plugin: string; id: string }>();
+ return <ConnectionDetail plugin={plugin} connectionId={+id} />;
+};
+
+interface Props {
+ plugin: string;
+ connectionId: ID;
+}
+
+const ConnectionDetail = ({ plugin, connectionId }: Props) => {
const [type, setType] = useState<
| 'deleteConnection'
| 'updateConnection'
@@ -50,17 +60,16 @@ export const ConnectionDetailPage = () => {
const [scopeIds, setScopeIds] = useState<ID[]>([]);
const [scopeConfigId, setScopeConfigId] = useState<ID>();
- const { plugin, id } = useParams<{ plugin: string; id: string }>();
const history = useHistory();
const { onGet, onTest, onRefresh } = useConnections();
const { setTips } = useTips();
- const { ready, data } = useRefreshData(() => API.getDataScopes(plugin, id),
[version]);
+ const { ready, data } = useRefreshData(() => API.getDataScopes(plugin,
connectionId), [version]);
- const { unique, status, name, icon } = onGet(`${plugin}-${id}`) || {};
+ const { unique, status, name, icon } = onGet(`${plugin}-${connectionId}`) ||
{};
useEffect(() => {
- onTest(`${plugin}-${id}`);
- }, [plugin, id]);
+ onTest(`${plugin}-${connectionId}`);
+ }, [plugin, connectionId]);
const handleHideDialog = () => {
setType(undefined);
@@ -83,7 +92,7 @@ export const ConnectionDetailPage = () => {
};
const handleDelete = async () => {
- const [success] = await operator(() => API.deleteConnection(plugin, id), {
+ const [success] = await operator(() => API.deleteConnection(plugin,
connectionId), {
setOperating,
formatMessage: () => 'Delete Connection Successful.',
});
@@ -109,6 +118,7 @@ export const ConnectionDetailPage = () => {
const handleCreateDataScope = () => {
setVersion((v) => v + 1);
+ handleHideDialog();
handleShowTips();
};
@@ -125,7 +135,7 @@ export const ConnectionDetailPage = () => {
const handleDeleteDataScope = async (onlyData: boolean) => {
if (!scopeId) return;
- const [success] = await operator(() => API.deleteDataScope(plugin, id,
scopeId, onlyData), {
+ const [success] = await operator(() => API.deleteDataScope(plugin,
connectionId, scopeId, onlyData), {
setOperating,
formatMessage: () => (onlyData ? 'Clear historical data successful.' :
'Delete Data Scope successful.'),
});
@@ -147,8 +157,8 @@ export const ConnectionDetailPage = () => {
() =>
Promise.all(
scopeIds.map(async (scopeId) => {
- const scope = await API.getDataScope(plugin, id, scopeId);
- return API.updateDataScope(plugin, id, scopeId, {
+ const scope = await API.getDataScope(plugin, connectionId,
scopeId);
+ return API.updateDataScope(plugin, connectionId, scopeId, {
...scope,
scopeConfigId: +trId,
});
@@ -184,7 +194,7 @@ export const ConnectionDetailPage = () => {
<IconButton icon="annotation" tooltip="Edit Connection"
onClick={handleShowUpdateDialog} />
</div>
</div>
- <Buttons position="top" align="left">
+ <Buttons>
<Button intent={Intent.PRIMARY} icon="add" text="Add Data Scope"
onClick={handleShowCreateDataScopeDialog} />
{plugin !== 'tapd' && (
<Button
@@ -206,20 +216,18 @@ export const ConnectionDetailPage = () => {
},
{
title: 'Scope Config',
- dataIndex: 'scopeConfigName',
+ dataIndex: 'scopeConfig',
key: 'scopeConfig',
width: 400,
- render: (val, row) => (
+ render: (_, row) => (
<>
- <span>{val ?? 'No Scope Config'}</span>
+ <span>{row.scopeConfigId ? 'Configured' : 'N/A'}</span>
<IconButton
icon="link"
tooltip="Associate Scope Config"
onClick={() => {
handleShowScopeConfigSelectDialog([row[getPluginId(plugin)]]);
- if (plugin === 'tapd') {
- setScopeConfigId(row.scopeConfigId);
- }
+ setScopeConfigId(row.scopeConfigId);
}}
/>
</>
@@ -291,7 +299,7 @@ export const ConnectionDetailPage = () => {
}
onCancel={handleHideDialog}
>
- <ConnectionForm plugin={plugin} connectionId={id}
onSuccess={handleUpdate} />
+ <ConnectionForm plugin={plugin} connectionId={connectionId}
onSuccess={handleUpdate} />
</Dialog>
)}
{type === 'createDataScope' && (
@@ -309,7 +317,7 @@ export const ConnectionDetailPage = () => {
>
<DataScopeSelectRemote
plugin={plugin}
- connectionId={id}
+ connectionId={connectionId}
disabledScope={data}
onCancel={handleHideDialog}
onSubmit={handleCreateDataScope}
@@ -356,7 +364,7 @@ export const ConnectionDetailPage = () => {
{plugin === 'tapd' ? (
<ScopeConfigForm
plugin={plugin}
- connectionId={id}
+ connectionId={connectionId}
scopeId={scopeIds[0]}
scopeConfigId={scopeConfigId}
onCancel={handleHideDialog}
@@ -365,7 +373,8 @@ export const ConnectionDetailPage = () => {
) : (
<ScopeConfigSelect
plugin={plugin}
- connectionId={id}
+ connectionId={connectionId}
+ scopeConfigId={scopeConfigId}
onCancel={handleHideDialog}
onSubmit={handleAssociateScopeConfig}
/>
diff --git a/config-ui/src/pages/pipeline/components/historical/index.tsx
b/config-ui/src/pages/pipeline/components/historical/index.tsx
index 1c8b8c7cf..51d346ae0 100644
--- a/config-ui/src/pages/pipeline/components/historical/index.tsx
+++ b/config-ui/src/pages/pipeline/components/historical/index.tsx
@@ -16,7 +16,7 @@
*
*/
-import React, { useState, useMemo } from 'react';
+import { useState, useMemo } from 'react';
import { ButtonGroup } from '@blueprintjs/core';
import { pick } from 'lodash';
import { saveAs } from 'file-saver';
diff --git a/config-ui/src/pages/pipeline/components/status/index.tsx
b/config-ui/src/pages/pipeline/components/status/index.tsx
index f93355252..72ced128b 100644
--- a/config-ui/src/pages/pipeline/components/status/index.tsx
+++ b/config-ui/src/pages/pipeline/components/status/index.tsx
@@ -16,7 +16,6 @@
*
*/
-import React from 'react';
import { Icon, IconName } from '@blueprintjs/core';
import classNames from 'classnames';
diff --git a/config-ui/src/pages/pipeline/components/task/index.tsx
b/config-ui/src/pages/pipeline/components/task/index.tsx
index d155ed1bd..8787348f6 100644
--- a/config-ui/src/pages/pipeline/components/task/index.tsx
+++ b/config-ui/src/pages/pipeline/components/task/index.tsx
@@ -16,7 +16,7 @@
*
*/
-import React, { useMemo } from 'react';
+import { useMemo } from 'react';
import { Intent } from '@blueprintjs/core';
import { TextTooltip } from '@/components';
diff --git a/config-ui/src/pages/pipeline/components/tasks/index.tsx
b/config-ui/src/pages/pipeline/components/tasks/index.tsx
index 8cda6d0fa..d9ceb4447 100644
--- a/config-ui/src/pages/pipeline/components/tasks/index.tsx
+++ b/config-ui/src/pages/pipeline/components/tasks/index.tsx
@@ -16,7 +16,7 @@
*
*/
-import React, { useState } from 'react';
+import { useState } from 'react';
import { Button, Collapse, Icon } from '@blueprintjs/core';
import { groupBy, sortBy } from 'lodash';
diff --git a/config-ui/src/pages/project/detail/settings-panel.tsx
b/config-ui/src/pages/project/detail/settings-panel.tsx
index 701be104c..b09bebd90 100644
--- a/config-ui/src/pages/project/detail/settings-panel.tsx
+++ b/config-ui/src/pages/project/detail/settings-panel.tsx
@@ -109,11 +109,11 @@ export const SettingsPanel = ({ project }: Props) => {
onChange={(e) => setEnableDora((e.target as
HTMLInputElement).checked)}
/>
</FormItem>
- <Buttons align="left">
+ <Buttons position="bottom">
<Button text="Save" loading={operating} disabled={!name}
intent={Intent.PRIMARY} onClick={handleUpdate} />
</Buttons>
</Card>
- <Buttons align="center">
+ <Buttons position="bottom" align="center">
<Button intent={Intent.DANGER} text="Delete Project"
onClick={handleShowDeleteDialog} />
</Buttons>
<Dialog
diff --git a/config-ui/src/pages/project/detail/webhooks-panel.tsx
b/config-ui/src/pages/project/detail/webhooks-panel.tsx
index 81413fbd9..343926d9f 100644
--- a/config-ui/src/pages/project/detail/webhooks-panel.tsx
+++ b/config-ui/src/pages/project/detail/webhooks-panel.tsx
@@ -121,17 +121,22 @@ export const WebhooksPanel = ({ project, onRefresh }:
Props) => {
return (
<>
- <Alert style={{ marginBottom: 24, color: '#3C5088' }}>
- <div>
- The data pushed by Webhooks will only be calculated for DORA in the
next run of the Blueprint of this project
- because DORA relies on the post-processing of "deployments,"
"incidents," and "pull requests" triggered by
- running the blueprint.
- </div>
- <div style={{ marginTop: 16 }}>
- To calculate DORA after receiving Webhook data immediately, you can
visit the{' '}
- <b style={{ textDecoration: 'underline' }}>Status tab</b> of the
Blueprint page and click on Run Now.
- </div>
- </Alert>
+ <Alert
+ style={{ marginBottom: 24, color: '#3C5088' }}
+ content={
+ <>
+ <div>
+ The data pushed by Webhooks will only be calculated for DORA in
the next run of the Blueprint of this
+ project because DORA relies on the post-processing of
"deployments," "incidents," and "pull requests"
+ triggered by running the blueprint.
+ </div>
+ <div style={{ marginTop: 16 }}>
+ To calculate DORA after receiving Webhook data immediately, you
can visit the{' '}
+ <b style={{ textDecoration: 'underline' }}>Status tab</b> of the
Blueprint page and click on Run Now.
+ </div>
+ </>
+ }
+ />
{!webhookIds.length ? (
<>
<NoData
diff --git a/config-ui/src/plugins/components/connection-form/fields/app-id.tsx
b/config-ui/src/plugins/components/connection-form/fields/app-id.tsx
index d4d789c41..8a38838aa 100644
--- a/config-ui/src/plugins/components/connection-form/fields/app-id.tsx
+++ b/config-ui/src/plugins/components/connection-form/fields/app-id.tsx
@@ -33,7 +33,7 @@
*
*/
-import React, { useEffect } from 'react';
+import { useEffect } from 'react';
import { FormGroup, InputGroup } from '@blueprintjs/core';
import * as S from './styled';
diff --git
a/config-ui/src/plugins/components/connection-form/fields/endpoint.tsx
b/config-ui/src/plugins/components/connection-form/fields/endpoint.tsx
index 9f17011b6..4bbb2ab91 100644
--- a/config-ui/src/plugins/components/connection-form/fields/endpoint.tsx
+++ b/config-ui/src/plugins/components/connection-form/fields/endpoint.tsx
@@ -33,7 +33,7 @@
*
*/
-import React, { useState, useEffect } from 'react';
+import { useState, useEffect } from 'react';
import { FormGroup, RadioGroup, Radio, InputGroup } from '@blueprintjs/core';
import * as S from './styled';
diff --git a/config-ui/src/plugins/components/connection-form/fields/index.tsx
b/config-ui/src/plugins/components/connection-form/fields/index.tsx
index a8cb78215..514ba3f95 100644
--- a/config-ui/src/plugins/components/connection-form/fields/index.tsx
+++ b/config-ui/src/plugins/components/connection-form/fields/index.tsx
@@ -16,8 +16,6 @@
*
*/
-import React from 'react';
-
import { ConnectionName } from './name';
import { ConnectionEndpoint } from './endpoint';
import { ConnectionUsername } from './username';
diff --git a/config-ui/src/plugins/components/connection-form/fields/name.tsx
b/config-ui/src/plugins/components/connection-form/fields/name.tsx
index ab299e285..282fc24ca 100644
--- a/config-ui/src/plugins/components/connection-form/fields/name.tsx
+++ b/config-ui/src/plugins/components/connection-form/fields/name.tsx
@@ -16,7 +16,7 @@
*
*/
-import React, { useEffect } from 'react';
+import { useEffect } from 'react';
import { FormGroup, InputGroup } from '@blueprintjs/core';
import * as S from './styled';
diff --git
a/config-ui/src/plugins/components/connection-form/fields/password.tsx
b/config-ui/src/plugins/components/connection-form/fields/password.tsx
index fc823a196..409514013 100644
--- a/config-ui/src/plugins/components/connection-form/fields/password.tsx
+++ b/config-ui/src/plugins/components/connection-form/fields/password.tsx
@@ -33,7 +33,7 @@
*
*/
-import React, { useEffect } from 'react';
+import { useEffect } from 'react';
import { FormGroup, InputGroup } from '@blueprintjs/core';
import * as S from './styled';
diff --git a/config-ui/src/plugins/components/connection-form/fields/proxy.tsx
b/config-ui/src/plugins/components/connection-form/fields/proxy.tsx
index 9d1cadf45..f51d8223a 100644
--- a/config-ui/src/plugins/components/connection-form/fields/proxy.tsx
+++ b/config-ui/src/plugins/components/connection-form/fields/proxy.tsx
@@ -33,7 +33,7 @@
*
*/
-import React, { useEffect } from 'react';
+import { useEffect } from 'react';
import { FormGroup, InputGroup } from '@blueprintjs/core';
import * as S from './styled';
diff --git
a/config-ui/src/plugins/components/connection-form/fields/rate-limit.tsx
b/config-ui/src/plugins/components/connection-form/fields/rate-limit.tsx
index 8e6e4f09b..2dda69dc9 100644
--- a/config-ui/src/plugins/components/connection-form/fields/rate-limit.tsx
+++ b/config-ui/src/plugins/components/connection-form/fields/rate-limit.tsx
@@ -33,7 +33,7 @@
*
*/
-import React, { useState, useEffect } from 'react';
+import { useState, useEffect } from 'react';
import { FormGroup, Switch, NumericInput } from '@blueprintjs/core';
import { ExternalLink } from '@/components';
diff --git
a/config-ui/src/plugins/components/connection-form/fields/secret-key.tsx
b/config-ui/src/plugins/components/connection-form/fields/secret-key.tsx
index 88cc42ba6..ff61dacf5 100644
--- a/config-ui/src/plugins/components/connection-form/fields/secret-key.tsx
+++ b/config-ui/src/plugins/components/connection-form/fields/secret-key.tsx
@@ -33,7 +33,7 @@
*
*/
-import React, { useEffect } from 'react';
+import { useEffect } from 'react';
import { FormGroup, InputGroup } from '@blueprintjs/core';
import * as S from './styled';
diff --git a/config-ui/src/plugins/components/connection-form/fields/token.tsx
b/config-ui/src/plugins/components/connection-form/fields/token.tsx
index ff48ee9cb..108c6e958 100644
--- a/config-ui/src/plugins/components/connection-form/fields/token.tsx
+++ b/config-ui/src/plugins/components/connection-form/fields/token.tsx
@@ -33,7 +33,7 @@
*
*/
-import React, { useEffect } from 'react';
+import { useEffect } from 'react';
import { FormGroup, InputGroup } from '@blueprintjs/core';
import * as S from './styled';
diff --git
a/config-ui/src/plugins/components/connection-form/fields/username.tsx
b/config-ui/src/plugins/components/connection-form/fields/username.tsx
index 0487e8203..127e24be1 100644
--- a/config-ui/src/plugins/components/connection-form/fields/username.tsx
+++ b/config-ui/src/plugins/components/connection-form/fields/username.tsx
@@ -33,7 +33,7 @@
*
*/
-import React, { useEffect } from 'react';
+import { useEffect } from 'react';
import { FormGroup, InputGroup } from '@blueprintjs/core';
import * as S from './styled';
diff --git
a/config-ui/src/plugins/components/data-scope-miller-columns/index.tsx
b/config-ui/src/plugins/components/data-scope-miller-columns/index.tsx
index 0fe73014b..3f9585bf9 100644
--- a/config-ui/src/plugins/components/data-scope-miller-columns/index.tsx
+++ b/config-ui/src/plugins/components/data-scope-miller-columns/index.tsx
@@ -16,7 +16,7 @@
*
*/
-import React, { useState, useEffect } from 'react';
+import { useState, useEffect } from 'react';
import type { McsID, McsItem, McsColumn } from 'miller-columns-select';
import type { MillerColumnsSelectProps } from 'miller-columns-select';
import MillerColumnsSelect from 'miller-columns-select';
diff --git a/config-ui/src/plugins/components/data-scope-search/index.tsx
b/config-ui/src/plugins/components/data-scope-search/index.tsx
index 3d2aa7e8a..faa8394ce 100644
--- a/config-ui/src/plugins/components/data-scope-search/index.tsx
+++ b/config-ui/src/plugins/components/data-scope-search/index.tsx
@@ -16,7 +16,7 @@
*
*/
-import React, { useState, useEffect } from 'react';
+import { useState, useEffect } from 'react';
import { MultiSelector } from '@/components';
diff --git
a/config-ui/src/plugins/components/data-scope-select-remote/index.tsx
b/config-ui/src/plugins/components/data-scope-select-remote/index.tsx
index 582be6462..d1c274497 100644
--- a/config-ui/src/plugins/components/data-scope-select-remote/index.tsx
+++ b/config-ui/src/plugins/components/data-scope-select-remote/index.tsx
@@ -19,8 +19,6 @@
import { useMemo, useState } from 'react';
import { Button, Intent } from '@blueprintjs/core';
-import { getPluginId } from '@/plugins';
-
import { GitHubDataScope } from '@/plugins/register/github';
import { JiraDataScope } from '@/plugins/register/jira';
import { GitLabDataScope } from '@/plugins/register/gitlab';
@@ -31,6 +29,7 @@ import { SonarQubeDataScope } from
'@/plugins/register/sonarqube';
import { PagerDutyDataScope } from '@/plugins/register/pagerduty';
import { TapdDataScope } from '@/plugins/register/tapd';
import { ZentaoDataScope } from '@/plugins/register/zentao';
+import { operator } from '@/utils';
import * as API from './api';
import * as S from './styled';
@@ -49,40 +48,29 @@ export const DataScopeSelectRemote = ({ plugin,
connectionId, disabledScope, onS
const error = useMemo(() => (!scope.length ? 'No Data Scope is Selected' :
''), [scope]);
- const getDataScope = async (scope: any) => {
- try {
- const res = await API.getDataScope(plugin, connectionId,
scope[getPluginId(plugin)]);
- return {
- ...scope,
- transformationRuleId: res.transformationRuleId,
- };
- } catch {
- return scope;
- }
- };
-
const handleSubmit = async () => {
- setOperating(true);
- try {
- const data = await Promise.all(scope.map((sc: any) => getDataScope(sc)));
- const res =
+ const [success, res] = await operator(
+ async () =>
plugin === 'zentao'
? [
...(await API.updateDataScopeWithType(plugin, connectionId,
'product', {
- data: data.filter((s) => s.type !== 'project'),
+ data: scope.filter((s: any) => s.type !== 'project'),
})),
...(await API.updateDataScopeWithType(plugin, connectionId,
'project', {
- data: data.filter((s) => s.type === 'project'),
+ data: scope.filter((s: any) => s.type === 'project'),
})),
]
- : await API.updateDataScope(plugin, connectionId, {
- data,
- });
-
+ : API.updateDataScope(plugin, connectionId, {
+ data: scope,
+ }),
+ {
+ setOperating,
+ formatMessage: () => 'Add data scope successful.',
+ },
+ );
+
+ if (success) {
onSubmit(res);
- } finally {
- setOperating(false);
- onCancel();
}
};
diff --git a/config-ui/src/plugins/components/data-scope-select/index.tsx
b/config-ui/src/plugins/components/data-scope-select/index.tsx
index b1005a787..00692d130 100644
--- a/config-ui/src/plugins/components/data-scope-select/index.tsx
+++ b/config-ui/src/plugins/components/data-scope-select/index.tsx
@@ -100,7 +100,7 @@ export const DataScopeSelect = ({
}
/>
) : (
- <Buttons position="top" align="left">
+ <Buttons>
<Button intent={Intent.PRIMARY} icon="refresh" text="Refresh
Data Scope" onClick={handleRefresh} />
</Buttons>
)}
@@ -113,6 +113,12 @@ export const DataScopeSelect = ({
dataIndex: 'name',
key: 'name',
},
+ {
+ title: 'Scope Config',
+ dataIndex: 'scopeConfig',
+ key: 'scopeConfig',
+ render: (_, row) => (row.scopeConfigId ? 'Configured' : 'N/A'),
+ },
]}
dataSource={data}
rowSelection={{
@@ -122,7 +128,7 @@ export const DataScopeSelect = ({
onChange: (selectedRowKeys) => setScopeIds(selectedRowKeys),
}}
/>
- <Buttons>
+ <Buttons position="bottom" align="right">
<Button outlined intent={Intent.PRIMARY} text="Cancel"
onClick={onCancel} />
<Button disabled={!scopeIds.length} intent={Intent.PRIMARY}
text="Save" onClick={handleSubmit} />
</Buttons>
diff --git a/config-ui/src/plugins/components/scope-config-form/index.tsx
b/config-ui/src/plugins/components/scope-config-form/index.tsx
index e46daf1da..c1250f0e1 100644
--- a/config-ui/src/plugins/components/scope-config-form/index.tsx
+++ b/config-ui/src/plugins/components/scope-config-form/index.tsx
@@ -43,8 +43,8 @@ interface Props {
showWarning?: boolean;
scopeId?: ID;
scopeConfigId?: ID;
- onCancel?: () => void;
- onSubmit?: (trId: string) => void;
+ onCancel: () => void;
+ onSubmit: (trId: string) => void;
}
export const ScopeConfigForm = ({
@@ -107,18 +107,22 @@ export const ScopeConfigForm = ({
);
if (success) {
- onCancel?.();
- onSubmit?.(res.id);
+ onSubmit(res.id);
}
};
return (
<S.Wrapper>
{TIPS_MAP[plugin] && (
- <Alert style={{ marginBottom: 24 }}>
- To learn about how {TIPS_MAP[plugin].name} transformation is used in
DevLake,{' '}
- <ExternalLink link={TIPS_MAP[plugin].link}>check out this
doc</ExternalLink>.
- </Alert>
+ <Alert
+ style={{ marginBottom: 24 }}
+ content={
+ <>
+ To learn about how {TIPS_MAP[plugin].name} transformation is
used in DevLake,{' '}
+ <ExternalLink link={TIPS_MAP[plugin].link}>check out this
doc</ExternalLink>.
+ </>
+ }
+ />
)}
{step === 1 && (
<>
@@ -158,7 +162,7 @@ export const ScopeConfigForm = ({
/>
)}
</Card>
- <Buttons>
+ <Buttons position="bottom" align="right">
<Button outlined intent={Intent.PRIMARY} text="Cancel"
onClick={onCancel} />
<Button disabled={!name || !entities.length}
intent={Intent.PRIMARY} text="Next" onClick={handleNextStep} />
</Buttons>
@@ -235,7 +239,7 @@ export const ScopeConfigForm = ({
{hasRefDiff && <AdditionalSettings transformation={transformation}
setTransformation={setTransformation} />}
</Card>
- <Buttons>
+ <Buttons position="bottom" align="right">
<Button outlined intent={Intent.PRIMARY} text="Prev"
onClick={handlePrevStep} />
<Button loading={operating} intent={Intent.PRIMARY} text="Save"
onClick={handleSubmit} />
</Buttons>
diff --git a/config-ui/src/plugins/components/scope-config-select/index.tsx
b/config-ui/src/plugins/components/scope-config-select/index.tsx
index 3cba0b5bf..974d6d88c 100644
--- a/config-ui/src/plugins/components/scope-config-select/index.tsx
+++ b/config-ui/src/plugins/components/scope-config-select/index.tsx
@@ -16,7 +16,7 @@
*
*/
-import { useState, useMemo } from 'react';
+import { useState, useEffect, useMemo } from 'react';
import { Button, Intent } from '@blueprintjs/core';
import { Buttons, Table, IconButton, Dialog } from '@/components';
@@ -30,13 +30,14 @@ import * as S from './styled';
interface Props {
plugin: string;
connectionId: ID;
- onCancel?: () => void;
- onSubmit?: (trId: string) => void;
+ scopeConfigId?: ID;
+ onCancel: () => void;
+ onSubmit: (trId: ID) => void;
}
-export const ScopeConfigSelect = ({ plugin, connectionId, onCancel, onSubmit
}: Props) => {
+export const ScopeConfigSelect = ({ plugin, connectionId, scopeConfigId,
onCancel, onSubmit }: Props) => {
const [version, setVersion] = useState(1);
- const [trId, setTrId] = useState<string>();
+ const [trId, setTrId] = useState<ID>();
const [isOpen, setIsOpen] = useState(false);
const [updatedId, setUpdatedId] = useState<ID>();
@@ -44,6 +45,10 @@ export const ScopeConfigSelect = ({ plugin, connectionId,
onCancel, onSubmit }:
const dataSource = useMemo(() => (data ? data : []), [data]);
+ useEffect(() => {
+ setTrId(scopeConfigId);
+ }, [scopeConfigId]);
+
const handleShowDialog = () => {
setIsOpen(true);
};
@@ -58,14 +63,15 @@ export const ScopeConfigSelect = ({ plugin, connectionId,
onCancel, onSubmit }:
handleShowDialog();
};
- const handleSubmit = async () => {
+ const handleSubmit = async (trId: ID) => {
handleHideDialog();
setVersion((v) => v + 1);
+ setTrId(trId);
};
return (
<S.Wrapper>
- <Buttons position="top" align="left">
+ <Buttons>
<Button icon="add" intent={Intent.PRIMARY} text="Add New Scope Config"
onClick={handleShowDialog} />
</Buttons>
<Table
@@ -84,12 +90,12 @@ export const ScopeConfigSelect = ({ plugin, connectionId,
onCancel, onSubmit }:
rowSelection={{
rowKey: 'id',
type: 'radio',
- selectedRowKeys: trId ? [`${trId}`] : [],
- onChange: (selectedRowKeys) => setTrId(`${selectedRowKeys[0]}`),
+ selectedRowKeys: trId ? [trId] : [],
+ onChange: (selectedRowKeys) => setTrId(selectedRowKeys[0]),
}}
noShadow
/>
- <Buttons>
+ <Buttons position="bottom" align="right">
<Button outlined intent={Intent.PRIMARY} text="Cancel"
onClick={onCancel} />
<Button disabled={!trId} intent={Intent.PRIMARY} text="Save"
onClick={() => trId && onSubmit?.(trId)} />
</Buttons>
diff --git
a/config-ui/src/plugins/register/azure/connection-fields/base-url.tsx
b/config-ui/src/plugins/register/azure/connection-fields/base-url.tsx
index d33ca3a09..99538d761 100644
--- a/config-ui/src/plugins/register/azure/connection-fields/base-url.tsx
+++ b/config-ui/src/plugins/register/azure/connection-fields/base-url.tsx
@@ -16,7 +16,6 @@
*
*/
-import React from 'react';
import { FormGroup, RadioGroup, Radio } from '@blueprintjs/core';
import * as S from './styled';
diff --git a/config-ui/src/plugins/register/azure/transformation.tsx
b/config-ui/src/plugins/register/azure/transformation.tsx
index e5bebbd2b..adcd9e59d 100644
--- a/config-ui/src/plugins/register/azure/transformation.tsx
+++ b/config-ui/src/plugins/register/azure/transformation.tsx
@@ -16,7 +16,7 @@
*
*/
-import React, { useState, useEffect } from 'react';
+import { useState, useEffect } from 'react';
import { Tag, Switch, InputGroup, Intent } from '@blueprintjs/core';
import { ExternalLink, HelpTooltip } from '@/components';
diff --git a/config-ui/src/plugins/register/bitbucket/transformation.tsx
b/config-ui/src/plugins/register/bitbucket/transformation.tsx
index 0dc647035..e6da2dba0 100644
--- a/config-ui/src/plugins/register/bitbucket/transformation.tsx
+++ b/config-ui/src/plugins/register/bitbucket/transformation.tsx
@@ -16,7 +16,7 @@
*
*/
-import React, { useMemo, useState, useEffect } from 'react';
+import { useMemo, useState, useEffect } from 'react';
import { FormGroup, InputGroup, Tag, Intent, Checkbox } from
'@blueprintjs/core';
import { ExternalLink, HelpTooltip, Divider, MultiSelector } from
'@/components';
diff --git
a/config-ui/src/plugins/register/github/components/miller-columns/index.tsx
b/config-ui/src/plugins/register/github/components/miller-columns/index.tsx
index 316eb52f4..2eb2cc522 100644
--- a/config-ui/src/plugins/register/github/components/miller-columns/index.tsx
+++ b/config-ui/src/plugins/register/github/components/miller-columns/index.tsx
@@ -16,7 +16,7 @@
*
*/
-import React, { useState, useEffect } from 'react';
+import { useState, useEffect } from 'react';
import type { McsID, McsItem, McsColumn } from 'miller-columns-select';
import MillerColumnsSelect from 'miller-columns-select';
diff --git
a/config-ui/src/plugins/register/github/connection-fields/authentication.tsx
b/config-ui/src/plugins/register/github/connection-fields/authentication.tsx
index 9cb6e3d0b..311592c9b 100644
--- a/config-ui/src/plugins/register/github/connection-fields/authentication.tsx
+++ b/config-ui/src/plugins/register/github/connection-fields/authentication.tsx
@@ -16,7 +16,7 @@
*
*/
-import React, { useEffect } from 'react';
+import { useEffect } from 'react';
import { FormGroup, RadioGroup, Radio } from '@blueprintjs/core';
import * as S from './styled';
diff --git
a/config-ui/src/plugins/register/github/connection-fields/githubapp.tsx
b/config-ui/src/plugins/register/github/connection-fields/githubapp.tsx
index 5637ad73e..8c717f745 100644
--- a/config-ui/src/plugins/register/github/connection-fields/githubapp.tsx
+++ b/config-ui/src/plugins/register/github/connection-fields/githubapp.tsx
@@ -16,7 +16,7 @@
*
*/
-import React, { useEffect, useState } from 'react';
+import { useEffect, useState } from 'react';
import { Button, FormGroup, InputGroup, MenuItem, TextArea } from
'@blueprintjs/core';
import { Select2 } from '@blueprintjs/select';
diff --git
a/config-ui/src/plugins/register/github/connection-fields/graphql.tsx
b/config-ui/src/plugins/register/github/connection-fields/graphql.tsx
index 26fc16be8..4ce81643b 100644
--- a/config-ui/src/plugins/register/github/connection-fields/graphql.tsx
+++ b/config-ui/src/plugins/register/github/connection-fields/graphql.tsx
@@ -16,7 +16,7 @@
*
*/
-import React, { useEffect } from 'react';
+import { useEffect } from 'react';
import { FormGroup, Switch } from '@blueprintjs/core';
import * as S from './styled';
diff --git a/config-ui/src/plugins/register/github/transformation.tsx
b/config-ui/src/plugins/register/github/transformation.tsx
index 082725be3..8c56067b5 100644
--- a/config-ui/src/plugins/register/github/transformation.tsx
+++ b/config-ui/src/plugins/register/github/transformation.tsx
@@ -16,7 +16,7 @@
*
*/
-import React, { useState, useEffect } from 'react';
+import { useState, useEffect } from 'react';
import { FormGroup, InputGroup, TextArea, Tag, Switch, Icon, Intent, Colors }
from '@blueprintjs/core';
import { ExternalLink, HelpTooltip, Divider } from '@/components';
diff --git a/config-ui/src/plugins/register/gitlab/transformation.tsx
b/config-ui/src/plugins/register/gitlab/transformation.tsx
index 864f380bf..52a4ce00f 100644
--- a/config-ui/src/plugins/register/gitlab/transformation.tsx
+++ b/config-ui/src/plugins/register/gitlab/transformation.tsx
@@ -16,7 +16,7 @@
*
*/
-import React, { useState, useEffect } from 'react';
+import { useState, useEffect } from 'react';
import { Tag, Intent, Switch, InputGroup } from '@blueprintjs/core';
import { ExternalLink, HelpTooltip, Divider } from '@/components';
diff --git
a/config-ui/src/plugins/register/jenkins/components/miller-columns/index.tsx
b/config-ui/src/plugins/register/jenkins/components/miller-columns/index.tsx
index 9a934992e..0c1fd19fa 100644
--- a/config-ui/src/plugins/register/jenkins/components/miller-columns/index.tsx
+++ b/config-ui/src/plugins/register/jenkins/components/miller-columns/index.tsx
@@ -16,7 +16,7 @@
*
*/
-import React, { useState, useEffect } from 'react';
+import { useState, useEffect } from 'react';
import type { McsItem } from 'miller-columns-select';
import MillerColumnsSelect from 'miller-columns-select';
diff --git a/config-ui/src/plugins/register/jenkins/transformation.tsx
b/config-ui/src/plugins/register/jenkins/transformation.tsx
index 5ec2980ed..a7250e0ee 100644
--- a/config-ui/src/plugins/register/jenkins/transformation.tsx
+++ b/config-ui/src/plugins/register/jenkins/transformation.tsx
@@ -16,7 +16,7 @@
*
*/
-import React, { useState, useEffect } from 'react';
+import { useState, useEffect } from 'react';
import { Tag, Intent, Switch, InputGroup } from '@blueprintjs/core';
import * as S from './styled';
diff --git
a/config-ui/src/plugins/register/jira/components/miller-columns/index.tsx
b/config-ui/src/plugins/register/jira/components/miller-columns/index.tsx
index d3bf209a2..c8a92ccdf 100644
--- a/config-ui/src/plugins/register/jira/components/miller-columns/index.tsx
+++ b/config-ui/src/plugins/register/jira/components/miller-columns/index.tsx
@@ -16,7 +16,7 @@
*
*/
-import React, { useState, useEffect } from 'react';
+import { useState, useEffect } from 'react';
import type { McsItem } from 'miller-columns-select';
import MillerColumnsSelect from 'miller-columns-select';
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 b82f9aa21..b1527692a 100644
--- a/config-ui/src/plugins/register/jira/connection-fields/auth.tsx
+++ b/config-ui/src/plugins/register/jira/connection-fields/auth.tsx
@@ -16,7 +16,7 @@
*
*/
-import React, { useState, useEffect } from 'react';
+import { useState, useEffect } from 'react';
import { FormGroup, RadioGroup, Radio, InputGroup } from '@blueprintjs/core';
import { ExternalLink } from '@/components';
diff --git
a/config-ui/src/plugins/register/jira/transformation-fields/cross-domain.tsx
b/config-ui/src/plugins/register/jira/transformation-fields/cross-domain.tsx
index 6db672bd7..f27065ab8 100644
--- a/config-ui/src/plugins/register/jira/transformation-fields/cross-domain.tsx
+++ b/config-ui/src/plugins/register/jira/transformation-fields/cross-domain.tsx
@@ -19,7 +19,7 @@
import { useState, useEffect } from 'react';
import { Radio, Icon, Collapse, InputGroup, Button, Intent } from
'@blueprintjs/core';
-import { ExternalLink, IconButton, Divider } from '@/components';
+import { ExternalLink, IconButton } from '@/components';
import JiraIssueTipsImg from '@/images/jira-issue-tips.png';
import * as S from './styled';
diff --git a/config-ui/src/plugins/register/jira/transformation.tsx
b/config-ui/src/plugins/register/jira/transformation.tsx
index 1b264e4f3..7f13e9e22 100644
--- a/config-ui/src/plugins/register/jira/transformation.tsx
+++ b/config-ui/src/plugins/register/jira/transformation.tsx
@@ -16,7 +16,7 @@
*
*/
-import React, { useState, useEffect, useMemo } from 'react';
+import { useState, useEffect, useMemo } from 'react';
import { FormGroup, Tag, Icon, Intent } from '@blueprintjs/core';
import { Popover2 } from '@blueprintjs/popover2';
import { uniqWith } from 'lodash';
diff --git a/config-ui/src/plugins/register/tapd/transformation.tsx
b/config-ui/src/plugins/register/tapd/transformation.tsx
index eb1bab91b..12450bce5 100644
--- a/config-ui/src/plugins/register/tapd/transformation.tsx
+++ b/config-ui/src/plugins/register/tapd/transformation.tsx
@@ -16,7 +16,7 @@
*
*/
-import React, { useEffect, useState } from 'react';
+import { useEffect, useState } from 'react';
import { FormGroup, Intent, Tag } from '@blueprintjs/core';
import { HelpTooltip, MultiSelector, PageLoading } from '@/components';
diff --git
a/config-ui/src/plugins/register/teambition/connection-fields/tenant-id.tsx
b/config-ui/src/plugins/register/teambition/connection-fields/tenant-id.tsx
index 5b2a66f35..a5d1a64d4 100644
--- a/config-ui/src/plugins/register/teambition/connection-fields/tenant-id.tsx
+++ b/config-ui/src/plugins/register/teambition/connection-fields/tenant-id.tsx
@@ -33,7 +33,7 @@
*
*/
-import React, { useEffect } from 'react';
+import { useEffect } from 'react';
import { FormGroup, InputGroup } from '@blueprintjs/core';
import * as S from './styled';
diff --git
a/config-ui/src/plugins/register/teambition/connection-fields/tenant-type.tsx
b/config-ui/src/plugins/register/teambition/connection-fields/tenant-type.tsx
index 6829555de..613f48b87 100644
---
a/config-ui/src/plugins/register/teambition/connection-fields/tenant-type.tsx
+++
b/config-ui/src/plugins/register/teambition/connection-fields/tenant-type.tsx
@@ -33,7 +33,7 @@
*
*/
-import React, { useEffect } from 'react';
+import { useEffect } from 'react';
import { FormGroup, InputGroup } from '@blueprintjs/core';
import * as S from './styled';
diff --git
a/config-ui/src/plugins/register/webook/components/miller-columns/index.tsx
b/config-ui/src/plugins/register/webook/components/miller-columns/index.tsx
index a14a87583..4812f8d98 100644
--- a/config-ui/src/plugins/register/webook/components/miller-columns/index.tsx
+++ b/config-ui/src/plugins/register/webook/components/miller-columns/index.tsx
@@ -16,7 +16,7 @@
*
*/
-import React, { useState, useEffect } from 'react';
+import { useState, useEffect } from 'react';
import MillerColumnsSelect from 'miller-columns-select';
import { Loading } from '@/components';
diff --git a/config-ui/src/plugins/register/webook/delete-dialog/index.tsx
b/config-ui/src/plugins/register/webook/delete-dialog/index.tsx
index 1670349a6..24941fc93 100644
--- a/config-ui/src/plugins/register/webook/delete-dialog/index.tsx
+++ b/config-ui/src/plugins/register/webook/delete-dialog/index.tsx
@@ -16,8 +16,6 @@
*
*/
-import React from 'react';
-
import { Dialog } from '@/components';
import type { UseDeleteProps } from './use-delete';
diff --git a/config-ui/src/plugins/register/webook/selector-dialog/index.tsx
b/config-ui/src/plugins/register/webook/selector-dialog/index.tsx
index 469cc4daf..2de2d0ae8 100644
--- a/config-ui/src/plugins/register/webook/selector-dialog/index.tsx
+++ b/config-ui/src/plugins/register/webook/selector-dialog/index.tsx
@@ -16,7 +16,7 @@
*
*/
-import React, { useState } from 'react';
+import { useState } from 'react';
import { Dialog } from '@/components';
diff --git
a/config-ui/src/plugins/register/webook/view-or-edit-dialog/index.tsx
b/config-ui/src/plugins/register/webook/view-or-edit-dialog/index.tsx
index d8a447296..f57df34ab 100644
--- a/config-ui/src/plugins/register/webook/view-or-edit-dialog/index.tsx
+++ b/config-ui/src/plugins/register/webook/view-or-edit-dialog/index.tsx
@@ -16,7 +16,6 @@
*
*/
-import React from 'react';
import { InputGroup, Icon } from '@blueprintjs/core';
import { CopyToClipboard } from 'react-copy-to-clipboard';