Compare commits

..
6 Commits
Author SHA1 Message Date
Maycon Santos 360d807008 Enable creating service user for all domains (#178)
Removed unnecessary check from create button.
2023-05-14 11:56:14 +02:00
Misha Bragin 6f8897ffa5 Make breadcrumbs look like links (#176) 2023-05-10 18:48:11 +02:00
pascal-fischer 75d5f804c5 fix dropdown button in lists to only show ellipsis (#175) 2023-05-10 16:45:47 +02:00
pascal-fischer f7cac02a2d reduce api calls on user edit (#174) 2023-05-10 16:44:43 +02:00
Misha Bragin ec40730cb2 Fix setup key layout (#172) 2023-05-08 17:49:27 +02:00
Misha Bragin 7f3648861b Fix popups layout (#171) 2023-05-08 12:30:53 +02:00
9 changed files with 107 additions and 128 deletions

No files matched your search

+55 -79
View File
@@ -292,7 +292,7 @@ const SetupKeyNew = () => {
textAlign: "start",
whiteSpace: "pre-line",
marginTop: "-23px",
paddingBottom: "25px",
paddingBottom: "15px",
}}>
{"Use this key to register new machines in your network"}
</Paragraph>
@@ -323,7 +323,7 @@ const SetupKeyNew = () => {
<Col span={24}>
<Form.Item
style={{marginBottom: "0px", marginTop: "-10px"}}
style={{marginBottom: "0px", marginTop: "10px"}}
name="name"
rules={[{required: true, message: "Please enter key name."}]}
>
@@ -382,9 +382,9 @@ const SetupKeyNew = () => {
>
Reusable
</Paragraph>
<Text type={"secondary"}>
<Paragraph type={"secondary"} style={{whiteSpace: "pre-line", margin: 0}}>
Use this type to enroll multiple peers
</Text>
</Paragraph>
</Col>
<Col span={6}>
<Row justify={"end"}>
@@ -410,10 +410,10 @@ const SetupKeyNew = () => {
<Paragraph style={{whiteSpace: "pre-line", margin: 0, fontWeight: "bold"}}>
{formSetupKey.type === "one-off" ? "One-off" : "Reusable"}
</Paragraph>
<Text type={"secondary"} style={{marginLeft: "5px"}}>type</Text>
<Text type={"secondary"} style={{marginLeft: "5px"}}>key</Text>
</Row>)}
<Row style={{marginTop: "10px"}}>
<Row style={{marginTop: isEditMode? "20px" : "10px"}}>
<Col span={24}>
<Paragraph
style={{whiteSpace: "pre-line", margin: 0, fontWeight: "bold"}}
@@ -421,40 +421,67 @@ const SetupKeyNew = () => {
{isEditMode ? "Available uses" : "Usage limit"}
</Paragraph>
</Col>
<Col>
{isEditMode ? (
{isEditMode && (
<Col>
<Input
disabled
value={formSetupKey.usage_limit}
value={formSetupKey.usage_limit - formSetupKey.used_times}
suffix={<LockOutlined style={{color: "#BFBFBF"}}/>}
style={{width: "104px"}}
style={{width: "104px", marginTop: "5px"}}
/>
) : (
</Col>
)}
{!isEditMode && (
<Col>
<Form.Item
style={{marginTop: "5px", width: "112px", marginBottom: "5px"}}
name="usage_limit"
>
<InputNumber
type={"number"}
style={{marginTop: "5px", width: "112px"}}
disabled={setupKey.id || formSetupKey.type !== "reusable"}
controls={false}
min={0}
/>
</Form.Item>
)}
</Col>
{isEditMode ? (
<></>
) : (
<Col span={24}>
<Text type={"secondary"}>
<Paragraph type={"secondary"} style={{marginTop: "-18px", marginBottom: 0}}>
For example, set to 30 if you want to enroll 30 peers
</Text>
</Paragraph>
</Col>
)}
</Row>
<Row style={{marginTop: "15px"}}>
{isEditMode ? (
{!isEditMode && (
<Row style={{marginTop: "20px"}}>
<Col span={24}>
<Paragraph
style={{whiteSpace: "pre-line", margin: 0, fontWeight: "bold"}}
>
Expires in
</Paragraph>
</Col>
<Col>
<Form.Item
name="expiresIn"
rules={[{required: true, message: "Please enter expiration date"}]}
>
<InputNumber defaultValue={7} placeholder={`2`} type="number" addonAfter=" Days"
style={{width: "160px", marginTop: "5px"}}/>
</Form.Item>
<Paragraph type={"secondary"} style={{marginTop: "-18px", marginBottom: 0}}>
Should be between 1 and 180 days
</Paragraph>
</Col>
</Row>)}
{isEditMode && (
<Row style={{marginTop: "20px"}}>
<Container style={{width: "100%", padding: 0, margin: 0}}>
<Row>
<Col span={11}>
@@ -463,6 +490,7 @@ const SetupKeyNew = () => {
</Paragraph>
<Row>
<Input
style={{marginTop: "5px"}}
disabled
suffix={<LockOutlined style={{color: "#BFBFBF"}}/>}
value={customExpiresFormat(new Date(formSetupKey.expires))!}
@@ -476,6 +504,7 @@ const SetupKeyNew = () => {
<Row>
<Input
disabled
style={{marginTop: "5px"}}
suffix={<LockOutlined style={{color: "#BFBFBF"}}/>}
value={customLastUsedFormat(new Date(formSetupKey.last_used))!}
/>
@@ -483,62 +512,8 @@ const SetupKeyNew = () => {
</Col>
</Row>
</Container>
) : (
<>
<Col span={24}>
<Paragraph
style={{
whiteSpace: "pre-line",
margin: 0,
fontWeight: "bold",
}}
>
Expires in
</Paragraph>
</Col>
<Col>
<Form.Item
style={{
marginTop: "5px",
width: "112px",
marginBottom: "0px",
}}
name="expiresIn"
rules={[{required: true, message: "Please enter expiration date."}]}
>
<Col
style={{
display: "flex",
flexDirection: "row",
}}
>
<InputNumber
type="number"
controls={false}
placeholder={`0`}
min={0}
max={180}
/>
<Col
style={{
marginLeft: "7px",
padding: "4px 12px",
border: "1px solid #D9D9D9",
borderRadius: "2px",
}}
>
Days
</Col>
</Col>
</Form.Item>
</Col>
<Col span={24} style={{marginTop: "5px"}}>
<Text type={"secondary"}>Should be between 1 and 180 days</Text>
</Col>
</>
)}
</Row>
</Row>)}
<Row style={{marginTop: "20px"}}>
<Col span={24}>
@@ -589,7 +564,8 @@ const SetupKeyNew = () => {
</Form>
</Container>
</Modal>
);
)
;
};
export default SetupKeyNew;
export default SetupKeyNew;
+2 -14
View File
@@ -102,18 +102,6 @@ const UserEdit = () => {
dispatch(userActions.setEditUserPopupVisible(false));
dispatch(userActions.setUser(null as unknown as User))
dispatch(personalAccessTokenActions.resetPersonalAccessTokens(null))
dispatch(groupActions.getGroups.request({
getAccessTokenSilently: getTokenSilently,
payload: null
}));
dispatch(userActions.getServiceUsers.request({
getAccessTokenSilently: getTokenSilently,
payload: null
}))
dispatch(userActions.getUsers.request({
getAccessTokenSilently: getTokenSilently,
payload: null
}))
})
.catch((errorInfo) => {
console.log('errorInfo', errorInfo)
@@ -320,10 +308,10 @@ const UserEdit = () => {
<Breadcrumb style={{marginBottom: "30px"}}
items={[
{
title: <Text onClick={() => onBreadcrumbUsersClick("Users")}>All Users</Text>,
title: <a href = "" onClick={() => onBreadcrumbUsersClick("Users")}>All Users</a>,
},
{
title: <Text onClick={() => onBreadcrumbUsersClick(tab)}>{tab}</Text>,
title: <a href= "" onClick={() => onBreadcrumbUsersClick(tab)}>{tab}</a>,
// menu: { items: menuItems },
},
{
-9
View File
@@ -99,15 +99,6 @@ export function* saveUser(action: ReturnType<typeof actions.saveUser.request>):
error: null,
data: response.body
} as CreateResponse<User | null>));
yield put(groupActions.getGroups.request({
getAccessTokenSilently: action.payload.getAccessTokenSilently,
payload: null
}));
yield put(actions.getUsers.request({
getAccessTokenSilently: action.payload.getAccessTokenSilently,
payload: null
}));
} catch (err) {
yield put(actions.saveUser.failure({
loading: false,
+13 -6
View File
@@ -27,7 +27,7 @@ import {Rule} from "../store/rule/types";
import {actions as ruleActions} from "../store/rule";
import {actions as groupActions} from "../store/group";
import {filter, sortBy} from "lodash";
import {CloseOutlined, ExclamationCircleOutlined} from "@ant-design/icons";
import {CloseOutlined, EllipsisOutlined, ExclamationCircleOutlined} from "@ant-design/icons";
import bidirect from '../assets/direct_bi.svg';
import inbound from '../assets/direct_in.svg';
import outbound from '../assets/direct_out.svg';
@@ -37,6 +37,7 @@ import AccessControlModalGroups from "../components/AccessControlModalGroups";
import tableSpin from "../components/Spin";
import {useGetTokenSilently} from "../utils/token";
import {usePageSizeHelpers} from "../utils/pageSize";
import {PeerDataTable} from "../store/peer/types";
const {Title, Paragraph, Text} = Typography;
const {Column} = Table;
@@ -449,11 +450,17 @@ export const AccessControl = () => {
<Column title="" align="center"
render={(text, record, index) => {
if (deletedRule.loading || savedRule.loading) return <></>
return <Dropdown.Button type="text" overlay={actionsMenu}
trigger={["click"]}
onOpenChange={visible => {
if (visible) setRuleToAction(record as RuleDataTable)
}}></Dropdown.Button>
return (
<Dropdown trigger={["click"]} overlay={actionsMenu} onOpenChange={visible => {
if (visible) setRuleToAction(record as RuleDataTable)
}}>
<Button type="text">
<Space>
<EllipsisOutlined />
</Space>
</Button>
</Dropdown>
)
}}
/>
</Table>
+11 -6
View File
@@ -31,7 +31,7 @@ import {Group} from "../store/group/types";
import {TooltipPlacement} from "antd/es/tooltip";
import {NameServer, NameServerGroup} from "../store/nameservers/types";
import NameServerGroupUpdate from "../components/NameServerGroupUpdate";
import {ExclamationCircleOutlined} from "@ant-design/icons";
import {EllipsisOutlined, ExclamationCircleOutlined} from "@ant-design/icons";
import {useGetGroupTagHelpers} from "../utils/groups";
import {usePageSizeHelpers} from "../utils/pageSize";
@@ -441,11 +441,16 @@ export const Nameservers = () => {
<Column title="" align="center" width="30px"
render={(text, record) => {
return (
<Dropdown.Button type="text" overlay={actionsMenu}
trigger={["click"]}
onOpenChange={visible => {
if (visible) setNsGroupToAction(record as NameserverGroupDataTable)
}}></Dropdown.Button>)
<Dropdown trigger={["click"]} overlay={actionsMenu} onOpenChange={visible => {
if (visible) setNsGroupToAction(record as NameserverGroupDataTable)
}}>
<Button type="text">
<Space>
<EllipsisOutlined />
</Space>
</Button>
</Dropdown>
)
}}
/>
</Table>
+12 -6
View File
@@ -6,7 +6,7 @@ import {actions as peerActions} from '../store/peer';
import {actions as groupActions} from '../store/group';
import {actions as routeActions} from '../store/route';
import {Container} from "../components/Container";
import {ExclamationCircleOutlined, ReloadOutlined,} from '@ant-design/icons';
import {EllipsisOutlined, ExclamationCircleOutlined, ReloadOutlined,} from '@ant-design/icons';
import {
Alert,
Button,
@@ -611,11 +611,17 @@ export const Peers = () => {
<Column title="Version" dataIndex="version"/>
<Column title="" align="center"
render={(text, record, index) => {
return <Dropdown.Button type="text" overlay={actionsMenu}
trigger={["click"]}
onOpenChange={visible => {
if (visible) setPeerToAction(record as PeerDataTable)
}}></Dropdown.Button>
return (
<Dropdown trigger={["click"]} overlay={actionsMenu} onOpenChange={visible => {
if (visible) setPeerToAction(record as PeerDataTable)
}}>
<Button type="text">
<Space>
<EllipsisOutlined />
</Space>
</Button>
</Dropdown>
)
}}
/>
</Table>)}
+12 -5
View File
@@ -28,7 +28,7 @@ import {Route, RouteToSave} from "../store/route/types";
import {actions as routeActions} from "../store/route";
import {actions as peerActions} from "../store/peer";
import {filter, sortBy} from "lodash";
import {ExclamationCircleOutlined, QuestionCircleOutlined} from "@ant-design/icons";
import {EllipsisOutlined, ExclamationCircleOutlined, QuestionCircleOutlined} from "@ant-design/icons";
import RouteUpdate from "../components/RouteUpdate";
import tableSpin from "../components/Spin";
import {
@@ -410,10 +410,17 @@ export const Routes = () => {
<Column title="" align="center"
render={(text, record) => {
if (deletedRoute.loading || savedRoute.loading) return <></>
return <Dropdown.Button type="text" overlay={actionsMenu} trigger={["click"]}
onOpenChange={visible => {
if (visible) setRouteToAction(record as RouteDataTable)
}}></Dropdown.Button>
return (
<Dropdown trigger={["click"]} overlay={actionsMenu} onOpenChange={visible => {
if (visible) setRouteToAction(record as RouteDataTable)
}}>
<Button type="text">
<Space>
<EllipsisOutlined />
</Space>
</Button>
</Dropdown>
)
}}
/>
</Table>
+1 -2
View File
@@ -187,12 +187,11 @@ export const ServiceUsers = () => {
lg={5}
xl={5}
xxl={5} span={5}>
{(isNetBirdHosted() || isLocalDev()) &&
<Row justify="end">
<Col>
<Button type="primary" onClick={onClickCreateServiceUser}>Create Service User</Button>
</Col>
</Row>}
</Row>
</Col>
</Row>
{failed &&
+1 -1
View File
@@ -592,4 +592,4 @@ export const SetupKeys = () => {
);
};
export default SetupKeys;
export default SetupKeys;