mirror of
https://github.com/Telecominfraproject/wlan-cloud-owprov-ui.git
synced 2025-11-01 19:17:50 +00:00
[WIFI-13031] Add support for radius endpoints
Signed-off-by: Charles <charles.bourque96@gmail.com>
This commit is contained in:
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "wlan-cloud-owprov-ui",
|
"name": "wlan-cloud-owprov-ui",
|
||||||
"version": "2.11.0(56)",
|
"version": "2.11.0(57)",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "wlan-cloud-owprov-ui",
|
"name": "wlan-cloud-owprov-ui",
|
||||||
"version": "2.11.0(56)",
|
"version": "2.11.0(57)",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@chakra-ui/anatomy": "^2.1.1",
|
"@chakra-ui/anatomy": "^2.1.1",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "wlan-cloud-owprov-ui",
|
"name": "wlan-cloud-owprov-ui",
|
||||||
"version": "2.11.0(56)",
|
"version": "2.11.0(57)",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.tsx",
|
"main": "index.tsx",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -1,18 +1,15 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Flex, FormControl, FormLabel, Heading, SimpleGrid, Switch } from '@chakra-ui/react';
|
import { Flex, Heading, SimpleGrid } from '@chakra-ui/react';
|
||||||
import NumberField from 'components/FormFields/NumberField';
|
|
||||||
import StringField from 'components/FormFields/StringField';
|
import StringField from 'components/FormFields/StringField';
|
||||||
import ToggleField from 'components/FormFields/ToggleField';
|
import ToggleField from 'components/FormFields/ToggleField';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
editing: boolean;
|
editing: boolean;
|
||||||
namePrefix: string;
|
namePrefix: string;
|
||||||
onAccountingChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
||||||
isAccountingEnabled: boolean;
|
|
||||||
// eslint-disable-next-line react/no-unused-prop-types
|
// eslint-disable-next-line react/no-unused-prop-types
|
||||||
isPasspoint?: boolean;
|
isPasspoint?: boolean;
|
||||||
};
|
};
|
||||||
const OpenRoamingRadiusForm = ({ editing, namePrefix, onAccountingChange, isAccountingEnabled }: Props) => (
|
const OpenRoamingRadiusForm = ({ editing, namePrefix }: Props) => (
|
||||||
<>
|
<>
|
||||||
<Flex mt={6}>
|
<Flex mt={6}>
|
||||||
<div>
|
<div>
|
||||||
@@ -21,39 +18,6 @@ const OpenRoamingRadiusForm = ({ editing, namePrefix, onAccountingChange, isAcco
|
|||||||
</Heading>
|
</Heading>
|
||||||
</div>
|
</div>
|
||||||
</Flex>
|
</Flex>
|
||||||
<FormControl isDisabled={!editing}>
|
|
||||||
<FormLabel ms="4px" fontSize="md" fontWeight="normal">
|
|
||||||
Enable Accounting
|
|
||||||
</FormLabel>
|
|
||||||
<Switch
|
|
||||||
onChange={onAccountingChange}
|
|
||||||
isChecked={isAccountingEnabled}
|
|
||||||
borderRadius="15px"
|
|
||||||
size="lg"
|
|
||||||
isDisabled={!editing}
|
|
||||||
_disabled={{ opacity: 0.8, cursor: 'not-allowed' }}
|
|
||||||
/>
|
|
||||||
</FormControl>
|
|
||||||
{isAccountingEnabled && (
|
|
||||||
<SimpleGrid minChildWidth="300px" spacing="20px">
|
|
||||||
<StringField name={`${namePrefix}.accounting.host`} label="accounting.host" isDisabled={!editing} isRequired />
|
|
||||||
<NumberField
|
|
||||||
name={`${namePrefix}.accounting.port`}
|
|
||||||
label="accounting.port"
|
|
||||||
isDisabled={!editing}
|
|
||||||
isRequired
|
|
||||||
hideArrows
|
|
||||||
w={24}
|
|
||||||
/>
|
|
||||||
<StringField
|
|
||||||
name={`${namePrefix}.accounting.secret`}
|
|
||||||
label="accounting.secret"
|
|
||||||
isDisabled={!editing}
|
|
||||||
isRequired
|
|
||||||
hideButton
|
|
||||||
/>
|
|
||||||
</SimpleGrid>
|
|
||||||
)}
|
|
||||||
<SimpleGrid minChildWidth="300px" spacing="20px">
|
<SimpleGrid minChildWidth="300px" spacing="20px">
|
||||||
<StringField
|
<StringField
|
||||||
name={`${namePrefix}.nas-identifier`}
|
name={`${namePrefix}.nas-identifier`}
|
||||||
|
|||||||
@@ -1,35 +1,10 @@
|
|||||||
import React, { useMemo } from 'react';
|
import React from 'react';
|
||||||
import RadiusForm from './Radius';
|
import RadiusForm from './Radius';
|
||||||
import useFastField from 'hooks/useFastField';
|
|
||||||
|
|
||||||
type Props = { editing: boolean; namePrefix: string; isPasspoint?: boolean };
|
type Props = { editing: boolean; namePrefix: string; isPasspoint?: boolean };
|
||||||
|
|
||||||
const OpenRoamingRadius = ({ editing, namePrefix, isPasspoint }: Props) => {
|
const OpenRoamingRadius = ({ editing, namePrefix, isPasspoint }: Props) => (
|
||||||
const { value: accounting, onChange: setAccounting } = useFastField({ name: `${namePrefix}.accounting` });
|
<RadiusForm editing={editing} namePrefix={namePrefix} isPasspoint={isPasspoint} />
|
||||||
|
);
|
||||||
const onEnabledAccountingChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
||||||
if (e.target.checked) {
|
|
||||||
setAccounting({
|
|
||||||
host: '192.168.178.192',
|
|
||||||
port: 1813,
|
|
||||||
secret: 'YOUR_SECRET',
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
setAccounting(undefined);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const isAccountingEnabled = useMemo(() => accounting !== undefined, [accounting !== undefined]);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<RadiusForm
|
|
||||||
editing={editing}
|
|
||||||
onAccountingChange={onEnabledAccountingChange}
|
|
||||||
isAccountingEnabled={isAccountingEnabled}
|
|
||||||
namePrefix={namePrefix}
|
|
||||||
isPasspoint={isPasspoint}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default React.memo(OpenRoamingRadius);
|
export default React.memo(OpenRoamingRadius);
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ const CONSORTIUMS = {
|
|||||||
generic: [],
|
generic: [],
|
||||||
radsec: [],
|
radsec: [],
|
||||||
} as const;
|
} as const;
|
||||||
|
|
||||||
const DEFAULT_VALUE = (defaultEndpoint?: RadiusEndpoint) => ({
|
const DEFAULT_VALUE = (defaultEndpoint?: RadiusEndpoint) => ({
|
||||||
'bss-mode': 'ap',
|
'bss-mode': 'ap',
|
||||||
'dtim-period': 2,
|
'dtim-period': 2,
|
||||||
@@ -32,11 +31,6 @@ const DEFAULT_VALUE = (defaultEndpoint?: RadiusEndpoint) => ({
|
|||||||
radius: {
|
radius: {
|
||||||
__radiusEndpoint: defaultEndpoint?.id ?? '',
|
__radiusEndpoint: defaultEndpoint?.id ?? '',
|
||||||
'chargeable-user-id': true,
|
'chargeable-user-id': true,
|
||||||
accounting: {
|
|
||||||
host: 'example.com',
|
|
||||||
port: '1813',
|
|
||||||
secret: 'Secret',
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
'pass-point': {
|
'pass-point': {
|
||||||
'venue-group': 1,
|
'venue-group': 1,
|
||||||
|
|||||||
Reference in New Issue
Block a user