Skip to content

Commit

Permalink
fix(config-ui): adjust the table component
Browse files Browse the repository at this point in the history
  • Loading branch information
mintsweet committed Nov 14, 2023
1 parent cb4b897 commit f6045b8
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 36 deletions.
5 changes: 3 additions & 2 deletions config-ui/src/pages/blueprint/connection-detail/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ export const BlueprintConnectionDetailPage = () => {
)}
</Buttons>
<Table
rowKey="id"
size="middle"
columns={[
{
title: 'Data Scope',
Expand All @@ -224,9 +226,8 @@ export const BlueprintConnectionDetailPage = () => {
},
{
title: 'Scope Config',
dataIndex: ['scopeConfigId', 'scopeConfigName'],
key: 'scopeConfig',
render: ({ scopeConfigId, scopeConfigName }) => (scopeConfigId ? scopeConfigName : 'N/A'),
render: (_, { scopeConfigId, scopeConfigName }) => (scopeConfigId ? scopeConfigName : 'N/A'),
},
]}
dataSource={scopes}
Expand Down
4 changes: 4 additions & 0 deletions config-ui/src/pages/blueprint/detail/configuration-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ export const ConfigurationPanel = ({ from, blueprint, onRefresh, onChangeTab }:
<IconButton icon="annotation" tooltip="Edit" onClick={handleShowPolicyDialog} />
</h3>
<Table
rowKey="id"
size="middle"
columns={[
{
title: 'Data Time Range',
Expand Down Expand Up @@ -162,12 +164,14 @@ export const ConfigurationPanel = ({ from, blueprint, onRefresh, onChangeTab }:
]}
dataSource={[
{
id: blueprint.id,
timeRange: blueprint.timeAfter,
frequency: blueprint.cronConfig,
isManual: blueprint.isManual,
skipFailed: blueprint.skipOnFail,
},
]}
pagination={false}
/>
</div>
{blueprint.mode === IBPMode.NORMAL && (
Expand Down
22 changes: 8 additions & 14 deletions config-ui/src/pages/blueprint/home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,35 +112,31 @@ export const BlueprintHomePage = () => {
<Button icon="plus" intent={Intent.PRIMARY} text="New Blueprint" onClick={handleShowDialog} />
</div>
<Table
rowKey="id"
size="middle"
loading={!ready}
columns={[
{
title: 'Blueprint Name',
dataIndex: ['id', 'name'],
key: 'name',
render: ({ id, name }) => (
render: (_, { id, name }) => (
<Link to={`/blueprints/${id}?tab=configuration`} style={{ color: '#292b3f' }}>
<TextTooltip content={name}>{name}</TextTooltip>
</Link>
),
},
{
title: 'Data Connections',
dataIndex: ['mode', 'connections'],
key: 'connections',
render: ({ mode, connections }: Pick<IBlueprint, 'mode' | 'connections'>) => {
render: (_, { mode, connections }: Pick<IBlueprint, 'mode' | 'connections'>) => {
if (mode === IBPMode.ADVANCED) {
return 'Advanced Mode';
}
return (
<S.ConnectionList>
{connections.map((it) => (
<li>
<ConnectionName
key={`${it.pluginName}-${it.connectionId}`}
plugin={it.pluginName}
connectionId={it.connectionId}
/>
<li key={`${it.pluginName}-${it.connectionId}`}>
<ConnectionName plugin={it.pluginName} connectionId={it.connectionId} />
</li>
))}
</S.ConnectionList>
Expand All @@ -149,20 +145,18 @@ export const BlueprintHomePage = () => {
},
{
title: 'Frequency',
dataIndex: ['isManual', 'cronConfig'],
key: 'frequency',
width: 100,
render: ({ isManual, cronConfig }) => {
render: (_, { isManual, cronConfig }) => {
const cron = getCron(isManual, cronConfig);
return cron.label;
},
},
{
title: 'Next Run Time',
dataIndex: ['isManual', 'cronConfig'],
key: 'nextRunTime',
width: 200,
render: ({ isManual, cronConfig }) => {
render: (_, { isManual, cronConfig }) => {
const cron = getCron(isManual, cronConfig);
return formatTime(cron.nextTime);
},
Expand Down
6 changes: 3 additions & 3 deletions config-ui/src/pages/connection/detail/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,8 @@ export const ConnectionDetailPage = () => {
)}
</Buttons>
<Table
rowKey={(row) => row.id}
rowKey="id"
size="middle"
loading={!ready}
columns={[
{
Expand Down Expand Up @@ -296,10 +297,9 @@ export const ConnectionDetailPage = () => {
},
{
title: 'Scope Config',
dataIndex: ['id', 'configId', 'configName'],
key: 'scopeConfig',
width: 400,
render: ({ id, configId, configName }) => (
render: (_, { id, configId, configName }) => (
<>
<span>{configId ? configName : 'N/A'}</span>
{pluginConfig.scopeConfig && (
Expand Down
13 changes: 5 additions & 8 deletions config-ui/src/pages/project/home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ export const ProjectHomePage = () => {
extra={<Button intent={Intent.PRIMARY} icon="plus" text="New Project" onClick={handleShowDialog} />}
>
<Table
rowKey="name"
size="middle"
loading={!ready}
columns={[
{
Expand All @@ -145,22 +147,17 @@ export const ProjectHomePage = () => {
) : (
<S.ConnectionList>
{val.map((it) => (
<li>
<ConnectionName
key={`${it.pluginName}-${it.connectionId}`}
plugin={it.pluginName}
connectionId={it.connectionId}
/>
<li key={`${it.pluginName}-${it.connectionId}`}>
<ConnectionName plugin={it.pluginName} connectionId={it.connectionId} />
</li>
))}
</S.ConnectionList>
),
},
{
title: 'Sync Frequency',
dataIndex: ['isManual', 'cronConfig'],
key: 'frequency',
render: ({ isManual, cronConfig }) => {
render: (_, { isManual, cronConfig }) => {
const cron = getCron(isManual, cronConfig);
return cron.label;
},
Expand Down
6 changes: 4 additions & 2 deletions config-ui/src/plugins/components/connection-list/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ export const ConnectionList = ({ plugin, onCreate }: Props) => {
return (
<>
<Table
rowKey="id"
size="small"
columns={[
{
title: 'Connection Name',
Expand All @@ -55,13 +57,13 @@ export const ConnectionList = ({ plugin, onCreate }: Props) => {
},
{
title: '',
dataIndex: ['plugin', 'id'],
key: 'link',
width: 100,
render: ({ plugin, id }) => <Link to={`/connections/${plugin}/${id}`}>Details</Link>,
render: (_, { plugin, id }) => <Link to={`/connections/${plugin}/${id}`}>Details</Link>,
},
]}
dataSource={connections}
pagination={false}
/>
<Button
style={{ marginTop: 16 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ export const ScopeConfigSelect = ({ plugin, connectionId, scopeConfigId, onCance
<Button icon="add" intent={Intent.PRIMARY} text="Add New Scope Config" onClick={handleShowDialog} />
</Buttons>
<Table
rowKey="id"
size="small"
loading={!ready}
columns={[
{ title: 'Name', dataIndex: 'name', key: 'name' },
Expand All @@ -93,6 +95,7 @@ export const ScopeConfigSelect = ({ plugin, connectionId, scopeConfigId, onCance
selectedRowKeys: trId ? [trId] : [],
onChange: (selectedRowKeys) => setTrId(selectedRowKeys[0]),
}}
pagination={false}
/>
<Buttons position="bottom" align="right">
<Button outlined intent={Intent.PRIMARY} text="Cancel" onClick={onCancel} />
Expand Down
9 changes: 6 additions & 3 deletions config-ui/src/plugins/register/webhook/connection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,9 @@ export const WebHookConnection = ({ filterIds, onCreateAfter, onDeleteAfter }: P

return (
<S.Wrapper>
<Buttons position="top">
<Button icon="plus" text="Add a Webhook" intent={Intent.PRIMARY} onClick={() => handleShowDialog('add')} />
</Buttons>
<Table
rowKey="id"
size="middle"
columns={[
{
title: 'ID',
Expand Down Expand Up @@ -86,7 +85,11 @@ export const WebHookConnection = ({ filterIds, onCreateAfter, onDeleteAfter }: P
},
]}
dataSource={webhooks.filter((cs) => (filterIds ? filterIds.includes(cs.id) : true))}
pagination={false}
/>
<Buttons position="bottom">
<Button icon="plus" text="Add a Webhook" intent={Intent.PRIMARY} onClick={() => handleShowDialog('add')} />
</Buttons>
{type === 'add' && (
<CreateDialog isOpen onCancel={handleHideDialog} onSubmitAfter={(id) => onCreateAfter?.(id)} />
)}
Expand Down
2 changes: 2 additions & 0 deletions config-ui/src/routes/api-keys/api-keys.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ export const ApiKeys = () => {
>
<p>You can generate and manage your API keys to access the DevLake API.</p>
<Table
rowKey="id"
size="middle"
loading={!ready}
columns={[
{
Expand Down
2 changes: 0 additions & 2 deletions config-ui/src/routes/layout/styled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import { Navbar } from '@blueprintjs/core';
export const Wrapper = styled.div`
display: flex;
height: 100vh;
background-color: #f9f9fa;
overflow: hidden;
`;

Expand Down Expand Up @@ -89,7 +88,6 @@ export const Sider = styled.div`

export const Header = styled(Navbar)`
flex: 0 0 50px;
background-color: #f9f9fa;
box-shadow: none;
a {
Expand Down
5 changes: 3 additions & 2 deletions config-ui/src/routes/pipeline/components/table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ export const PipelineTable = ({ dataSource, pagination, noData }: Props) => {
return (
<>
<Table
rowKey="id"
size="middle"
columns={[
{
title: 'ID',
Expand Down Expand Up @@ -98,9 +100,8 @@ export const PipelineTable = ({ dataSource, pagination, noData }: Props) => {
},
{
title: 'Duration',
dataIndex: ['status', 'beganAt', 'finishedAt'],
key: 'duration',
render: ({ status, beganAt, finishedAt }) => (
render: (_, { status, beganAt, finishedAt }) => (
<PipelineDuration status={status} beganAt={beganAt} finishedAt={finishedAt} />
),
},
Expand Down

0 comments on commit f6045b8

Please sign in to comment.