mirror of
https://github.com/Telecominfraproject/wlan-cloud-owprov-ui.git
synced 2025-10-29 01:32:22 +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",
|
||||
"version": "2.11.0(56)",
|
||||
"version": "2.11.0(57)",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "wlan-cloud-owprov-ui",
|
||||
"version": "2.11.0(56)",
|
||||
"version": "2.11.0(57)",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@chakra-ui/anatomy": "^2.1.1",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "wlan-cloud-owprov-ui",
|
||||
"version": "2.11.0(56)",
|
||||
"version": "2.11.0(57)",
|
||||
"description": "",
|
||||
"main": "index.tsx",
|
||||
"scripts": {
|
||||
|
||||
@@ -1,18 +1,15 @@
|
||||
import React from 'react';
|
||||
import { Flex, FormControl, FormLabel, Heading, SimpleGrid, Switch } from '@chakra-ui/react';
|
||||
import NumberField from 'components/FormFields/NumberField';
|
||||
import { Flex, Heading, SimpleGrid } from '@chakra-ui/react';
|
||||
import StringField from 'components/FormFields/StringField';
|
||||
import ToggleField from 'components/FormFields/ToggleField';
|
||||
|
||||
type Props = {
|
||||
editing: boolean;
|
||||
namePrefix: string;
|
||||
onAccountingChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
||||
isAccountingEnabled: boolean;
|
||||
// eslint-disable-next-line react/no-unused-prop-types
|
||||
isPasspoint?: boolean;
|
||||
};
|
||||
const OpenRoamingRadiusForm = ({ editing, namePrefix, onAccountingChange, isAccountingEnabled }: Props) => (
|
||||
const OpenRoamingRadiusForm = ({ editing, namePrefix }: Props) => (
|
||||
<>
|
||||
<Flex mt={6}>
|
||||
<div>
|
||||
@@ -21,39 +18,6 @@ const OpenRoamingRadiusForm = ({ editing, namePrefix, onAccountingChange, isAcco
|
||||
</Heading>
|
||||
</div>
|
||||
</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">
|
||||
<StringField
|
||||
name={`${namePrefix}.nas-identifier`}
|
||||
|
||||
@@ -1,35 +1,10 @@
|
||||
import React, { useMemo } from 'react';
|
||||
import React from 'react';
|
||||
import RadiusForm from './Radius';
|
||||
import useFastField from 'hooks/useFastField';
|
||||
|
||||
type Props = { editing: boolean; namePrefix: string; isPasspoint?: boolean };
|
||||
|
||||
const OpenRoamingRadius = ({ editing, namePrefix, isPasspoint }: Props) => {
|
||||
const { value: accounting, onChange: setAccounting } = useFastField({ name: `${namePrefix}.accounting` });
|
||||
|
||||
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}
|
||||
/>
|
||||
);
|
||||
};
|
||||
const OpenRoamingRadius = ({ editing, namePrefix, isPasspoint }: Props) => (
|
||||
<RadiusForm editing={editing} namePrefix={namePrefix} isPasspoint={isPasspoint} />
|
||||
);
|
||||
|
||||
export default React.memo(OpenRoamingRadius);
|
||||
|
||||
@@ -21,7 +21,6 @@ const CONSORTIUMS = {
|
||||
generic: [],
|
||||
radsec: [],
|
||||
} as const;
|
||||
|
||||
const DEFAULT_VALUE = (defaultEndpoint?: RadiusEndpoint) => ({
|
||||
'bss-mode': 'ap',
|
||||
'dtim-period': 2,
|
||||
@@ -32,11 +31,6 @@ const DEFAULT_VALUE = (defaultEndpoint?: RadiusEndpoint) => ({
|
||||
radius: {
|
||||
__radiusEndpoint: defaultEndpoint?.id ?? '',
|
||||
'chargeable-user-id': true,
|
||||
accounting: {
|
||||
host: 'example.com',
|
||||
port: '1813',
|
||||
secret: 'Secret',
|
||||
},
|
||||
},
|
||||
'pass-point': {
|
||||
'venue-group': 1,
|
||||
|
||||
Reference in New Issue
Block a user