juzhiyuan commented on a change in pull request #1089:
URL: https://github.com/apache/apisix-dashboard/pull/1089#discussion_r548364908
##########
File path: web/src/pages/Route/components/Step1/RequestConfigView.tsx
##########
@@ -376,6 +383,19 @@ const RequestConfigView:
React.FC<RouteModule.Step1PassProps> = ({
return null;
}}
</Form.Item>
+ <Form.Item
+ label={formatMessage({ id: 'page.route.service' })}
+ name='service_id'
+ >
+ <Select disabled={disabled}>
+ <Select.Option value=''>{}</Select.Option>
+ {serviceList.map(item => {
+ return <Select.Option value={item.id}>
Review comment:
key
##########
File path: web/src/pages/Route/components/Step1/RequestConfigView.tsx
##########
@@ -376,6 +383,19 @@ const RequestConfigView:
React.FC<RouteModule.Step1PassProps> = ({
return null;
}}
</Form.Item>
+ <Form.Item
+ label={formatMessage({ id: 'page.route.service' })}
+ name='service_id'
+ >
+ <Select disabled={disabled}>
+ <Select.Option value=''>{}</Select.Option>
Review comment:

##########
File path: web/src/pages/Route/components/Step1/RequestConfigView.tsx
##########
@@ -376,6 +383,19 @@ const RequestConfigView:
React.FC<RouteModule.Step1PassProps> = ({
return null;
}}
</Form.Item>
+ <Form.Item
+ label={formatMessage({ id: 'page.route.service' })}
+ name='service_id'
+ >
+ <Select disabled={disabled}>
+ <Select.Option value=''>{}</Select.Option>
Review comment:
how about using a global default value for the selector? e.g
`DEFAULT_SELECT_VALUE`
Then we could omit those fields using a global filter.
##########
File path: web/src/pages/Route/service.ts
##########
@@ -99,3 +99,9 @@ export const debugRoute = (data: RouteModule.debugRequest) =>
{
data,
});
};
+
+export const fetchServiceList = () =>
+ request('/services').then(({ data }) => ({
+ data: data.rows,
+ total: data.total_size,
+ }));
Review comment:
new line please
##########
File path: web/src/pages/Route/transform.ts
##########
@@ -150,6 +152,7 @@ export const transformRouteData = (data: RouteModule.Body)
=> {
status,
upstream,
upstream_id,
+ service_id,
Review comment:
should have a default empty string value, or maybe crashed due to
undefined.length
##########
File path: web/src/pages/Route/transform.ts
##########
@@ -83,6 +83,7 @@ export const transformStepData = ({
'redirectURI',
'ret_code',
'redirectOption',
+ form1Data.service_id.length === 0 ? 'service_id' : '',
Review comment:
trick, because default_service_id is empty string
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]