Skip to content

Commit

Permalink
feat: added websocket tab for route (#1079)
Browse files Browse the repository at this point in the history
* feat: added websocket tab for route

* Update RequestConfigView.tsx

Co-authored-by: 琚致远 <juzhiyuan@apache.org>
  • Loading branch information
guoqqqi and juzhiyuan authored Dec 21, 2020
1 parent e786ef6 commit 0a0bcab
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion web/src/pages/Route/components/Step1/RequestConfigView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
import React from 'react';
import Form from 'antd/es/form';
import { Button, Input, Select, Row, Col, InputNumber } from 'antd';
import { Button, Input, Select, Row, Col, InputNumber, Switch } from 'antd';
import { PlusOutlined, MinusCircleOutlined } from '@ant-design/icons';
import { useIntl } from 'umi';
import { PanelSection } from '@api7-dashboard/ui';
Expand Down Expand Up @@ -294,6 +294,9 @@ const RequestConfigView: React.FC<RouteModule.Step1PassProps> = ({
disabled={disabled}
/>
</Form.Item>
<Form.Item label="Websocket" valuePropName="checked" name="enable_websocket">
<Switch disabled={disabled} />
</Form.Item>
<Form.Item
label={formatMessage({ id: 'page.route.form.itemLabel.redirect' })}
name="redirectOption"
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 @@ -148,6 +148,7 @@ export const transformRouteData = (data: RouteModule.Body) => {
upstream,
upstream_id,
priority = 0,
enable_websocket
} = data;
const form1Data: Partial<RouteModule.Form1Data> = {
name,
Expand All @@ -159,6 +160,7 @@ export const transformRouteData = (data: RouteModule.Body) => {
// @ts-ignore
methods: methods.length ? methods : ["ALL"],
priority,
enable_websocket
};

const redirect = data.plugins?.redirect || {};
Expand Down
2 changes: 2 additions & 0 deletions web/src/pages/Route/typing.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ declare namespace RouteModule {
};
script: Record<string, any>;
url?: string;
enable_websocket?: boolean;
};

// step1
Expand Down Expand Up @@ -140,6 +141,7 @@ declare namespace RouteModule {
redirectURI?: string;
ret_code?: number;
status: boolean;
enable_websocket?: boolean;
};

type AdvancedMatchingRules = {
Expand Down

0 comments on commit 0a0bcab

Please sign in to comment.