Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(route): show route id in list and edit views. #2269

Merged
merged 2 commits into from
Jan 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions web/src/locales/en-US/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export default {
'component.global.sendTimeout': 'Send Timeout',
'component.global.receiveTimeout': 'Receive Timeout',
'component.global.name': 'Name',
'component.global.id': 'ID',
'component.global.updateTime': 'Update Time',
'component.global.form.itemExtraMessage.nameGloballyUnique': 'Name should be globally unique',
'component.global.input.placeholder.description':
Expand Down
1 change: 1 addition & 0 deletions web/src/locales/zh-CN/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export default {
'component.global.sendTimeout': '发送超时时间',
'component.global.receiveTimeout': '接收超时时间',
'component.global.name': '名称',
'component.global.id': 'ID',
'component.global.updateTime': '更新时间',

'component.global.popconfirm.title.delete': '确定删除该条记录吗?',
Expand Down
5 changes: 5 additions & 0 deletions web/src/pages/Route/List.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,11 @@ const Page: React.FC = () => {
dataIndex: 'name',
fixed: 'left',
},
{
title: formatMessage({ id: 'component.global.id' }),
hideInSearch: true,
dataIndex: 'id',
},
{
title: formatMessage({ id: 'page.route.host' }),
hideInSearch: true,
Expand Down
22 changes: 21 additions & 1 deletion web/src/pages/Route/components/Step1/MetaView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,23 @@ const MetaView: React.FC<RouteModule.Step1PassProps> = ({
</Form.Item>
);

const Id: React.FC = () => {
if (isEdit) {
return (
<Form.Item label={formatMessage({ id: 'component.global.id' })}>
<Row>
<Col span={10}>
<Form.Item noStyle name="id">
<Input disabled={true} />
</Form.Item>
</Col>
</Row>
</Form.Item>
);
}
return null;
};

const Description: React.FC = () => (
<Form.Item label={formatMessage({ id: 'component.global.description' })}>
<Row>
Expand Down Expand Up @@ -316,7 +333,9 @@ const MetaView: React.FC<RouteModule.Step1PassProps> = ({
showSearch
disabled={disabled}
optionFilterProp="children"
filterOption={(input, option) => option?.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
filterOption={(input, option) =>
option?.children.toLowerCase().indexOf(input.toLowerCase()) >= 0
}
>
{/* TODO: value === '' means no service_id select, need to find a better way */}
<Select.Option value="" key={Math.random().toString(36).substring(7)}>
Expand Down Expand Up @@ -361,6 +380,7 @@ const MetaView: React.FC<RouteModule.Step1PassProps> = ({
return (
<PanelSection title={formatMessage({ id: 'page.route.panelSection.title.nameDescription' })}>
<Name />
<Id />
<NormalLabelComponent />
<VersionLabelComponent />

Expand Down
2 changes: 2 additions & 0 deletions web/src/pages/Route/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ export const transformUpstreamNodes = (
export const transformRouteData = (data: RouteModule.Body) => {
const {
name,
id,
desc,
labels = {},
methods = [],
Expand All @@ -334,6 +335,7 @@ export const transformRouteData = (data: RouteModule.Body) => {

const form1Data: Partial<RouteModule.Form1Data> = {
name,
id,
desc,
status,
hosts: hosts || (host && [host]) || [''],
Expand Down