Skip to content

Commit

Permalink
improvement: warn (with orange background and tooltip text) if there …
Browse files Browse the repository at this point in the history
…is no free ip address to determine it automatically in node forms (LMS+ fixes #2313)
  • Loading branch information
chilek committed Jul 12, 2023
1 parent 2ea7db9 commit d4fa0e3
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions js/locale/pl_PL.js
Original file line number Diff line number Diff line change
Expand Up @@ -898,6 +898,7 @@ $_LANG['Device connected to other device or node can\'t be deleted.'] = 'Urządz
$_LANG['Device Edit: $a ($b)'] = 'Edycja urządzenia: $a ($b)';
$_LANG['Device Edit: $a'] = 'Edycja urządzenia: $a';
$_LANG['No free ports on device!'] = 'Urządzenie nie posiada wolnych portów!';
$_LANG['No free addresses in selected network!'] = 'Brak dostępnych adresów w wybranej sieci!';
$_LANG['No IP addresses on device.'] = 'Urządzenie nie posiada adresu IP.';
$_LANG['Device Info: $a $b $c'] = 'Informacje o urządzeniu: $a $b $c';
$_LANG['Device name is required!'] = 'Nazwa urządzenia jest wymagana!';
Expand Down
1 change: 1 addition & 0 deletions lib/locale/pl_PL/strings.php
Original file line number Diff line number Diff line change
Expand Up @@ -906,6 +906,7 @@
$_LANG['Device Edit: $a ($b)'] = 'Edycja urządzenia: $a ($b)';
$_LANG['Device Edit: $a'] = 'Edycja urządzenia: $a';
$_LANG['No free ports on device!'] = 'Urządzenie nie posiada wolnych portów!';
$_LANG['No free addresses in selected network!'] = 'Brak dostępnych adresów w wybranej sieci!';
$_LANG['No IP addresses on device.'] = 'Urządzenie nie posiada adresu IP.';
$_LANG['Device Info: $a $b $c'] = 'Informacje o urządzeniu: $a $b $c';
$_LANG['Device name is required!'] = 'Nazwa urządzenia jest wymagana!';
Expand Down
8 changes: 8 additions & 0 deletions modules/nodexajax.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,14 @@ function getFirstFreeAddress($netid, $elemid)
$ip = $LMS->GetFirstFreeAddress($netid);
if ($ip != false) {
$result->assign($elemid, 'value', $ip);
$result->script('
$("#ipaddr").removeClass("lms-ui-warning").removeAttr("data-tooltip").attr("title", null);
');
} else {
$result->script('
$("#ipaddr").addClass("lms-ui-warning").removeAttr("data-tooltip").attr("title",
$t("No free addresses in selected network!"));
');
}

return $result;
Expand Down
2 changes: 1 addition & 1 deletion templates/default/node/nodeaddbox.html
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
</td>
<td class="cell-flex">
<div>
<input type="text" name="nodedata[ipaddr]" value="{$nodedata.ipaddr}" required
<input type="text" name="nodedata[ipaddr]" id="ipaddr" value="{$nodedata.ipaddr}" required
placeholder="{trans("IP address")}"
{tip trigger="ipaddr"}>
{button type="link" onClick="return ipchoosewin({
Expand Down
2 changes: 1 addition & 1 deletion templates/default/node/nodeeditbox.html
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
</td>
<td class="cell-flex">
<div>
<input type="text" name="nodeedit[ipaddr]" value="{$nodeinfo.ipaddr}" required
<input type="text" name="nodeedit[ipaddr]" id="ipaddr" value="{$nodeinfo.ipaddr}" required
{tip trigger="ipaddr"}>
{button type="link" onClick="return ipchoosewin({
ipelem: document.editnode['nodeedit[ipaddr]'],
Expand Down

0 comments on commit d4fa0e3

Please sign in to comment.