| 1 |
import React from "react"; |
| 2 |
// PatternFly |
| 3 |
import { |
| 4 |
DropdownItem, |
| 5 |
Flex, |
| 6 |
FlexItem, |
| 7 |
Form, |
| 8 |
FormGroup, |
| 9 |
Sidebar, |
| 10 |
SidebarContent, |
| 11 |
SidebarPanel, |
| 12 |
} from "@patternfly/react-core"; |
| 13 |
// Data types |
| 14 |
import { |
| 15 |
DnsPermissionType, |
| 16 |
DNSZone, |
| 17 |
Metadata, |
| 18 |
} from "src/utils/datatypes/globalDataTypes"; |
| 19 |
// Redux |
| 20 |
import { useAppDispatch } from "src/store/hooks"; |
| 21 |
// Hooks |
| 22 |
import useUpdateRoute from "src/hooks/useUpdateRoute"; |
| 23 |
import { addAlert } from "src/store/Global/alerts-slice"; |
| 24 |
// Utils |
| 25 |
import { dnsZoneAsRecord } from "src/utils/dnsZonesUtils"; |
| 26 |
// Icons |
| 27 |
import { OutlinedQuestionCircleIcon } from "@patternfly/react-icons"; |
| 28 |
// RPC |
| 29 |
import { KwError } from "src/services/rpc"; |
| 30 |
import { |
| 31 |
DnsZoneModPayload, |
| 32 |
useDnsZoneModMutation, |
| 33 |
} from "src/services/rpcDnsZones"; |
| 34 |
// Components |
| 35 |
import IpaTextInput from "src/components/Form/IpaTextInput/IpaTextInput"; |
| 36 |
import TabLayout from "src/components/layouts/TabLayout"; |
| 37 |
import SecondaryButton from "src/components/layouts/SecondaryButton"; |
| 38 |
import HelpTextWithIconLayout from "src/components/layouts/HelpTextWithIconLayout"; |
| 39 |
import KebabLayout from "src/components/layouts/KebabLayout"; |
| 40 |
import IpaTextArea from "src/components/Form/IpaTextArea"; |
| 41 |
import IpaTextboxList from "src/components/Form/IpaTextboxList"; |
| 42 |
import IpaNumberInput from "src/components/Form/IpaNumberInput"; |
| 43 |
import IpaCheckbox from "src/components/Form/IpaCheckbox"; |
| 44 |
import IpaForwardPolicy from "src/components/Form/IpaForwardPolicy"; |
| 45 |
import EnableDisableDnsZonesModal from "src/components/modals/DnsZones/EnableDisableDnsZonesModal"; |
| 46 |
import DeleteDnsZonesModal from "src/components/modals/DnsZones/DeleteDnsZonesModal"; |
| 47 |
import AddRemovePermission from "src/components/modals/DnsZones/AddRemovePermission"; |
| 48 |
|
| 49 |
interface DnsZonesSettingsProps { |
| 50 |
dnsZone: Partial<DNSZone>; |
| 51 |
originalDnsZone: Partial<DNSZone>; |
| 52 |
permissionsData: DnsPermissionType | KwError | null; |
| 53 |
metadata: Metadata; |
| 54 |
onDnsZoneChange: (dnsZone: Partial<DNSZone>) => void; |
| 55 |
onRefresh: () => void; |
| 56 |
isModified: boolean; |
| 57 |
isDataLoading: boolean; |
| 58 |
modifiedValues: () => Partial<DNSZone>; |
| 59 |
onResetValues: () => void; |
| 60 |
pathname: string; |
| 61 |
} |
| 62 |
|
| 63 |
const DnsZonesSettings = (props: DnsZonesSettingsProps) => { |
| 64 |
const dispatch = useAppDispatch(); |
| 65 |
|
| 66 |
// Update current route data to Redux and highlight the current page in the Nav bar |
| 67 |
useUpdateRoute({ pathname: props.pathname }); |
| 68 |
|
| 69 |
// Infer the status of the DNS zone from the 'idnszoneactive' property |
| 70 |
const inferStatus = () => { |
| 71 |
if (props.dnsZone.idnszoneactive !== undefined) { |
| 72 |
let isActive = !!props.dnsZone.idnszoneactive; |
| 73 |
if (typeof props.dnsZone.idnszoneactive === "string") { |
| 74 |
// Convert string to boolean |
| 75 |
if (props.dnsZone.idnszoneactive === "true") { |
| 76 |
isActive = true; |
| 77 |
} else { |
| 78 |
isActive = false; |
| 79 |
} |
| 80 |
} |
| 81 |
return isActive; |
| 82 |
} |
| 83 |
return false; // Default to false if not defined |
| 84 |
}; |
| 85 |
|
| 86 |
// Infer permission operation from the permissions data |
| 87 |
const inferPermissionOperation = () => { |
| 88 |
if (props.permissionsData?.type === "error") { |
| 89 |
return "add"; |
| 90 |
} else if (props.permissionsData?.type === "dns_permission") { |
| 91 |
return "remove"; |
| 92 |
} |
| 93 |
return null; |
| 94 |
}; |
| 95 |
|
| 96 |
// States |
| 97 |
const [isDataLoading, setIsDataLoading] = React.useState(false); |
| 98 |
const [isDnsZoneEnabled, setIsDnsZoneEnabled] = |
| 99 |
React.useState<boolean>(inferStatus); |
| 100 |
const [operation, setOperation] = React.useState<"add" | "remove" | null>( |
| 101 |
inferPermissionOperation |
| 102 |
); |
| 103 |
|
| 104 |
// Keep the status updated |
| 105 |
React.useEffect(() => { |
| 106 |
setIsDnsZoneEnabled(inferStatus()); |
| 107 |
}, [props.dnsZone.idnszoneactive]); |
| 108 |
|
| 109 |
// Keep the operation updated |
| 110 |
React.useEffect(() => { |
| 111 |
setOperation(inferPermissionOperation()); |
| 112 |
}, [props.permissionsData]); |
| 113 |
|
| 114 |
// Get 'ipaObject' and 'recordOnChange' to use in 'IpaTextInput' |
| 115 |
const { ipaObject, recordOnChange } = dnsZoneAsRecord( |
| 116 |
props.dnsZone, |
| 117 |
props.onDnsZoneChange |
| 118 |
); |
| 119 |
|
| 120 |
// API calls |
| 121 |
const [saveDnsZone] = useDnsZoneModMutation(); |
| 122 |
|
| 123 |
// 'Revert' handler method |
| 124 |
const onRevert = () => { |
| 125 |
props.onDnsZoneChange(props.originalDnsZone); |
| 126 |
props.onRefresh(); |
| 127 |
dispatch( |
| 128 |
addAlert({ |
| 129 |
name: "revert-success", |
| 130 |
title: "DNS zone data reverted", |
| 131 |
variant: "success", |
| 132 |
}) |
| 133 |
); |
| 134 |
}; |
| 135 |
|
| 136 |
// Helper method to build the payload based on values |
| 137 |
const buildPayload = ( |
| 138 |
modifiedValues: Partial<DNSZone>, |
| 139 |
keyArray: string[] |
| 140 |
): DnsZoneModPayload => { |
| 141 |
const payload: DnsZoneModPayload = { |
| 142 |
idnsname: props.dnsZone.idnsname?.toString() as string, |
| 143 |
}; |
| 144 |
|
| 145 |
keyArray.forEach((key) => { |
| 146 |
// Modified values are either the value (in string) or an array ([]) when set to empty string |
| 147 |
if (modifiedValues[key] !== undefined) { |
| 148 |
if (modifiedValues[key] === "") { |
| 149 |
payload[key] = []; |
| 150 |
} else { |
| 151 |
payload[key] = modifiedValues[key]; |
| 152 |
} |
| 153 |
} |
| 154 |
}); |
| 155 |
return payload; |
| 156 |
}; |
| 157 |
|
| 158 |
// on Save handler method |
| 159 |
const onSave = () => { |
| 160 |
setIsDataLoading(true); |
| 161 |
const modifiedValues = props.modifiedValues(); |
| 162 |
|
| 163 |
// Generate payload |
| 164 |
const payload = buildPayload(modifiedValues, [ |
| 165 |
"idnszone", |
| 166 |
"idnssoamname", |
| 167 |
"idnssoarname", |
| 168 |
"idnssoarefresh", |
| 169 |
"idnssoaretry", |
| 170 |
"idnssoaexpire", |
| 171 |
"idnssoaminimum", |
| 172 |
"dnsdefaultttl", |
| 173 |
"dnsttl", |
| 174 |
"idnsallowdynupdate", |
| 175 |
"idnsupdatepolicy", |
| 176 |
"idnsallowquery", |
| 177 |
"idnsallowtransfer", |
| 178 |
"idnsforwarders", |
| 179 |
"idnsforwardpolicy", |
| 180 |
"idnsallowsyncptr", |
| 181 |
"idnssecinlinesigning", |
| 182 |
"nsec3paramrecord", |
| 183 |
]); |
| 184 |
|
| 185 |
saveDnsZone(payload).then((response) => { |
| 186 |
if ("data" in response) { |
| 187 |
const data = response.data; |
| 188 |
if (data?.error) { |
| 189 |
dispatch( |
| 190 |
addAlert({ |
| 191 |
name: "error", |
| 192 |
title: (data.error as Error).message, |
| 193 |
variant: "danger", |
| 194 |
}) |
| 195 |
); |
| 196 |
} |
| 197 |
if (data?.result) { |
| 198 |
props.onDnsZoneChange(data.result.result); |
| 199 |
dispatch( |
| 200 |
addAlert({ |
| 201 |
name: "success", |
| 202 |
title: "DNS zone data updated", |
| 203 |
variant: "success", |
| 204 |
}) |
| 205 |
); |
| 206 |
// Disable 'revert' and 'save' buttons |
| 207 |
props.onRefresh(); |
| 208 |
} |
| 209 |
} |
| 210 |
setIsDataLoading(false); |
| 211 |
}); |
| 212 |
}; |
| 213 |
|
| 214 |
// Kebab |
| 215 |
const [isKebabOpen, setIsKebabOpen] = React.useState<boolean>(false); |
| 216 |
|
| 217 |
const kebabItems = [ |
| 218 |
<DropdownItem |
| 219 |
data-cy="dns-zones-tab-settings-kebab-enable" |
| 220 |
key="enable" |
| 221 |
isDisabled={isDnsZoneEnabled} |
| 222 |
onClick={() => setIsEnableDisableOpen(true)} |
| 223 |
> |
| 224 |
Enable |
| 225 |
</DropdownItem>, |
| 226 |
<DropdownItem |
| 227 |
data-cy="dns-zones-tab-settings-kebab-disable" |
| 228 |
key="disable" |
| 229 |
isDisabled={!isDnsZoneEnabled} |
| 230 |
onClick={() => setIsEnableDisableOpen(true)} |
| 231 |
> |
| 232 |
Disable |
| 233 |
</DropdownItem>, |
| 234 |
<DropdownItem |
| 235 |
data-cy="dns-zones-tab-settings-kebab-delete" |
| 236 |
key="delete" |
| 237 |
onClick={() => setIsDeleteOpen(true)} |
| 238 |
> |
| 239 |
Delete |
| 240 |
</DropdownItem>, |
| 241 |
<DropdownItem |
| 242 |
data-cy="dns-zones-tab-settings-kebab-add-permission" |
| 243 |
key="add-permission" |
| 244 |
isDisabled={operation !== "add"} |
| 245 |
onClick={() => { |
| 246 |
setOperation("add"); |
| 247 |
setIsAddRemovePermissionOpen(true); |
| 248 |
}} |
| 249 |
> |
| 250 |
Add permission |
| 251 |
</DropdownItem>, |
| 252 |
<DropdownItem |
| 253 |
data-cy="dns-zones-tab-settings-kebab-remove-permission" |
| 254 |
key="remove-permission" |
| 255 |
isDisabled={operation !== "remove"} |
| 256 |
onClick={() => { |
| 257 |
setOperation("remove"); |
| 258 |
setIsAddRemovePermissionOpen(true); |
| 259 |
}} |
| 260 |
> |
| 261 |
Remove permission |
| 262 |
</DropdownItem>, |
| 263 |
]; |
| 264 |
|
| 265 |
// Toolbar |
| 266 |
const toolbarFields = [ |
| 267 |
{ |
| 268 |
key: 0, |
| 269 |
element: ( |
| 270 |
<SecondaryButton |
| 271 |
dataCy="dns-zones-tab-settings-button-refresh" |
| 272 |
onClickHandler={props.onRefresh} |
| 273 |
> |
| 274 |
Refresh |
| 275 |
</SecondaryButton> |
| 276 |
), |
| 277 |
}, |
| 278 |
{ |
| 279 |
key: 1, |
| 280 |
element: ( |
| 281 |
<SecondaryButton |
| 282 |
dataCy="dns-zones-tab-settings-button-revert" |
| 283 |
isDisabled={!props.isModified || isDataLoading} |
| 284 |
onClickHandler={onRevert} |
| 285 |
> |
| 286 |
Revert |
| 287 |
</SecondaryButton> |
| 288 |
), |
| 289 |
}, |
| 290 |
{ |
| 291 |
key: 2, |
| 292 |
element: ( |
| 293 |
<SecondaryButton |
| 294 |
dataCy="dns-zones-tab-settings-button-save" |
| 295 |
isDisabled={!props.isModified || isDataLoading} |
| 296 |
onClickHandler={onSave} |
| 297 |
> |
| 298 |
Save |
| 299 |
</SecondaryButton> |
| 300 |
), |
| 301 |
}, |
| 302 |
{ |
| 303 |
key: 3, |
| 304 |
element: ( |
| 305 |
<KebabLayout |
| 306 |
dataCy="dns-zones-tab-settings-kebab" |
| 307 |
direction={"up"} |
| 308 |
onDropdownSelect={() => setIsKebabOpen(!isKebabOpen)} |
| 309 |
onKebabToggle={() => setIsKebabOpen(!isKebabOpen)} |
| 310 |
idKebab="toggle-action-buttons" |
| 311 |
isKebabOpen={isKebabOpen} |
| 312 |
dropdownItems={kebabItems} |
| 313 |
isDisabled={isDataLoading} |
| 314 |
/> |
| 315 |
), |
| 316 |
}, |
| 317 |
]; |
| 318 |
|
| 319 |
// Modals |
| 320 |
const [isEnableDisableOpen, setIsEnableDisableOpen] = React.useState(false); |
| 321 |
const [isDeleteOpen, setIsDeleteOpen] = React.useState(false); |
| 322 |
const [isAddRemovePermissionOpen, setIsAddRemovePermissionOpen] = |
| 323 |
React.useState(false); |
| 324 |
|
| 325 |
// Render component |
| 326 |
return ( |
| 327 |
<> |
| 328 |
<TabLayout |
| 329 |
id="settings-page" |
| 330 |
toolbarItems={toolbarFields} |
| 331 |
dataCy="dns-zones-settings" |
| 332 |
> |
| 333 |
<Sidebar isPanelRight> |
| 334 |
<SidebarPanel variant="sticky"> |
| 335 |
<HelpTextWithIconLayout |
| 336 |
textContent="Help" |
| 337 |
icon={ |
| 338 |
<OutlinedQuestionCircleIcon className="pf-v6-u-primary-color-100 pf-v6-u-mr-sm" /> |
| 339 |
} |
| 340 |
/> |
| 341 |
</SidebarPanel> |
| 342 |
<SidebarContent className="pf-v6-u-mr-xl"> |
| 343 |
<Flex direction={{ default: "column", lg: "row" }}> |
| 344 |
<FlexItem flex={{ default: "flex_1" }}> |
| 345 |
<Form className="pf-v6-u-mb-lg"> |
| 346 |
<FormGroup label="Zone name" role="idnsname"> |
| 347 |
<IpaTextInput |
| 348 |
dataCy="dns-zones-tab-settings-textbox-idnsname" |
| 349 |
name={"idnsname"} |
| 350 |
ariaLabel={"Zone name text input"} |
| 351 |
ipaObject={ipaObject} |
| 352 |
onChange={recordOnChange} |
| 353 |
objectName="dnszone" |
| 354 |
metadata={props.metadata} |
| 355 |
/> |
| 356 |
</FormGroup> |
| 357 |
<FormGroup |
| 358 |
label="Authoritative nameserver" |
| 359 |
role="idnssoamname" |
| 360 |
isRequired |
| 361 |
> |
| 362 |
<IpaTextInput |
| 363 |
dataCy="dns-zones-tab-settings-textbox-idnssoamname" |
| 364 |
name={"idnssoamname"} |
| 365 |
ariaLabel={"Authoritative nameserver text input"} |
| 366 |
ipaObject={ipaObject} |
| 367 |
onChange={recordOnChange} |
| 368 |
objectName="dnszone" |
| 369 |
metadata={props.metadata} |
| 370 |
/> |
| 371 |
</FormGroup> |
| 372 |
<FormGroup |
| 373 |
label="Administrator e-mail address" |
| 374 |
role="idnssoarname" |
| 375 |
isRequired |
| 376 |
> |
| 377 |
<IpaTextInput |
| 378 |
dataCy="dns-zones-tab-settings-textbox-idnssoarname" |
| 379 |
name={"idnssoarname"} |
| 380 |
ariaLabel={"Administrator e-mail address text input"} |
| 381 |
ipaObject={ipaObject} |
| 382 |
onChange={recordOnChange} |
| 383 |
objectName="dnszone" |
| 384 |
metadata={props.metadata} |
| 385 |
/> |
| 386 |
</FormGroup> |
| 387 |
<FormGroup label="SOA serial" role="idnssoaserial"> |
| 388 |
<IpaNumberInput |
| 389 |
dataCy="dns-zones-tab-settings-textbox-idnssoaserial" |
| 390 |
name={"idnssoaserial"} |
| 391 |
ariaLabel={"SOA serial number input"} |
| 392 |
ipaObject={ipaObject} |
| 393 |
objectName="dnszone" |
| 394 |
metadata={props.metadata} |
| 395 |
numCharsShown={10} |
| 396 |
minValue={1} |
| 397 |
maxValue={4294967295} |
| 398 |
isDisabled={true} // Force to Read-only |
| 399 |
/> |
| 400 |
</FormGroup> |
| 401 |
<FormGroup |
| 402 |
label="SOA refresh (seconds)" |
| 403 |
role="idnssoarefresh" |
| 404 |
isRequired |
| 405 |
> |
| 406 |
<IpaNumberInput |
| 407 |
dataCy="dns-zones-tab-settings-textbox-idnssoarefresh" |
| 408 |
name={"idnssoarefresh"} |
| 409 |
ariaLabel={"SOA refresh in seconds number input"} |
| 410 |
ipaObject={ipaObject} |
| 411 |
objectName="dnszone" |
| 412 |
onChange={props.onDnsZoneChange} |
| 413 |
metadata={props.metadata} |
| 414 |
numCharsShown={10} |
| 415 |
maxValue={2147483647} |
| 416 |
/> |
| 417 |
</FormGroup> |
| 418 |
<FormGroup |
| 419 |
label="SOA retry (seconds)" |
| 420 |
role="idnssoaretry" |
| 421 |
isRequired |
| 422 |
> |
| 423 |
<IpaNumberInput |
| 424 |
dataCy="dns-zones-tab-settings-textbox-idnssoaretry" |
| 425 |
name={"idnssoaretry"} |
| 426 |
ariaLabel={"SOA retry in seconds number input"} |
| 427 |
ipaObject={ipaObject} |
| 428 |
objectName="dnszone" |
| 429 |
onChange={props.onDnsZoneChange} |
| 430 |
metadata={props.metadata} |
| 431 |
numCharsShown={10} |
| 432 |
maxValue={2147483647} |
| 433 |
/> |
| 434 |
</FormGroup> |
| 435 |
<FormGroup label="SOA expire (seconds)" role="idnssoaexpire"> |
| 436 |
<IpaNumberInput |
| 437 |
dataCy="dns-zones-tab-settings-textbox-idnssoaexpire" |
| 438 |
name={"idnssoaexpire"} |
| 439 |
ariaLabel={"SOA expire in seconds number input"} |
| 440 |
ipaObject={ipaObject} |
| 441 |
objectName="dnszone" |
| 442 |
onChange={props.onDnsZoneChange} |
| 443 |
metadata={props.metadata} |
| 444 |
numCharsShown={10} |
| 445 |
maxValue={2147483647} |
| 446 |
/> |
| 447 |
</FormGroup> |
| 448 |
<FormGroup |
| 449 |
label="SOA minimum (seconds)" |
| 450 |
role="idnssoaminimum" |
| 451 |
isRequired |
| 452 |
> |
| 453 |
<IpaNumberInput |
| 454 |
dataCy="dns-zones-tab-settings-textbox-idnssoaminimum" |
| 455 |
name={"idnssoaminimum"} |
| 456 |
ariaLabel={"SOA minimum in seconds number input"} |
| 457 |
ipaObject={ipaObject} |
| 458 |
objectName="dnszone" |
| 459 |
onChange={props.onDnsZoneChange} |
| 460 |
metadata={props.metadata} |
| 461 |
numCharsShown={10} |
| 462 |
maxValue={2147483647} |
| 463 |
/> |
| 464 |
</FormGroup> |
| 465 |
<FormGroup |
| 466 |
label="Default time to live (seconds)" |
| 467 |
role="dnsdefaultttl" |
| 468 |
> |
| 469 |
<IpaNumberInput |
| 470 |
dataCy="dns-zones-tab-settings-textbox-dnsdefaultttl" |
| 471 |
name={"dnsdefaultttl"} |
| 472 |
ariaLabel={"Default time to live in seconds number input"} |
| 473 |
ipaObject={ipaObject} |
| 474 |
objectName="dnszone" |
| 475 |
onChange={props.onDnsZoneChange} |
| 476 |
metadata={props.metadata} |
| 477 |
numCharsShown={10} |
| 478 |
maxValue={2147483647} |
| 479 |
/> |
| 480 |
</FormGroup> |
| 481 |
<FormGroup label="Time to live (seconds)" role="dnsttl"> |
| 482 |
<IpaNumberInput |
| 483 |
dataCy="dns-zones-tab-settings-textbox-dnsttl" |
| 484 |
name={"dnsttl"} |
| 485 |
ariaLabel={"Time to live in seconds number input"} |
| 486 |
ipaObject={ipaObject} |
| 487 |
objectName="dnszone" |
| 488 |
onChange={props.onDnsZoneChange} |
| 489 |
metadata={props.metadata} |
| 490 |
numCharsShown={10} |
| 491 |
maxValue={2147483647} |
| 492 |
/> |
| 493 |
</FormGroup> |
| 494 |
<FormGroup label="Dynamic update" role="idnsallowdynupdate"> |
| 495 |
<IpaCheckbox |
| 496 |
dataCy="dns-zones-tab-settings-checkbox-idnsallowdynupdate" |
| 497 |
name={"idnsallowdynupdate"} |
| 498 |
value={"dynamic-update"} |
| 499 |
text={"Dynamic update"} |
| 500 |
ariaLabel={"Dynamic update checkbox"} |
| 501 |
ipaObject={ipaObject} |
| 502 |
onChange={recordOnChange} |
| 503 |
objectName="dnszone" |
| 504 |
metadata={props.metadata} |
| 505 |
/> |
| 506 |
</FormGroup> |
| 507 |
<FormGroup label="BIND update policy" role="idnsupdatepolicy"> |
| 508 |
<IpaTextArea |
| 509 |
dataCy="dns-zones-tab-settings-textbox-idnsupdatepolicy" |
| 510 |
name={"idnsupdatepolicy"} |
| 511 |
ariaLabel={"BIND update policy"} |
| 512 |
ipaObject={ipaObject} |
| 513 |
onChange={props.onDnsZoneChange} |
| 514 |
objectName="dnszone" |
| 515 |
metadata={props.metadata} |
| 516 |
/> |
| 517 |
</FormGroup> |
| 518 |
<FormGroup label="Allow query" role="idnsallowquery"> |
| 519 |
<IpaTextboxList |
| 520 |
dataCy="dns-zones-tab-settings-textbox-idnsallowquery" |
| 521 |
name={"idnsallowquery"} |
| 522 |
ariaLabel={"Allow query textbox list"} |
| 523 |
ipaObject={ipaObject} |
| 524 |
setIpaObject={recordOnChange} |
| 525 |
/> |
| 526 |
</FormGroup> |
| 527 |
<FormGroup label="Allow transfer" role="idnsallowtransfer"> |
| 528 |
<IpaTextboxList |
| 529 |
dataCy="dns-zones-tab-settings-textbox-idnsallowtransfer" |
| 530 |
name={"idnsallowtransfer"} |
| 531 |
ariaLabel={"Allow transfer textbox list"} |
| 532 |
ipaObject={ipaObject} |
| 533 |
setIpaObject={recordOnChange} |
| 534 |
/> |
| 535 |
</FormGroup> |
| 536 |
<FormGroup label="Zone forwarders" role="idnsforwarders"> |
| 537 |
<IpaTextboxList |
| 538 |
dataCy="dns-zones-tab-settings-textbox-idnsforwarders" |
| 539 |
name={"idnsforwarders"} |
| 540 |
ariaLabel={"Zone forwarders textbox list"} |
| 541 |
ipaObject={ipaObject} |
| 542 |
setIpaObject={recordOnChange} |
| 543 |
/> |
| 544 |
</FormGroup> |
| 545 |
<FormGroup label="Forward policy" role="idnsforwardpolicy"> |
| 546 |
<IpaForwardPolicy |
| 547 |
name={"idnsforwardpolicy"} |
| 548 |
ariaLabel={"Forward policy radio group"} |
| 549 |
ipaObject={ipaObject} |
| 550 |
onChange={recordOnChange} |
| 551 |
metadata={props.metadata} |
| 552 |
objectName="dnszone" |
| 553 |
/> |
| 554 |
</FormGroup> |
| 555 |
<FormGroup label="Allow PTR sync" role="idnsallowsyncptr"> |
| 556 |
<IpaCheckbox |
| 557 |
dataCy="dns-zones-tab-settings-checkbox-idnsallowsyncptr" |
| 558 |
name={"idnsallowsyncptr"} |
| 559 |
value={"allow-sync-ptr"} |
| 560 |
text={"Allow PTR sync"} |
| 561 |
ariaLabel={"Allow PTR sync checkbox"} |
| 562 |
ipaObject={ipaObject} |
| 563 |
onChange={recordOnChange} |
| 564 |
objectName="dnszone" |
| 565 |
metadata={props.metadata} |
| 566 |
/> |
| 567 |
</FormGroup> |
| 568 |
<FormGroup |
| 569 |
label="Allow in-line DNSSEC signing" |
| 570 |
role="idnssecinlinesigning" |
| 571 |
> |
| 572 |
<IpaCheckbox |
| 573 |
dataCy="dns-zones-tab-settings-checkbox-idnssecinlinesigning" |
| 574 |
name={"idnssecinlinesigning"} |
| 575 |
value={"inline-signing"} |
| 576 |
text={"Allow in-line DNSSEC signing"} |
| 577 |
ariaLabel={"Allow in-line DNSSEC signing checkbox"} |
| 578 |
ipaObject={ipaObject} |
| 579 |
onChange={recordOnChange} |
| 580 |
objectName="dnszone" |
| 581 |
metadata={props.metadata} |
| 582 |
/> |
| 583 |
</FormGroup> |
| 584 |
<FormGroup label="NSEC3PARAM record" role="nsec3paramrecord"> |
| 585 |
<IpaTextInput |
| 586 |
dataCy="dns-zones-tab-settings-textbox-nsec3paramrecord" |
| 587 |
name={"nsec3paramrecord"} |
| 588 |
ariaLabel={"NSEC3PARAM record text input"} |
| 589 |
ipaObject={ipaObject} |
| 590 |
onChange={recordOnChange} |
| 591 |
objectName="dnszone" |
| 592 |
metadata={props.metadata} |
| 593 |
/> |
| 594 |
</FormGroup> |
| 595 |
</Form> |
| 596 |
</FlexItem> |
| 597 |
</Flex> |
| 598 |
</SidebarContent> |
| 599 |
</Sidebar> |
| 600 |
</TabLayout> |
| 601 |
<EnableDisableDnsZonesModal |
| 602 |
isOpen={isEnableDisableOpen} |
| 603 |
onClose={() => setIsEnableDisableOpen(false)} |
| 604 |
elementsList={[props.dnsZone.idnsname || ""]} |
| 605 |
setElementsList={() => {}} // No need to unselect elements in this case |
| 606 |
operation={isDnsZoneEnabled ? "disable" : "enable"} |
| 607 |
setShowTableRows={setIsDataLoading} |
| 608 |
onRefresh={props.onRefresh} |
| 609 |
/> |
| 610 |
<DeleteDnsZonesModal |
| 611 |
isOpen={isDeleteOpen} |
| 612 |
onClose={() => setIsDeleteOpen(false)} |
| 613 |
elementsToDelete={[props.dnsZone] as DNSZone[]} |
| 614 |
clearSelectedElements={() => {}} // No need to unselect elements in this case |
| 615 |
columnNames={["DNS zone name"]} |
| 616 |
keyNames={["idnsname"]} |
| 617 |
onRefresh={props.onRefresh} |
| 618 |
updateIsDeleteButtonDisabled={() => {}} // No need to disable delete button in this case |
| 619 |
updateIsDeletion={() => {}} // No need to update deletion state in this case |
| 620 |
fromSettings={true} |
| 621 |
/> |
| 622 |
<AddRemovePermission |
| 623 |
isOpen={isAddRemovePermissionOpen} |
| 624 |
onClose={() => setIsAddRemovePermissionOpen(false)} |
| 625 |
dnsZoneId={props.dnsZone.idnsname || ""} |
| 626 |
operation={operation} |
| 627 |
changeOperation={setOperation} |
| 628 |
onRefresh={props.onRefresh} |
| 629 |
/> |
| 630 |
</> |
| 631 |
); |
| 632 |
}; |
| 633 |
|
| 634 |
export default DnsZonesSettings; |