aboutsummaryrefslogtreecommitdiffstats
path: root/AdminPanel
diff options
context:
space:
mode:
authorMatteo Pasotti <matteo.pasotti@gmail.com>2014-01-19 01:07:59 +0100
committerMatteo Pasotti <matteo.pasotti@gmail.com>2014-01-19 01:07:59 +0100
commit37603e411c756699854c4657233dca681eb2c27b (patch)
tree9a5705093587e933c32d846c95d6a9ab45d8c1a8 /AdminPanel
parente09c0e78c3e46bfc842f3c7fdbf0d01c90087710 (diff)
downloadmanatools-37603e411c756699854c4657233dca681eb2c27b.tar
manatools-37603e411c756699854c4657233dca681eb2c27b.tar.gz
manatools-37603e411c756699854c4657233dca681eb2c27b.tar.bz2
manatools-37603e411c756699854c4657233dca681eb2c27b.tar.xz
manatools-37603e411c756699854c4657233dca681eb2c27b.zip
- now able to insert host entries
- cfgHosts is a instance variable
Diffstat (limited to 'AdminPanel')
-rw-r--r--AdminPanel/Hosts/GHosts.pm34
1 files changed, 33 insertions, 1 deletions
diff --git a/AdminPanel/Hosts/GHosts.pm b/AdminPanel/Hosts/GHosts.pm
index 9f82ab0c..91959297 100644
--- a/AdminPanel/Hosts/GHosts.pm
+++ b/AdminPanel/Hosts/GHosts.pm
@@ -49,6 +49,11 @@ has 'table' => (
init_arg => undef
);
+has 'cfgHosts' => (
+ is => 'rw',
+ init_arg => undef
+);
+
sub start {
my $self = shift;
@@ -122,12 +127,38 @@ sub _addHostDialog {
if ($widget == $cancelButton) {
last;
}
+ elsif($widget == $okButton) {
+ print $textIPAddress->value();
+ my $res = $self->cfgHosts->_insertHost($textIPAddress->value(),[$textHostName->value(), $textHostAlias->value()]);
+ print "Insertion result: $res\n";
+ $res = $self->cfgHosts->_writeHosts();
+ print "Write result: $res\n";
+ last;
+ }
}
}
destroy $dlg;
}
+#=============================================================
+
+=head2 setupTable
+
+=head3 INPUT
+
+ $self: this object
+
+ $data: reference to the array containaing the host data to show into the table
+
+=head3 DESCRIPTION
+
+This subroutine populates a previously created YTable with the hosts data
+retrieved by the Config::Hosts module
+
+=cut
+
+#=============================================================
sub setupTable {
my $self = shift();
my $data = shift();
@@ -182,7 +213,8 @@ sub manageHostsDialog {
$leftContent->setWeight($yui::YD_HORIZ,45);
$self->table($factory->createTable($leftContent,$tableHeader));
- my @hosts = AdminPanel::Hosts::hosts::_getHosts();
+ $self->cfgHosts(AdminPanel::Hosts::hosts->new());
+ my @hosts = $self->cfgHosts->_getHosts();
$self->setupTable(\@hosts);
my $rightContent = $factory->createRight($hbox_content);