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

fix(NET-327): remove proxy references #165

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
14 changes: 0 additions & 14 deletions src/components/modals/update-host-modal/UpdateHostModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ export default function UpdateHostModal({ isOpen, host, onUpdateHost, onCancel }

const storeUpdateHost = store.updateHost;
const isStaticVal: Host['isstatic'] = Form.useWatch('isstatic', form);
const proxyEnabledVal: Host['proxy_enabled'] = Form.useWatch('proxy_enabled', form);

const resetModal = () => {
form.resetFields();
Expand Down Expand Up @@ -85,19 +84,6 @@ export default function UpdateHostModal({ isOpen, host, onUpdateHost, onCancel }
<Input placeholder="Endpoint IP" disabled={!isStaticVal} />
</Form.Item>

<Form.Item label="Proxy Status" name="proxy_enabled" valuePropName="checked" rules={[{ required: true }]}>
<Switch />
</Form.Item>

<Form.Item label="Proxy Listen Port" name="proxy_listen_port" rules={[{ required: proxyEnabledVal }]}>
<InputNumber
placeholder="Proxy Listen Port"
min={0}
style={{ width: '100%' }}
disabled={!proxyEnabledVal}
/>
</Form.Item>

<Form.Item label="Default Host" name="isdefault" valuePropName="checked" rules={[{ required: true }]}>
<Switch />
</Form.Item>
Expand Down
3 changes: 0 additions & 3 deletions src/constants/Types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ export const NULL_HOST: Host = {
isstatic: false,
listenport: 0,
localrange: '',
locallistenport: 0,
proxy_listen_port: 0,
mtu: 0,
interfaces: [],
defaultinterface: '',
Expand All @@ -23,7 +21,6 @@ export const NULL_HOST: Host = {
macaddress: '',
internetgateway: '',
nodes: [],
proxy_enabled: false,
isdefault: false,
nat_type: 'public',
};
Expand Down
3 changes: 0 additions & 3 deletions src/models/Host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ export interface Host {
isstatic: boolean;
listenport: number;
localrange: string;
locallistenport: number;
proxy_listen_port: number;
mtu: number;
interfaces: Interface[];
defaultinterface: string; // iface name
Expand All @@ -22,7 +20,6 @@ export interface Host {
macaddress: string;
internetgateway: string;
nodes: Node['id'][];
proxy_enabled: boolean;
isdefault: boolean;
nat_type: 'public' | 'symmetric' | 'asymmetric' | 'double' | '';
}
Expand Down
1 change: 0 additions & 1 deletion src/models/Metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ export interface NodeMetric {
actualuptime: number;
uptime: number;
percentup: number;
collected_by_proxy: boolean;
latency: number;
totalreceived: number;
totalsent: number;
Expand Down
35 changes: 0 additions & 35 deletions src/pages/hosts/HostDetailsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,28 +74,6 @@ export default function HostDetailsPage(props: PageProps) {
setIsEditingHost(false);
}, []);

// const toggleProxyStatus = useCallback(
// (newStatus: boolean) => {
// Modal.confirm({
// title: 'Toggle proxy status',
// content: `Are you sure you want to turn ${newStatus ? 'on' : 'off'} proxy for this host?`,
// onOk: async () => {
// try {
// if (!hostId || !host) return;
// const newHost = (await HostsService.updateHost(hostId, { ...host, proxy_enabled: newStatus })).data;
// storeUpdateHost(hostId, newHost);
// } catch (err) {
// notify.error({
// message: 'Failed to update host',
// description: extractErrorMsg(err as any),
// });
// }
// },
// });
// },
// [hostId, host, storeUpdateHost, notify]
// );

const getHostHealth = useCallback(() => {
const nodeHealths = store.nodes
.filter((n) => n.hostid === host?.id)
Expand Down Expand Up @@ -379,15 +357,6 @@ export default function HostDetailsPage(props: PageProps) {
<Typography.Text>{host.internetgateway}</Typography.Text>
</Col>
</Row>

<Row style={{ borderBottom: `1px solid ${themeToken.colorBorder}`, padding: '.5rem 0rem' }}>
<Col xs={12}>
<Typography.Text disabled>Proxy Listen Port</Typography.Text>
</Col>
<Col xs={12}>
<Typography.Text>{host.listenport}</Typography.Text>
</Col>
</Row>
</Card>
</div>
);
Expand Down Expand Up @@ -471,10 +440,6 @@ export default function HostDetailsPage(props: PageProps) {
</Typography.Title>
</Col>
<Col xs={6} style={{ textAlign: 'right' }}>
{/* <span style={{ marginRight: '2rem' }}>
<Typography.Text style={{ marginRight: '1rem' }}>Proxy Status</Typography.Text>
<Switch checked={host?.proxy_enabled} onChange={toggleProxyStatus} />
</span> */}
<Dropdown
placement="bottomRight"
menu={{
Expand Down
32 changes: 1 addition & 31 deletions src/pages/hosts/HostsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -221,36 +221,6 @@ export default function HostsPage(props: PageProps) {
</div>
),
},
{
title: 'Proxy Status',
dataIndex: 'proxy_enabled',
render(value, host) {
return (
<Switch
checked={value}
onChange={(newStatus: boolean, ev) => {
ev.stopPropagation();
Modal.confirm({
title: 'Toggle proxy status',
content: `Are you sure you want to turn ${newStatus ? 'on' : 'off'} proxy for host ${host.name}?`,
onOk: async () => {
try {
const newHost = (await HostsService.updateHost(host.id, { ...host, proxy_enabled: newStatus }))
.data;
storeUpdateHost(host.id, newHost);
} catch (err) {
notify.error({
message: 'Failed to update host',
description: extractErrorMsg(err as any),
});
}
},
});
}}
/>
);
},
},
// {
// title: 'Relay status',
// render(_, host) {
Expand Down Expand Up @@ -360,7 +330,7 @@ export default function HostsPage(props: PageProps) {
},
},
],
[confirmToggleHostDefaultness, notify, confirmDeleteHost, onEditHost, refreshHostKeys, store.nodes, storeUpdateHost]
[confirmToggleHostDefaultness, confirmDeleteHost, onEditHost, refreshHostKeys, store.nodes]
);

const namHostsTableCols: TableColumnsType<Host> = useMemo(
Expand Down
45 changes: 0 additions & 45 deletions src/pages/hosts/NetworkHostDetailsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ export default function NetworkHostDetailsPage(props: PageProps) {
const { token: themeToken } = theme.useToken();
const queryParams = useQuery();

// const storeUpdateHost = store.updateHost;
const storeDeleteNode = store.deleteNode;
const [isLoading, setIsLoading] = useState(false);
const [isEditingNode, setIsEditingNode] = useState(false);
Expand Down Expand Up @@ -84,28 +83,6 @@ export default function NetworkHostDetailsPage(props: PageProps) {
setIsEditingNode(false);
}, []);

// const toggleProxyStatus = useCallback(
// (newStatus: boolean) => {
// Modal.confirm({
// title: 'Toggle proxy status',
// content: `Are you sure you want to turn ${newStatus ? 'on' : 'off'} proxy for this host?`,
// onOk: async () => {
// try {
// if (!hostId || !host) return;
// const newHost = (await HostsService.updateHost(hostId, { ...host, proxy_enabled: newStatus })).data;
// storeUpdateHost(hostId, newHost);
// } catch (err) {
// notify.error({
// message: 'Failed to update host',
// description: extractErrorMsg(err as any),
// });
// }
// },
// });
// },
// [hostId, host, storeUpdateHost, notify]
// );

const getHostHealth = useCallback(() => {
const nodeHealth: NodeConnectivityStatus = node ? getNodeConnectivityStatus(node) : 'unknown';

Expand Down Expand Up @@ -482,24 +459,6 @@ export default function NetworkHostDetailsPage(props: PageProps) {
<Typography.Text>{host.internetgateway}</Typography.Text>
</Col>
</Row>

<Row style={{ borderBottom: `1px solid ${themeToken.colorBorder}`, padding: '.5rem 0rem' }}>
<Col xs={12}>
<Typography.Text disabled>Proxy Enabled</Typography.Text>
</Col>
<Col xs={12}>
<Typography.Text>{host.proxy_enabled ? 'Yes' : 'No'}</Typography.Text>
</Col>
</Row>

<Row style={{ borderBottom: `1px solid ${themeToken.colorBorder}`, padding: '.5rem 0rem' }}>
<Col xs={12}>
<Typography.Text disabled>Proxy Listen Port</Typography.Text>
</Col>
<Col xs={12}>
<Typography.Text>{host.listenport}</Typography.Text>
</Col>
</Row>
</Collapse.Panel>
</Collapse>
</Card>
Expand Down Expand Up @@ -590,10 +549,6 @@ export default function NetworkHostDetailsPage(props: PageProps) {
</Typography.Title>
</Col>
<Col xs={6} style={{ textAlign: 'right' }}>
{/* <span style={{ marginRight: '2rem' }}>
<Typography.Text style={{ marginRight: '1rem' }}>Proxy Status</Typography.Text>
<Switch checked={host?.proxy_enabled} onChange={toggleProxyStatus} />
</span> */}
<Dropdown
placement="bottomRight"
menu={{
Expand Down
6 changes: 0 additions & 6 deletions src/tests/fixtures/Models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ export const stubHost1: Host = {
isstatic: false,
listenport: 0,
localrange: '',
locallistenport: 0,
proxy_listen_port: 0,
mtu: 0,
interfaces: [],
defaultinterface: '',
Expand All @@ -25,7 +23,6 @@ export const stubHost1: Host = {
macaddress: '',
internetgateway: '',
nodes: [],
proxy_enabled: false,
isdefault: false,
nat_type: 'public',
};
Expand All @@ -41,8 +38,6 @@ export const stubHost2: Host = {
isstatic: false,
listenport: 0,
localrange: '',
locallistenport: 0,
proxy_listen_port: 0,
mtu: 0,
interfaces: [],
defaultinterface: '',
Expand All @@ -51,7 +46,6 @@ export const stubHost2: Host = {
macaddress: '',
internetgateway: '',
nodes: [],
proxy_enabled: false,
isdefault: false,
nat_type: 'asymmetric',
};
Expand Down
3 changes: 0 additions & 3 deletions src/tests/utils/RouteUtils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ const testHost: Host = {
isstatic: false,
listenport: 0,
localrange: '',
locallistenport: 0,
proxy_listen_port: 0,
mtu: 0,
interfaces: [],
defaultinterface: '',
Expand All @@ -30,7 +28,6 @@ const testHost: Host = {
macaddress: '',
internetgateway: '',
nodes: [],
proxy_enabled: false,
isdefault: false,
nat_type: '',
};
Expand Down
3 changes: 0 additions & 3 deletions src/tests/utils/Utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ const testHost1: Host = {
isstatic: false,
listenport: 0,
localrange: '',
locallistenport: 0,
proxy_listen_port: 0,
mtu: 0,
interfaces: [],
defaultinterface: '',
Expand All @@ -61,7 +59,6 @@ const testHost1: Host = {
macaddress: '',
internetgateway: '',
nodes: [],
proxy_enabled: false,
isdefault: false,
nat_type: '',
};
Expand Down
Loading