Compare commits

..
Author SHA1 Message Date
Sarooj Bukhari ee21c424a2 fix table jerks 2023-07-10 16:58:19 +05:00
Sarooj Bukhari 40cf40829c fix table jerks 2023-07-10 16:54:45 +05:00
Sarooj Bukhari 30cd602e41 update 2023-07-10 16:49:13 +05:00
Sarooj bukhari 09ae157be3 Re-work DNS layout (#222) 2023-07-10 09:03:27 +02:00
Sarooj Bukhari a11511ecbf fix comments 2023-07-10 08:27:48 +05:00
Sarooj Bukhari 2ac5504bee fix comments 2023-07-10 08:26:18 +05:00
braginini f6476ecf05 All nameservers by default in the table 2023-07-09 11:31:48 +02:00
Sarooj Bukhari c8108ef01f fix delete issue 2023-07-07 20:11:06 +05:00
Sarooj Bukhari ad4e54129a fix delete issue 2023-07-07 20:07:00 +05:00
Sarooj Bukhari 57318de4c6 fix issue of CLA 2023-07-07 19:17:58 +05:00
Sarooj Bukhari 70c2f973ef fix issue of CLA 2023-07-07 19:15:25 +05:00
Sarooj Bukhari 3bbe1079af work on DNS layout 2023-07-07 19:14:54 +05:00
Sarooj Bukhari 923c00b70c work on DNS layout 2023-07-07 18:31:31 +05:00
pascal-fischer cb89eeb921 Fix default value for expiration for setup keys (#221)
* fix initial value for setup keys so default works

* fix initial value for setup keys so default works
2023-07-07 12:40:51 +02:00
18 changed files with 2232 additions and 1129 deletions

No files matched your search

File diff suppressed because it is too large. Load diff
File diff suppressed because it is too large. Load diff
-1
View File
@@ -366,7 +366,6 @@ const PeerUpdate = () => {
noUpdateToName() &&
noUpdateToLoginExpiration()
) {
console.log("no group update==<");
const style = { marginTop: 85 };
if (savedGroups.loading) {
message.loading({
-1
View File
@@ -234,7 +234,6 @@ const RoutePeerUpdate = () => {
style: styleNotification,
});
} else if (savedRoute.success) {
console.log("savedRoute", savedRoute);
message.success({
content: "Route has been successfully updated.",
key: saveKey,
-1
View File
@@ -259,7 +259,6 @@ const RouteAddNew = () => {
style: styleNotification,
});
} else if (savedRoute.success) {
console.log("savedRoute", savedRoute);
message.success({
content: "Route has been successfully added.",
key: saveKey,
-1
View File
@@ -371,7 +371,6 @@ const SetupKeyNew = () => {
form={form}
onValuesChange={onChange}
initialValues={{
expires_in: 7,
usage_limit: 1,
}}
>
+26
View File
@@ -211,6 +211,9 @@ td.non-highlighted-table-column {
.ant-form-item-explain-error {
font-weight: 500;
font-size: 12px;
line-height: 14px;
margin-top: 2px;
}
.menlo-font,
@@ -441,4 +444,27 @@ ul.ant-list-items {
position: absolute;
top: 10px;
right: 2px;
}
.blue-color {
color: #1890FF;
}
.style-like-text .ant-select-selector {
background: transparent !important;
border: none !important;
padding: 0 !important;
color: rgba(0, 0, 0, 1) !important;
}
.style-like-text .ant-select-selection-search::after {
display: none !important;
}
.style-like-text .ant-select-selection-item {
padding-inline-end: 0 !important;
}
.style-like-text .ant-select-arrow {
display: none !important;
}
+1
View File
@@ -28,6 +28,7 @@ const actions = {
setNameServerGroup: createAction('SET_NameServerGroup')<NameServerGroup>(),
setSetupNewNameServerGroupVisible: createAction('SET_SETUP_NEW_NameServerGroup_VISIBLE')<boolean>(),
setSetupEditNameServerGroupVisible: createAction('SET_SETUP_EDIT_NameServerGroup_VISIBLE')<boolean>(),
setSetupNewNameServerGroupHA: createAction('SET_SETUP_NEW_NameServerGroup_HA')<boolean>()
};
+10 -4
View File
@@ -13,6 +13,7 @@ type StateType = Readonly<{
deleteNameServerGroup: DeleteResponse<string | null>;
savedNameServerGroup: CreateResponse<NameServerGroup | null>;
setupNewNameServerGroupVisible: boolean;
setupEditNameServerGroupVisible: boolean;
setupNewNameServerGroupHA: boolean
}>;
@@ -27,17 +28,18 @@ const initialState: StateType = {
success: false,
failure: false,
error: null,
data : null
data: null,
},
savedNameServerGroup: <CreateResponse<NameServerGroup | null>>{
loading: false,
success: false,
failure: false,
error: null,
data : null
data: null,
},
setupNewNameServerGroupVisible: false,
setupNewNameServerGroupHA: false
setupEditNameServerGroupVisible: false,
setupNewNameServerGroupHA: false,
};
const data = createReducer<NameServerGroup[], ActionTypes>(initialState.data as NameServerGroup[])
@@ -79,6 +81,9 @@ const savedNameServerGroup = createReducer<CreateResponse<NameServerGroup | null
const setupNewNameServerGroupVisible = createReducer<boolean, ActionTypes>(initialState.setupNewNameServerGroupVisible)
.handleAction(actions.setSetupNewNameServerGroupVisible, (store, action) => action.payload)
const setupEditNameServerGroupVisible = createReducer<boolean, ActionTypes>(initialState.setupEditNameServerGroupVisible)
.handleAction(actions.setSetupEditNameServerGroupVisible, (store, action) => action.payload)
const setupNewNameServerGroupHA = createReducer<boolean, ActionTypes>(initialState.setupNewNameServerGroupHA)
.handleAction(actions.setSetupNewNameServerGroupHA, (store, action) => action.payload)
@@ -91,5 +96,6 @@ export default combineReducers({
deletedNameServerGroup,
savedNameServerGroup,
setupNewNameServerGroupVisible,
setupNewNameServerGroupHA
setupEditNameServerGroupVisible,
setupNewNameServerGroupHA,
});
+2 -2
View File
@@ -118,13 +118,13 @@ export function* setDeleteNameServerGroup(action: ReturnType<typeof actions.set
export function* deleteNameServerGroup(action: ReturnType<typeof actions.deleteNameServerGroup.request>): Generator {
try {
yield call(actions.setDeletedNameServerGroup,{
yield put(actions.setDeletedNameServerGroup({
loading: true,
success: false,
failure: false,
error: null,
data: null
} as DeleteResponse<string | null>)
}))
const effect = yield call(service.deletedNameServerGroup, action.payload);
const response = effect as ApiResponse<any>;
+14 -15
View File
@@ -1,21 +1,20 @@
export interface NameServerGroup {
id?: string
name: string
description: string
primary: boolean
domains: string[]
nameservers: NameServer[]
groups: string[]
enabled: boolean
id?: string;
name: string;
description: string;
primary: boolean;
domains: string[];
nameservers: NameServer[];
groups: string[];
enabled: boolean;
}
export interface NameServer {
ip: string
ns_type: string
port: number
ip: string;
ns_type: string;
port: number;
}
export interface NameServerGroupToSave extends NameServerGroup
{
groupsToCreate: string[]
}
export interface NameServerGroupToSave extends NameServerGroup {
groupsToCreate?: string[];
}
+9 -7
View File
@@ -174,13 +174,15 @@ export function* deletePolicy(
action: ReturnType<typeof actions.deletePolicy.request>
): Generator {
try {
yield call(actions.setDeletedPolicy, {
loading: true,
success: false,
failure: false,
error: null,
data: null,
} as DeleteResponse<string | null>);
yield put(
actions.setDeletedPolicy({
loading: true,
success: false,
failure: false,
error: null,
data: null,
})
);
const effect = yield call(service.deletedPolicy, action.payload);
const response = effect as ApiResponse<any>;
+41 -43
View File
@@ -473,7 +473,7 @@ export const AccessControl = () => {
};
const renderPorts = (ports: string[]) => {
if (!ports) {
if (!ports) {
return (
<Tag style={{ marginRight: 3 }}>
<span className="menlo-font">ALL</span>
@@ -549,7 +549,6 @@ export const AccessControl = () => {
})
);
};
console.log("dataTable", dataTable);
return (
<>
{!setupEditPolicyVisible && (
@@ -662,7 +661,46 @@ export const AccessControl = () => {
/>
)}
<Card bodyStyle={{ padding: 0 }}>
{!showTutorial && (
{showTutorial && !loading ? (
<Space
direction="vertical"
size="small"
align="center"
style={{
display: "flex",
padding: "45px 15px",
justifyContent: "center",
}}
>
<Title level={4} style={{ textAlign: "center" }}>
Create New Rule
</Title>
<Paragraph
style={{
textAlign: "center",
whiteSpace: "pre-line",
}}
>
It looks like you don't have any rules. {"\n"}
Get started with access control by adding a new one.
<a
target="_blank"
rel="noreferrer"
href="https://docs.netbird.io/how-to/manage-network-access"
>
{" "}
Learn more
</a>
</Paragraph>
<Button
size={"middle"}
type="primary"
onClick={() => onClickAddNewPolicy()}
>
Add rule
</Button>
</Space>
) : (
<Table
pagination={{
current: currentPage,
@@ -826,46 +864,6 @@ export const AccessControl = () => {
/>
</Table>
)}
{showTutorial && (
<Space
direction="vertical"
size="small"
align="center"
style={{
display: "flex",
padding: "45px 15px",
justifyContent: "center",
}}
>
<Title level={4} style={{ textAlign: "center" }}>
Create New Rule
</Title>
<Paragraph
style={{
textAlign: "center",
whiteSpace: "pre-line",
}}
>
It looks like you don't have any rules. {"\n"}
Get started with access control by adding a new one.
<a
target="_blank"
rel="noreferrer"
href="https://docs.netbird.io/how-to/manage-network-access"
>
{" "}
Learn more
</a>
</Paragraph>
<Button
size={"middle"}
type="primary"
onClick={() => onClickAddNewPolicy()}
>
Add rule
</Button>
</Space>
)}
</Card>
</Space>
</Col>
+79 -66
View File
@@ -1,78 +1,91 @@
import React, {useEffect, useState} from 'react';
import {Container} from "../components/Container";
import {
Col,
Row,
Tabs,
Typography,
} from "antd";
import type { TabsProps } from 'antd';
import React, { useEffect, useState } from "react";
import { Container } from "../components/Container";
import { Col, Row, Tabs, Typography } from "antd";
import type { TabsProps } from "antd";
import NameServerGroupUpdate from "../components/NameServerGroupUpdate";
import NameServerGroupAdd from "../components/NameServerGroupAdd";
import Nameservers from "./Nameservers";
import {actions as groupActions} from "../store/group";
import {useGetTokenSilently} from "../utils/token";
import {useDispatch, useSelector} from "react-redux";
import { actions as groupActions } from "../store/group";
import { useGetTokenSilently } from "../utils/token";
import { useDispatch, useSelector } from "react-redux";
import DNSSettingsForm from "./DNSSettings";
import {RootState} from "typesafe-actions";
import {actions as dnsSettingsActions} from '../store/dns-settings';
import {useGetGroupTagHelpers} from "../utils/groups";
import { RootState } from "typesafe-actions";
import { actions as dnsSettingsActions } from "../store/dns-settings";
import { useGetGroupTagHelpers } from "../utils/groups";
const {Title, Paragraph} = Typography;
const { Title, Paragraph } = Typography;
export const DNS = () => {
const {getTokenSilently} = useGetTokenSilently()
const dispatch = useDispatch()
const {
getGroupNamesFromIDs,
} = useGetGroupTagHelpers()
const { getTokenSilently } = useGetTokenSilently();
const dispatch = useDispatch();
const { getGroupNamesFromIDs } = useGetGroupTagHelpers();
const dnsSettingsData = useSelector((state: RootState) => state.dnsSettings.data)
const dnsSettingsData = useSelector(
(state: RootState) => state.dnsSettings.data
);
const setupEditNameServerGroupVisible = useSelector(
(state: RootState) => state.nameserverGroup.setupEditNameServerGroupVisible
);
const setupNewNameServerGroupVisible = useSelector(
(state: RootState) => state.nameserverGroup.setupNewNameServerGroupVisible
);
useEffect(() => {
dispatch(
groupActions.getGroups.request({
getAccessTokenSilently: getTokenSilently,
payload: null,
})
);
}, []);
useEffect(() => {
dispatch(groupActions.getGroups.request({getAccessTokenSilently: getTokenSilently, payload: null}));
}, [])
const nsTabKey = "1";
const items: TabsProps["items"] = [
{
key: nsTabKey,
label: "Nameservers",
children: <Nameservers />,
},
{
key: "2",
label: "Settings",
children: <DNSSettingsForm />,
},
];
const nsTabKey = '1'
const items: TabsProps['items'] = [
{
key: nsTabKey,
label: 'Nameservers',
children: <Nameservers/>,
},
{
key: '2',
label: 'Settings',
children: <DNSSettingsForm/>,
},
]
const onTabClick = (key:string) => {
if (key == nsTabKey) {
if (!dnsSettingsData) return
dispatch(dnsSettingsActions.setDNSSettings({
disabled_management_groups: getGroupNamesFromIDs(dnsSettingsData.disabled_management_groups),
}))
}
const onTabClick = (key: string) => {
if (key == nsTabKey) {
if (!dnsSettingsData) return;
dispatch(
dnsSettingsActions.setDNSSettings({
disabled_management_groups: getGroupNamesFromIDs(
dnsSettingsData.disabled_management_groups
),
})
);
}
};
return (
<>
<Container style={{paddingTop: "40px"}}>
<Row>
<Col span={24}>
<Tabs
defaultActiveKey={nsTabKey}
items={items}
onTabClick={onTabClick}
animated={{ inkBar: true, tabPane: false }}
tabPosition="top"
/>
</Col>
</Row>
</Container>
<NameServerGroupUpdate/>
</>
)
}
return (
<>
{!setupEditNameServerGroupVisible && (
<Container style={{ paddingTop: "40px" }}>
<Row>
<Col span={24}>
<Tabs
defaultActiveKey={nsTabKey}
items={items}
onTabClick={onTabClick}
animated={{ inkBar: true, tabPane: false }}
tabPosition="top"
/>
</Col>
</Row>
</Container>
)}
{setupEditNameServerGroupVisible && <NameServerGroupUpdate />}
{setupNewNameServerGroupVisible && <NameServerGroupAdd />}
</>
);
};
export default DNS;
export default DNS;
+266 -232
View File
File diff suppressed because it is too large. Load diff
+52 -44
View File
@@ -206,8 +206,6 @@ export const Peers = () => {
}
}, [deletedPeer]);
const filterDataTable = (): Peer[] => {
const t = textToSearch.toLowerCase().trim();
let f: Peer[] = filter(peers, (f: Peer) => {
@@ -511,7 +509,14 @@ export const Peers = () => {
let loginExpire = peer.login_expired ? (
<Tooltip title="The peer is offline and needs to be re-authenticated because its login has expired ">
<Tag color="red"><Text style={{fontSize: "10px", color: "rgba(210, 64, 64, 0.85)"}} type={"secondary"}>needs login</Text></Tag>
<Tag color="red">
<Text
style={{ fontSize: "10px", color: "rgba(210, 64, 64, 0.85)" }}
type={"secondary"}
>
needs login
</Text>
</Tag>
</Tooltip>
) : (
""
@@ -519,9 +524,11 @@ export const Peers = () => {
const userEmail = users?.find((u) => u.id === peer.user_id)?.email;
let expiry = !peer.login_expiration_enabled ? (
<Tag>
<Text type="secondary" style={{ fontSize: 10 }}>expiration disabled</Text>
</Tag>
<Tag>
<Text type="secondary" style={{ fontSize: 10 }}>
expiration disabled
</Text>
</Tag>
) : null;
if (!userEmail) {
return (
@@ -573,12 +580,14 @@ export const Peers = () => {
<Col span={24}>
<Title className="page-heading">Peers</Title>
{peers.length ? (
<Paragraph style={{marginTop: "5px"}}>
A list of all machines and devices connected to your private network. Use this view to manage peers
<Paragraph style={{ marginTop: "5px" }}>
A list of all machines and devices connected to your private
network. Use this view to manage peers
</Paragraph>
) : (
<Paragraph style={{marginTop: "5px"}} type={"secondary"}>
A list of all machines and devices connected to your private network. Use this view to manage peers
<Paragraph style={{ marginTop: "5px" }} type={"secondary"}>
A list of all machines and devices connected to your private
network. Use this view to manage peers
</Paragraph>
)}
@@ -649,7 +658,39 @@ export const Peers = () => {
/>
)}
<Card bodyStyle={{ padding: 0 }}>
{!showTutorial && (
{showTutorial && !loading ? (
<Space
direction="vertical"
size="small"
align="center"
style={{
display: "flex",
padding: "45px 15px",
justifyContent: "center",
}}
>
<Title level={4} style={{ textAlign: "center" }}>
Get Started
</Title>
<Paragraph
style={{
textAlign: "center",
whiteSpace: "pre-line",
}}
>
It looks like you don't have any connected machines.{" "}
{"\n"}
Get started by adding one to your network.
</Paragraph>
<Button
size={"middle"}
type="primary"
onClick={() => setAddPeerModalOpen(true)}
>
Add new peer
</Button>
</Space>
) : (
<Table
pagination={{
pageSize,
@@ -804,39 +845,6 @@ export const Peers = () => {
/>
</Table>
)}
{showTutorial && (
<Space
direction="vertical"
size="small"
align="center"
style={{
display: "flex",
padding: "45px 15px",
justifyContent: "center",
}}
>
<Title level={4} style={{ textAlign: "center" }}>
Get Started
</Title>
<Paragraph
style={{
textAlign: "center",
whiteSpace: "pre-line",
}}
>
It looks like you don't have any connected machines.{" "}
{"\n"}
Get started by adding one to your network.
</Paragraph>
<Button
size={"middle"}
type="primary"
onClick={() => setAddPeerModalOpen(true)}
>
Add new peer
</Button>
</Space>
)}
</Card>
</Space>
</Col>
+13 -14
View File
@@ -463,9 +463,11 @@ export const Routes = () => {
</>
) : (
<>
<Tag color="default">
<Text type="secondary" style={{ fontSize: 12 }}>off</Text>
</Tag>
<Tag color="default">
<Text type="secondary" style={{ fontSize: 12 }}>
off
</Text>
</Tag>
<Button
type="link"
style={{ padding: "0" }}
@@ -497,16 +499,13 @@ export const Routes = () => {
let name = selectedGroup ? selectedGroup.network_id : "";
confirm({
icon: <ExclamationCircleOutlined />,
title: (
<span className="font-500">
Delete routes to network {name}
</span>
),
title: <span className="font-500">Delete routes to network {name}</span>,
width: 600,
content: (
<Space direction="vertical" size="small">
<Paragraph>
This operation will delete all routes to the network {name}. Are you sure?
This operation will delete all routes to the network {name}. Are you
sure?
</Paragraph>
<Alert
message={
@@ -808,7 +807,11 @@ export const Routes = () => {
</Col>
</Row>
{showTutorial ? (
{loading || loadingPeer ? (
<div className="container-spinner">
<Spin size={"large"} />
</div>
) : showTutorial ? (
<Card bodyStyle={{ padding: 0 }}>
<Space
direction="vertical"
@@ -849,10 +852,6 @@ export const Routes = () => {
</Button>
</Space>
</Card>
) : loading || loadingPeer ? (
<div className="container-spinner">
<Spin size={"large"} />
</div>
) : (
<div className="routes-accordian">
<Collapse onChange={callback}>
+55 -71
View File
@@ -252,6 +252,7 @@ export const SetupKeys = () => {
name: "",
type: "one-off",
auto_groups: autoGroups,
expires_in: 7,
} as SetupKey)
);
};
@@ -359,26 +360,6 @@ export const SetupKeys = () => {
);
};
const setUpdateGroupsVisible = (
setupKeyToAction: SetupKey,
status: boolean
) => {
if (status) {
dispatch(setupKeyActions.setSetupKey({ ...setupKeyToAction }));
dispatch(setupKeyActions.setSetupNewKeyVisible(true));
return;
}
const autoGroups: string[] = [];
dispatch(
setupKeyActions.setSetupKey({
name: "",
type: "one-off",
auto_groups: autoGroups,
} as SetupKey)
);
dispatch(setupKeyActions.setSetupNewKeyVisible(false));
};
return (
<>
<Container style={{ paddingTop: "40px" }}>
@@ -387,24 +368,26 @@ export const SetupKeys = () => {
<Col span={24}>
<Title className="page-heading">Setup Keys</Title>
{setupKeys.length ? (
<Paragraph style={{marginTop: "5px"}}>
Setup keys are pre-authentication keys that allow to register new machines in your network.
<Paragraph style={{ marginTop: "5px" }}>
Setup keys are pre-authentication keys that allow to register
new machines in your network.
<a
target="_blank"
rel="noreferrer"
href="https://docs.netbird.io/how-to/register-machines-using-setup-keys"
>
{" "}
Learn more
</a>
>
{" "}
Learn more
</a>
</Paragraph>
) : (
<Paragraph style={{marginTop: "5px"}} type={"secondary"}>
Setup key is a pre-authentication key that allows to register new machines in your network
<Paragraph style={{ marginTop: "5px" }} type={"secondary"}>
Setup key is a pre-authentication key that allows to register
new machines in your network
<a
target="_blank"
rel="noreferrer"
href="https://docs.netbird.io/how-to/register-machines-using-setup-keys"
target="_blank"
rel="noreferrer"
href="https://docs.netbird.io/how-to/register-machines-using-setup-keys"
>
{" "}
Learn more
@@ -480,47 +463,48 @@ export const SetupKeys = () => {
closable
/>
)}
{showTutorial ? (
<Card bodyStyle={{ padding: 0 }}>
<Space
direction="vertical"
size="small"
align="center"
style={{
display: "flex",
padding: "45px 15px",
justifyContent: "center",
}}
{showTutorial && !loading ? (
<Card bodyStyle={{ padding: 0 }}>
<Space
direction="vertical"
size="small"
align="center"
style={{
display: "flex",
padding: "45px 15px",
justifyContent: "center",
}}
>
<Title level={4} style={{ textAlign: "center" }}>
Create Setup Key
</Title>
<Paragraph
style={{
textAlign: "center",
whiteSpace: "pre-line",
}}
>
Add a setup key to register new machines in your
network. {"\n"} The key links machines to your account
during initial setup.{" "}
<a
target="_blank"
rel="noreferrer"
href="https://docs.netbird.io/how-to/register-machines-using-setup-keys"
>
<Title level={4} style={{ textAlign: "center" }}>
Create Setup Key
</Title>
<Paragraph
style={{
textAlign: "center",
whiteSpace: "pre-line",
}}
>
Add a setup key to register new machines in your
network. {"\n"} The key links machines to your account during
initial setup. <a
target="_blank"
rel="noreferrer"
href="https://docs.netbird.io/how-to/register-machines-using-setup-keys"
>
{" "}
Learn more
</a>
</Paragraph>
<Button
size={"middle"}
type="primary"
onClick={() => onClickAddNewSetupKey()}
>
Add setup key
</Button>
</Space>
</Card>
{" "}
Learn more
</a>
</Paragraph>
<Button
size={"middle"}
type="primary"
onClick={() => onClickAddNewSetupKey()}
>
Add setup key
</Button>
</Space>
</Card>
) : (
<Card bodyStyle={{ padding: 0 }}>
<Table