Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
fusiondirectory
fusiondirectory-plugins
Commits
1e1058bc
Verified
Commit
1e1058bc
authored
5 years ago
by
Côme Chilliet
Browse files
Options
Download
Patches
Plain Diff
feat(ipam) Update Subnet selection depending on VLAN selection
issue
#6039
parent
c7a7de3f
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ipam/admin/ipam/class_ipamVlan.inc
+1
-1
ipam/admin/ipam/class_ipamVlan.inc
ipam/admin/systems/ipam/class_networkInterface.inc
+23
-7
ipam/admin/systems/ipam/class_networkInterface.inc
with
24 additions
and
8 deletions
+24
-8
ipam/admin/ipam/class_ipamVlan.inc
+
1
−
1
View file @
1e1058bc
...
...
@@ -62,7 +62,7 @@ class ipamVlan extends simplePlugin
),
new
IntAttribute
(
_
(
'Inner ID'
),
_
(
'Inner VLAN ID'
),
'fdIpamVlanInnerId'
,
FALS
E
,
'fdIpamVlanInnerId'
,
TRU
E
,
1
,
4096
),
new
IntAttribute
(
...
...
This diff is collapsed.
Click to expand it.
ipam/admin/systems/ipam/class_networkInterface.inc
+
23
−
7
View file @
1e1058bc
...
...
@@ -54,11 +54,6 @@ class networkInterface extends simplePlugin
_
(
'Mac address'
),
_
(
'Mac address of this system'
),
'macAddress'
,
FALSE
),
new
ObjectSelectAttribute
(
_
(
'Subnet'
),
_
(
'Subnet'
),
'fdNetworkInterfaceSubnetDN'
,
FALSE
,
[
'ipamSubnet'
]
),
new
SetAttribute
(
new
IPAttribute
(
_
(
'IP address'
),
_
(
'IP addresses this system uses (v4 or v6)'
),
...
...
@@ -67,8 +62,8 @@ class networkInterface extends simplePlugin
),
],
],
'
vlan
'
=>
[
'name'
=>
_
(
'
VLAN information
'
),
'
ipam
'
=>
[
'name'
=>
_
(
'
IPAM
'
),
'attrs'
=>
[
new
ObjectSelectAttribute
(
_
(
'VLAN'
),
_
(
'VLAN'
),
...
...
@@ -79,6 +74,10 @@ class networkInterface extends simplePlugin
_
(
'VLAN tag'
),
_
(
'VLAN tag'
),
'fdNetworkInterfaceVlanTag'
,
FALSE
),
new
SelectAttribute
(
_
(
'Subnet'
),
_
(
'Subnet'
),
'fdNetworkInterfaceSubnetDN'
,
FALSE
),
]
],
];
...
...
@@ -89,5 +88,22 @@ class networkInterface extends simplePlugin
global
$config
;
parent
::
__construct
(
$dn
,
$object
,
$parent
,
$mainTab
);
$this
->
attributesAccess
[
'fdNetworkInterfaceVlanId'
]
->
setSubmitForm
(
'vlanChanged'
);
$this
->
vlanChanged
();
}
function
vlanChanged
()
{
if
(
$this
->
fdNetworkInterfaceVlanId
!=
''
)
{
/* Get the DN of our current VLAN */
$vlans
=
objects
::
ls
(
'ipamVlan'
,
[
'fdIpamVlanInnerId'
=>
1
],
NULL
,
'(fdIpamVlanInnerId='
.
ldap_escape_f
(
$this
->
fdNetworkInterfaceVlanId
)
.
')'
);
$vlanDN
=
key
(
$vlans
);
$subnets
=
objects
::
ls
(
'ipamSubnet'
,
[
'dn'
=>
'raw'
,
'cn'
=>
1
],
NULL
,
'(fdIpamVlanDN='
.
$vlanDN
.
')'
);
}
else
{
/* List all the subnets when no VLAN is selected */
$subnets
=
objects
::
ls
(
'ipamSubnet'
,
[
'dn'
=>
'raw'
,
'cn'
=>
1
]);
}
$this
->
attributesAccess
[
'fdNetworkInterfaceSubnetDN'
]
->
setChoices
(
array_column
(
$subnets
,
'dn'
),
array_column
(
$subnets
,
'cn'
));
}
}
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets