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 2023/12/15 09:40:34 UTC
(incubator-devlake) branch refactor-6307 created (now 34aae9cc6)
This is an automated email from the ASF dual-hosted git repository.
mintsweet pushed a change to branch refactor-6307
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
at 34aae9cc6 refactor(config-ui): use new ui form component to replace old
This branch includes the following new commits:
new 34aae9cc6 refactor(config-ui): use new ui form component to replace old
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(incubator-devlake) 01/01: refactor(config-ui): use new ui form component to replace old
Posted by mi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
mintsweet pushed a commit to branch refactor-6307
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
commit 34aae9cc6cf85aac16ddb1909f07250b98ee8564
Author: mintsweet <0x...@gmail.com>
AuthorDate: Fri Dec 15 22:40:22 2023 +1300
refactor(config-ui): use new ui form component to replace old
---
.../detail/components/advanced-editor/index.tsx | 22 ++++++++++++-----
.../src/pages/blueprint/detail/status-panel.tsx | 8 +++----
.../connection-form/fields/rate-limit.tsx | 28 ++++------------------
.../github/connection-fields/githubapp.tsx | 3 +--
.../register/github/connection-fields/graphql.tsx | 6 ++---
5 files changed, 29 insertions(+), 38 deletions(-)
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 efebee958..5f6e08db3 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,9 @@
*
*/
-import { TextArea, ButtonGroup, Button, Menu, MenuItem, Position } from '@blueprintjs/core';
+import { ClearOutlined, CaretDownOutlined } from '@ant-design/icons';
+import { Space, Input, Button } from 'antd';
+import { Menu, MenuItem, Position } from '@blueprintjs/core';
import { Popover2 } from '@blueprintjs/popover2';
import styled from 'styled-components';
@@ -65,9 +67,15 @@ export const AdvancedEditor = ({ value, onChange }: Props) => {
<span>Enter JSON Configuration or preload from a template.</span>
<ExternalLink link={DOC_URL.ADVANCED_MODE.EXAMPLES}>See examples</ExternalLink>
</p>
- <TextArea fill value={value} onChange={(e) => onChange(e.target.value)} />
- <ButtonGroup minimal>
- <Button small text="Reset" icon="eraser" onClick={() => onChange(JSON.stringify([[]], null, ' '))} />
+ <Input.TextArea rows={6} value={value} onChange={(e) => onChange(e.target.value)} />
+ <Space>
+ <Button
+ size="small"
+ icon={<ClearOutlined rev={undefined} />}
+ onClick={() => onChange(JSON.stringify([[]], null, ' '))}
+ >
+ Reset
+ </Button>
<Popover2
placement={Position.TOP}
content={
@@ -83,10 +91,12 @@ export const AdvancedEditor = ({ value, onChange }: Props) => {
</Menu>
}
renderTarget={({ ref, ...targetProps }) => (
- <Button {...targetProps} ref={ref} small text="Load Templates" rightIcon="caret-down" />
+ <Button {...targetProps} ref={ref} size="small" icon={<CaretDownOutlined rev={undefined} />}>
+ Load Templates
+ </Button>
)}
/>
- </ButtonGroup>
+ </Space>
</Wrapper>
);
};
diff --git a/config-ui/src/pages/blueprint/detail/status-panel.tsx b/config-ui/src/pages/blueprint/detail/status-panel.tsx
index 39b827fc0..b9175295d 100644
--- a/config-ui/src/pages/blueprint/detail/status-panel.tsx
+++ b/config-ui/src/pages/blueprint/detail/status-panel.tsx
@@ -19,8 +19,8 @@
import { useState, useMemo } from 'react';
import { useNavigate } from 'react-router-dom';
import { MoreOutlined, DeleteOutlined } from '@ant-design/icons';
-import { Card, Modal, Button, Tooltip } from 'antd';
-import { Switch, Position, Popover, Menu, MenuItem } from '@blueprintjs/core';
+import { Card, Modal, Switch, Button, Tooltip } from 'antd';
+import { Position, Popover, Menu, MenuItem } from '@blueprintjs/core';
import { Tooltip2 } from '@blueprintjs/popover2';
import API from '@/api';
@@ -163,11 +163,11 @@ export const StatusPanel = ({ from, blueprint, pipelineId, onRefresh }: Props) =
<Button onClick={() => handleRun({})}>Run Now</Button>
<Switch
style={{ marginBottom: 0 }}
- label="Blueprint Enabled"
disabled={!!blueprint.projectName}
checked={blueprint.enable}
- onChange={(e) => handleUpdate({ enable: (e.target as HTMLInputElement).checked })}
+ onChange={(enable) => handleUpdate({ enable })}
/>
+ Blueprint Enabled
<Tooltip title="Delete Blueprint">
<Button
type="primary"
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 341714824..4a7eaf840 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
@@ -15,26 +15,9 @@
* limitations under the License.
*
*/
-/*
- * 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 { useState, useEffect } from 'react';
-import { Switch, NumericInput } from '@blueprintjs/core';
+import { Switch, InputNumber } from 'antd';
import { Block, ExternalLink } from '@/components';
@@ -72,8 +55,7 @@ export const ConnectionRateLimit = ({
setChecked(value ? true : false);
}, [value]);
- const handleChange = (e: React.FormEvent<HTMLInputElement>) => {
- const checked = (e.target as HTMLInputElement).checked;
+ const handleChange = (checked: boolean) => {
if (checked) {
setValue(defaultValue);
} else {
@@ -82,8 +64,8 @@ export const ConnectionRateLimit = ({
setChecked(checked);
};
- const handleChangeValue = (value: number) => {
- setValue(value);
+ const handleChangeValue = (value: number | null) => {
+ setValue(value ?? 0);
};
return (
@@ -99,7 +81,7 @@ export const ConnectionRateLimit = ({
<Switch checked={checked} onChange={handleChange} />
{checked && (
<>
- <NumericInput buttonPosition="none" min={0} value={value} onValueChange={handleChangeValue} />
+ <InputNumber min={0} value={value} onChange={handleChangeValue} />
<span>requests/hour</span>
</>
)}
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 a641036f8..0355be9b9 100644
--- a/config-ui/src/plugins/register/github/connection-fields/githubapp.tsx
+++ b/config-ui/src/plugins/register/github/connection-fields/githubapp.tsx
@@ -18,7 +18,6 @@
import { useEffect, useState } from 'react';
import { Select, Input } from 'antd';
-import { TextArea } from '@blueprintjs/core';
import API from '@/api';
import { Block, ExternalLink } from '@/components';
@@ -168,7 +167,7 @@ export const GithubApp = ({ endpoint, proxy, initialValue, value, error, setValu
</S.Input>
<S.Input>
<div className="input">
- <TextArea
+ <Input.TextArea
cols={90}
rows={15}
placeholder="Private key"
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 d17a0d4b8..401890bd3 100644
--- a/config-ui/src/plugins/register/github/connection-fields/graphql.tsx
+++ b/config-ui/src/plugins/register/github/connection-fields/graphql.tsx
@@ -17,7 +17,7 @@
*/
import { useEffect } from 'react';
-import { Switch } from '@blueprintjs/core';
+import { Switch } from 'antd';
import { Block } from '@/components';
@@ -32,8 +32,8 @@ export const Graphql = ({ initialValue, value, setValue }: Props) => {
setValue(initialValue);
}, [initialValue]);
- const handleChange = (e: React.FormEvent<HTMLInputElement>) => {
- setValue((e.target as HTMLInputElement).checked);
+ const handleChange = (checked: boolean) => {
+ setValue(checked);
};
return (