Synched up 2.7 branch with trunk for xCAT-UI and zVM plugin.
git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.7@12528 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
parent
86d96195bf
commit
fe8752991b
@ -2,8 +2,8 @@
|
||||
#-------------------------------------------------------
|
||||
|
||||
=head1
|
||||
|
||||
This is a CP utility plugin for z/VM.
|
||||
|
||||
This is a CP utility plugin for z/VM.
|
||||
|
||||
=cut
|
||||
|
||||
@ -18,604 +18,604 @@ use warnings;
|
||||
|
||||
=head3 getUserId
|
||||
|
||||
Description : Get the user ID of a given node
|
||||
Arguments : Node
|
||||
Returns : UserID
|
||||
Example : my $userID = xCAT::zvmCPUtils->getUserId($node);
|
||||
Description : Get the user ID of a given node
|
||||
Arguments : Node
|
||||
Returns : UserID
|
||||
Example : my $userID = xCAT::zvmCPUtils->getUserId($node);
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------
|
||||
sub getUserId {
|
||||
|
||||
# Get inputs
|
||||
my ( $class, $node ) = @_;
|
||||
# Get inputs
|
||||
my ( $class, $node ) = @_;
|
||||
|
||||
# Get user ID using VMCP
|
||||
my $out = `ssh -o ConnectTimeout=5 $node "vmcp q userid"`;
|
||||
my @results = split( ' ', $out );
|
||||
# Get user ID using VMCP
|
||||
my $out = `ssh -o ConnectTimeout=5 $node "vmcp q userid"`;
|
||||
my @results = split( ' ', $out );
|
||||
|
||||
return ( $results[0] );
|
||||
return ( $results[0] );
|
||||
}
|
||||
|
||||
#-------------------------------------------------------
|
||||
|
||||
=head3 getHost
|
||||
|
||||
Description : Get the z/VM host of a given node
|
||||
Arguments : Node
|
||||
Returns : z/VM host
|
||||
Example : my $host = xCAT::zvmCPUtils->getHost($node);
|
||||
Description : Get the z/VM host of a given node
|
||||
Arguments : Node
|
||||
Returns : z/VM host
|
||||
Example : my $host = xCAT::zvmCPUtils->getHost($node);
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------
|
||||
sub getHost {
|
||||
|
||||
# Get inputs
|
||||
my ( $class, $node ) = @_;
|
||||
# Get inputs
|
||||
my ( $class, $node ) = @_;
|
||||
|
||||
# Get host using VMCP
|
||||
my $out = `ssh -o ConnectTimeout=5 $node "vmcp q userid"`;
|
||||
my @results = split( ' ', $out );
|
||||
my $host = $results[2];
|
||||
# Get host using VMCP
|
||||
my $out = `ssh -o ConnectTimeout=5 $node "vmcp q userid"`;
|
||||
my @results = split( ' ', $out );
|
||||
my $host = $results[2];
|
||||
|
||||
return ($host);
|
||||
return ($host);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------
|
||||
|
||||
=head3 getPrivileges
|
||||
|
||||
Description : Get the privilege class of a given node
|
||||
Arguments : Node
|
||||
Returns : Privilege class
|
||||
Example : my $class = xCAT::zvmCPUtils->getPrivileges($node);
|
||||
Description : Get the privilege class of a given node
|
||||
Arguments : Node
|
||||
Returns : Privilege class
|
||||
Example : my $class = xCAT::zvmCPUtils->getPrivileges($node);
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------
|
||||
sub getPrivileges {
|
||||
|
||||
# Get inputs
|
||||
my ( $class, $node ) = @_;
|
||||
# Get inputs
|
||||
my ( $class, $node ) = @_;
|
||||
|
||||
# Get privilege class
|
||||
my $out = `ssh -o ConnectTimeout=5 $node "vmcp q priv"`;
|
||||
my @out = split( '\n', $out );
|
||||
$out[1] = xCAT::zvmUtils->trimStr( $out[1] );
|
||||
$out[2] = xCAT::zvmUtils->trimStr( $out[2] );
|
||||
my $str = " $out[1]\n $out[2]\n";
|
||||
# Get privilege class
|
||||
my $out = `ssh -o ConnectTimeout=5 $node "vmcp q priv"`;
|
||||
my @out = split( '\n', $out );
|
||||
$out[1] = xCAT::zvmUtils->trimStr( $out[1] );
|
||||
$out[2] = xCAT::zvmUtils->trimStr( $out[2] );
|
||||
my $str = " $out[1]\n $out[2]\n";
|
||||
|
||||
return ($str);
|
||||
return ($str);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------
|
||||
|
||||
=head3 getMemory
|
||||
|
||||
Description : Get the memory of a given node
|
||||
Arguments : Node
|
||||
Returns : Memory
|
||||
Example : my $memory = xCAT::zvmCPUtils->getMemory($node);
|
||||
Description : Get the memory of a given node
|
||||
Arguments : Node
|
||||
Returns : Memory
|
||||
Example : my $memory = xCAT::zvmCPUtils->getMemory($node);
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------
|
||||
sub getMemory {
|
||||
|
||||
# Get inputs
|
||||
my ( $class, $node ) = @_;
|
||||
# Get inputs
|
||||
my ( $class, $node ) = @_;
|
||||
|
||||
# Get memory
|
||||
my $out = `ssh -o ConnectTimeout=5 $node "vmcp q virtual storage"`;
|
||||
my @out = split( '=', $out );
|
||||
# Get memory
|
||||
my $out = `ssh -o ConnectTimeout=5 $node "vmcp q virtual storage"`;
|
||||
my @out = split( '=', $out );
|
||||
|
||||
return ( xCAT::zvmUtils->trimStr( $out[1] ) );
|
||||
return ( xCAT::zvmUtils->trimStr( $out[1] ) );
|
||||
}
|
||||
|
||||
#-------------------------------------------------------
|
||||
|
||||
=head3 getCpu
|
||||
|
||||
Description : Get the processor(s) of a given node
|
||||
Arguments : Node
|
||||
Returns : Processor(s)
|
||||
Example : my $proc = xCAT::zvmCPUtils->getCpu($node);
|
||||
Description : Get the processor(s) of a given node
|
||||
Arguments : Node
|
||||
Returns : Processor(s)
|
||||
Example : my $proc = xCAT::zvmCPUtils->getCpu($node);
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------
|
||||
sub getCpu {
|
||||
|
||||
# Get inputs
|
||||
my ( $class, $node ) = @_;
|
||||
# Get inputs
|
||||
my ( $class, $node ) = @_;
|
||||
|
||||
# Get processors
|
||||
my $out = `ssh -o ConnectTimeout=5 $node "vmcp q virtual cpus"`;
|
||||
my $str = xCAT::zvmUtils->tabStr($out);
|
||||
# Get processors
|
||||
my $out = `ssh -o ConnectTimeout=5 $node "vmcp q virtual cpus"`;
|
||||
my $str = xCAT::zvmUtils->tabStr($out);
|
||||
|
||||
return ($str);
|
||||
return ($str);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------
|
||||
|
||||
=head3 getNic
|
||||
|
||||
Description : Get the network interface card (NIC) of a given node
|
||||
Arguments : Node
|
||||
Returns : NIC(s)
|
||||
Example : my $nic = xCAT::zvmCPUtils->getNic($node);
|
||||
Description : Get the network interface card (NIC) of a given node
|
||||
Arguments : Node
|
||||
Returns : NIC(s)
|
||||
Example : my $nic = xCAT::zvmCPUtils->getNic($node);
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------
|
||||
sub getNic {
|
||||
|
||||
# Get inputs
|
||||
my ( $class, $node ) = @_;
|
||||
# Get inputs
|
||||
my ( $class, $node ) = @_;
|
||||
|
||||
# Get NIC
|
||||
my $out = `ssh -o ConnectTimeout=5 $node "vmcp q virtual nic"`;
|
||||
my $str = xCAT::zvmUtils->tabStr($out);
|
||||
# Get NIC
|
||||
my $out = `ssh -o ConnectTimeout=5 $node "vmcp q virtual nic"`;
|
||||
my $str = xCAT::zvmUtils->tabStr($out);
|
||||
|
||||
return ($str);
|
||||
return ($str);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------
|
||||
|
||||
=head3 getNetworkNames
|
||||
|
||||
Description : Get a list of network names available to a given node
|
||||
Arguments : Node
|
||||
Returns : Network names
|
||||
Example : my $lans = xCAT::zvmCPUtils->getNetworkNames($node);
|
||||
Description : Get a list of network names available to a given node
|
||||
Arguments : Node
|
||||
Returns : Network names
|
||||
Example : my $lans = xCAT::zvmCPUtils->getNetworkNames($node);
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------
|
||||
sub getNetworkNames {
|
||||
|
||||
# Get inputs
|
||||
my ( $class, $node ) = @_;
|
||||
# Get inputs
|
||||
my ( $class, $node ) = @_;
|
||||
|
||||
# Get network names
|
||||
my $out = `ssh -o ConnectTimeout=5 $node "vmcp q lan | egrep 'LAN|VSWITCH'"`;
|
||||
my @lines = split( '\n', $out );
|
||||
my @parms;
|
||||
my $names;
|
||||
foreach (@lines) {
|
||||
|
||||
# Trim output
|
||||
$_ = xCAT::zvmUtils->trimStr($_);
|
||||
@parms = split( ' ', $_ );
|
||||
|
||||
# Get the network name
|
||||
if ( $parms[0] eq "LAN" ) {
|
||||
|
||||
# Determine if this network is a hipersocket
|
||||
# Only hipersocket guest LANs are supported
|
||||
if ( $_ =~ m/Type: HIPERS/i ) {
|
||||
$names .= $parms[0] . ":HIPERS " . $parms[1] . " " . $parms[2] . "\n";
|
||||
} else {
|
||||
$names .= $parms[0] . ":QDIO " . $parms[1] . " " . $parms[2] . "\n";
|
||||
}
|
||||
} elsif ( $parms[0] eq "VSWITCH" ) {
|
||||
$names .= $parms[0] . " " . $parms[1] . " " . $parms[2] . "\n";
|
||||
}
|
||||
}
|
||||
# Get network names
|
||||
my $out = `ssh -o ConnectTimeout=5 $node "vmcp q lan | egrep 'LAN|VSWITCH'"`;
|
||||
my @lines = split( '\n', $out );
|
||||
my @parms;
|
||||
my $names;
|
||||
foreach (@lines) {
|
||||
|
||||
# Trim output
|
||||
$_ = xCAT::zvmUtils->trimStr($_);
|
||||
@parms = split( ' ', $_ );
|
||||
|
||||
# Get the network name
|
||||
if ( $parms[0] eq "LAN" ) {
|
||||
|
||||
# Determine if this network is a hipersocket
|
||||
# Only hipersocket guest LANs are supported
|
||||
if ( $_ =~ m/Type: HIPERS/i ) {
|
||||
$names .= $parms[0] . ":HIPERS " . $parms[1] . " " . $parms[2] . "\n";
|
||||
} else {
|
||||
$names .= $parms[0] . ":QDIO " . $parms[1] . " " . $parms[2] . "\n";
|
||||
}
|
||||
} elsif ( $parms[0] eq "VSWITCH" ) {
|
||||
$names .= $parms[0] . " " . $parms[1] . " " . $parms[2] . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
return ($names);
|
||||
return ($names);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------
|
||||
|
||||
=head3 getNetworkNamesArray
|
||||
|
||||
Description : Get an array of network names available to a given node
|
||||
Arguments : Node
|
||||
Returns : Array of networks names
|
||||
Example : my @networks = xCAT::zvmCPUtils->getNetworkNamesArray($node);
|
||||
Description : Get an array of network names available to a given node
|
||||
Arguments : Node
|
||||
Returns : Array of networks names
|
||||
Example : my @networks = xCAT::zvmCPUtils->getNetworkNamesArray($node);
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------
|
||||
sub getNetworkNamesArray {
|
||||
|
||||
# Get inputs
|
||||
my ( $class, $node ) = @_;
|
||||
my @networks;
|
||||
my %netHash;
|
||||
|
||||
# Get the networks used by the node
|
||||
my $out = `ssh $node "vmcp q v nic" | egrep -i "VSWITCH|LAN"`;
|
||||
my @lines = split( '\n', $out );
|
||||
|
||||
# Loop through each line
|
||||
my $line;
|
||||
my @words;
|
||||
my $name;
|
||||
foreach(@lines) {
|
||||
# Get network name
|
||||
# Line should contain: MAC: 02-00-01-00-00-12 VSWITCH: SYSTEM VSW1
|
||||
$line = xCAT::zvmUtils->trimStr( $_ );
|
||||
@words = split( ' ', $line );
|
||||
if (@words) {
|
||||
$name = xCAT::zvmUtils->trimStr( $words[4] );
|
||||
|
||||
# If network is not 'None'
|
||||
if ($name ne 'None') {
|
||||
# Save network
|
||||
$netHash{$name} = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Push networks into array
|
||||
foreach $name ( keys %netHash ) {
|
||||
push(@networks, $name);
|
||||
}
|
||||
|
||||
return @networks;
|
||||
# Get inputs
|
||||
my ( $class, $node ) = @_;
|
||||
my @networks;
|
||||
my %netHash;
|
||||
|
||||
# Get the networks used by the node
|
||||
my $out = `ssh $node "vmcp q v nic" | egrep -i "VSWITCH|LAN"`;
|
||||
my @lines = split( '\n', $out );
|
||||
|
||||
# Loop through each line
|
||||
my $line;
|
||||
my @words;
|
||||
my $name;
|
||||
foreach(@lines) {
|
||||
# Get network name
|
||||
# Line should contain: MAC: 02-00-01-00-00-12 VSWITCH: SYSTEM VSW1
|
||||
$line = xCAT::zvmUtils->trimStr( $_ );
|
||||
@words = split( ' ', $line );
|
||||
if (@words) {
|
||||
$name = xCAT::zvmUtils->trimStr( $words[4] );
|
||||
|
||||
# If network is not 'None'
|
||||
if ($name ne 'None') {
|
||||
# Save network
|
||||
$netHash{$name} = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Push networks into array
|
||||
foreach $name ( keys %netHash ) {
|
||||
push(@networks, $name);
|
||||
}
|
||||
|
||||
return @networks;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------
|
||||
|
||||
=head3 getNetwork
|
||||
|
||||
Description : Get the network info for a given node
|
||||
Arguments : Node
|
||||
Network name
|
||||
Returns : Network configuration
|
||||
Example : my $config = xCAT::zvmCPUtils->getNetwork($node, $netName);
|
||||
Description : Get the network info for a given node
|
||||
Arguments : Node
|
||||
Network name
|
||||
Returns : Network configuration
|
||||
Example : my $config = xCAT::zvmCPUtils->getNetwork($node, $netName);
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------
|
||||
sub getNetwork {
|
||||
|
||||
# Get inputs
|
||||
my ( $class, $node, $netName ) = @_;
|
||||
# Get inputs
|
||||
my ( $class, $node, $netName ) = @_;
|
||||
|
||||
# Get network info
|
||||
my $out;
|
||||
if ( $netName eq "all" ) {
|
||||
$out = `ssh -o ConnectTimeout=5 $node "vmcp q lan"`;
|
||||
} else {
|
||||
$out = `ssh -o ConnectTimeout=5 $node "vmcp q lan $netName"`;
|
||||
}
|
||||
# Get network info
|
||||
my $out;
|
||||
if ( $netName eq "all" ) {
|
||||
$out = `ssh -o ConnectTimeout=5 $node "vmcp q lan"`;
|
||||
} else {
|
||||
$out = `ssh -o ConnectTimeout=5 $node "vmcp q lan $netName"`;
|
||||
}
|
||||
|
||||
return ($out);
|
||||
return ($out);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------
|
||||
|
||||
=head3 getDisks
|
||||
|
||||
Description : Get the disk(s) of given node
|
||||
Arguments : Node
|
||||
Returns : Disk(s)
|
||||
Example : my $storage = xCAT::zvmCPUtils->getDisks($node);
|
||||
Description : Get the disk(s) of given node
|
||||
Arguments : Node
|
||||
Returns : Disk(s)
|
||||
Example : my $storage = xCAT::zvmCPUtils->getDisks($node);
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------
|
||||
sub getDisks {
|
||||
|
||||
# Get inputs
|
||||
my ( $class, $node ) = @_;
|
||||
# Get inputs
|
||||
my ( $class, $node ) = @_;
|
||||
|
||||
# Get disks
|
||||
my $out = `ssh -o ConnectTimeout=5 $node "vmcp q virtual dasd"`;
|
||||
my $str = xCAT::zvmUtils->tabStr($out);
|
||||
# Get disks
|
||||
my $out = `ssh -o ConnectTimeout=5 $node "vmcp q virtual dasd"`;
|
||||
my $str = xCAT::zvmUtils->tabStr($out);
|
||||
|
||||
return ($str);
|
||||
return ($str);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------
|
||||
|
||||
=head3 loadVmcp
|
||||
|
||||
Description : Load Linux VMCP module on a given node
|
||||
Arguments : Node
|
||||
Returns : Nothing
|
||||
Example : xCAT::zvmCPUtils->loadVmcp($node);
|
||||
Description : Load Linux VMCP module on a given node
|
||||
Arguments : Node
|
||||
Returns : Nothing
|
||||
Example : xCAT::zvmCPUtils->loadVmcp($node);
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------
|
||||
sub loadVmcp {
|
||||
|
||||
# Get inputs
|
||||
my ( $class, $node ) = @_;
|
||||
# Get inputs
|
||||
my ( $class, $node ) = @_;
|
||||
|
||||
# Load Linux VMCP module
|
||||
my $out = `ssh -o ConnectTimeout=5 $node "modprobe vmcp"`;
|
||||
return;
|
||||
# Load Linux VMCP module
|
||||
my $out = `ssh -o ConnectTimeout=5 $node "modprobe vmcp"`;
|
||||
return;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------
|
||||
|
||||
=head3 getVswitchId
|
||||
|
||||
Description : Get the VSwitch ID(s) of given node
|
||||
Arguments : Node
|
||||
Returns : VSwitch ID(s)
|
||||
Example : my @vswitch = xCAT::zvmCPUtils->getVswitchId($node);
|
||||
Description : Get the VSwitch ID(s) of given node
|
||||
Arguments : Node
|
||||
Returns : VSwitch ID(s)
|
||||
Example : my @vswitch = xCAT::zvmCPUtils->getVswitchId($node);
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------
|
||||
sub getVswitchId {
|
||||
|
||||
# Get inputs
|
||||
my ( $class, $node ) = @_;
|
||||
# Get inputs
|
||||
my ( $class, $node ) = @_;
|
||||
|
||||
# Get VSwitch
|
||||
my $out = `ssh -o ConnectTimeout=5 $node "vmcp q v nic" | grep "VSWITCH"`;
|
||||
my @lines = split( '\n', $out );
|
||||
my @parms;
|
||||
my @vswitch;
|
||||
foreach (@lines) {
|
||||
@parms = split( ' ', $_ );
|
||||
push( @vswitch, $parms[4] );
|
||||
}
|
||||
# Get VSwitch
|
||||
my $out = `ssh -o ConnectTimeout=5 $node "vmcp q v nic" | grep "VSWITCH"`;
|
||||
my @lines = split( '\n', $out );
|
||||
my @parms;
|
||||
my @vswitch;
|
||||
foreach (@lines) {
|
||||
@parms = split( ' ', $_ );
|
||||
push( @vswitch, $parms[4] );
|
||||
}
|
||||
|
||||
return @vswitch;
|
||||
return @vswitch;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------
|
||||
|
||||
=head3 grantVSwitch
|
||||
|
||||
Description : Grant VSwitch access for a given userID
|
||||
Arguments : HCP node
|
||||
User ID
|
||||
VSWITCH ID
|
||||
Returns : Operation results (Done/Failed)
|
||||
Example : my $out = xCAT::zvmCPUtils->grantVswitch($callback, $hcp, $userId, $vswitchId);
|
||||
Description : Grant VSwitch access for a given userID
|
||||
Arguments : HCP node
|
||||
User ID
|
||||
VSWITCH ID
|
||||
Returns : Operation results (Done/Failed)
|
||||
Example : my $out = xCAT::zvmCPUtils->grantVswitch($callback, $hcp, $userId, $vswitchId);
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------
|
||||
sub grantVSwitch {
|
||||
|
||||
# Get inputs
|
||||
my ( $class, $callback, $hcp, $userId, $vswitchId ) = @_;
|
||||
# Get inputs
|
||||
my ( $class, $callback, $hcp, $userId, $vswitchId ) = @_;
|
||||
|
||||
# Grant VSwitch for specified userID
|
||||
my $out = `ssh $hcp "vmcp set vswitch $vswitchId grant $userId"`;
|
||||
$out = xCAT::zvmUtils->trimStr($out);
|
||||
# Grant VSwitch for specified userID
|
||||
my $out = `ssh $hcp "vmcp set vswitch $vswitchId grant $userId"`;
|
||||
$out = xCAT::zvmUtils->trimStr($out);
|
||||
|
||||
# If return string contains 'Command complete' - Operation was successful
|
||||
my $retStr;
|
||||
if ( $out =~ m/Command complete/i ) {
|
||||
$retStr = "Done\n";
|
||||
} else {
|
||||
$retStr = "Failed\n";
|
||||
return $retStr;
|
||||
}
|
||||
# If return string contains 'Command complete' - Operation was successful
|
||||
my $retStr;
|
||||
if ( $out =~ m/Command complete/i ) {
|
||||
$retStr = "Done\n";
|
||||
} else {
|
||||
$retStr = "Failed\n";
|
||||
return $retStr;
|
||||
}
|
||||
|
||||
return $retStr;
|
||||
return $retStr;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------
|
||||
|
||||
=head3 flashCopy
|
||||
|
||||
Description : Flash copy (Class B users only)
|
||||
Arguments : Node
|
||||
Source address
|
||||
Target address
|
||||
Returns : Operation results (Done/Failed)
|
||||
Example : my $results = xCAT::zvmCPUtils->flashCopy($node, $srcAddr, $targetAddr);
|
||||
Description : Flash copy (Class B users only)
|
||||
Arguments : Node
|
||||
Source address
|
||||
Target address
|
||||
Returns : Operation results (Done/Failed)
|
||||
Example : my $results = xCAT::zvmCPUtils->flashCopy($node, $srcAddr, $targetAddr);
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------
|
||||
sub flashCopy {
|
||||
|
||||
# Get inputs
|
||||
my ( $class, $node, $srcAddr, $tgtAddr ) = @_;
|
||||
# Get inputs
|
||||
my ( $class, $node, $srcAddr, $tgtAddr ) = @_;
|
||||
|
||||
# Flash copy
|
||||
my $out = `ssh $node "vmcp flashcopy $srcAddr 0 end to $tgtAddr 0 end synchronous"`;
|
||||
$out = xCAT::zvmUtils->trimStr($out);
|
||||
# Flash copy
|
||||
my $out = `ssh $node "vmcp flashcopy $srcAddr 0 end to $tgtAddr 0 end synchronous"`;
|
||||
$out = xCAT::zvmUtils->trimStr($out);
|
||||
|
||||
# If return string contains 'Command complete' - Operation was successful
|
||||
my $retStr = "";
|
||||
if ( $out =~ m/Command complete/i ) {
|
||||
$retStr = "Done\n";
|
||||
} else {
|
||||
$out = xCAT::zvmUtils->tabStr($out);
|
||||
$retStr = "Failed\n$out";
|
||||
}
|
||||
# If return string contains 'Command complete' - Operation was successful
|
||||
my $retStr = "";
|
||||
if ( $out =~ m/Command complete/i ) {
|
||||
$retStr = "Done\n";
|
||||
} else {
|
||||
$out = xCAT::zvmUtils->tabStr($out);
|
||||
$retStr = "Failed\n$out";
|
||||
}
|
||||
|
||||
return $retStr;
|
||||
return $retStr;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------
|
||||
|
||||
=head3 punch2Reader
|
||||
|
||||
Description : Write file to z/VM punch and transfer it to reader
|
||||
Arguments : HCP node
|
||||
UserID to receive file
|
||||
Source file
|
||||
Target file to be created by punch (e.g. sles.parm)
|
||||
Options, e.g. -t (Convert EBCDIC to ASCII)
|
||||
Returns : Operation results (Done/Failed)
|
||||
Example : my $rc = xCAT::zvmCPUtils->punch2Reader($hcp, $userId, $srcFile, $tgtFile, $options);
|
||||
Description : Write file to z/VM punch and transfer it to reader
|
||||
Arguments : HCP node
|
||||
UserID to receive file
|
||||
Source file
|
||||
Target file to be created by punch (e.g. sles.parm)
|
||||
Options, e.g. -t (Convert EBCDIC to ASCII)
|
||||
Returns : Operation results (Done/Failed)
|
||||
Example : my $rc = xCAT::zvmCPUtils->punch2Reader($hcp, $userId, $srcFile, $tgtFile, $options);
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------
|
||||
sub punch2Reader {
|
||||
my ( $class, $hcp, $userId, $srcFile, $tgtFile, $options ) = @_;
|
||||
my ( $class, $hcp, $userId, $srcFile, $tgtFile, $options ) = @_;
|
||||
|
||||
# Punch to reader
|
||||
my $out = `ssh -o ConnectTimeout=5 $hcp "vmur punch $options -u $userId -r $srcFile -N $tgtFile"`;
|
||||
# Punch to reader
|
||||
my $out = `ssh -o ConnectTimeout=5 $hcp "vmur punch $options -u $userId -r $srcFile -N $tgtFile"`;
|
||||
|
||||
# If punch is successful -- Look for this string
|
||||
my $searchStr = "created and transferred";
|
||||
if ( !( $out =~ m/$searchStr/i ) ) {
|
||||
$out = "Failed\n";
|
||||
} else {
|
||||
$out = "Done\n";
|
||||
}
|
||||
# If punch is successful -- Look for this string
|
||||
my $searchStr = "created and transferred";
|
||||
if ( !( $out =~ m/$searchStr/i ) ) {
|
||||
$out = "Failed\n";
|
||||
} else {
|
||||
$out = "Done\n";
|
||||
}
|
||||
|
||||
return $out;
|
||||
return $out;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------
|
||||
|
||||
=head3 purgeReader
|
||||
|
||||
Description : Purge reader (Class D users only)
|
||||
Arguments : HCP node
|
||||
UserID to purge reader
|
||||
Returns : Nothing
|
||||
Example : my $rc = xCAT::zvmCPUtils->purgeReader($hcp, $userId);
|
||||
Description : Purge reader (Class D users only)
|
||||
Arguments : HCP node
|
||||
UserID to purge reader
|
||||
Returns : Nothing
|
||||
Example : my $rc = xCAT::zvmCPUtils->purgeReader($hcp, $userId);
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------
|
||||
sub purgeReader {
|
||||
my ( $class, $hcp, $userId ) = @_;
|
||||
my ( $class, $hcp, $userId ) = @_;
|
||||
|
||||
# Purge reader
|
||||
my $out = `ssh -o ConnectTimeout=5 $hcp "vmcp purge $userId rdr all"`;
|
||||
# Purge reader
|
||||
my $out = `ssh -o ConnectTimeout=5 $hcp "vmcp purge $userId rdr all"`;
|
||||
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------
|
||||
|
||||
=head3 sendCPCmd
|
||||
|
||||
Description : Send CP command to a given userID (Class C users only)
|
||||
Arguments : HCP node
|
||||
UserID to send CP command
|
||||
Returns : Nothing
|
||||
Example : xCAT::zvmCPUtils->sendCPCmd($hcp, $userId, $cmd);
|
||||
Description : Send CP command to a given userID (Class C users only)
|
||||
Arguments : HCP node
|
||||
UserID to send CP command
|
||||
Returns : Nothing
|
||||
Example : xCAT::zvmCPUtils->sendCPCmd($hcp, $userId, $cmd);
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------
|
||||
sub sendCPCmd {
|
||||
my ( $class, $hcp, $userId, $cmd ) = @_;
|
||||
my ( $class, $hcp, $userId, $cmd ) = @_;
|
||||
|
||||
# Send CP command to given userID
|
||||
my $out = `ssh $hcp "vmcp send cp $userId $cmd"`;
|
||||
# Send CP command to given userID
|
||||
my $out = `ssh $hcp "vmcp send cp $userId $cmd"`;
|
||||
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------
|
||||
|
||||
=head3 getNetworkLayer
|
||||
|
||||
Description : Get the network layer for a given node
|
||||
Arguments : Node
|
||||
Network name
|
||||
Returns : 2 - Layer 2
|
||||
3 - Layer 3
|
||||
-1 - Failed to get network layer
|
||||
Example : my $layer = xCAT::zvmCPUtils->getNetworkLayer($node);
|
||||
Description : Get the network layer for a given node
|
||||
Arguments : Node
|
||||
Network name
|
||||
Returns : 2 - Layer 2
|
||||
3 - Layer 3
|
||||
-1 - Failed to get network layer
|
||||
Example : my $layer = xCAT::zvmCPUtils->getNetworkLayer($node);
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------
|
||||
sub getNetworkLayer {
|
||||
my ( $class, $node, $netName ) = @_;
|
||||
my ( $class, $node, $netName ) = @_;
|
||||
|
||||
# Exit if the network name is not given
|
||||
if ( !$netName ) {
|
||||
return -1;
|
||||
}
|
||||
# Exit if the network name is not given
|
||||
if ( !$netName ) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
# Get network type (Layer 2 or 3)
|
||||
my $out = `ssh -o ConnectTimeout=5 $node "vmcp q lan $netName"`;
|
||||
if ( !$out ) {
|
||||
return -1;
|
||||
}
|
||||
# Get network type (Layer 2 or 3)
|
||||
my $out = `ssh -o ConnectTimeout=5 $node "vmcp q lan $netName"`;
|
||||
if ( !$out ) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
# Go through each line
|
||||
my $layer = 3; # Default to layer 3
|
||||
my @lines = split( '\n', $out );
|
||||
foreach (@lines) {
|
||||
# Go through each line
|
||||
my $layer = 3; # Default to layer 3
|
||||
my @lines = split( '\n', $out );
|
||||
foreach (@lines) {
|
||||
|
||||
# If the line contains ETHERNET, then it is a layer 2 network
|
||||
if ( $_ =~ m/ETHERNET/i ) {
|
||||
$layer = 2;
|
||||
}
|
||||
}
|
||||
# If the line contains ETHERNET, then it is a layer 2 network
|
||||
if ( $_ =~ m/ETHERNET/i ) {
|
||||
$layer = 2;
|
||||
}
|
||||
}
|
||||
|
||||
return $layer;
|
||||
return $layer;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------
|
||||
|
||||
=head3 getNetworkType
|
||||
|
||||
Description : Get the network type of a given network
|
||||
Arguments : HCP node
|
||||
Name of network
|
||||
Returns : Network type (VSWITCH/HIPERS/QDIO)
|
||||
Example : my $netType = xCAT::zvmCPUtils->getNetworkType($hcp, $netName);
|
||||
Description : Get the network type of a given network
|
||||
Arguments : HCP node
|
||||
Name of network
|
||||
Returns : Network type (VSWITCH/HIPERS/QDIO)
|
||||
Example : my $netType = xCAT::zvmCPUtils->getNetworkType($hcp, $netName);
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------
|
||||
sub getNetworkType {
|
||||
my ( $class, $hcp, $netName ) = @_;
|
||||
my ( $class, $hcp, $netName ) = @_;
|
||||
|
||||
# Get network details
|
||||
my $out = `ssh -o ConnectTimeout=5 $hcp "vmcp q lan $netName" | grep "Type"`;
|
||||
# Get network details
|
||||
my $out = `ssh -o ConnectTimeout=5 $hcp "vmcp q lan $netName" | grep "Type"`;
|
||||
|
||||
# Go through each line and determine network type
|
||||
my @lines = split( '\n', $out );
|
||||
my $netType = "";
|
||||
foreach (@lines) {
|
||||
# Go through each line and determine network type
|
||||
my @lines = split( '\n', $out );
|
||||
my $netType = "";
|
||||
foreach (@lines) {
|
||||
|
||||
# Virtual switch
|
||||
if ( $_ =~ m/VSWITCH/i ) {
|
||||
$netType = "VSWITCH";
|
||||
}
|
||||
# Virtual switch
|
||||
if ( $_ =~ m/VSWITCH/i ) {
|
||||
$netType = "VSWITCH";
|
||||
}
|
||||
|
||||
# HiperSocket guest LAN
|
||||
elsif ( $_ =~ m/HIPERS/i ) {
|
||||
$netType = "HIPERS";
|
||||
}
|
||||
# HiperSocket guest LAN
|
||||
elsif ( $_ =~ m/HIPERS/i ) {
|
||||
$netType = "HIPERS";
|
||||
}
|
||||
|
||||
# QDIO guest LAN
|
||||
elsif ( $_ =~ m/QDIO/i ) {
|
||||
$netType = "QDIO";
|
||||
}
|
||||
}
|
||||
# QDIO guest LAN
|
||||
elsif ( $_ =~ m/QDIO/i ) {
|
||||
$netType = "QDIO";
|
||||
}
|
||||
}
|
||||
|
||||
return $netType;
|
||||
return $netType;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------
|
||||
|
||||
=head3 defineCpu
|
||||
|
||||
Description : Add processor(s) to given node
|
||||
Arguments : Node
|
||||
Returns : Nothing
|
||||
Example : my $out = xCAT::zvmCPUtils->defineCpu($node, $addr, $type);
|
||||
Description : Add processor(s) to given node
|
||||
Arguments : Node
|
||||
Returns : Nothing
|
||||
Example : my $out = xCAT::zvmCPUtils->defineCpu($node, $addr, $type);
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------
|
||||
sub defineCpu {
|
||||
|
||||
# Get inputs
|
||||
my ( $class, $node, $addr, $type ) = @_;
|
||||
# Get inputs
|
||||
my ( $class, $node, $addr, $type ) = @_;
|
||||
|
||||
# Define processor(s)
|
||||
my $out = `ssh -o ConnectTimeout=5 $node "vmcp define cpu $addr type $type"`;
|
||||
# Define processor(s)
|
||||
my $out = `ssh -o ConnectTimeout=5 $node "vmcp define cpu $addr type $type"`;
|
||||
|
||||
return ($out);
|
||||
return ($out);
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -10,8 +10,8 @@ loadPage();
|
||||
|
||||
/* Login user */
|
||||
if (!isAuthenticated()) {
|
||||
login();
|
||||
login();
|
||||
} else {
|
||||
loadContent();
|
||||
loadContent();
|
||||
}
|
||||
?>
|
@ -30,11 +30,11 @@ body {
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
#login label{
|
||||
#login label {
|
||||
font: bold 12px sans-serif;
|
||||
}
|
||||
|
||||
#login_status {
|
||||
#login-status {
|
||||
font: bold 12px sans-serif;
|
||||
}
|
||||
|
||||
@ -44,7 +44,7 @@ body {
|
||||
float: right;
|
||||
}
|
||||
|
||||
#login_form {
|
||||
#login-form {
|
||||
background-color: #f5f5f5;
|
||||
height: 280px;
|
||||
-moz-border-radius: 3px;
|
||||
@ -52,9 +52,9 @@ body {
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
#loginfo {
|
||||
#log-info {
|
||||
margin: 5px 0px;
|
||||
text-align: right;
|
||||
color: #f5f5f5;
|
||||
font-weight:bold;
|
||||
font-weight: bold;
|
||||
}
|
@ -1,11 +1,10 @@
|
||||
/*--------------- Dialogs ---------------*/
|
||||
/*--- Dialogs ---*/
|
||||
.ui-dialog input {
|
||||
border: solid 1px #BDBDBD;
|
||||
font: 12px sans-serif;
|
||||
}
|
||||
|
||||
.ui-dialog label,.ui-dialog input,.ui-dialog p,.ui-dialog button,.ui-dialog td
|
||||
{
|
||||
.ui-dialog label,.ui-dialog input,.ui-dialog p,.ui-dialog button,.ui-dialog td {
|
||||
font: 12px sans-serif;
|
||||
}
|
||||
|
||||
@ -13,12 +12,11 @@
|
||||
font: 12px sans-serif;
|
||||
}
|
||||
|
||||
.ui-widget input,.ui-widget select,.ui-widget textarea,.ui-widget button
|
||||
{
|
||||
.ui-widget input,.ui-widget select,.ui-widget textarea,.ui-widget button {
|
||||
font: 12px sans-serif;
|
||||
}
|
||||
|
||||
/*--------------- Tooltip ---------------*/
|
||||
/*--- Tooltip ---*/
|
||||
.tooltip {
|
||||
background-color: #000;
|
||||
border: 1px solid #fff;
|
||||
@ -37,7 +35,7 @@
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
/*--------------- Header ---------------*/
|
||||
/*--- Header ---*/
|
||||
#header {
|
||||
height: 39px;
|
||||
width: 1000px;
|
||||
@ -90,15 +88,7 @@
|
||||
color: #FF0000;
|
||||
}
|
||||
|
||||
#layoutselector {
|
||||
padding: 2px 10px 0px 2px; /* Top right left bottom*/
|
||||
text-align: right;
|
||||
color: #FFC125;
|
||||
text-decoration: none;
|
||||
display: block;
|
||||
}
|
||||
|
||||
/*--------------- Body and content ---------------*/
|
||||
/*--- Body and content ---*/
|
||||
body {
|
||||
background: #1C1C1C;
|
||||
font: 12px sans-serif;
|
||||
@ -124,7 +114,7 @@ pre {
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
/*--------------- Groups ---------------*/
|
||||
/*--- Groups ---*/
|
||||
#groups {
|
||||
width: 150px;
|
||||
vertical-align: top;
|
||||
@ -178,7 +168,7 @@ pre {
|
||||
border-top: thin solid #E7EBFF;
|
||||
}
|
||||
|
||||
/*--------------- Nodes section ---------------*/
|
||||
/*--- Nodes section ---*/
|
||||
#nodes {
|
||||
width: 790px;
|
||||
min-height: 570px;
|
||||
@ -204,7 +194,7 @@ pre {
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
/*--------------- Info/warning bar ---------------*/
|
||||
/*--- Info and warning bar ---*/
|
||||
span.ui-icon-info {
|
||||
float: left;
|
||||
margin-right: 0.3em;
|
||||
@ -227,7 +217,7 @@ span.ui-icon-info {
|
||||
text-align: center
|
||||
}
|
||||
|
||||
/*--------------- jQuery tabs ---------------*/
|
||||
/*--- jQuery tabs ---*/
|
||||
.tab {
|
||||
font: 12px sans-serif;
|
||||
border-style: none;
|
||||
@ -248,7 +238,7 @@ span.ui-icon-info {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/*--------------- Inventory and user entry ---------------*/
|
||||
/*--- Inventory and user entry ---*/
|
||||
.tab table {
|
||||
border-width: 1px;
|
||||
border-spacing: 0px;
|
||||
@ -326,7 +316,7 @@ legend {
|
||||
height: 300px;
|
||||
}
|
||||
|
||||
/*--------------- menu Div Actions bar ---------------*/
|
||||
/*--- menu Div Actions bar ---*/
|
||||
.menuDiv {
|
||||
padding: 0.5em;
|
||||
height: 30px;
|
||||
@ -373,7 +363,7 @@ legend {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/*--------------- jQuery datatable ---------------*/
|
||||
/*--- jQuery datatable ---*/
|
||||
.dataTables_wrapper {
|
||||
overflow: auto;
|
||||
width: auto;
|
||||
@ -414,8 +404,7 @@ legend {
|
||||
}
|
||||
|
||||
/*** < > buttons ***/
|
||||
.paginate_disabled_previous,.paginate_enabled_previous,.paginate_disabled_next,.paginate_enabled_next
|
||||
{
|
||||
.paginate_disabled_previous,.paginate_enabled_previous,.paginate_disabled_next,.paginate_enabled_next {
|
||||
height: 19px;
|
||||
width: 19px;
|
||||
margin-left: 2px;
|
||||
@ -472,7 +461,7 @@ legend {
|
||||
color: #FF0000;
|
||||
}
|
||||
|
||||
/*--------------- Editable column ---------------*/
|
||||
/*--- Editable column ---*/
|
||||
.tab .datatable textarea {
|
||||
font: 12px sans-serif;
|
||||
border: solid 1px #BDBDBD;
|
||||
@ -498,7 +487,7 @@ legend {
|
||||
background: none;
|
||||
}
|
||||
|
||||
/*--------------- jQuery context menu ---------------*/
|
||||
/*--- jQuery context menu ---*/
|
||||
.context-menu-theme-vista {
|
||||
background: #FAFAFA url(../images/contextmenu/context-menu-bg.gif)
|
||||
repeat-y left top;
|
||||
@ -536,8 +525,7 @@ legend {
|
||||
background-image: none;
|
||||
}
|
||||
|
||||
.context-menu-theme-vista .context-menu-item-hover .context-menu-item-inner
|
||||
{
|
||||
.context-menu-theme-vista .context-menu-item-hover .context-menu-item-inner {
|
||||
padding: 3px 15px 3px 35px;
|
||||
margin-left: 0px;
|
||||
}
|
||||
@ -546,7 +534,7 @@ legend {
|
||||
color: #A7A7A7;
|
||||
}
|
||||
|
||||
/*--------------- Forms ---------------*/
|
||||
/*--- Forms ---*/
|
||||
.form label {
|
||||
color: #424242;
|
||||
line-height: 1.5;
|
||||
@ -613,7 +601,7 @@ table a:hover {
|
||||
border: solid 1px #d4d4d4;
|
||||
}
|
||||
|
||||
/*--------------- Provision disk table ---------------*/
|
||||
/*--- Provision disk table ---*/
|
||||
.provision table {
|
||||
border-width: 1px;
|
||||
border-spacing: 0px;
|
||||
@ -630,7 +618,7 @@ table a:hover {
|
||||
width: 60px;
|
||||
}
|
||||
|
||||
/*--------------- Provision and clone table ---------------*/
|
||||
/*--- Provision and clone table ---*/
|
||||
.special table {
|
||||
border-width: 1px;
|
||||
border-spacing: 0px;
|
||||
@ -646,52 +634,52 @@ table a:hover {
|
||||
padding: 3px;
|
||||
}
|
||||
|
||||
/*--------------- Provision and monitor forms ---------------*/
|
||||
.monitornormal {
|
||||
/*--- Provision and monitor forms ---*/
|
||||
.monitor-normal {
|
||||
background: #66CD00;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.mornitorwarning {
|
||||
.mornitor-warning {
|
||||
background: #FFD700;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.monitorerror {
|
||||
.monitor-error {
|
||||
background: #FF3030;
|
||||
}
|
||||
|
||||
.monitorunknown {
|
||||
.monitor-unknown {
|
||||
background: #8B8B7A;
|
||||
}
|
||||
|
||||
.monitornodeli {
|
||||
.monitor-node-li {
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
float: left;
|
||||
border: 1px solid white;
|
||||
}
|
||||
|
||||
.monitorsumdiv {
|
||||
.monitor-sum-div {
|
||||
width: 300px;
|
||||
height: 180px;
|
||||
float: left;
|
||||
margin: 0px 0px 10px 10px;
|
||||
}
|
||||
|
||||
.monitorsumdiv td {
|
||||
.monitor-sum-div td {
|
||||
padding: 0;
|
||||
border-style: none;
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
.monitornodediv {
|
||||
.monitor-node-div {
|
||||
width: 240px;
|
||||
height: 120px;
|
||||
margin: 0px 0px 15px 0px;
|
||||
}
|
||||
|
||||
.monitorzoomlink {
|
||||
.monitor-zoom-link {
|
||||
cursor: pointer;
|
||||
color: blue;
|
||||
}
|
||||
@ -710,7 +698,7 @@ table a:hover {
|
||||
height: 150px;
|
||||
}
|
||||
|
||||
/*--------------- Physical layout section ---------------*/
|
||||
/*--- Physical layout section ---*/
|
||||
.frameDiv {
|
||||
width: 179px;
|
||||
height: 500px;
|
||||
@ -768,7 +756,7 @@ table a:hover {
|
||||
height: 11px;
|
||||
}
|
||||
|
||||
.fspcheckbox {
|
||||
.fspCheckbox {
|
||||
padding: 0px;
|
||||
margin: 3px 3px 1px 3px;
|
||||
}
|
||||
@ -796,7 +784,7 @@ table a:hover {
|
||||
background: url(../images/nodes/blade.jpg);
|
||||
}
|
||||
|
||||
.xnodeDiv {
|
||||
.xNodeDiv {
|
||||
font-size: 12px;
|
||||
height: 21px;
|
||||
line-height: 21px;
|
||||
@ -809,45 +797,7 @@ table a:hover {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
/*--------------- Discovery section ---------------*/
|
||||
.discoverstep {
|
||||
width: 960px;
|
||||
vertical-align: top;
|
||||
background-color: #A9D0F5;
|
||||
padding: 0px 0px 0px 5px;
|
||||
-moz-border-radius: .3em;
|
||||
-webkit-border-radius: .3em;
|
||||
border-radius: .3em;
|
||||
}
|
||||
|
||||
.discovercurrentstep {
|
||||
background-color: yellow;
|
||||
font: normal bold 12px/35px sans-serif;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
.discovercontent {
|
||||
width: 960px;
|
||||
display: inline-table;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.discovercontent table {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.discovercontent td {
|
||||
border: none;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.discovercontent th {
|
||||
font: normal bold 15px sans-serif;
|
||||
text-align: center;
|
||||
border: none;
|
||||
}
|
||||
|
||||
/*--------------- jqPlot Pie legend ---------------*/
|
||||
/*--- jqPlot Pie legend ---*/
|
||||
td.jqplot-table-legend {
|
||||
border-width: 0px;
|
||||
}
|
||||
|
@ -1 +1,2 @@
|
||||
opt/xcat/ui
|
||||
opt/xcat/lib/perl/xCAT_plugin/
|
||||
|
@ -5,3 +5,5 @@ etc opt/xcat/ui/
|
||||
images opt/xcat/ui/
|
||||
js opt/xcat/ui/
|
||||
lib opt/xcat/ui/
|
||||
xcat/plugins/web.pm opt/xcat/lib/perl/xCAT_plugin
|
||||
xcat/plugins/webportal.pm opt/xcat/lib/perl/xCAT_plugin
|
||||
|
2
xCAT-UI/debian/links
Normal file
2
xCAT-UI/debian/links
Normal file
@ -0,0 +1,2 @@
|
||||
#opt/xcat/ui/etc/apache2/conf.d/xcat-ui.conf etc/apache2/conf.d/xcat-ui.conf
|
||||
opt/xcat/bin/xcatclientnnr opt/xcat/bin/webportal
|
@ -1,5 +1,5 @@
|
||||
#!/bin/sh
|
||||
# postinst script for openmpi
|
||||
# postinst script for xcat-ui
|
||||
#
|
||||
# see: dh_installdeb(1)
|
||||
|
||||
@ -21,9 +21,9 @@ set -e
|
||||
case "$1" in
|
||||
configure)
|
||||
apachedaemon=apache2
|
||||
/bin/rm -f /etc/$apachedaemon/conf.d/xcat-ui.conf
|
||||
/bin/ln -s /opt/xcat/ui/etc/apache2/conf.d/xcat-ui.conf /etc/$apachedaemon/conf.d/xcat-ui.conf
|
||||
/etc/init.d/$apachedaemon reload
|
||||
/bin/rm -f /etc/apache2/conf.d/xcat-ui.conf
|
||||
/bin/ln -s /opt/xcat/ui/etc/apache2/conf.d/xcat-ui.conf /etc/apache2/conf.d/xcat-ui.conf
|
||||
/etc/init.d/apache2 restart
|
||||
# automatically put the encrypted passwd into the xcat passwd db
|
||||
/opt/xcat/sbin/chtab key=xcat,username=root passwd.password=`grep root /etc/shadow|cut -d : -f 2`
|
||||
|
||||
|
@ -22,11 +22,9 @@ case "$1" in
|
||||
;;
|
||||
|
||||
remove)
|
||||
apachedaemon=apache2
|
||||
|
||||
echo "Undoing $apachedaemon configuration for xCAT..."
|
||||
/bin/rm -f /etc/$apachedaemon/conf.d/xcat-ui.conf
|
||||
/etc/init.d/$apachedaemon reload
|
||||
echo "Undoing apache2 configuration for xCAT..."
|
||||
/bin/rm -f /etc/apache2/conf.d/xcat-ui.conf
|
||||
/etc/init.d/apache2 restart
|
||||
;;
|
||||
|
||||
failed-upgrade)
|
||||
|
@ -25,7 +25,7 @@ install:
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_installdirs
|
||||
dh_install
|
||||
dh_install -X".svn"
|
||||
dh_link
|
||||
|
||||
|
||||
@ -41,7 +41,7 @@ binary-arch:
|
||||
dh_installchangelogs
|
||||
dh_installdocs
|
||||
# dh_installexamples
|
||||
dh_install
|
||||
dh_install -X".svn"
|
||||
# dh_installmenu
|
||||
# dh_installdebconf
|
||||
# dh_installlogrotate
|
||||
|
@ -1,17 +1,18 @@
|
||||
<?php
|
||||
echo <<<EEE
|
||||
<html>
|
||||
<head>
|
||||
<title>Node {$_GET['n']} Ganglia Report</title>
|
||||
<meta content="600" http-equiv="refresh">
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
|
||||
<link href="css/style.css" rel=stylesheet type="text/css">
|
||||
<link href="css/jquery.jqplot.css" rel=stylesheet type="text/css">
|
||||
<script type="text/javascript" src="js/jquery/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="js/jquery/jquery-ui.min.js"></script>
|
||||
<script type="text/javascript" src="js/ui.js"></script>
|
||||
<head>
|
||||
<title>Node {$_GET['n']} Ganglia Report</title>
|
||||
<meta content="600" http-equiv="refresh">
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
|
||||
<link href="css/style.css" rel=stylesheet type="text/css">
|
||||
<link href="css/jquery.jqplot.css" rel=stylesheet type="text/css">
|
||||
<script type="text/javascript" src="js/jquery/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="js/jquery/jquery-ui.min.js"></script>
|
||||
<script type="text/javascript" src="js/ui.js"></script>
|
||||
EEE;
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
window.onload=function() {
|
||||
var nodepath = $('#nodepath').val();
|
||||
@ -37,9 +38,9 @@ window.onload=function() {
|
||||
};
|
||||
|
||||
function drawNodesummary(summaryString){
|
||||
var nodename = $('#nodename').val();
|
||||
var nodeData = new Object();
|
||||
var metricArray = summaryString.split(';');
|
||||
var nodename = $('#nodename').val();
|
||||
var nodeData = new Object();
|
||||
var metricArray = summaryString.split(';');
|
||||
var metricname = '';
|
||||
var valueArray = '';
|
||||
var position = 0;
|
||||
@ -64,27 +65,28 @@ function drawNodesummary(summaryString){
|
||||
drawNetworkFlot('ganglianodenetwork', nodename, nodeData['bytes_in'], nodeData['bytes_out']);
|
||||
}
|
||||
</script>
|
||||
|
||||
<?php
|
||||
echo <<<EEE
|
||||
</head>
|
||||
<body>
|
||||
<input id="nodename" type="hidden" value="{$_GET['n']}"></input>
|
||||
<input id="nodepath" type="hidden" value="{$_GET['p']}"></input>
|
||||
<div style="background-color:white;" class="tab">
|
||||
<table style="border-style:none;">
|
||||
<tr>
|
||||
<td style="padding:0;border-style:none;"><div id="ganglianodeload" class="monitorsumdiv"></div></td>
|
||||
<td style="padding:0;border-style:none;"><div id="ganglianodecpu" class="monitorsumdiv"></div></td>
|
||||
<td style="padding:0;border-style: none;"><div id="ganglianodemem" class="monitorsumdiv"></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding:0;border-style:none;"><div id="ganglianodedisk" class="monitorsumdiv"></div></td>
|
||||
<td style="padding:0;border-style:none;"><div id="ganglianodenetwork" class="monitorsumdiv"></div></td>
|
||||
<td style="padding:0;border-style:none;"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
</head>
|
||||
<body>
|
||||
<input id="nodename" type="hidden" value="{$_GET['n']}"></input>
|
||||
<input id="nodepath" type="hidden" value="{$_GET['p']}"></input>
|
||||
<div style="background-color:white;" class="tab">
|
||||
<table style="border-style:none;">
|
||||
<tr>
|
||||
<td style="padding:0;border-style:none;"><div id="ganglianodeload" class="monitor-sum-div"></div></td>
|
||||
<td style="padding:0;border-style:none;"><div id="ganglianodecpu" class="monitor-sum-div"></div></td>
|
||||
<td style="padding:0;border-style: none;"><div id="ganglianodemem" class="monitor-sum-div"></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding:0;border-style:none;"><div id="ganglianodedisk" class="monitor-sum-div"></div></td>
|
||||
<td style="padding:0;border-style:none;"><div id="ganglianodenetwork" class="monitor-sum-div"></div></td>
|
||||
<td style="padding:0;border-style:none;"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
EEE;
|
||||
?>
|
@ -10,8 +10,8 @@ loadPage();
|
||||
|
||||
/* Login user */
|
||||
if (!isAuthenticated()) {
|
||||
login();
|
||||
login();
|
||||
} else {
|
||||
loadContent();
|
||||
loadContent();
|
||||
}
|
||||
?>
|
@ -11,8 +11,8 @@ loadPage();
|
||||
|
||||
/* Login user */
|
||||
if (!isAuthenticated()) {
|
||||
login();
|
||||
login();
|
||||
} else {
|
||||
loadContent();
|
||||
loadContent();
|
||||
}
|
||||
?>
|
@ -7,36 +7,30 @@ var configDatatables = new Object(); // Datatables on the config page
|
||||
/**
|
||||
* Set the datatable
|
||||
*
|
||||
* @param id
|
||||
* The ID of the datatable
|
||||
* @param obj
|
||||
* Datatable object
|
||||
* @return Nothing
|
||||
* @param id The ID of the datatable
|
||||
* @param obj Datatable object
|
||||
*/
|
||||
function setConfigDatatable(id, obj) {
|
||||
configDatatables[id] = obj;
|
||||
configDatatables[id] = obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the datatable with the given ID
|
||||
*
|
||||
* @param id
|
||||
* The ID of the datatable
|
||||
* @param id The ID of the datatable
|
||||
* @return Datatable object
|
||||
*/
|
||||
function getConfigDatatable(id) {
|
||||
return configDatatables[id];
|
||||
return configDatatables[id];
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the configure tab
|
||||
*
|
||||
* @param obj
|
||||
* Tab object
|
||||
* @return Nothing
|
||||
* @param obj Tab object
|
||||
*/
|
||||
function setConfigTab(obj) {
|
||||
configTabs = obj;
|
||||
configTabs = obj;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -46,449 +40,449 @@ function setConfigTab(obj) {
|
||||
* @return Tab object
|
||||
*/
|
||||
function getConfigTab() {
|
||||
return configTabs;
|
||||
return configTabs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load configure page
|
||||
*
|
||||
* @return Nothing
|
||||
*/
|
||||
function loadConfigPage() {
|
||||
// If the configure page has already been loaded
|
||||
if ($('#content').children().length) {
|
||||
// Do not reload configure page
|
||||
return;
|
||||
}
|
||||
// If the configure page has already been loaded
|
||||
if ($('#content').children().length) {
|
||||
// Do not reload configure page
|
||||
return;
|
||||
}
|
||||
|
||||
// Create configure tab
|
||||
var tab = new Tab();
|
||||
setConfigTab(tab);
|
||||
tab.init();
|
||||
$('#content').append(tab.object());
|
||||
// Create configure tab
|
||||
var tab = new Tab();
|
||||
setConfigTab(tab);
|
||||
tab.init();
|
||||
$('#content').append(tab.object());
|
||||
|
||||
// Create loader
|
||||
var loader = $('<center></center>').append(createLoader());
|
||||
// Create loader
|
||||
var loader = $('<center></center>').append(createLoader());
|
||||
|
||||
// Add tab to configure xCAT tables
|
||||
tab.add('configTablesTab', 'Tables', loader, false);
|
||||
// Add tab to configure xCAT tables
|
||||
tab.add('configTablesTab', 'Tables', loader, false);
|
||||
|
||||
// Add the update tab
|
||||
tab.add('updateTab', 'Update', '', false);
|
||||
|
||||
// Add the discover tab
|
||||
tab.add('discoverTab', 'Discover', '', false);
|
||||
// Add the update tab
|
||||
tab.add('updateTab', 'Update', '', false);
|
||||
|
||||
// Add the discover tab
|
||||
tab.add('discoverTab', 'Discover', '', false);
|
||||
|
||||
// Add the self-service tab
|
||||
tab.add('serviceTab', 'Service', '', false);
|
||||
|
||||
// Get list of tables and their descriptions
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'tabdump',
|
||||
tgt : '',
|
||||
args : '-d',
|
||||
msg : ''
|
||||
},
|
||||
// Get list of tables and their descriptions
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'tabdump',
|
||||
tgt : '',
|
||||
args : '-d',
|
||||
msg : ''
|
||||
},
|
||||
|
||||
success : loadTableNames
|
||||
});
|
||||
success : loadTableNames
|
||||
});
|
||||
|
||||
loadUpdatePage();
|
||||
loadDiscoverPage();
|
||||
loadUpdatePage();
|
||||
loadDiscoverPage();
|
||||
loadServicePage();
|
||||
}
|
||||
|
||||
/**
|
||||
* Load xCAT database table names and their descriptions
|
||||
*
|
||||
* @param data
|
||||
* Data returned from HTTP request
|
||||
* @return Nothing
|
||||
* @param data Data returned from HTTP request
|
||||
*/
|
||||
function loadTableNames(data) {
|
||||
// Get output
|
||||
var tables = data.rsp;
|
||||
// Get output
|
||||
var tables = data.rsp;
|
||||
|
||||
// Remove loader
|
||||
var tabId = 'configTablesTab';
|
||||
$('#' + tabId).find('img').hide();
|
||||
// Remove loader
|
||||
var tabId = 'configTablesTab';
|
||||
$('#' + tabId).find('img').hide();
|
||||
|
||||
// Create a groups division
|
||||
var tablesDIV = $('<div id="configTable"></div>');
|
||||
$('#' + tabId).append(tablesDIV);
|
||||
// Create a groups division
|
||||
var tablesDIV = $('<div id="configTable"></div>');
|
||||
$('#' + tabId).append(tablesDIV);
|
||||
|
||||
// Create info bar
|
||||
var infoBar = createInfoBar('Select a table to view or edit.');
|
||||
tablesDIV.append(infoBar);
|
||||
// Create info bar
|
||||
var infoBar = createInfoBar('Select a table to view or edit.');
|
||||
tablesDIV.append(infoBar);
|
||||
|
||||
// Create a list for the tables
|
||||
var list = $('<ul></ul>');
|
||||
// Loop through each table
|
||||
for ( var i = 0; i < tables.length; i++) {
|
||||
// Create a link for each table
|
||||
var args = tables[i].split(':');
|
||||
var link = $('<a style="color: blue;" id="' + args[0] + '">' + args[0] + '</a>');
|
||||
// Create a list for the tables
|
||||
var list = $('<ul></ul>');
|
||||
// Loop through each table
|
||||
for ( var i = 0; i < tables.length; i++) {
|
||||
// Create a link for each table
|
||||
var args = tables[i].split(':');
|
||||
var link = $('<a style="color: blue;" id="' + args[0] + '">' + args[0] + '</a>');
|
||||
|
||||
// Open table on click
|
||||
link.bind('click', function(e) {
|
||||
// Get table ID that was clicked
|
||||
var id = (e.target) ? e.target.id : e.srcElement.id;
|
||||
// Open table on click
|
||||
link.bind('click', function(e) {
|
||||
// Get table ID that was clicked
|
||||
var id = (e.target) ? e.target.id : e.srcElement.id;
|
||||
|
||||
// Create loader
|
||||
var loader = $('<center></center>').append(createLoader());
|
||||
// Create loader
|
||||
var loader = $('<center></center>').append(createLoader());
|
||||
|
||||
// Add a new tab for this table
|
||||
var configTab = getConfigTab();
|
||||
if (!$('#' + id + 'Tab').length) {
|
||||
configTab.add(id + 'Tab', id, loader, true);
|
||||
// Add a new tab for this table
|
||||
var configTab = getConfigTab();
|
||||
if (!$('#' + id + 'Tab').length) {
|
||||
configTab.add(id + 'Tab', id, loader, true);
|
||||
|
||||
// Get contents of selected table
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'tabdump',
|
||||
tgt : '',
|
||||
args : id,
|
||||
msg : id
|
||||
},
|
||||
// Get contents of selected table
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'tabdump',
|
||||
tgt : '',
|
||||
args : id,
|
||||
msg : id
|
||||
},
|
||||
|
||||
success : loadTable
|
||||
});
|
||||
}
|
||||
success : loadTable
|
||||
});
|
||||
}
|
||||
|
||||
// Select new tab
|
||||
configTab.select(id + 'Tab');
|
||||
});
|
||||
// Select new tab
|
||||
configTab.select(id + 'Tab');
|
||||
});
|
||||
|
||||
var item = $('<li></li>');
|
||||
item.append(link);
|
||||
var item = $('<li></li>');
|
||||
item.append(link);
|
||||
|
||||
// Append the table description
|
||||
item.append(': ' + args[1]);
|
||||
// Append the table description
|
||||
item.append(': ' + args[1]);
|
||||
|
||||
// Append item to list
|
||||
list.append(item);
|
||||
}
|
||||
// Append item to list
|
||||
list.append(item);
|
||||
}
|
||||
|
||||
tablesDIV.append(list);
|
||||
tablesDIV.append(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load a given database table
|
||||
*
|
||||
* @param data
|
||||
* Data returned from HTTP request
|
||||
* @return Nothing
|
||||
* @param data Data returned from HTTP request
|
||||
*/
|
||||
function loadTable(data) {
|
||||
// Get response
|
||||
var rsp = data.rsp;
|
||||
// Get table ID
|
||||
var id = data.msg;
|
||||
// Get response
|
||||
var rsp = data.rsp;
|
||||
// Get table ID
|
||||
var id = data.msg;
|
||||
|
||||
// Remove loader
|
||||
var tabId = id + 'Tab';
|
||||
$('#' + tabId).find('img').remove();
|
||||
// Remove loader
|
||||
var tabId = id + 'Tab';
|
||||
$('#' + tabId).find('img').remove();
|
||||
|
||||
// Create info bar
|
||||
var infoBar = createInfoBar('Click on a cell to edit. Click outside the table to write to the cell. Once you are satisfied with how the table looks, click on Save.');
|
||||
$('#' + tabId).append(infoBar);
|
||||
// Create info bar
|
||||
var infoBar = createInfoBar('Click on a cell to edit. Click outside the table to write to the cell. Once you are satisfied with how the table looks, click on Save.');
|
||||
$('#' + tabId).append(infoBar);
|
||||
|
||||
// Create action bar
|
||||
var actionBar = $('<div></div>');
|
||||
$('#' + tabId).append(actionBar);
|
||||
// Create action bar
|
||||
var actionBar = $('<div></div>');
|
||||
$('#' + tabId).append(actionBar);
|
||||
|
||||
// Get table headers
|
||||
var args = rsp[0].replace('#', '');
|
||||
var headers = args.split(',');
|
||||
// Get table headers
|
||||
var args = rsp[0].replace('#', '');
|
||||
var headers = args.split(',');
|
||||
|
||||
// Create container for original table contents
|
||||
var origCont = new Array(); // Original table content
|
||||
origCont[0] = rsp[0].split(','); // Headers
|
||||
// Create container for original table contents
|
||||
var origCont = new Array(); // Original table content
|
||||
origCont[0] = rsp[0].split(','); // Headers
|
||||
|
||||
// Create container for new table contents
|
||||
var newCont = new Object();
|
||||
var tmp = new Object();
|
||||
tmp[0] = '#' + headers[0]; // Put a # in front of the header
|
||||
for ( var i = 1; i < headers.length; i++) {
|
||||
tmp[i] = headers[i];
|
||||
}
|
||||
newCont[0] = tmp;
|
||||
// Create container for new table contents
|
||||
var newCont = new Object();
|
||||
var tmp = new Object();
|
||||
tmp[0] = '#' + headers[0]; // Put a # in front of the header
|
||||
for ( var i = 1; i < headers.length; i++) {
|
||||
tmp[i] = headers[i];
|
||||
}
|
||||
newCont[0] = tmp;
|
||||
|
||||
// Create a new datatable
|
||||
var tableId = id + 'Datatable';
|
||||
var table = new DataTable(tableId);
|
||||
// Create a new datatable
|
||||
var tableId = id + 'Datatable';
|
||||
var table = new DataTable(tableId);
|
||||
|
||||
// Add column for the remove row button
|
||||
headers.unshift('');
|
||||
table.init(headers);
|
||||
headers.shift();
|
||||
// Add column for the remove row button
|
||||
headers.unshift('');
|
||||
table.init(headers);
|
||||
headers.shift();
|
||||
|
||||
// Append datatable to tab
|
||||
$('#' + tabId).append(table.object());
|
||||
// Append datatable to tab
|
||||
$('#' + tabId).append(table.object());
|
||||
|
||||
// Data table
|
||||
var dTable;
|
||||
// Add table rows
|
||||
// Start with the 2nd row (1st row is the headers)
|
||||
for ( var i = 1; i < rsp.length; i++) {
|
||||
// Split into columns
|
||||
var cols = rsp[i].split(',');
|
||||
|
||||
// Add table rows
|
||||
// Start with the 2nd row (1st row is the headers)
|
||||
for ( var i = 1; i < rsp.length; i++) {
|
||||
// Split into columns
|
||||
var cols = rsp[i].split(',');
|
||||
// Go through each column
|
||||
for ( var j = 0; j < cols.length; j++) {
|
||||
|
||||
// Go through each column
|
||||
for ( var j = 0; j < cols.length; j++) {
|
||||
// If the column is not complete
|
||||
if (cols[j].count('"') == 1) {
|
||||
while (cols[j].count('"') != 2) {
|
||||
// Merge this column with the adjacent one
|
||||
cols[j] = cols[j] + "," + cols[j + 1];
|
||||
|
||||
// If the column is not complete
|
||||
if (cols[j].count('"') == 1) {
|
||||
while (cols[j].count('"') != 2) {
|
||||
// Merge this column with the adjacent one
|
||||
cols[j] = cols[j] + "," + cols[j + 1];
|
||||
// Remove merged row
|
||||
cols.splice(j + 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove merged row
|
||||
cols.splice(j + 1, 1);
|
||||
}
|
||||
}
|
||||
// Replace quote
|
||||
cols[j] = cols[j].replace(new RegExp('"', 'g'), '');
|
||||
}
|
||||
|
||||
// Replace quote
|
||||
cols[j] = cols[j].replace(new RegExp('"', 'g'), '');
|
||||
}
|
||||
// Add remove button
|
||||
cols.unshift('<span class="ui-icon ui-icon-close" onclick="deleteRow(this)"></span>');
|
||||
|
||||
// Add remove button
|
||||
cols.unshift('<span class="ui-icon ui-icon-close" onclick="deleteRow(this)"></span>');
|
||||
// Add row
|
||||
table.add(cols);
|
||||
|
||||
// Add row
|
||||
table.add(cols);
|
||||
// Save original table content
|
||||
origCont[i] = cols;
|
||||
}
|
||||
|
||||
// Save original table content
|
||||
origCont[i] = cols;
|
||||
}
|
||||
// Turn table into datatable
|
||||
var dTable = $('#' + id + 'Datatable').dataTable({
|
||||
'iDisplayLength': 50,
|
||||
'bLengthChange': false,
|
||||
"sScrollX": "100%",
|
||||
"bAutoWidth": true
|
||||
});
|
||||
|
||||
/**
|
||||
* Enable editable columns
|
||||
*/
|
||||
// Do not make 1st column editable
|
||||
$('#' + tableId + ' td:not(td:nth-child(1))').editable(
|
||||
function(value, settings) {
|
||||
// Get column index
|
||||
var colPos = this.cellIndex;
|
||||
// Get row index
|
||||
var rowPos = dTable.fnGetPosition(this.parentNode);
|
||||
/**
|
||||
* Enable editable columns
|
||||
*/
|
||||
// Do not make 1st column editable
|
||||
$('#' + tableId + ' td:not(td:nth-child(1))').editable(
|
||||
function(value, settings) {
|
||||
// Get column index
|
||||
var colPos = this.cellIndex;
|
||||
// Get row index
|
||||
var rowPos = dTable.fnGetPosition(this.parentNode);
|
||||
|
||||
// Update datatable
|
||||
dTable.fnUpdate(value, rowPos, colPos);
|
||||
// Update datatable
|
||||
dTable.fnUpdate(value, rowPos, colPos);
|
||||
|
||||
return (value);
|
||||
}, {
|
||||
onblur : 'submit', // Clicking outside editable area submits changes
|
||||
type : 'textarea',
|
||||
placeholder: ' ',
|
||||
height : '30px' // The height of the text area
|
||||
});
|
||||
return (value);
|
||||
}, {
|
||||
onblur : 'submit', // Clicking outside editable area submits changes
|
||||
type : 'textarea',
|
||||
placeholder: ' ',
|
||||
height : '30px' // The height of the text area
|
||||
});
|
||||
|
||||
// Create action bar
|
||||
var actionBar = $('<div class="actionBar"></div>');
|
||||
|
||||
var saveLnk = $('<a>Save</a>');
|
||||
saveLnk.click(function() {
|
||||
// Get table ID and name
|
||||
var tableId = $(this).parents('.dataTables_wrapper').attr('id').replace('_wrapper', '');
|
||||
var tableName = tableId.replace('Datatable', '');
|
||||
|
||||
// Get datatable
|
||||
var dTable = $('#' + tableId).dataTable();
|
||||
// Get the nodes from the table
|
||||
var dRows = dTable.fnGetNodes();
|
||||
|
||||
// Turn table into datatable
|
||||
dTable = $('#' + id + 'Datatable').dataTable({
|
||||
'iDisplayLength': 50,
|
||||
'bLengthChange': false,
|
||||
"sScrollX": "100%",
|
||||
"bAutoWidth": true
|
||||
});
|
||||
// Go through each row
|
||||
for ( var i = 0; i < dRows.length; i++) {
|
||||
// If there is row with values
|
||||
if (dRows[i]) {
|
||||
// Go through each column
|
||||
// Ignore the 1st column because it is a button
|
||||
var cols = dRows[i].childNodes;
|
||||
var vals = new Object();
|
||||
for ( var j = 1; j < cols.length; j++) {
|
||||
var val = cols.item(j).firstChild.nodeValue;
|
||||
|
||||
// Insert quotes
|
||||
if (val == ' ') {
|
||||
vals[j - 1] = '';
|
||||
} else {
|
||||
vals[j - 1] = val;
|
||||
}
|
||||
}
|
||||
|
||||
// Create action bar
|
||||
var actionBar = $('<div class="actionBar"></div>');
|
||||
|
||||
var saveLnk = $('<a>Save</a>');
|
||||
saveLnk.click(function() {
|
||||
// Get table ID and name
|
||||
var tableId = $(this).parents('.dataTables_wrapper').attr('id').replace('_wrapper', '');
|
||||
var tableName = tableId.replace('Datatable', '');
|
||||
|
||||
// Get datatable
|
||||
var dTable = $('#' + tableId).dataTable();
|
||||
// Get the nodes from the table
|
||||
var dRows = dTable.fnGetNodes();
|
||||
// Save row
|
||||
newCont[i + 1] = vals;
|
||||
}
|
||||
}
|
||||
|
||||
// Update xCAT table
|
||||
$.ajax({
|
||||
type : 'POST',
|
||||
url : 'lib/tabRestore.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
table : tableName,
|
||||
cont : newCont
|
||||
},
|
||||
success : function(data) {
|
||||
// Create info message
|
||||
var dialog = $('<div></div>').append(createInfoBar('Changes saved!'));
|
||||
|
||||
// Open dialog
|
||||
dialog.dialog({
|
||||
modal: true,
|
||||
title: 'Info',
|
||||
width: 400,
|
||||
buttons: {
|
||||
"Ok": function(){
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var undoLnk = $('<a>Undo</a>');
|
||||
undoLnk.click(function() {
|
||||
// Get table ID
|
||||
var tableId = $(this).parents('.dataTables_wrapper').attr('id').replace('_wrapper', '');
|
||||
|
||||
// Get datatable
|
||||
var dTable = $('#' + tableId).dataTable();
|
||||
|
||||
// Clear entire datatable
|
||||
dTable.fnClearTable();
|
||||
|
||||
// Go through each row
|
||||
for ( var i = 0; i < dRows.length; i++) {
|
||||
// If there is row with values
|
||||
if (dRows[i]) {
|
||||
// Go through each column
|
||||
// Ignore the 1st column because it is a button
|
||||
var cols = dRows[i].childNodes;
|
||||
var vals = new Object();
|
||||
for ( var j = 1; j < cols.length; j++) {
|
||||
var val = cols.item(j).firstChild.nodeValue;
|
||||
|
||||
// Insert quotes
|
||||
if (val == ' ') {
|
||||
vals[j - 1] = '';
|
||||
} else {
|
||||
vals[j - 1] = val;
|
||||
}
|
||||
}
|
||||
// Add original content back into datatable
|
||||
for ( var i = 1; i < origCont.length; i++) {
|
||||
dTable.fnAddData(origCont[i], true);
|
||||
}
|
||||
|
||||
// Save row
|
||||
newCont[i + 1] = vals;
|
||||
}
|
||||
}
|
||||
|
||||
// Update xCAT table
|
||||
$.ajax( {
|
||||
type : 'POST',
|
||||
url : 'lib/tabRestore.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
table : tableName,
|
||||
cont : newCont
|
||||
},
|
||||
success : function(data) {
|
||||
alert('Changes saved');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
var undoLnk = $('<a>Undo</a>');
|
||||
undoLnk.click(function() {
|
||||
// Get table ID
|
||||
var tableId = $(this).parents('.dataTables_wrapper').attr('id').replace('_wrapper', '');
|
||||
|
||||
// Get datatable
|
||||
var dTable = $('#' + tableId).dataTable();
|
||||
|
||||
// Clear entire datatable
|
||||
dTable.fnClearTable();
|
||||
// Enable editable columns (again)
|
||||
// Do not make 1st column editable
|
||||
$('#' + tableId + ' td:not(td:nth-child(1))').editable(
|
||||
function(value, settings) {
|
||||
// Get column index
|
||||
var colPos = this.cellIndex;
|
||||
// Get row index
|
||||
var rowPos = dTable.fnGetPosition(this.parentNode);
|
||||
|
||||
// Add original content back into datatable
|
||||
for ( var i = 1; i < origCont.length; i++) {
|
||||
dTable.fnAddData(origCont[i], true);
|
||||
}
|
||||
// Update datatable
|
||||
dTable.fnUpdate(value, rowPos, colPos);
|
||||
|
||||
// Enable editable columns (again)
|
||||
// Do not make 1st column editable
|
||||
$('#' + tableId + ' td:not(td:nth-child(1))').editable(
|
||||
function(value, settings) {
|
||||
// Get column index
|
||||
var colPos = this.cellIndex;
|
||||
// Get row index
|
||||
var rowPos = dTable.fnGetPosition(this.parentNode);
|
||||
return (value);
|
||||
}, {
|
||||
onblur : 'submit', // Clicking outside editable area submits changes
|
||||
type : 'textarea',
|
||||
placeholder: ' ',
|
||||
height : '30px' // The height of the text area
|
||||
});
|
||||
});
|
||||
|
||||
var addLnk = $('<a>Add row</a>');
|
||||
addLnk.click(function() {
|
||||
// Create an empty row
|
||||
var row = new Array();
|
||||
|
||||
// Update datatable
|
||||
dTable.fnUpdate(value, rowPos, colPos);
|
||||
/**
|
||||
* Remove button
|
||||
*/
|
||||
row.push('<span class="ui-icon ui-icon-close" onclick="deleteRow(this)"></span>');
|
||||
for ( var i = 0; i < headers.length; i++) {
|
||||
row.push('');
|
||||
}
|
||||
|
||||
return (value);
|
||||
}, {
|
||||
onblur : 'submit', // Clicking outside editable area submits changes
|
||||
type : 'textarea',
|
||||
placeholder: ' ',
|
||||
height : '30px' // The height of the text area
|
||||
});
|
||||
});
|
||||
|
||||
var addLnk = $('<a>Add row</a>');
|
||||
addLnk.click(function() {
|
||||
// Create an empty row
|
||||
var row = new Array();
|
||||
// Get table ID and name
|
||||
var tableId = $(this).parents('.dataTables_wrapper').attr('id').replace('_wrapper', '');
|
||||
|
||||
// Get datatable
|
||||
var dTable = $('#' + tableId).dataTable();
|
||||
|
||||
// Add the row to the data table
|
||||
dTable.fnAddData(row);
|
||||
|
||||
/**
|
||||
* Remove button
|
||||
*/
|
||||
row.push('<span class="ui-icon ui-icon-close" onclick="deleteRow(this)"></span>');
|
||||
for ( var i = 0; i < headers.length; i++) {
|
||||
row.push('');
|
||||
}
|
||||
// Enable editable columns (again)
|
||||
// Do not make 1st column editable
|
||||
$('#' + tableId + ' td:not(td:nth-child(1))').editable(
|
||||
function(value, settings) {
|
||||
// Get column index
|
||||
var colPos = this.cellIndex;
|
||||
// Get row index
|
||||
var rowPos = dTable.fnGetPosition(this.parentNode);
|
||||
|
||||
// Get table ID and name
|
||||
var tableId = $(this).parents('.dataTables_wrapper').attr('id').replace('_wrapper', '');
|
||||
var tableName = tableId.replace('Datatable', '');
|
||||
|
||||
// Get datatable
|
||||
var dTable = $('#' + tableId).dataTable();
|
||||
|
||||
// Add the row to the data table
|
||||
dTable.fnAddData(row);
|
||||
// Update datatable
|
||||
dTable.fnUpdate(value, rowPos, colPos);
|
||||
|
||||
// Enable editable columns (again)
|
||||
// Do not make 1st column editable
|
||||
$('#' + tableId + ' td:not(td:nth-child(1))').editable(
|
||||
function(value, settings) {
|
||||
// Get column index
|
||||
var colPos = this.cellIndex;
|
||||
// Get row index
|
||||
var rowPos = dTable.fnGetPosition(this.parentNode);
|
||||
|
||||
// Update datatable
|
||||
dTable.fnUpdate(value, rowPos, colPos);
|
||||
|
||||
return (value);
|
||||
}, {
|
||||
onblur : 'submit', // Clicking outside editable area submits changes
|
||||
type : 'textarea',
|
||||
placeholder: ' ',
|
||||
height : '30px' // The height of the text area
|
||||
});
|
||||
});
|
||||
|
||||
// Actions
|
||||
var actionsLnk = '<a>Actions</a>';
|
||||
var actsMenu = createMenu([saveLnk, undoLnk, addLnk]);
|
||||
|
||||
// Create an action menu
|
||||
var actionsMenu = createMenu([ [ actionsLnk, actsMenu ] ]);
|
||||
actionsMenu.superfish();
|
||||
actionsMenu.css('display', 'inline-block');
|
||||
actionBar.append(actionsMenu);
|
||||
|
||||
// Set correct theme for action menu
|
||||
actionsMenu.find('li').hover(function() {
|
||||
setMenu2Theme($(this));
|
||||
}, function() {
|
||||
setMenu2Normal($(this));
|
||||
});
|
||||
|
||||
// Create a division to hold actions menu
|
||||
var menuDiv = $('<div id="' + id + 'Datatable_menuDiv" class="menuDiv"></div>');
|
||||
$('#' + id + 'Datatable_wrapper').prepend(menuDiv);
|
||||
menuDiv.append(actionBar);
|
||||
$('#' + id + 'Datatable_filter').appendTo(menuDiv);
|
||||
return (value);
|
||||
}, {
|
||||
onblur : 'submit', // Clicking outside editable area submits changes
|
||||
type : 'textarea',
|
||||
placeholder: ' ',
|
||||
height : '30px' // The height of the text area
|
||||
});
|
||||
});
|
||||
|
||||
// Create an action menu
|
||||
var actionsMenu = createMenu([saveLnk, undoLnk, addLnk]);
|
||||
actionsMenu.superfish();
|
||||
actionsMenu.css('display', 'inline-block');
|
||||
actionBar.append(actionsMenu);
|
||||
|
||||
// Set correct theme for action menu
|
||||
actionsMenu.find('li').hover(function() {
|
||||
setMenu2Theme($(this));
|
||||
}, function() {
|
||||
setMenu2Normal($(this));
|
||||
});
|
||||
|
||||
// Create a division to hold actions menu
|
||||
var menuDiv = $('<div id="' + id + 'Datatable_menuDiv" class="menuDiv"></div>');
|
||||
$('#' + id + 'Datatable_wrapper').prepend(menuDiv);
|
||||
menuDiv.append(actionBar);
|
||||
$('#' + id + 'Datatable_filter').appendTo(menuDiv);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a row in the data table
|
||||
*
|
||||
* @param obj
|
||||
* The object that was clicked
|
||||
* @return Nothing
|
||||
* @param obj The object that was clicked
|
||||
*/
|
||||
function deleteRow(obj) {
|
||||
// Get table ID
|
||||
var tableId = $(obj).parents('table').attr('id');
|
||||
// Get table ID
|
||||
var tableId = $(obj).parents('table').attr('id');
|
||||
|
||||
// Get datatable
|
||||
var dTable = $('#' + tableId).dataTable();
|
||||
// Get datatable
|
||||
var dTable = $('#' + tableId).dataTable();
|
||||
|
||||
// Get all nodes within the datatable
|
||||
var rows = dTable.fnGetNodes();
|
||||
// Get target row
|
||||
var tgtRow = $(obj).parent().parent().get(0);
|
||||
// Get all nodes within the datatable
|
||||
var rows = dTable.fnGetNodes();
|
||||
// Get target row
|
||||
var tgtRow = $(obj).parent().parent().get(0);
|
||||
|
||||
// Find the target row in the datatable
|
||||
for ( var i in rows) {
|
||||
// If the row matches the target row
|
||||
if (rows[i] == tgtRow) {
|
||||
// Remove row
|
||||
dTable.fnDeleteRow(i, null, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Find the target row in the datatable
|
||||
for ( var i in rows) {
|
||||
// If the row matches the target row
|
||||
if (rows[i] == tgtRow) {
|
||||
// Remove row
|
||||
dTable.fnDeleteRow(i, null, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Count the number of occurrences of a specific character in a string
|
||||
*
|
||||
* @param c
|
||||
* Character to count
|
||||
* @param c Character to count
|
||||
* @return The number of occurrences
|
||||
*/
|
||||
String.prototype.count = function(c) {
|
||||
return (this.length - this.replace(new RegExp(c, 'g'), '').length)/c.length;
|
||||
return (this.length - this.replace(new RegExp(c, 'g'), '').length)/c.length;
|
||||
};
|
@ -1,408 +1,372 @@
|
||||
/*associate the step name with step number*/
|
||||
var steps = ['Platform', 'Complete'];
|
||||
// Associate the step name with step number
|
||||
var steps = [ 'Platform', 'Complete' ];
|
||||
|
||||
/*associate the function with step number*/
|
||||
var initFunctions = [initSelectPlatform, complete];
|
||||
// Associate the function with step number
|
||||
var initFunctions = [ initSelectPlatform, complete ];
|
||||
var nextFunctions = [ getPlatform, undefined ];
|
||||
|
||||
/*associate the function witch should be called before the page changed(when click next or back)
|
||||
*if there is no need to call functions, use undefined.*/
|
||||
var nextFunctions = [getPlatform, undefined];
|
||||
|
||||
/*save current step number*/
|
||||
// Save current step number
|
||||
var currentStep = 0;
|
||||
|
||||
/*save user's input*/
|
||||
// Save user's input
|
||||
var discoverEnv;
|
||||
|
||||
/**
|
||||
* create the discover page
|
||||
*
|
||||
* @return nothing
|
||||
* Create the discovery page
|
||||
*/
|
||||
function loadDiscoverPage(){
|
||||
currentStep = 0;
|
||||
discoverEnv = new Object();
|
||||
|
||||
$('#discoverTab').append('<div class="discovercontent" id="discoverContentDiv"><div>');
|
||||
initSelectPlatform();
|
||||
function loadDiscoverPage() {
|
||||
currentStep = 0;
|
||||
discoverEnv = new Object();
|
||||
|
||||
$('#discoverTab').append('<div class="discovercontent" id="discoverContentDiv"><div>');
|
||||
initSelectPlatform();
|
||||
}
|
||||
|
||||
/**
|
||||
* create the navigator buttons on the bottom of discover page
|
||||
*
|
||||
* @param
|
||||
*
|
||||
* @return nothing
|
||||
* Create the navigation buttons on the bottom of discovery page
|
||||
*/
|
||||
function createDiscoverButtons(){
|
||||
var buttonDiv = $('<div style="text-align:center;padding:20px 0px 10px 0px;"></div>');
|
||||
var backButton = createBackButton();
|
||||
var nextButton = createNextButton();
|
||||
var cancelButton = createCancelButton();
|
||||
|
||||
if (backButton)
|
||||
buttonDiv.append(backButton);
|
||||
|
||||
if (nextButton)
|
||||
buttonDiv.append(nextButton);
|
||||
|
||||
if (cancelButton)
|
||||
buttonDiv.append(cancelButton);
|
||||
function createDiscoverButtons() {
|
||||
var buttonDiv = $('<div style="text-align:center;padding:20px 0px 10px 0px;"></div>');
|
||||
var backButton = createBackButton();
|
||||
var nextButton = createNextButton();
|
||||
var cancelButton = createCancelButton();
|
||||
|
||||
$('#discoverContentDiv').append(buttonDiv);
|
||||
if (backButton)
|
||||
buttonDiv.append(backButton);
|
||||
|
||||
if (nextButton)
|
||||
buttonDiv.append(nextButton);
|
||||
|
||||
if (cancelButton)
|
||||
buttonDiv.append(cancelButton);
|
||||
|
||||
$('#discoverContentDiv').append(buttonDiv);
|
||||
}
|
||||
|
||||
function createCancelButton(){
|
||||
if (0 == currentStep)
|
||||
return undefined;
|
||||
|
||||
if ((steps.length - 1) == currentStep)
|
||||
return undefined;
|
||||
|
||||
var cancelbutton = createButton('Cancel');
|
||||
cancelbutton.bind('click', function(){
|
||||
$('#discoverTab').empty();
|
||||
for (var name in discoverEnv)
|
||||
removeDiscoverEnv(name);
|
||||
loadDiscoverPage();
|
||||
});
|
||||
|
||||
return cancelbutton;
|
||||
function createCancelButton() {
|
||||
if (0 == currentStep)
|
||||
return undefined;
|
||||
|
||||
if ((steps.length - 1) == currentStep)
|
||||
return undefined;
|
||||
|
||||
var cancelbutton = createButton('Cancel');
|
||||
cancelbutton.bind('click', function() {
|
||||
$('#discoverTab').empty();
|
||||
for (var name in discoverEnv)
|
||||
removeDiscoverEnv(name);
|
||||
loadDiscoverPage();
|
||||
});
|
||||
|
||||
return cancelbutton;
|
||||
}
|
||||
|
||||
/**
|
||||
* create the next button base on the currentStep, the last step does not need this button
|
||||
*
|
||||
* @return nothing
|
||||
* Create the next button base on the current step,
|
||||
* the last step does not need this button
|
||||
*/
|
||||
function createNextButton(){
|
||||
var tempFlag = true;
|
||||
if ((steps.length - 1) == currentStep)
|
||||
return undefined;
|
||||
|
||||
var nextButton = createButton('Next');
|
||||
nextButton.bind('click', function(){
|
||||
if (nextFunctions[currentStep])
|
||||
tempFlag = nextFunctions[currentStep]('next');
|
||||
|
||||
if (!tempFlag)
|
||||
return;
|
||||
currentStep ++;
|
||||
initFunctions[currentStep]('next');
|
||||
});
|
||||
|
||||
return nextButton;
|
||||
function createNextButton() {
|
||||
var tempFlag = true;
|
||||
if ((steps.length - 1) == currentStep)
|
||||
return undefined;
|
||||
|
||||
var nextButton = createButton('Next');
|
||||
nextButton.bind('click', function() {
|
||||
if (nextFunctions[currentStep])
|
||||
tempFlag = nextFunctions[currentStep]('next');
|
||||
|
||||
if (!tempFlag)
|
||||
return;
|
||||
currentStep++;
|
||||
initFunctions[currentStep]('next');
|
||||
});
|
||||
|
||||
return nextButton;
|
||||
}
|
||||
|
||||
/**
|
||||
* create the next button base on the currentStep, the first step does not need this button
|
||||
*
|
||||
* @return nothing
|
||||
* Create the next button base on the current step,
|
||||
* the first step does not need this button
|
||||
*/
|
||||
function createBackButton(){
|
||||
var tempFlag = true;
|
||||
if (0 == currentStep)
|
||||
return undefined;
|
||||
|
||||
var backButton = createButton('Back');
|
||||
backButton.bind('click', function(){
|
||||
if (nextFunctions[currentStep])
|
||||
tempFlag = nextFunctions[currentStep]('back');
|
||||
|
||||
if (!tempFlag)
|
||||
return;
|
||||
|
||||
currentStep--;
|
||||
function createBackButton() {
|
||||
var tempFlag = true;
|
||||
if (0 == currentStep)
|
||||
return undefined;
|
||||
|
||||
initFunctions[currentStep]('back');
|
||||
});
|
||||
|
||||
return backButton;
|
||||
var backButton = createButton('Back');
|
||||
backButton.bind('click', function() {
|
||||
if (nextFunctions[currentStep])
|
||||
tempFlag = nextFunctions[currentStep]('back');
|
||||
|
||||
if (!tempFlag)
|
||||
return;
|
||||
|
||||
currentStep--;
|
||||
|
||||
initFunctions[currentStep]('back');
|
||||
});
|
||||
|
||||
return backButton;
|
||||
}
|
||||
|
||||
/**
|
||||
* get the input value on discover page
|
||||
* Get the input value on discovery page
|
||||
*
|
||||
* @param envName
|
||||
* value's name(discoverEnv's key)
|
||||
* @return
|
||||
* if there is assciate value, return the value.
|
||||
* else return null.
|
||||
* @param envName Value name (discoverEnv key)
|
||||
* @return If there is an associate value, return the value, else return NULL
|
||||
*/
|
||||
function getDiscoverEnv(envName){
|
||||
if (discoverEnv[envName])
|
||||
return discoverEnv[envName];
|
||||
else
|
||||
return '';
|
||||
function getDiscoverEnv(envName) {
|
||||
if (discoverEnv[envName])
|
||||
return discoverEnv[envName];
|
||||
else
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* set the input value on discover page
|
||||
* Set the input value on discovery page
|
||||
*
|
||||
* @param envName
|
||||
* value's name(discoverEnv's key)
|
||||
* @param envValue
|
||||
* value
|
||||
* @return nothing
|
||||
* @param envName Value name (discoverEnv key)
|
||||
* @param envValue Value
|
||||
*/
|
||||
function setDiscoverEnv(envName, envValue){
|
||||
if (envName)
|
||||
discoverEnv[envName] = envValue;
|
||||
function setDiscoverEnv(envName, envValue) {
|
||||
if (envName)
|
||||
discoverEnv[envName] = envValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* delete the input value on discover page
|
||||
* Delete the input value on discovery page
|
||||
*
|
||||
* @param envName
|
||||
* value's name(discoverEnv's key)
|
||||
* @return nothing
|
||||
* @param envName Value name (discoverEnv's key)
|
||||
*/
|
||||
function removeDiscoverEnv(envName){
|
||||
if (discoverEnv[envName])
|
||||
delete discoverEnv[envName];
|
||||
function removeDiscoverEnv(envName) {
|
||||
if (discoverEnv[envName])
|
||||
delete discoverEnv[envName];
|
||||
}
|
||||
|
||||
/**
|
||||
* Expand the noderange into node names.
|
||||
* Expand the noderange into node names
|
||||
*
|
||||
* @param nodeRange
|
||||
* @return node names array
|
||||
* @param nodeRange Node range
|
||||
* @return Array of node names
|
||||
*/
|
||||
function expandNR(nodeRange){
|
||||
var retArray = new Array();
|
||||
var tempResult;
|
||||
if ('' == nodeRange)
|
||||
return retArray;
|
||||
|
||||
tempResult = nodeRange.match(/(.*?)\[(.*?)\](.*)/);
|
||||
if (null != tempResult){
|
||||
var parts = tempResult[2].split('-');
|
||||
if (2 > parts.length)
|
||||
return retArray;
|
||||
|
||||
var start = Number(parts[0]);
|
||||
var end = Number(parts[1]);
|
||||
var len = parts[0].length;
|
||||
for (var i = parts[0]; i <= parts[1]; i++){
|
||||
var ts = i.toString();
|
||||
if (ts.length < len)
|
||||
ts = "000000".substring(0, (len - ts.length)) + ts;
|
||||
function expandNR(nodeRange) {
|
||||
var retArray = new Array();
|
||||
var tempResult;
|
||||
if ('' == nodeRange)
|
||||
return retArray;
|
||||
|
||||
retArray = retArray.concat(expandNR(tempResult[1] + ts + tempResult[3]));
|
||||
}
|
||||
return retArray;
|
||||
}
|
||||
|
||||
var tempArray = nodeRange.split('-');
|
||||
if (2 > tempArray.length){
|
||||
retArray.push(nodeRange);
|
||||
return retArray;
|
||||
}
|
||||
|
||||
var begin = tempArray[0].match(/^(\D+)(\d+)$/);
|
||||
if (2 > begin){
|
||||
retArray.push(nodeRange);
|
||||
return retArray;
|
||||
}
|
||||
|
||||
var end = tempArray[1].match(/^(\D+)(\d+)$/);
|
||||
if (2 > end){
|
||||
retArray.push(nodeRange);
|
||||
return retArray;
|
||||
}
|
||||
|
||||
if (begin[1] != end[1]){
|
||||
retArray.push(nodeRange);
|
||||
return retArray;
|
||||
}
|
||||
|
||||
var prefix = begin[1];
|
||||
var len = begin[2].length;
|
||||
for (var i = begin[2]; i <= end[2]; i++){
|
||||
var ts = i.toString();
|
||||
if (ts.length < len)
|
||||
ts = "000000".substring(0, (len - ts.length)) + ts;
|
||||
retArray.push(prefix + ts);
|
||||
}
|
||||
|
||||
return retArray;
|
||||
tempResult = nodeRange.match(/(.*?)\[(.*?)\](.*)/);
|
||||
if (null != tempResult) {
|
||||
var parts = tempResult[2].split('-');
|
||||
if (2 > parts.length)
|
||||
return retArray;
|
||||
|
||||
var len = parts[0].length;
|
||||
for (var i = parts[0]; i <= parts[1]; i++) {
|
||||
var ts = i.toString();
|
||||
if (ts.length < len)
|
||||
ts = "000000".substring(0, (len - ts.length)) + ts;
|
||||
|
||||
retArray = retArray.concat(expandNR(tempResult[1] + ts
|
||||
+ tempResult[3]));
|
||||
}
|
||||
|
||||
return retArray;
|
||||
}
|
||||
|
||||
var tempArray = nodeRange.split('-');
|
||||
if (2 > tempArray.length) {
|
||||
retArray.push(nodeRange);
|
||||
return retArray;
|
||||
}
|
||||
|
||||
var begin = tempArray[0].match(/^(\D+)(\d+)$/);
|
||||
if (2 > begin) {
|
||||
retArray.push(nodeRange);
|
||||
return retArray;
|
||||
}
|
||||
|
||||
var end = tempArray[1].match(/^(\D+)(\d+)$/);
|
||||
if (2 > end) {
|
||||
retArray.push(nodeRange);
|
||||
return retArray;
|
||||
}
|
||||
|
||||
if (begin[1] != end[1]) {
|
||||
retArray.push(nodeRange);
|
||||
return retArray;
|
||||
}
|
||||
|
||||
var prefix = begin[1];
|
||||
var len = begin[2].length;
|
||||
for (var i = begin[2]; i <= end[2]; i++) {
|
||||
var ts = i.toString();
|
||||
if (ts.length < len)
|
||||
ts = "000000".substring(0, (len - ts.length)) + ts;
|
||||
retArray.push(prefix + ts);
|
||||
}
|
||||
|
||||
return retArray;
|
||||
}
|
||||
|
||||
/**
|
||||
* collect all inputs' value from the page
|
||||
* Collect all input values from the page
|
||||
*
|
||||
* @return true: this step is correct, can go to the next page
|
||||
* false: this step contains error.
|
||||
* @return True if this step is correct and can go to the next page, false if this step contains error
|
||||
*/
|
||||
function collectInputValue(){
|
||||
$('#discoverContentDiv input[type=text]').each(function(){
|
||||
var name = $(this).attr('name');
|
||||
var value = $(this).attr('value');
|
||||
if ('' != value)
|
||||
setDiscoverEnv(name, value);
|
||||
else
|
||||
removeDiscoverEnv(name);
|
||||
});
|
||||
|
||||
return true;
|
||||
function collectInputValue() {
|
||||
$('#discoverContentDiv input[type=text]').each(function() {
|
||||
var name = $(this).attr('name');
|
||||
var value = $(this).attr('value');
|
||||
if ('' != value)
|
||||
setDiscoverEnv(name, value);
|
||||
else
|
||||
removeDiscoverEnv(name);
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* verify the ip address,
|
||||
* Verify the IP address
|
||||
*
|
||||
* @param
|
||||
*
|
||||
* @return true: for valid IP address
|
||||
* false : for invalid IP address
|
||||
* @param ip IP address
|
||||
* @return True if IP address is valid, false otherwise
|
||||
*/
|
||||
function verifyIp(ip){
|
||||
function verifyIp(ip) {
|
||||
var reg = /^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-4])$/;
|
||||
return reg.test(ip);
|
||||
}
|
||||
|
||||
/**
|
||||
* transfer ip into decimal
|
||||
* Transalate IP into decimal
|
||||
*
|
||||
* @param
|
||||
*
|
||||
* @return decimal type ip address
|
||||
* @param ip IP address
|
||||
* @return Decimal type for IP address
|
||||
*/
|
||||
function ip2Decimal(ip){
|
||||
function ip2Decimal(ip) {
|
||||
if (!verifyIp(ip))
|
||||
return 0;
|
||||
|
||||
|
||||
var retIp = 0;
|
||||
var tempArray = ip.split('.');
|
||||
for (var i = 0; i < 4; i++){
|
||||
for (var i = 0; i < 4; i++) {
|
||||
retIp = (retIp << 8) | parseInt(tempArray[i]);
|
||||
}
|
||||
|
||||
//change the int into unsigned int type
|
||||
|
||||
// Change the int into unsigned int type
|
||||
retIp = retIp >>> 0;
|
||||
return retIp;
|
||||
}
|
||||
|
||||
/**
|
||||
* calculate the end IP address by start IP and the number of IP range.
|
||||
*
|
||||
* @param
|
||||
*
|
||||
* @return
|
||||
* Calculate the ending IP address from the starting IP address and the IP range number.
|
||||
*/
|
||||
function calcEndIp(ipStart, num){
|
||||
function calcEndIp(ipStart, num) {
|
||||
var sum = 0;
|
||||
var tempNum = Number(num);
|
||||
var temp = /(\d+)\.(\d+)\.(\d+)\.(\d+)/;
|
||||
var ipArray = temp.exec(ipStart);
|
||||
|
||||
|
||||
ipArray.shift();
|
||||
sum = Number(ipArray[3]) + tempNum;
|
||||
if (sum <= 254){
|
||||
if (sum <= 254) {
|
||||
ipArray[3] = sum;
|
||||
return (ipArray.join('.'));
|
||||
}
|
||||
|
||||
|
||||
ipArray[3] = sum % 254;
|
||||
|
||||
|
||||
sum = Number(ipArray[2]) + parseInt(sum / 254);
|
||||
if (sum <= 255){
|
||||
if (sum <= 255) {
|
||||
ipArray[2] = sum;
|
||||
return (ipArray.join('.'));
|
||||
}
|
||||
|
||||
|
||||
ipArray[2] = sum % 255;
|
||||
|
||||
|
||||
sum = Number(ipArray[1]) + parseInt(sum / 255);
|
||||
if (sum <= 255){
|
||||
if (sum <= 255) {
|
||||
ipArray[1] = sum;
|
||||
return (ipArray.join('.'));
|
||||
}
|
||||
|
||||
|
||||
ipArray[1] = sum % 255;
|
||||
ipArray[0] = ipArray[0] + parseInt(sum / 255);
|
||||
return (ipArray.join('.'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Step 1: show the wizard's function
|
||||
* platform selector(system P or system X)
|
||||
*
|
||||
* @return nothing
|
||||
* Step 1: Show the wizard's function platform selector (System p or System x)
|
||||
*/
|
||||
function initSelectPlatform(){
|
||||
var type = '';
|
||||
|
||||
$('#discoverContentDiv').empty();
|
||||
$('.tooltip').remove();
|
||||
|
||||
var selectPlatform = $('<div style="min-height:360px"><h2>' + steps[currentStep] + '</h2></div>');
|
||||
|
||||
var infoMsg = 'This wizard will guide you through the process of defining the naming conventions within' +
|
||||
'your cluster, discovering the hardware on your network, and automatically defining it in the xCAT' +
|
||||
'database. Choose which type of hardware you want to discover, and then click Next.';
|
||||
var info = createInfoBar(infoMsg);
|
||||
selectPlatform.append(info);
|
||||
|
||||
var hwList = $('<ol>Platforms available:</ol>');
|
||||
hwList.append('<li><input type="radio" name="platform" id="idataplex"><label>iDataPlex</label></input></li>');
|
||||
hwList.append('<li><input type="radio" name="platform" disabled="true" id="blade"><span style="color:gray;"> BladeCenter</span></input></li>');
|
||||
hwList.append('<li><input type="radio" name="platform" id="ih"> System p hardware (P7 IH)</input></li>');
|
||||
hwList.append('<li><input type="radio" name="platform" id="nonih"> System p hardware (Non P7 IH)</input></li>');
|
||||
|
||||
hwList.find('li').css('padding', '2px 10px');
|
||||
selectPlatform.append(hwList);
|
||||
|
||||
$('#discoverContentDiv').append(selectPlatform);
|
||||
|
||||
if (getDiscoverEnv('machineType'))
|
||||
type = getDiscoverEnv('machineType');
|
||||
else
|
||||
type = 'ih';
|
||||
|
||||
$('#discoverContentDiv #' + type).attr('checked', 'checked');
|
||||
createDiscoverButtons();
|
||||
function initSelectPlatform() {
|
||||
var type = '';
|
||||
|
||||
$('#discoverContentDiv').empty();
|
||||
$('.tooltip').remove();
|
||||
|
||||
var selectPlatform = $('<div style="min-height:360px"><h2>' + steps[currentStep] + '</h2></div>');
|
||||
|
||||
var infoMsg = 'This wizard will guide you through the process of defining the naming conventions within'
|
||||
+ 'your cluster, discovering the hardware on your network, and automatically defining it in the xCAT'
|
||||
+ 'database. Choose which type of hardware you want to discover, and then click Next.';
|
||||
var info = createInfoBar(infoMsg);
|
||||
selectPlatform.append(info);
|
||||
|
||||
var hwList = $('<ol>Platforms available:</ol>');
|
||||
hwList.append('<li><input type="radio" name="platform" id="idataplex"><label>iDataPlex</label></input></li>');
|
||||
hwList.append('<li><input type="radio" name="platform" disabled="true" id="blade"><span style="color:gray;"> BladeCenter</span></input></li>');
|
||||
hwList.append('<li><input type="radio" name="platform" id="ih"> System p hardware (P7 IH)</input></li>');
|
||||
hwList.append('<li><input type="radio" name="platform" id="nonih"> System p hardware (Non P7 IH)</input></li>');
|
||||
|
||||
hwList.find('li').css('padding', '2px 10px');
|
||||
selectPlatform.append(hwList);
|
||||
|
||||
$('#discoverContentDiv').append(selectPlatform);
|
||||
|
||||
if (getDiscoverEnv('machineType'))
|
||||
type = getDiscoverEnv('machineType');
|
||||
else
|
||||
type = 'ih';
|
||||
|
||||
$('#discoverContentDiv #' + type).attr('checked', 'checked');
|
||||
createDiscoverButtons();
|
||||
}
|
||||
|
||||
/**
|
||||
* Step 1: Get the platform type
|
||||
*
|
||||
* @return true
|
||||
*/
|
||||
function getPlatform(){
|
||||
var radioValue = $('#discoverContentDiv :checked').attr('id');
|
||||
var platformObj;
|
||||
switch(radioValue){
|
||||
case 'ih':
|
||||
case 'nonih':
|
||||
platformObj = new hmcPlugin();
|
||||
break;
|
||||
case 'idataplex':
|
||||
platformObj = new ipmiPlugin();
|
||||
break;
|
||||
case 'blade':
|
||||
break;
|
||||
}
|
||||
|
||||
steps = ['Platform'].concat(platformObj.getStep(), 'compelte');
|
||||
initFunctions = [initSelectPlatform].concat(platformObj.getInitFunction(), complete);
|
||||
nextFunctions = [getPlatform].concat(platformObj.getNextFunction(), undefined);
|
||||
setDiscoverEnv('machineType', radioValue);
|
||||
return true;
|
||||
function getPlatform() {
|
||||
var radioValue = $('#discoverContentDiv :checked').attr('id');
|
||||
var platformObj = null;
|
||||
switch (radioValue) {
|
||||
case 'ih':
|
||||
case 'nonih':
|
||||
platformObj = new hmcPlugin();
|
||||
break;
|
||||
case 'idataplex':
|
||||
platformObj = new ipmiPlugin();
|
||||
break;
|
||||
case 'blade':
|
||||
break;
|
||||
}
|
||||
|
||||
steps = [ 'Platform' ].concat(platformObj.getStep(), 'compelte');
|
||||
initFunctions = [ initSelectPlatform ].concat(platformObj.getInitFunction(), complete);
|
||||
nextFunctions = [ getPlatform ].concat(platformObj.getNextFunction(), undefined);
|
||||
setDiscoverEnv('machineType', radioValue);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* last step: complete
|
||||
*
|
||||
* @param
|
||||
*
|
||||
* @return
|
||||
* Last step: Complete
|
||||
*/
|
||||
function complete(){
|
||||
$('#discoverContentDiv').empty();
|
||||
$('.tooltip').remove();
|
||||
var showStr = '<div style="min-height:360px"><h2>' + steps[currentStep] + '<br/><br/></h2>';
|
||||
showStr += 'You can go to the <a href="index.php">nodes page</a> to check nodes which were defined just now.';
|
||||
$('#discoverContentDiv').append(showStr);
|
||||
|
||||
createDiscoverButtons();
|
||||
function complete() {
|
||||
$('#discoverContentDiv').empty();
|
||||
$('.tooltip').remove();
|
||||
var showStr = '<div style="min-height:360px"><h2>' + steps[currentStep] + '<br/><br/></h2>';
|
||||
showStr += 'You can go to the <a href="index.php">nodes page</a> to check nodes which were defined just now.';
|
||||
$('#discoverContentDiv').append(showStr);
|
||||
|
||||
createDiscoverButtons();
|
||||
}
|
525
xCAT-UI/js/configure/service.js
Normal file
525
xCAT-UI/js/configure/service.js
Normal file
@ -0,0 +1,525 @@
|
||||
/**
|
||||
* Global variables
|
||||
*/
|
||||
var topPriority = 0;
|
||||
|
||||
/**
|
||||
* Load the service portal's provision page
|
||||
*
|
||||
* @param tabId Tab ID where page will reside
|
||||
*/
|
||||
function loadServicePage(tabId) {
|
||||
// Create info bar
|
||||
var infoBar = createInfoBar('Select a platform to configure, then click Ok.');
|
||||
|
||||
// Create self-service portal page
|
||||
var tabId = 'serviceTab';
|
||||
var servicePg = $('<div class="form"></div>');
|
||||
$('#' + tabId).append(infoBar, servicePg);
|
||||
|
||||
// Create radio buttons for platforms
|
||||
var hwList = $('<ol>Platforms available:</ol>');
|
||||
var esx = $('<li><input type="radio" name="hw" value="esx" checked/>ESX</li>');
|
||||
var kvm = $('<li><input type="radio" name="hw" value="kvm"/>KVM</li>');
|
||||
var zvm = $('<li><input type="radio" name="hw" value="zvm"/>z\/VM</li>');
|
||||
|
||||
hwList.append(esx);
|
||||
hwList.append(kvm);
|
||||
hwList.append(zvm);
|
||||
servicePg.append(hwList);
|
||||
|
||||
/**
|
||||
* Ok
|
||||
*/
|
||||
var okBtn = createButton('Ok');
|
||||
okBtn.bind('click', function(event) {
|
||||
var configTabs = getConfigTab();
|
||||
|
||||
// Get hardware that was selected
|
||||
var hw = $(this).parent().find('input[name="hw"]:checked').val();
|
||||
var newTabId = hw + 'ProvisionTab';
|
||||
|
||||
if ($('#' + newTabId).size() > 0){
|
||||
configTabs.select(newTabId);
|
||||
} else {
|
||||
var title = '';
|
||||
|
||||
// Create an instance of the plugin
|
||||
var plugin = null;
|
||||
switch (hw) {
|
||||
case "kvm":
|
||||
plugin = new kvmPlugin();
|
||||
title = 'KVM';
|
||||
break;
|
||||
case "esx":
|
||||
plugin = new esxPlugin();
|
||||
title = 'ESX';
|
||||
break;
|
||||
case "zvm":
|
||||
plugin = new zvmPlugin();
|
||||
title = 'z/VM';
|
||||
|
||||
// Get zVM host names
|
||||
if (!$.cookie('srv_zvm')){
|
||||
$.ajax( {
|
||||
url : 'lib/srv_cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'webportal',
|
||||
tgt : '',
|
||||
args : 'lszvm',
|
||||
msg : ''
|
||||
},
|
||||
|
||||
success : function(data) {
|
||||
setzVMCookies(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
// Select tab
|
||||
configTabs.add(newTabId, title, '', true);
|
||||
configTabs.select(newTabId);
|
||||
plugin.loadConfigPage(newTabId);
|
||||
}
|
||||
});
|
||||
|
||||
servicePg.append(okBtn);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the user panel where users can be created, modified, or deleted
|
||||
*
|
||||
* @param panelId Panel ID
|
||||
*/
|
||||
function loadUserPanel(panelId) {
|
||||
// Get users list
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'tabdump',
|
||||
tgt : '',
|
||||
args : 'passwd',
|
||||
msg : panelId
|
||||
},
|
||||
|
||||
success : loadUserTable
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Load user datatable
|
||||
*
|
||||
* @param data HTTP request data
|
||||
*/
|
||||
function loadUserTable(data) {
|
||||
// Get response
|
||||
var rsp = data.rsp;
|
||||
// Get panel ID
|
||||
var panelId = data.msg;
|
||||
|
||||
// Wipe panel clean
|
||||
$('#' + panelId).empty();
|
||||
|
||||
// Add info bar
|
||||
$('#' + panelId).append(createInfoBar('Create, edit, and delete users for the self-service portal. Double-click on a cell to edit a users properties. Click outside the table to save changes. Hit the Escape key to ignore changes.'));
|
||||
|
||||
// Get table headers
|
||||
// The table headers in the passwd table are: key, username, password, cryptmethod, comments, and disable
|
||||
var headers = new Array('priority', 'username', 'password', 'max-vm');
|
||||
|
||||
// Create a new datatable
|
||||
var tableId = 'userDatatable';
|
||||
var table = new DataTable(tableId);
|
||||
|
||||
// Add column for the checkbox
|
||||
headers.unshift('<input type="checkbox" onclick="selectAllCheckbox(event, $(this))">');
|
||||
table.init(headers);
|
||||
headers.shift();
|
||||
|
||||
// Append datatable to panel
|
||||
$('#' + panelId).append(table.object());
|
||||
|
||||
// Add table rows
|
||||
// Start with the 2nd row (1st row is the headers)
|
||||
for ( var i = 1; i < rsp.length; i++) {
|
||||
// Split into columns
|
||||
var tmp = rsp[i].split(',');
|
||||
|
||||
// Go through each column
|
||||
for (var j = 0; j < tmp.length; j++) {
|
||||
// Replace quote
|
||||
tmp[j] = tmp[j].replace(new RegExp('"', 'g'), '');
|
||||
}
|
||||
|
||||
// Only add users having the key = xcat
|
||||
if (tmp[0] == 'xcat') {
|
||||
// Columns are: priority, username, password, and max-vm
|
||||
var cols = new Array('', tmp[1], tmp[2], '');
|
||||
|
||||
// Add remove button where id = user name
|
||||
cols.unshift('<input type="checkbox" name="' + tmp[1] + '"/>');
|
||||
|
||||
// Add row
|
||||
table.add(cols);
|
||||
}
|
||||
}
|
||||
|
||||
// Turn table into datatable
|
||||
$('#' + tableId).dataTable({
|
||||
'iDisplayLength': 50,
|
||||
'bLengthChange': false,
|
||||
"sScrollX": "100%",
|
||||
"bAutoWidth": true
|
||||
});
|
||||
|
||||
// Create action bar
|
||||
var actionBar = $('<div class="actionBar"></div>');
|
||||
|
||||
var createLnk = $('<a>Create</a>');
|
||||
createLnk.click(function() {
|
||||
openCreateUserDialog();
|
||||
});
|
||||
|
||||
var deleteLnk = $('<a>Delete</a>');
|
||||
deleteLnk.click(function() {
|
||||
var users = getNodesChecked(tableId);
|
||||
if (users) {
|
||||
openDeleteUserDialog(users);
|
||||
}
|
||||
});
|
||||
|
||||
var refreshLnk = $('<a>Refresh</a>');
|
||||
refreshLnk.click(function() {
|
||||
loadUserPanel(panelId);
|
||||
});
|
||||
|
||||
// Create an action menu
|
||||
var actionsMenu = createMenu([createLnk, deleteLnk, refreshLnk]);
|
||||
actionsMenu.superfish();
|
||||
actionsMenu.css('display', 'inline-block');
|
||||
actionBar.append(actionsMenu);
|
||||
|
||||
// Set correct theme for action menu
|
||||
actionsMenu.find('li').hover(function() {
|
||||
setMenu2Theme($(this));
|
||||
}, function() {
|
||||
setMenu2Normal($(this));
|
||||
});
|
||||
|
||||
// Create a division to hold actions menu
|
||||
var menuDiv = $('<div id="' + tableId + '_menuDiv" class="menuDiv"></div>');
|
||||
$('#' + tableId + '_wrapper').prepend(menuDiv);
|
||||
menuDiv.append(actionBar);
|
||||
$('#' + tableId + '_filter').appendTo(menuDiv);
|
||||
|
||||
// Get policy data
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'tabdump',
|
||||
tgt : '',
|
||||
args : 'policy',
|
||||
msg : tableId
|
||||
},
|
||||
|
||||
success : loadUserTable4Policy
|
||||
});
|
||||
|
||||
/**
|
||||
* Enable editable cells
|
||||
*/
|
||||
// Do not make 1st or 2nd column editable
|
||||
$('#' + tableId + ' td:not(td:nth-child(1),td:nth-child(2))').editable(
|
||||
function(value, settings) {
|
||||
// If users did not make changes, return the value directly
|
||||
// jeditable saves the old value in this.revert
|
||||
if ($(this).attr('revert') == value){
|
||||
return value;
|
||||
}
|
||||
|
||||
var panelId = $(this).parents('.ui-accordion-content').attr('id');
|
||||
|
||||
// Get column index
|
||||
var colPos = this.cellIndex;
|
||||
|
||||
// Get row index
|
||||
var dTable = $('#' + tableId).dataTable();
|
||||
var rowPos = dTable.fnGetPosition(this.parentNode);
|
||||
|
||||
// Update datatable
|
||||
dTable.fnUpdate(value, rowPos, colPos, false);
|
||||
|
||||
// Get table headers
|
||||
var headers = $('#' + nodesTableId).parents('.dataTables_scroll').find('.dataTables_scrollHead thead tr:eq(0) th');
|
||||
|
||||
// Get user attributes
|
||||
var priority = $(this).parent().find('td:eq(1)').text();
|
||||
var user = $(this).parent().find('td:eq(2)').text();
|
||||
var password = $(this).parent().find('td:eq(3)').text();
|
||||
var maxVM = $(this).parent().find('td:eq(4)').text();
|
||||
|
||||
// Send command to change user attributes
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'webrun',
|
||||
tgt : '',
|
||||
args : 'updateuser;' + priority + ';' + user + ';' + password + ';' + maxVM,
|
||||
msg : panelId
|
||||
},
|
||||
success : updatePanel
|
||||
});
|
||||
|
||||
return value;
|
||||
}, {
|
||||
onblur : 'submit', // Clicking outside editable area submits changes
|
||||
type : 'textarea',
|
||||
placeholder: ' ',
|
||||
event : "dblclick", // Double click and edit
|
||||
height : '30px' // The height of the text area
|
||||
});
|
||||
|
||||
// Resize accordion
|
||||
$('#' + tableId).parents('.ui-accordion').accordion('resize');
|
||||
}
|
||||
|
||||
/**
|
||||
* Update user datatable for policy
|
||||
*
|
||||
* @param data HTTP request data
|
||||
*/
|
||||
function loadUserTable4Policy(data) {
|
||||
// Get response
|
||||
var rsp = data.rsp;
|
||||
// Get datatable ID
|
||||
var tableId = data.msg;
|
||||
|
||||
// Get datatable
|
||||
var datatable = $('#' + tableId).dataTable();
|
||||
|
||||
// Update max-vm column
|
||||
// The data coming back contains: priority, name, host, commands, noderange, parameters, time, rule, comments, disable
|
||||
|
||||
// Start with the 2nd row (1st row is the headers)
|
||||
topPriority = 0;
|
||||
for ( var i = 1; i < rsp.length; i++) {
|
||||
// Split into columns
|
||||
var tmp = rsp[i].split(',');
|
||||
|
||||
// Go through each column
|
||||
for (var j = 0; j < tmp.length; j++) {
|
||||
// Replace quote
|
||||
tmp[j] = tmp[j].replace(new RegExp('"', 'g'), '');
|
||||
}
|
||||
|
||||
// Get the row containing the user name
|
||||
var rowPos = -1;
|
||||
if (tmp[1])
|
||||
rowPos = findRow(tmp[1], '#' + tableId, 2);
|
||||
|
||||
// Update the priority and max-vm columns
|
||||
if (rowPos > -1) {
|
||||
var maxVM = tmp[8].replace('max-vm:', '');
|
||||
maxVM = maxVM.replace(';', '');
|
||||
datatable.fnUpdate(maxVM, rowPos, 4, false);
|
||||
|
||||
var priority = tmp[0];
|
||||
datatable.fnUpdate(priority, rowPos, 1, false);
|
||||
|
||||
// Set the highest priority
|
||||
if (priority > topPriority)
|
||||
topPriority = priority;
|
||||
}
|
||||
}
|
||||
|
||||
// Adjust column sizes
|
||||
adjustColumnSize(tableId);
|
||||
|
||||
// Resize accordion
|
||||
$('#' + tableId).parents('.ui-accordion').accordion('resize');
|
||||
}
|
||||
|
||||
/**
|
||||
* Open a dialog to create a user
|
||||
*/
|
||||
function openCreateUserDialog() {
|
||||
var dialogId = 'createUser';
|
||||
var dialog = $('<div id="' + dialogId + '" class="form"></div>');
|
||||
var info = createInfoBar('Create an xCAT user. A priority will be generated for the new user.');
|
||||
dialog.append(info);
|
||||
|
||||
// Generate the user priority
|
||||
var userPriority = parseFloat(topPriority) + 0.01;
|
||||
userPriority = userPriority.toPrecision(3);
|
||||
|
||||
// Create node inputs
|
||||
dialog.append($('<div><label>Priority:</label><input name="priority" type="text" disabled="disabled" value="' + userPriority + '"></div>'));
|
||||
dialog.append($('<div><label>User name:</label><input name="username" type="text"></div>'));
|
||||
dialog.append($('<div><label>Password:</label><input name="password" type="password"></div>'));
|
||||
dialog.append($('<div><label>Maximum virtual machines:</label><input name="maxvm" type="text"></div>'));
|
||||
|
||||
dialog.dialog({
|
||||
title: 'Create user',
|
||||
modal: true,
|
||||
width: 400,
|
||||
close: function(){
|
||||
$(this).remove();
|
||||
},
|
||||
buttons: {
|
||||
"OK" : function(){
|
||||
// Remove any warning messages
|
||||
$(this).find('.ui-state-error').remove();
|
||||
|
||||
// Change dialog buttons
|
||||
$('#' + dialogId).dialog('option', 'buttons', {
|
||||
'Close':function(){
|
||||
$(this).dialog('close');
|
||||
}
|
||||
});
|
||||
|
||||
var priority = $(this).find('input[name="priority"]').val();
|
||||
var user = $(this).find('input[name="username"]').val();
|
||||
var password = $(this).find('input[name="password"]').val();
|
||||
var maxVM = $(this).find('input[name="maxvm"]').val();
|
||||
|
||||
// Verify inputs are provided
|
||||
if (!user || !password || !maxVM) {
|
||||
var warn = createWarnBar('Please provide a value for each missing field!');
|
||||
warn.prependTo($(this));
|
||||
} else {
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'webrun',
|
||||
tgt : '',
|
||||
args : 'updateuser;' + priority + ';' + user + ';' + password + ';' + maxVM,
|
||||
msg : dialogId
|
||||
},
|
||||
success : updatePanel
|
||||
});
|
||||
|
||||
// Update highest priority
|
||||
topPriority = priority;
|
||||
}
|
||||
},
|
||||
"Cancel": function(){
|
||||
$(this).dialog('close');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Update dialog
|
||||
*
|
||||
* @param data HTTP request data
|
||||
*/
|
||||
function updatePanel(data) {
|
||||
var dialogId = data.msg;
|
||||
var infoMsg;
|
||||
|
||||
// Create info message
|
||||
if (jQuery.isArray(data.rsp)) {
|
||||
infoMsg = '';
|
||||
for (var i in data.rsp) {
|
||||
infoMsg += data.rsp[i] + '</br>';
|
||||
}
|
||||
} else {
|
||||
infoMsg = data.rsp;
|
||||
}
|
||||
|
||||
// Create info bar with close button
|
||||
var infoBar = $('<div class="ui-state-highlight ui-corner-all"></div>').css('margin', '5px 0px');
|
||||
var icon = $('<span class="ui-icon ui-icon-info"></span>').css({
|
||||
'display': 'inline-block',
|
||||
'margin': '10px 5px'
|
||||
});
|
||||
|
||||
// Create close button to close info bar
|
||||
var close = $('<span class="ui-icon ui-icon-close"></span>').css({
|
||||
'display': 'inline-block',
|
||||
'float': 'right'
|
||||
}).click(function() {
|
||||
$(this).parent().remove();
|
||||
});
|
||||
|
||||
var msg = $('<pre>' + infoMsg + '</pre>').css({
|
||||
'display': 'inline-block',
|
||||
'width': '85%'
|
||||
});
|
||||
|
||||
infoBar.append(icon, msg, close);
|
||||
infoBar.prependTo($('#' + dialogId));
|
||||
}
|
||||
|
||||
/**
|
||||
* Open dialog to confirm user delete
|
||||
*
|
||||
* @param users Users to delete
|
||||
*/
|
||||
function openDeleteUserDialog(users) {
|
||||
// Create form to delete disk to pool
|
||||
var dialogId = 'deleteUser';
|
||||
var deleteForm = $('<div id="' + dialogId + '" class="form"></div>');
|
||||
|
||||
// Create info bar
|
||||
var info = createInfoBar('Are you sure you want to delete ' + users.replace(new RegExp(',', 'g'), ', ') + '?');
|
||||
deleteForm.append(info);
|
||||
|
||||
// Open dialog to delete user
|
||||
deleteForm.dialog({
|
||||
title:'Delete user',
|
||||
modal: true,
|
||||
width: 400,
|
||||
close: function(){
|
||||
$(this).remove();
|
||||
},
|
||||
buttons: {
|
||||
"Ok": function(){
|
||||
// Remove any warning messages
|
||||
$(this).find('.ui-state-error').remove();
|
||||
|
||||
// Change dialog buttons
|
||||
$(this).dialog('option', 'buttons', {
|
||||
'Close': function() {$(this).dialog("close");}
|
||||
});
|
||||
|
||||
// Delete user
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'webrun',
|
||||
tgt : '',
|
||||
args : 'deleteuser;' + users,
|
||||
msg : dialogId
|
||||
},
|
||||
success : updatePanel
|
||||
});
|
||||
},
|
||||
"Cancel": function() {
|
||||
$(this).dialog( "close" );
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Round a floating point to a given precision
|
||||
*
|
||||
* @param value Floating point
|
||||
* @param precision Decimal precision
|
||||
* @returns Floating point number
|
||||
*/
|
||||
function toFixed(value, precision) {
|
||||
var power = Math.pow(10, precision || 0);
|
||||
return String(Math.round(value * power) / power);
|
||||
}
|
@ -1,321 +1,310 @@
|
||||
/**
|
||||
* Load update page
|
||||
*
|
||||
* @return Nothing
|
||||
*/
|
||||
function loadUpdatePage() {
|
||||
var repositoryDiv = $('<div id="repository"></div>');
|
||||
var rpmDiv = $('<div id="rpm"></div>');
|
||||
var statusDiv = createStatusBar("update");
|
||||
statusDiv.hide();
|
||||
var repositoryDiv = $('<div id="repository"></div>');
|
||||
var rpmDiv = $('<div id="rpm"></div>');
|
||||
var statusDiv = createStatusBar("update");
|
||||
statusDiv.hide();
|
||||
|
||||
$('#updateTab').append(statusDiv);
|
||||
$('#updateTab').append('<br/>');
|
||||
$('#updateTab').append(repositoryDiv);
|
||||
$('#updateTab').append(rpmDiv);
|
||||
$('#updateTab').append(statusDiv);
|
||||
$('#updateTab').append('<br/>');
|
||||
$('#updateTab').append(repositoryDiv);
|
||||
$('#updateTab').append(rpmDiv);
|
||||
|
||||
var infoBar = createInfoBar('Select the repository to use and the RPMs to update, then click Update.');
|
||||
repositoryDiv.append(infoBar);
|
||||
var infoBar = createInfoBar('Select the repository to use and the RPMs to update, then click Update.');
|
||||
repositoryDiv.append(infoBar);
|
||||
|
||||
repositoryDiv.append("<fieldset><legend>Repository</legend></fieldset>");
|
||||
$.ajax( {
|
||||
url : 'lib/systemcmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'ostype'
|
||||
},
|
||||
repositoryDiv.append("<fieldset><legend>Repository</legend></fieldset>");
|
||||
$.ajax( {
|
||||
url : 'lib/systemcmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'ostype'
|
||||
},
|
||||
|
||||
success : showRepository
|
||||
});
|
||||
success : showRepository
|
||||
});
|
||||
|
||||
rpmDiv.append("<fieldset></fieldset>");
|
||||
$.ajax( {
|
||||
url : 'lib/systemcmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'rpm -q xCAT-client perl-xCAT xCAT-server xCAT xCAT-rmc xCAT-UI'
|
||||
},
|
||||
rpmDiv.append("<fieldset></fieldset>");
|
||||
$.ajax( {
|
||||
url : 'lib/systemcmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'rpm -q xCAT-client perl-xCAT xCAT-server xCAT xCAT-rmc xCAT-UI'
|
||||
},
|
||||
|
||||
success : showRpmInfo
|
||||
});
|
||||
success : showRpmInfo
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the RPM Repository, it can use user's last choice and input
|
||||
* Show the RPM repository (it can use the user's last choice and input)
|
||||
*
|
||||
* @param data
|
||||
* Data returned from HTTP request
|
||||
* @return Nothing
|
||||
* @param data Data returned from HTTP request
|
||||
*/
|
||||
function showRepository(data) {
|
||||
var develRepository = "";
|
||||
var stableRepository = "";
|
||||
var show = "";
|
||||
var develRepository = "";
|
||||
var stableRepository = "";
|
||||
var show = "";
|
||||
|
||||
// Get the corresponding repository by OS Type
|
||||
if (data.rsp == "aix") {
|
||||
// No repository exists for AIX on sourceforge!
|
||||
develRepository = "http://xcat.sourceforge.net/aix/devel/xcat-core/";
|
||||
stableRepository = "http://xcat.sourceforge.net/aix/xcat-core/";
|
||||
} else {
|
||||
develRepository = "http://sourceforge.net/projects/xcat/files/yum/devel/xcat-core/";
|
||||
stableRepository = "http://sourceforge.net/projects/xcat/files/yum/stable/xcat-core/";
|
||||
}
|
||||
// Get the corresponding repository by OS Type
|
||||
if (data.rsp == "aix") {
|
||||
// No repository exists for AIX on Sourceforge!
|
||||
develRepository = "http://xcat.sourceforge.net/aix/devel/xcat-core/";
|
||||
stableRepository = "http://xcat.sourceforge.net/aix/xcat-core/";
|
||||
} else {
|
||||
develRepository = "http://sourceforge.net/projects/xcat/files/yum/devel/xcat-core/";
|
||||
stableRepository = "http://sourceforge.net/projects/xcat/files/yum/stable/xcat-core/";
|
||||
}
|
||||
|
||||
var repoList = $('<ol></ol>');
|
||||
var repoList = $('<ol></ol>');
|
||||
|
||||
// Display the Devel Repository, remember user's last selection
|
||||
show = show + "<li><input type='radio' ";
|
||||
if ($.cookie('xcatrepository') == 1) {
|
||||
show = show + "checked='true'";
|
||||
}
|
||||
show = show + "name='reporadio' value='" + develRepository + "'>";
|
||||
show = show + "<strong>Development</strong>: " + develRepository + "</li>";
|
||||
repoList.append(show);
|
||||
// Display the Devel Repository, remember user's last selection
|
||||
show = show + "<li><input type='radio' ";
|
||||
if ($.cookie('xcatrepository') == 1) {
|
||||
show = show + "checked='true'";
|
||||
}
|
||||
show = show + "name='reporadio' value='" + develRepository + "'>";
|
||||
show = show + "<strong>Development</strong>: " + develRepository + "</li>";
|
||||
repoList.append(show);
|
||||
|
||||
// Display the Stable Repository, remember user's last selection
|
||||
show = "<li><input type='radio' ";
|
||||
if ($.cookie('xcatrepository') == 2) {
|
||||
show = show + "checked='true'";
|
||||
}
|
||||
show = show + "name='reporadio' value='" + stableRepository + "' checked='true'>";
|
||||
show = show + "<strong>Stable</strong>: " + stableRepository + "</li>";
|
||||
repoList.append(show);
|
||||
// Display the Stable Repository, remember user's last selection
|
||||
show = "<li><input type='radio' ";
|
||||
if ($.cookie('xcatrepository') == 2) {
|
||||
show = show + "checked='true'";
|
||||
}
|
||||
show = show + "name='reporadio' value='" + stableRepository + "' checked='true'>";
|
||||
show = show + "<strong>Stable</strong>: " + stableRepository + "</li>";
|
||||
repoList.append(show);
|
||||
|
||||
// Display the Input Repository, remember user's last selection
|
||||
if (($.cookie('xcatrepository')) && ($.cookie('xcatrepository') != 1)
|
||||
&& ($.cookie('xcatrepository') != 2)) {
|
||||
show = "<li><input type='radio' checked='true' name='reporadio' value=''>Other: ";
|
||||
show += "<input style='width: 500px' id='repositoryaddr' value='"
|
||||
+ $.cookie('xcatrepository') + "'</li>";
|
||||
} else {
|
||||
show = "<li><input type='radio' name='reporadio' value=''>Other: ";
|
||||
show += "<input style='width: 500px' id='repositoryaddr' value=''</li>";
|
||||
}
|
||||
repoList.append(show);
|
||||
|
||||
$('#repository fieldset').append(repoList);
|
||||
// Display the Input Repository, remember user's last selection
|
||||
if (($.cookie('xcatrepository')) && ($.cookie('xcatrepository') != 1)
|
||||
&& ($.cookie('xcatrepository') != 2)) {
|
||||
show = "<li><input type='radio' checked='true' name='reporadio' value=''>Other: ";
|
||||
show += "<input style='width: 500px' id='repositoryaddr' value='"
|
||||
+ $.cookie('xcatrepository') + "'</li>";
|
||||
} else {
|
||||
show = "<li><input type='radio' name='reporadio' value=''>Other: ";
|
||||
show += "<input style='width: 500px' id='repositoryaddr' value=''</li>";
|
||||
}
|
||||
repoList.append(show);
|
||||
|
||||
$('#repository fieldset').append(repoList);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show all xCAT RPMs
|
||||
*
|
||||
* @param data
|
||||
* Data returned from HTTP request
|
||||
* @return Nothing
|
||||
* @param data Data returned from HTTP request
|
||||
*/
|
||||
function showRpmInfo(data) {
|
||||
var rpms = null;
|
||||
var show = "";
|
||||
var rpmNames = new Array("xCAT-client", "perl-xCAT", "xCAT-server", "xCAT", "xCAT-rmc",
|
||||
"xCAT-UI");
|
||||
var temp = 0;
|
||||
if (null == data.rsp) {
|
||||
$('#rpm fieldset').append("Error getting RPMs!");
|
||||
return;
|
||||
}
|
||||
var rpms = null;
|
||||
var show = "";
|
||||
var rpmNames = new Array("xCAT-client", "perl-xCAT", "xCAT-server", "xCAT", "xCAT-rmc",
|
||||
"xCAT-UI");
|
||||
var temp = 0;
|
||||
if (null == data.rsp) {
|
||||
$('#rpm fieldset').append("Error getting RPMs!");
|
||||
return;
|
||||
}
|
||||
|
||||
rpms = data.rsp.split(/\n/);
|
||||
|
||||
// No rpm installed, return
|
||||
if (1 > rpms.length) {
|
||||
$('#rpm fieldset').append("No RPMs installed!");
|
||||
return;
|
||||
}
|
||||
rpms = data.rsp.split(/\n/);
|
||||
|
||||
// No rpm installed, return
|
||||
if (1 > rpms.length) {
|
||||
$('#rpm fieldset').append("No RPMs installed!");
|
||||
return;
|
||||
}
|
||||
|
||||
// Clear the old data
|
||||
$('#rpm fieldset').children().remove();
|
||||
$('#rpm fieldset').append("<legend>xCAT RPMs</legend>");
|
||||
show = "<table id=rpmtable >";
|
||||
show += "<thead class='ui-widget-header'><tr>";
|
||||
show += "<th><input type='checkbox' id='selectall' value='' onclick='updateSelectAll()'></th>";
|
||||
show += "<th><b>Package Name</b></th><th><b>Version</b></th>";
|
||||
show += "</tr></thead>";
|
||||
for (temp = 0; temp < rpms.length; temp++) {
|
||||
// Empty line continue
|
||||
if (!rpms[temp]) {
|
||||
continue;
|
||||
}
|
||||
// Clear the old data
|
||||
$('#rpm fieldset').children().remove();
|
||||
$('#rpm fieldset').append("<legend>xCAT RPMs</legend>");
|
||||
show = "<table id=rpmtable >";
|
||||
show += "<thead class='ui-widget-header'><tr>";
|
||||
show += "<th><input type='checkbox' id='selectall' value='' onclick='updateSelectAll()'></th>";
|
||||
show += "<th><b>Package Name</b></th><th><b>Version</b></th>";
|
||||
show += "</tr></thead>";
|
||||
for (temp = 0; temp < rpms.length; temp++) {
|
||||
// Empty line continue
|
||||
if (!rpms[temp]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// The RPM is not installed, continue
|
||||
if (rpms[temp].indexOf("not") != -1) {
|
||||
continue;
|
||||
}
|
||||
// The RPM is not installed, continue
|
||||
if (rpms[temp].indexOf("not") != -1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Show the version in table
|
||||
show += "<tr>";
|
||||
show += "<td><input type='checkbox' value='" + rpmNames[temp] + "'></td>";
|
||||
show += "<td>" + rpmNames[temp] + "</td><td>"
|
||||
+ rpms[temp].substr(rpmNames[temp].length + 1) + "</td>";
|
||||
show += "</tr>";
|
||||
}
|
||||
show += "</table>";
|
||||
show += "<br\>";
|
||||
$('#rpm fieldset').append(show);
|
||||
// Show the version in table
|
||||
show += "<tr>";
|
||||
show += "<td><input type='checkbox' value='" + rpmNames[temp] + "'></td>";
|
||||
show += "<td>" + rpmNames[temp] + "</td><td>"
|
||||
+ rpms[temp].substr(rpmNames[temp].length + 1) + "</td>";
|
||||
show += "</tr>";
|
||||
}
|
||||
show += "</table>";
|
||||
show += "<br\>";
|
||||
$('#rpm fieldset').append(show);
|
||||
|
||||
// Add the update button
|
||||
var updateButton = createButton('Update');
|
||||
$('#rpm fieldset').append(updateButton);
|
||||
updateButton.bind('click', function() {
|
||||
updateRpm();
|
||||
});
|
||||
// Add the update button
|
||||
var updateButton = createButton('Update');
|
||||
$('#rpm fieldset').append(updateButton);
|
||||
updateButton.bind('click', function() {
|
||||
updateRpm();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Select all checkboxes
|
||||
*
|
||||
* @return Nothing
|
||||
*/
|
||||
function updateSelectAll() {
|
||||
var check_status = $('#selectall').attr('checked');
|
||||
$('input:checkbox').attr('checked', check_status);
|
||||
var check_status = $('#selectall').attr('checked');
|
||||
$('input:checkbox').attr('checked', check_status);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update selected xCAT RPMs
|
||||
*
|
||||
* @return Nothing
|
||||
*/
|
||||
function updateRpm() {
|
||||
// Remove any warning messages
|
||||
$('#updateTab').find('.ui-state-error').remove();
|
||||
// Remove any warning messages
|
||||
$('#updateTab').find('.ui-state-error').remove();
|
||||
|
||||
var rpmPath = $('input[type=radio]:checked').val();
|
||||
var rpmPathType = "0";
|
||||
var rpms = "";
|
||||
var temp = "";
|
||||
var rpmPath = $('input[type=radio]:checked').val();
|
||||
var rpmPathType = "0";
|
||||
var rpms = "";
|
||||
var temp = "";
|
||||
|
||||
if (undefined == rpmPath) {
|
||||
rpmPath = "";
|
||||
}
|
||||
if (undefined == rpmPath) {
|
||||
rpmPath = "";
|
||||
}
|
||||
|
||||
// Select other and we should use the value in the input
|
||||
if ("" == rpmPath) {
|
||||
// Store repo in a cookie
|
||||
rpmPath = $('#repositoryaddr').val();
|
||||
rpmPathType = rpmPath;
|
||||
} else {
|
||||
if (-1 == rpmPath.toLowerCase().indexOf("devel")) {
|
||||
rpmPathType = "2";
|
||||
} else {
|
||||
rpmPathType = "1";
|
||||
}
|
||||
}
|
||||
// Select other and we should use the value in the input
|
||||
if ("" == rpmPath) {
|
||||
// Store repo in a cookie
|
||||
rpmPath = $('#repositoryaddr').val();
|
||||
rpmPathType = rpmPath;
|
||||
} else {
|
||||
if (-1 == rpmPath.toLowerCase().indexOf("devel")) {
|
||||
rpmPathType = "2";
|
||||
} else {
|
||||
rpmPathType = "1";
|
||||
}
|
||||
}
|
||||
|
||||
$("input[type=checkbox]:checked").each(function() {
|
||||
temp = $(this).val();
|
||||
if ("" == temp) {
|
||||
return true;
|
||||
}
|
||||
$("input[type=checkbox]:checked").each(function() {
|
||||
temp = $(this).val();
|
||||
if ("" == temp) {
|
||||
return true;
|
||||
}
|
||||
|
||||
var pattern = new RegExp("^" + temp + ",|," + temp + ",");
|
||||
if (pattern.test(rpms)) {
|
||||
return true;
|
||||
}
|
||||
rpms = rpms + temp + ",";
|
||||
});
|
||||
var pattern = new RegExp("^" + temp + ",|," + temp + ",");
|
||||
if (pattern.test(rpms)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
rpms = rpms + temp + ",";
|
||||
});
|
||||
|
||||
if (0 < rpms.length) {
|
||||
rpms = rpms.slice(0, -1);
|
||||
}
|
||||
if (0 < rpms.length) {
|
||||
rpms = rpms.slice(0, -1);
|
||||
}
|
||||
|
||||
// Check RPM and repository
|
||||
var errMsg = '';
|
||||
if (!rpms) {
|
||||
errMsg = "Please select an RPM!<br>";
|
||||
}
|
||||
// Check RPM and repository
|
||||
var errMsg = '';
|
||||
if (!rpms) {
|
||||
errMsg = "Please select an RPM!<br>";
|
||||
}
|
||||
|
||||
if (!rpmPath) {
|
||||
errMsg += "Please select or specify a repository!";
|
||||
}
|
||||
if (!rpmPath) {
|
||||
errMsg += "Please select or specify a repository!";
|
||||
}
|
||||
|
||||
if (!rpms || !rpmPath) {
|
||||
// Show warning message
|
||||
var warn = createWarnBar(errMsg);
|
||||
warn.prependTo($('#updateTab'));
|
||||
return;
|
||||
}
|
||||
if (!rpms || !rpmPath) {
|
||||
// Show warning message
|
||||
var warn = createWarnBar(errMsg);
|
||||
warn.prependTo($('#updateTab'));
|
||||
return;
|
||||
}
|
||||
|
||||
// Remember users' choice and input
|
||||
$.cookie('xcatrepository', rpmPathType, {
|
||||
path : '/xcat',
|
||||
expires : 10
|
||||
});
|
||||
// Remember users' choice and input
|
||||
$.cookie('xcatrepository', rpmPathType, {
|
||||
path : '/xcat',
|
||||
expires : 10
|
||||
});
|
||||
|
||||
$('#update').show();
|
||||
$('#update div').empty();
|
||||
$('#update div').append("<p>Updating <b>" + rpms + "</b> from <b>" + rpmPath + "</b></p>");
|
||||
$('#update div').append("<img id='loadingpic' src='images/loader.gif'>");
|
||||
$('#rpm button').attr('disabled', 'true');
|
||||
$('#update').show();
|
||||
$('#update div').empty();
|
||||
$('#update div').append("<p>Updating <b>" + rpms + "</b> from <b>" + rpmPath + "</b></p>");
|
||||
$('#update div').append("<img id='loadingpic' src='images/loader.gif'>");
|
||||
$('#rpm button').attr('disabled', 'true');
|
||||
|
||||
// Send the update command to server
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'webrun',
|
||||
tgt : '',
|
||||
args : 'update;' + rpms + ";" + rpmPath,
|
||||
msg : ''
|
||||
},
|
||||
// Send the update command to server
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'webrun',
|
||||
tgt : '',
|
||||
args : 'update;' + rpms + ";" + rpmPath,
|
||||
msg : ''
|
||||
},
|
||||
|
||||
success : showUpdateResult
|
||||
});
|
||||
success : showUpdateResult
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the results of the RPM update
|
||||
*
|
||||
* @param data
|
||||
* Data returned from HTTP request
|
||||
* @return Nothing
|
||||
* @param data Data returned from HTTP request
|
||||
*/
|
||||
function showUpdateResult(data) {
|
||||
var temp = 0;
|
||||
$('#loadingpic').remove();
|
||||
var temp = 0;
|
||||
$('#loadingpic').remove();
|
||||
|
||||
var resArray = data.rsp[0].split(/\n/);
|
||||
if (0 < resArray.length) {
|
||||
// Show last lines
|
||||
if (('' == resArray[resArray.length - 1]) && (resArray.length > 1)) {
|
||||
$('#update div').append('<pre>' + resArray[resArray.length - 2] + '</pre>');
|
||||
} else {
|
||||
$('#update div').append('<pre>' + resArray[resArray.length - 1] + '</pre>');
|
||||
}
|
||||
var resArray = data.rsp[0].split(/\n/);
|
||||
if (0 < resArray.length) {
|
||||
// Show last lines
|
||||
if (('' == resArray[resArray.length - 1]) && (resArray.length > 1)) {
|
||||
$('#update div').append('<pre>' + resArray[resArray.length - 2] + '</pre>');
|
||||
} else {
|
||||
$('#update div').append('<pre>' + resArray[resArray.length - 1] + '</pre>');
|
||||
}
|
||||
|
||||
// Create link to show details
|
||||
$('#update div').append('<br/><a>Show details</a>');
|
||||
$('#update div a').css( {
|
||||
'color' : '#0000FF',
|
||||
'cursor' : 'pointer'
|
||||
}).bind('click', function() {
|
||||
// Toggle details and change text
|
||||
$('#resDetail').toggle();
|
||||
if ($('#update div a').text() == 'Show details') {
|
||||
$('#update div a').text('Hide details');
|
||||
} else {
|
||||
$('#update div a').text('Show details');
|
||||
}
|
||||
});
|
||||
// Create link to show details
|
||||
$('#update div').append('<br/><a>Show details</a>');
|
||||
$('#update div a').css( {
|
||||
'color' : '#0000FF',
|
||||
'cursor' : 'pointer'
|
||||
}).bind('click', function() {
|
||||
// Toggle details and change text
|
||||
$('#resDetail').toggle();
|
||||
if ($('#update div a').text() == 'Show details') {
|
||||
$('#update div a').text('Hide details');
|
||||
} else {
|
||||
$('#update div a').text('Show details');
|
||||
}
|
||||
});
|
||||
|
||||
var resDetail = $('<pre id="resDetail"></pre>');
|
||||
resDetail.hide();
|
||||
$('#update div').append(resDetail);
|
||||
for (temp = 0; temp < resArray.length; temp++) {
|
||||
resDetail.append(resArray[temp] + '<br/>');
|
||||
}
|
||||
}
|
||||
var resDetail = $('<pre id="resDetail"></pre>');
|
||||
resDetail.hide();
|
||||
$('#update div').append(resDetail);
|
||||
for (temp = 0; temp < resArray.length; temp++) {
|
||||
resDetail.append(resArray[temp] + '<br/>');
|
||||
}
|
||||
}
|
||||
|
||||
// Update the rpm info
|
||||
$.ajax( {
|
||||
url : 'lib/systemcmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'rpm -q xCAT-client perl-xCAT xCAT-server xCAT xCAT-rmc xCAT-UI'
|
||||
},
|
||||
// Update the rpm info
|
||||
$.ajax( {
|
||||
url : 'lib/systemcmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'rpm -q xCAT-client perl-xCAT xCAT-server xCAT xCAT-rmc xCAT-UI'
|
||||
},
|
||||
|
||||
success : showRpmInfo
|
||||
});
|
||||
success : showRpmInfo
|
||||
});
|
||||
|
||||
$('#rpm button').attr('disabled', '');
|
||||
$('#rpm button').attr('disabled', '');
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,30 +1,30 @@
|
||||
function loadHelpPage(){
|
||||
// Create help tab
|
||||
// Create help tab
|
||||
var tab = new Tab();
|
||||
tab.init();
|
||||
$('#content').append(tab.object());
|
||||
|
||||
// Add help content
|
||||
// Add help content
|
||||
var helpForm = $('<div class="form"></div>');
|
||||
helpForm.append(
|
||||
'<fieldset>' +
|
||||
'<legend>Quick Start</legend>' +
|
||||
'<div style="display: inline-table; vertical-align: middle;"><img src="images/help/quick_start.png" style="width: 90%;"></img></div>' +
|
||||
'<ol style="display: inline-table; vertical-align: middle;">' +
|
||||
'<li><a href="configure.php" style="color: blue;">1. Discover hardware</a><br/>Discover all hardware in the cluster. Define them in the xCAT database. Initialize your cluster.</li>' +
|
||||
'<li><a href="index.php" style="color: blue;">2. Verify defined nodes</a><br/>View nodes definition by groups in a table or graphical style.</li>' +
|
||||
'<li><a href="configure.php" style="color: blue;">3. Install compute nodes</a><br/>Copy useful files from DVD onto harddisk. Create Linux images. Install compute nodes in stateful, stateless, and statelite style.</li>' +
|
||||
'<li><a href="provision.php" style="color: blue;">4. Provision nodes</a><br/>Create stateful, stateless, or statelite virtual machines. Install an operating system on a physical machine.</li>' +
|
||||
'<li><a href="monitor.php" style="color: blue;">5. Monitor Cluster</a><br/>Monitor your xCAT cluster using one or more third party monitoring software such as Ganglia, RMC, etc. </li>' +
|
||||
'<fieldset>' +
|
||||
'<legend>Quick Start</legend>' +
|
||||
'<div style="display: inline-table; vertical-align: middle;"><img src="images/help/quick_start.png" style="width: 90%;"></img></div>' +
|
||||
'<ol style="display: inline-table; vertical-align: middle;">' +
|
||||
'<li><a href="configure.php" style="color: blue;">1. Discover hardware</a><br/>Discover all hardware in the cluster. Define them in the xCAT database. Initialize your cluster.</li>' +
|
||||
'<li><a href="index.php" style="color: blue;">2. Verify defined nodes</a><br/>View nodes definition by groups in a table or graphical style.</li>' +
|
||||
'<li><a href="configure.php" style="color: blue;">3. Install compute nodes</a><br/>Copy useful files from DVD onto harddisk. Create Linux images. Install compute nodes in stateful, stateless, and statelite style.</li>' +
|
||||
'<li><a href="provision.php" style="color: blue;">4. Provision nodes</a><br/>Create stateful, stateless, or statelite virtual machines. Install an operating system on a physical machine.</li>' +
|
||||
'<li><a href="monitor.php" style="color: blue;">5. Monitor Cluster</a><br/>Monitor your xCAT cluster using one or more third party monitoring software such as Ganglia, RMC, etc. </li>' +
|
||||
'</ol>' +
|
||||
'</fieldset>' +
|
||||
'<fieldset>' +
|
||||
'<legend>Advanced</legend>' +
|
||||
'<div style="display: inline-table; vertical-align: middle;"><img src="images/help/advanced_settings.png" style="width: 90%;"></img></div>' +
|
||||
'<ol style="display: inline-table; vertical-align: middle;">' +
|
||||
'<li><a href="configure.php" style="color: blue;">a. Edit the xCAT database tables</a></li>' +
|
||||
'<li><a href="configure.php" style="color: blue;">b. Update the xCAT RPM on the Management Node</a></li>' +
|
||||
'</ol>' +
|
||||
'</fieldset>');
|
||||
'<fieldset>' +
|
||||
'<legend>Advanced</legend>' +
|
||||
'<div style="display: inline-table; vertical-align: middle;"><img src="images/help/advanced_settings.png" style="width: 90%;"></img></div>' +
|
||||
'<ol style="display: inline-table; vertical-align: middle;">' +
|
||||
'<li><a href="configure.php" style="color: blue;">a. Edit the xCAT database tables</a></li>' +
|
||||
'<li><a href="configure.php" style="color: blue;">b. Update the xCAT RPM on the Management Node</a></li>' +
|
||||
'</ol>' +
|
||||
'</fieldset>');
|
||||
tab.add('helpTab', 'Help', helpForm, false);
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -11,300 +11,290 @@ var monitorTabs; // Monitor tabs
|
||||
* @return Nothing
|
||||
*/
|
||||
function setMonitorTab(o) {
|
||||
monitorTabs = o;
|
||||
monitorTabs = o;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the monitor tab
|
||||
*
|
||||
* @param Nothing
|
||||
* @return Tab object
|
||||
*/
|
||||
function getMonitorTab() {
|
||||
return monitorTabs;
|
||||
return monitorTabs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the monitor page
|
||||
*
|
||||
* @return Nothing
|
||||
*/
|
||||
function loadMonitorPage() {
|
||||
// If the page is already loaded
|
||||
if ($('#monitor_page').children().length) {
|
||||
// Do not reload the monitor page
|
||||
return;
|
||||
}
|
||||
// If the page is already loaded
|
||||
if ($('#monitor_page').children().length) {
|
||||
// Do not reload the monitor page
|
||||
return;
|
||||
}
|
||||
|
||||
// Create monitor tab
|
||||
var tab = new Tab();
|
||||
setMonitorTab(tab);
|
||||
tab.init();
|
||||
$('#content').append(tab.object());
|
||||
// Create monitor tab
|
||||
var tab = new Tab();
|
||||
setMonitorTab(tab);
|
||||
tab.init();
|
||||
$('#content').append(tab.object());
|
||||
|
||||
var monitorForm = $('<div class="form"></div>');
|
||||
monitorForm.append('Getting monitoring status ').append(createLoader());
|
||||
tab.add('monitorTab', 'Monitor', monitorForm, false);
|
||||
var monitorForm = $('<div class="form"></div>');
|
||||
monitorForm.append('Getting monitoring status ').append(createLoader());
|
||||
tab.add('monitorTab', 'Monitor', monitorForm, false);
|
||||
|
||||
// Get monitoring status of each tool
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'webrun',
|
||||
tgt : '',
|
||||
args : 'monls',
|
||||
msg : ''
|
||||
},
|
||||
// Get monitoring status of each tool
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'webrun',
|
||||
tgt : '',
|
||||
args : 'monls',
|
||||
msg : ''
|
||||
},
|
||||
|
||||
/**
|
||||
* Load monitoring status
|
||||
*
|
||||
* @param data
|
||||
* Data returned from HTTP request
|
||||
* @return Nothing
|
||||
*/
|
||||
success : function(data){
|
||||
// Initialize status for each tool
|
||||
var statusHash = new Object();
|
||||
statusHash['xcatmon'] = 'Off';
|
||||
statusHash['rmcmon'] = 'Off';
|
||||
statusHash['rmcevent'] = 'Off';
|
||||
statusHash['gangliamon'] = 'Off';
|
||||
statusHash['pcpmon'] = 'Off';
|
||||
if (data.rsp[0]) {
|
||||
var tempArray = data.rsp[0].split(';');
|
||||
var position = 0;
|
||||
var name = '';
|
||||
var status = '';
|
||||
for ( var i in tempArray) {
|
||||
position = tempArray[i].indexOf(':');
|
||||
if (position == -1) {
|
||||
continue;
|
||||
}
|
||||
/**
|
||||
* Load monitoring status
|
||||
*
|
||||
* @param data Data returned from HTTP request
|
||||
*/
|
||||
success : function(data){
|
||||
// Initialize status for each tool
|
||||
var statusHash = new Object();
|
||||
statusHash['xcatmon'] = 'Off';
|
||||
statusHash['rmcmon'] = 'Off';
|
||||
statusHash['rmcevent'] = 'Off';
|
||||
statusHash['gangliamon'] = 'Off';
|
||||
statusHash['pcpmon'] = 'Off';
|
||||
if (data.rsp[0]) {
|
||||
var tempArray = data.rsp[0].split(';');
|
||||
var position = 0;
|
||||
var name = '';
|
||||
var status = '';
|
||||
for ( var i in tempArray) {
|
||||
position = tempArray[i].indexOf(':');
|
||||
if (position == -1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
name = tempArray[i].substr(0, position);
|
||||
status = tempArray[i].substr(position + 1);
|
||||
statusHash[name] = status;
|
||||
}
|
||||
}
|
||||
|
||||
// Create a status buttonset for each monitoring tool
|
||||
var statusButtonHash = new Object();
|
||||
for ( var name in statusHash) {
|
||||
var statusButton = $('<div></div>').css({
|
||||
'width': '100px',
|
||||
'text-align': 'center'
|
||||
});
|
||||
statusButtonHash[name] = statusButton;
|
||||
|
||||
// Set button to correct status
|
||||
if (statusHash[name] == 'On') {
|
||||
statusButton.append($('<input type="radio" id="' + name + 'On" name="' + name + '" value="On" checked="checked"/><label for="' + name + 'On">On</label>'));
|
||||
statusButton.append($('<input type="radio" id="' + name + 'Off" name="' + name + '" value="Off"/><label for="' + name + 'Off">Off</label>'));
|
||||
} else {
|
||||
statusButton.append($('<input type="radio" id="' + name + 'On" name="' + name + '" value="On"/><label for="' + name + 'On">On</label>'));
|
||||
statusButton.append($('<input type="radio" id="' + name + 'Off" name="' + name + '" value="Off" checked="checked"/><label for="' + name + 'Off">Off</label>'));
|
||||
}
|
||||
name = tempArray[i].substr(0, position);
|
||||
status = tempArray[i].substr(position + 1);
|
||||
statusHash[name] = status;
|
||||
}
|
||||
}
|
||||
|
||||
// Create a status buttonset for each monitoring tool
|
||||
var statusButtonHash = new Object();
|
||||
for ( var name in statusHash) {
|
||||
var statusButton = $('<div></div>').css({
|
||||
'width': '100px',
|
||||
'text-align': 'center'
|
||||
});
|
||||
statusButtonHash[name] = statusButton;
|
||||
|
||||
// Set button to correct status
|
||||
if (statusHash[name] == 'On') {
|
||||
statusButton.append($('<input type="radio" id="' + name + 'On" name="' + name + '" value="On" checked="checked"/><label for="' + name + 'On">On</label>'));
|
||||
statusButton.append($('<input type="radio" id="' + name + 'Off" name="' + name + '" value="Off"/><label for="' + name + 'Off">Off</label>'));
|
||||
} else {
|
||||
statusButton.append($('<input type="radio" id="' + name + 'On" name="' + name + '" value="On"/><label for="' + name + 'On">On</label>'));
|
||||
statusButton.append($('<input type="radio" id="' + name + 'Off" name="' + name + '" value="Off" checked="checked"/><label for="' + name + 'Off">Off</label>'));
|
||||
}
|
||||
|
||||
statusButton.find('label').css({
|
||||
'margin': '0px',
|
||||
'padding': '0px',
|
||||
'font-size': '10px',
|
||||
'width': 'auto'
|
||||
});
|
||||
statusButton.buttonset();
|
||||
|
||||
// Turn on or off monitoring tool when clicked
|
||||
statusButton.find('input["' + name + '"]:radio').change(toggleMonitor);
|
||||
}
|
||||
|
||||
var monTable = $('<table></table>');
|
||||
monTable.append($('<thead class="ui-widget-header"><tr><th><b>Tool</b></th><th><b>Status</b></th><th><b>Description</b></th></tr></thead>'));
|
||||
|
||||
var monTableBody = $('<tbody></tbody>');
|
||||
monTable.append(monTableBody);
|
||||
|
||||
var xcatMon = $('<tr></tr>');
|
||||
xcatMon.append($('<td><a href="#" name="xcatmon">xCAT</a></td>'));
|
||||
xcatMon.append($('<td></td>').append(statusButtonHash['xcatmon']));
|
||||
xcatMon.append($('<td>Provides node status monitoring using fping on AIX and nmap on Linux. It also provides application status monitoring. The status and the appstatus columns of the nodelist table will be updated periodically with the latest status values for the nodes.</td>'));
|
||||
monTableBody.append(xcatMon);
|
||||
|
||||
var rmcMon = $('<tr></tr>');
|
||||
rmcMon.append($('<td><a href="#" name="rmcmon">RMC</a></td>'));
|
||||
rmcMon.append($('<td></td>').append(statusButtonHash['rmcmon']));
|
||||
rmcMon.append($('<td>IBM\'s Resource Monitoring and Control (RMC) subsystem is our recommended software for monitoring xCAT clusters. It\'s is part of the IBM\'s Reliable Scalable Cluster Technology (RSCT) that provides a comprehensive clustering environment for AIX and Linux.</td>'));
|
||||
monTableBody.append(rmcMon);
|
||||
|
||||
var rmcEvent = $('<tr></tr>');
|
||||
rmcEvent.append($('<td><a href="#" name="rmcevent">RMC Event</a></td>'));
|
||||
rmcEvent.append($('<td></td>').append(statusButtonHash['rmcevent']));
|
||||
rmcEvent.append($('<td>Listing event monitoring information recorded by the RSCT Event Response resource manager in the audit log. Creating and removing a condition/response association.</td>'));
|
||||
monTableBody.append(rmcEvent);
|
||||
statusButton.find('label').css({
|
||||
'margin': '0px',
|
||||
'padding': '0px',
|
||||
'font-size': '10px',
|
||||
'width': 'auto'
|
||||
});
|
||||
statusButton.buttonset();
|
||||
|
||||
// Turn on or off monitoring tool when clicked
|
||||
statusButton.find('input["' + name + '"]:radio').change(toggleMonitor);
|
||||
}
|
||||
|
||||
var monTable = $('<table></table>');
|
||||
monTable.append($('<thead class="ui-widget-header"><tr><th><b>Tool</b></th><th><b>Status</b></th><th><b>Description</b></th></tr></thead>'));
|
||||
|
||||
var monTableBody = $('<tbody></tbody>');
|
||||
monTable.append(monTableBody);
|
||||
|
||||
var xcatMon = $('<tr></tr>');
|
||||
xcatMon.append($('<td><a href="#" name="xcatmon">xCAT</a></td>'));
|
||||
xcatMon.append($('<td></td>').append(statusButtonHash['xcatmon']));
|
||||
xcatMon.append($('<td>Provides node status monitoring using fping on AIX and nmap on Linux. It also provides application status monitoring. The status and the appstatus columns of the nodelist table will be updated periodically with the latest status values for the nodes.</td>'));
|
||||
monTableBody.append(xcatMon);
|
||||
|
||||
var rmcMon = $('<tr></tr>');
|
||||
rmcMon.append($('<td><a href="#" name="rmcmon">RMC</a></td>'));
|
||||
rmcMon.append($('<td></td>').append(statusButtonHash['rmcmon']));
|
||||
rmcMon.append($('<td>IBM\'s Resource Monitoring and Control (RMC) subsystem is our recommended software for monitoring xCAT clusters. It\'s is part of the IBM\'s Reliable Scalable Cluster Technology (RSCT) that provides a comprehensive clustering environment for AIX and Linux.</td>'));
|
||||
monTableBody.append(rmcMon);
|
||||
|
||||
var rmcEvent = $('<tr></tr>');
|
||||
rmcEvent.append($('<td><a href="#" name="rmcevent">RMC Event</a></td>'));
|
||||
rmcEvent.append($('<td></td>').append(statusButtonHash['rmcevent']));
|
||||
rmcEvent.append($('<td>Listing event monitoring information recorded by the RSCT Event Response resource manager in the audit log. Creating and removing a condition/response association.</td>'));
|
||||
monTableBody.append(rmcEvent);
|
||||
|
||||
var gangliaMon = $('<tr></tr>');
|
||||
gangliaMon.append($('<td><a href="#" name="gangliamon">Ganglia</a></td>'));
|
||||
gangliaMon.append($('<td></td>').append(statusButtonHash['gangliamon']));
|
||||
gangliaMon.append($('<td>A scalable distributed monitoring system for high-performance computing systems such as clusters and Grids.</td>'));
|
||||
monTableBody.append(gangliaMon);
|
||||
|
||||
var pcpMon = $('<tr></tr>');
|
||||
pcpMon.append($('<td><a href="#" name="pcpmon">PCP</a></td>'));
|
||||
pcpMon.append($('<td></td>').append(statusButtonHash['pcpmon']));
|
||||
pcpMon.append($('<td>Not yet supported</td>'));
|
||||
monTableBody.append(pcpMon);
|
||||
|
||||
// Do not word wrap
|
||||
monTableBody.find('td:nth-child(1)').css('white-space', 'nowrap');
|
||||
monTableBody.find('td:nth-child(3)').css({
|
||||
'white-space': 'normal',
|
||||
'text-align': 'left'
|
||||
});
|
||||
|
||||
// Append info bar
|
||||
$('#monitorTab div').empty().append(createInfoBar('Select a monitoring tool to use'));
|
||||
$('#monitorTab .form').append(monTable);
|
||||
|
||||
// Open monitoring tool onclick
|
||||
$('#monitorTab .form a').bind('click', function() {
|
||||
loadMonitorTab($(this).attr('name'));
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Create resources tab
|
||||
var resrcForm = $('<div class="form"></div>');
|
||||
var gangliaMon = $('<tr></tr>');
|
||||
gangliaMon.append($('<td><a href="#" name="gangliamon">Ganglia</a></td>'));
|
||||
gangliaMon.append($('<td></td>').append(statusButtonHash['gangliamon']));
|
||||
gangliaMon.append($('<td>A scalable distributed monitoring system for high-performance computing systems such as clusters and Grids.</td>'));
|
||||
monTableBody.append(gangliaMon);
|
||||
|
||||
var pcpMon = $('<tr></tr>');
|
||||
pcpMon.append($('<td><a href="#" name="pcpmon">PCP</a></td>'));
|
||||
pcpMon.append($('<td></td>').append(statusButtonHash['pcpmon']));
|
||||
pcpMon.append($('<td>Not yet supported</td>'));
|
||||
monTableBody.append(pcpMon);
|
||||
|
||||
// Do not word wrap
|
||||
monTableBody.find('td:nth-child(1)').css('white-space', 'nowrap');
|
||||
monTableBody.find('td:nth-child(3)').css({
|
||||
'white-space': 'normal',
|
||||
'text-align': 'left'
|
||||
});
|
||||
|
||||
// Append info bar
|
||||
$('#monitorTab div').empty().append(createInfoBar('Select a monitoring tool to use'));
|
||||
$('#monitorTab .form').append(monTable);
|
||||
|
||||
// Open monitoring tool onclick
|
||||
$('#monitorTab .form a').bind('click', function() {
|
||||
loadMonitorTab($(this).attr('name'));
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Create resources tab
|
||||
var resrcForm = $('<div class="form"></div>');
|
||||
|
||||
// Create info bar
|
||||
var resrcInfoBar = createInfoBar('Select a platform to view its current resources.');
|
||||
resrcForm.append(resrcInfoBar);
|
||||
// Create info bar
|
||||
var resrcInfoBar = createInfoBar('Select a platform to view its current resources.');
|
||||
resrcForm.append(resrcInfoBar);
|
||||
|
||||
// Create radio buttons for platforms
|
||||
var hwList = $('<ol>Platforms available:</ol>');
|
||||
var esx = $('<li><input type="radio" name="hw" value="esx" checked/>ESX</li>');
|
||||
var kvm = $('<li><input type="radio" name="hw" value="kvm"/>KVM</li>');
|
||||
var zvm = $('<li><input type="radio" name="hw" value="zvm"/>z\/VM</li>');
|
||||
var ipmi = $('<li><input type="radio" name="hw" value="ipmi"/>iDataPlex</li>');
|
||||
var blade = $('<li><input type="radio" name="hw" value="blade"/>BladeCenter</li>');
|
||||
var hmc = $('<li><input type="radio" name="hw" value="hmc"/>System p</li>');
|
||||
|
||||
hwList.append(esx);
|
||||
hwList.append(kvm);
|
||||
hwList.append(zvm);
|
||||
hwList.append(blade);
|
||||
hwList.append(ipmi);
|
||||
hwList.append(hmc);
|
||||
|
||||
resrcForm.append(hwList);
|
||||
// Create radio buttons for platforms
|
||||
var hwList = $('<ol>Platforms available:</ol>');
|
||||
var esx = $('<li><input type="radio" name="hw" value="esx" checked/>ESX</li>');
|
||||
var kvm = $('<li><input type="radio" name="hw" value="kvm"/>KVM</li>');
|
||||
var zvm = $('<li><input type="radio" name="hw" value="zvm"/>z\/VM</li>');
|
||||
var ipmi = $('<li><input type="radio" name="hw" value="ipmi"/>iDataPlex</li>');
|
||||
var blade = $('<li><input type="radio" name="hw" value="blade"/>BladeCenter</li>');
|
||||
var hmc = $('<li><input type="radio" name="hw" value="hmc"/>System p</li>');
|
||||
|
||||
hwList.append(esx);
|
||||
hwList.append(kvm);
|
||||
hwList.append(zvm);
|
||||
hwList.append(blade);
|
||||
hwList.append(ipmi);
|
||||
hwList.append(hmc);
|
||||
|
||||
resrcForm.append(hwList);
|
||||
|
||||
var okBtn = createButton('Ok');
|
||||
okBtn.bind('click', function(event) {
|
||||
// Get hardware that was selected
|
||||
var hw = $(this).parent().find('input[name="hw"]:checked').val();
|
||||
var okBtn = createButton('Ok');
|
||||
okBtn.bind('click', function(event) {
|
||||
// Get hardware that was selected
|
||||
var hw = $(this).parent().find('input[name="hw"]:checked').val();
|
||||
|
||||
// Generate new tab ID
|
||||
var newTabId = hw + 'ResourceTab';
|
||||
if (!$('#' + newTabId).length) {
|
||||
// Create loader
|
||||
var loader = $('<center></center>').append(createLoader(hw + 'ResourceLoader'));
|
||||
// Generate new tab ID
|
||||
var newTabId = hw + 'ResourceTab';
|
||||
if (!$('#' + newTabId).length) {
|
||||
// Create loader
|
||||
var loader = $('<center></center>').append(createLoader(hw + 'ResourceLoader'));
|
||||
|
||||
// Create an instance of the plugin
|
||||
var plugin;
|
||||
var displayName = "";
|
||||
switch (hw) {
|
||||
case "kvm":
|
||||
plugin = new kvmPlugin();
|
||||
displayName = "KVM";
|
||||
break;
|
||||
case "esx":
|
||||
plugin = new esxPlugin();
|
||||
displayName = "ESX";
|
||||
break;
|
||||
case "blade":
|
||||
plugin = new bladePlugin();
|
||||
displayName = "BladeCenter";
|
||||
break;
|
||||
case "hmc":
|
||||
plugin = new hmcPlugin();
|
||||
displayName = "System p";
|
||||
break;
|
||||
case "ipmi":
|
||||
plugin = new ipmiPlugin();
|
||||
displayName = "iDataPlex";
|
||||
break;
|
||||
case "zvm":
|
||||
plugin = new zvmPlugin();
|
||||
displayName = "z\/VM";
|
||||
break;
|
||||
}
|
||||
|
||||
// Add resource tab and load resources
|
||||
tab.add(newTabId, displayName, loader, true);
|
||||
plugin.loadResources();
|
||||
}
|
||||
// Create an instance of the plugin
|
||||
var plugin = null;
|
||||
var displayName = "";
|
||||
switch (hw) {
|
||||
case "kvm":
|
||||
plugin = new kvmPlugin();
|
||||
displayName = "KVM";
|
||||
break;
|
||||
case "esx":
|
||||
plugin = new esxPlugin();
|
||||
displayName = "ESX";
|
||||
break;
|
||||
case "blade":
|
||||
plugin = new bladePlugin();
|
||||
displayName = "BladeCenter";
|
||||
break;
|
||||
case "hmc":
|
||||
plugin = new hmcPlugin();
|
||||
displayName = "System p";
|
||||
break;
|
||||
case "ipmi":
|
||||
plugin = new ipmiPlugin();
|
||||
displayName = "iDataPlex";
|
||||
break;
|
||||
case "zvm":
|
||||
plugin = new zvmPlugin();
|
||||
displayName = "z\/VM";
|
||||
break;
|
||||
}
|
||||
|
||||
// Add resource tab and load resources
|
||||
tab.add(newTabId, displayName, loader, true);
|
||||
plugin.loadResources();
|
||||
}
|
||||
|
||||
// Select tab
|
||||
tab.select(newTabId);
|
||||
});
|
||||
|
||||
resrcForm.append(okBtn);
|
||||
tab.add('resourceTab', 'Resources', resrcForm, false);
|
||||
// Select tab
|
||||
tab.select(newTabId);
|
||||
});
|
||||
|
||||
resrcForm.append(okBtn);
|
||||
tab.add('resourceTab', 'Resources', resrcForm, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load monitoring tool in a new tab
|
||||
*
|
||||
* @param name
|
||||
* Name of monitoring tool
|
||||
* @return Nothing
|
||||
* @param name Name of monitoring tool
|
||||
*/
|
||||
function loadMonitorTab(name) {
|
||||
// If the tab exist, then we only need to select it
|
||||
var tab = getMonitorTab();
|
||||
if ($("#" + name).length) {
|
||||
tab.select(name);
|
||||
return;
|
||||
}
|
||||
// If the tab exist, then we only need to select it
|
||||
var tab = getMonitorTab();
|
||||
if ($("#" + name).length) {
|
||||
tab.select(name);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (name) {
|
||||
case 'xcatmon':
|
||||
tab.add(name, 'xCAT', '', true);
|
||||
loadXcatMon();
|
||||
break;
|
||||
case 'rmcmon':
|
||||
tab.add(name, 'RMC Monitor', '', true);
|
||||
loadRmcMon();
|
||||
break;
|
||||
case 'gangliamon':
|
||||
tab.add(name, 'Ganglia', '', true);
|
||||
loadGangliaMon();
|
||||
break;
|
||||
case 'rmcevent':
|
||||
tab.add(name, 'RMC Event', '', true);
|
||||
loadRmcEvent();
|
||||
break;
|
||||
case 'pcpmon':
|
||||
loadUnfinish(name, tab);
|
||||
break;
|
||||
}
|
||||
switch (name) {
|
||||
case 'xcatmon':
|
||||
tab.add(name, 'xCAT', '', true);
|
||||
loadXcatMon();
|
||||
break;
|
||||
case 'rmcmon':
|
||||
tab.add(name, 'RMC Monitor', '', true);
|
||||
loadRmcMon();
|
||||
break;
|
||||
case 'gangliamon':
|
||||
tab.add(name, 'Ganglia', '', true);
|
||||
loadGangliaMon();
|
||||
break;
|
||||
case 'rmcevent':
|
||||
tab.add(name, 'RMC Event', '', true);
|
||||
loadRmcEvent();
|
||||
break;
|
||||
case 'pcpmon':
|
||||
loadUnfinish(name, tab);
|
||||
break;
|
||||
}
|
||||
|
||||
tab.select(name);
|
||||
tab.select(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load tab showing 'Under contruction'
|
||||
*
|
||||
* @param monitorName
|
||||
* Name of monitoring tool
|
||||
* @param tab
|
||||
* Tab area
|
||||
* @return Nothing
|
||||
* @param monitorName Name of monitoring tool
|
||||
* @param tab Tab area
|
||||
*/
|
||||
function loadUnfinish(monitorName, tab) {
|
||||
var unfinishPage = $('<div></div>');
|
||||
unfinishPage.append(createInfoBar('Not yet supported'));
|
||||
tab.add(monitorName, 'Unfinished', unfinishPage, true);
|
||||
var unfinishPage = $('<div></div>');
|
||||
unfinishPage.append(createInfoBar('Not yet supported'));
|
||||
tab.add(monitorName, 'Unfinished', unfinishPage, true);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -312,65 +302,63 @@ function loadUnfinish(monitorName, tab) {
|
||||
*
|
||||
* @return Nothing
|
||||
*/
|
||||
function toggleMonitor() {
|
||||
// Get the name of the monitoring tool
|
||||
var name = $(this).attr('name');
|
||||
// Get the status to toggle to, either on or off
|
||||
var status = $(this).val();
|
||||
function toggleMonitor() {
|
||||
// Get the name of the monitoring tool
|
||||
var name = $(this).attr('name');
|
||||
// Get the status to toggle to, either on or off
|
||||
var status = $(this).val();
|
||||
|
||||
// Start or stop monitoring plugin
|
||||
var command = 'monstart';
|
||||
if (status == 'Off') {
|
||||
command = 'monstop' ;
|
||||
}
|
||||
|
||||
// Start or stop monitoring on xCAT
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : command,
|
||||
tgt : '',
|
||||
args : name + '',
|
||||
msg : ''
|
||||
},
|
||||
success : function(data) {
|
||||
// Start or stop monitoring on remote nodes
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : command,
|
||||
tgt : '',
|
||||
args : name + ';-r',
|
||||
msg : name + ' switched ' + status
|
||||
},
|
||||
success : updateMonStatus
|
||||
});
|
||||
}
|
||||
});
|
||||
// Start or stop monitoring plugin
|
||||
var command = 'monstart';
|
||||
if (status == 'Off') {
|
||||
command = 'monstop' ;
|
||||
}
|
||||
|
||||
// Start or stop monitoring on xCAT
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : command,
|
||||
tgt : '',
|
||||
args : name + '',
|
||||
msg : ''
|
||||
},
|
||||
success : function(data) {
|
||||
// Start or stop monitoring on remote nodes
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : command,
|
||||
tgt : '',
|
||||
args : name + ';-r',
|
||||
msg : name + ' switched ' + status
|
||||
},
|
||||
success : updateMonStatus
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the monitoring status on Monitor tab
|
||||
*
|
||||
* @param data
|
||||
* Data returned from HTTP request
|
||||
* @return Nothing
|
||||
* @param data Data returned from HTTP request
|
||||
*/
|
||||
function updateMonStatus(data) {
|
||||
var rsp = data.rsp[data.rsp.length-1];
|
||||
var msg = data.msg;
|
||||
|
||||
// Create appropriate info or warning bar
|
||||
var bar = '';
|
||||
if (rsp.indexOf('started') > -1 || rsp.indexOf('stopped') > -1) {
|
||||
bar = createInfoBar(msg);
|
||||
} else {
|
||||
var bar = createWarnBar('Failed to ' + msg + '. ' + rsp);
|
||||
}
|
||||
|
||||
// Prepend info or warning bar to tab
|
||||
bar.prependTo($('#monitorTab .form'));
|
||||
bar.delay(4000).slideUp();
|
||||
var rsp = data.rsp[data.rsp.length-1];
|
||||
var msg = data.msg;
|
||||
|
||||
// Create appropriate info or warning bar
|
||||
var bar = '';
|
||||
if (rsp.indexOf('started') > -1 || rsp.indexOf('stopped') > -1) {
|
||||
bar = createInfoBar(msg);
|
||||
} else {
|
||||
bar = createWarnBar('Failed to ' + msg + '. ' + rsp);
|
||||
}
|
||||
|
||||
// Prepend info or warning bar to tab
|
||||
bar.prependTo($('#monitorTab .form'));
|
||||
bar.delay(4000).slideUp();
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -7,402 +7,402 @@ var xcatMonTableId = "xcatMonSettingTable";
|
||||
* Load xCAT monitoring
|
||||
*/
|
||||
function loadXcatMon() {
|
||||
// Find xCAT monitoring tab
|
||||
var xcatMonTab = $('#xcatmon');
|
||||
xcatMonTab.append("<div id= xcatmonTable></div>");
|
||||
// Find xCAT monitoring tab
|
||||
var xcatMonTab = $('#xcatmon');
|
||||
xcatMonTab.append("<div id= xcatmonTable></div>");
|
||||
|
||||
// Show content of monsetting table
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'tabdump',
|
||||
tgt : '',
|
||||
args : 'monsetting',
|
||||
msg : ''
|
||||
},
|
||||
success : loadXcatMonSetting
|
||||
});
|
||||
// Show content of monsetting table
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'tabdump',
|
||||
tgt : '',
|
||||
args : 'monsetting',
|
||||
msg : ''
|
||||
},
|
||||
success : loadXcatMonSetting
|
||||
});
|
||||
}
|
||||
|
||||
function loadXcatMonSetting(data) {
|
||||
var apps = ""; // Contains the xcatmon config
|
||||
var rsp = data.rsp;
|
||||
var apps_flag = 0;
|
||||
var ping; // xcatmon ping interval
|
||||
var ping_flag = 0;
|
||||
var apps = ""; // Contains the xcatmon config
|
||||
var rsp = data.rsp;
|
||||
var apps_flag = 0;
|
||||
var ping; // xcatmon ping interval
|
||||
var ping_flag = 0;
|
||||
|
||||
// Create an info bar
|
||||
var infoBar = createInfoBar('Click on a cell to edit. Click outside the table to write to the cell. Once you are finished configuring the xCAT monitor, click on Apply.');
|
||||
$('#xcatmonTable').append(infoBar);
|
||||
// Create an info bar
|
||||
var infoBar = createInfoBar('Click on a cell to edit. Click outside the table to write to the cell. Once you are finished configuring the xCAT monitor, click on Apply.');
|
||||
$('#xcatmonTable').append(infoBar);
|
||||
|
||||
// Create xcatmon table
|
||||
var xcatmonTable = new DataTable(xcatMonTableId);
|
||||
// Create xcatmon table
|
||||
var xcatmonTable = new DataTable(xcatMonTableId);
|
||||
|
||||
// Create datatable
|
||||
var dTable;
|
||||
// Create datatable
|
||||
var dTable;
|
||||
|
||||
// Create table header
|
||||
var header = rsp[0].split(",");
|
||||
header.splice(3, 2);
|
||||
header.splice(0, 1);
|
||||
header[0] = "App Name";
|
||||
header[1] = "Configure";
|
||||
header.push('<input type="checkbox" onclick="selectAllCheckbox(event,$(this))">');
|
||||
header.unshift('');
|
||||
xcatmonTable.init(header);
|
||||
// Create table header
|
||||
var header = rsp[0].split(",");
|
||||
header.splice(3, 2);
|
||||
header.splice(0, 1);
|
||||
header[0] = "App Name";
|
||||
header[1] = "Configure";
|
||||
header.push('<input type="checkbox" onclick="selectAllCheckbox(event,$(this))">');
|
||||
header.unshift('');
|
||||
xcatmonTable.init(header);
|
||||
|
||||
// Create container for original table contents
|
||||
var origCont = new Array();
|
||||
origCont[0] = header; // Table headers
|
||||
// Create container for original table contents
|
||||
var origCont = new Array();
|
||||
origCont[0] = header; // Table headers
|
||||
|
||||
// Create container for new contents to use later updating monsetting table
|
||||
var newCont = new Object();
|
||||
newCont[0] = rsp[0].split(","); // Table headers
|
||||
// Create container for new contents to use later updating monsetting table
|
||||
var newCont = new Object();
|
||||
newCont[0] = rsp[0].split(","); // Table headers
|
||||
|
||||
// Create container for other monsetting lines
|
||||
var otherCont = new Array();
|
||||
// Create container for other monsetting lines
|
||||
var otherCont = new Array();
|
||||
|
||||
$('#xcatmonTable').append(xcatmonTable.object());
|
||||
var m = 1; // Count for origCont
|
||||
var n = 0;
|
||||
for ( var i = 1; i < rsp.length; i++) {
|
||||
var pos = rsp[i].indexOf("xcatmon"); // Only check xcatmon setting
|
||||
if (pos == 1) {
|
||||
if ((rsp[i].indexOf("apps") == -1) && (rsp[i].indexOf("ping") == -1)) {
|
||||
var cols = rsp[i].split(',');
|
||||
for ( var j = 0; j < cols.length; j++) {
|
||||
if (cols[j].count('"') % 2 == 1) {
|
||||
while (cols[j].count('"') % 2 == 1) {
|
||||
cols[j] = cols[j] + "," + cols[j + 1];
|
||||
cols.splice(j + 1, 1);
|
||||
}
|
||||
}
|
||||
cols[j] = cols[j].replace(new RegExp('"', 'g'), '');
|
||||
}
|
||||
$('#xcatmonTable').append(xcatmonTable.object());
|
||||
var m = 1; // Count for origCont
|
||||
var n = 0;
|
||||
for ( var i = 1; i < rsp.length; i++) {
|
||||
var pos = rsp[i].indexOf("xcatmon"); // Only check xcatmon setting
|
||||
if (pos == 1) {
|
||||
if ((rsp[i].indexOf("apps") == -1) && (rsp[i].indexOf("ping") == -1)) {
|
||||
var cols = rsp[i].split(',');
|
||||
for ( var j = 0; j < cols.length; j++) {
|
||||
if (cols[j].count('"') % 2 == 1) {
|
||||
while (cols[j].count('"') % 2 == 1) {
|
||||
cols[j] = cols[j] + "," + cols[j + 1];
|
||||
cols.splice(j + 1, 1);
|
||||
}
|
||||
}
|
||||
cols[j] = cols[j].replace(new RegExp('"', 'g'), '');
|
||||
}
|
||||
|
||||
cols.splice(3, 2);
|
||||
cols.splice(0, 1);
|
||||
cols.push('<input type="checkbox" name="' + cols[0] + '" title="Checking this box will add/remove the app from the configured app value"/>');
|
||||
cols.unshift('<span class="ui-icon ui-icon-close" onclick="deleteXcatMonRow(this)"></span>');
|
||||
cols.splice(3, 2);
|
||||
cols.splice(0, 1);
|
||||
cols.push('<input type="checkbox" name="' + cols[0] + '" title="Checking this box will add/remove the app from the configured app value"/>');
|
||||
cols.unshift('<span class="ui-icon ui-icon-close" onclick="deleteXcatMonRow(this)"></span>');
|
||||
|
||||
// Add column to table
|
||||
xcatmonTable.add(cols);
|
||||
origCont[m++] = cols;
|
||||
} else {
|
||||
if (!apps_flag) { // Check the apps setting
|
||||
if (rsp[i].indexOf("apps") > -1) {
|
||||
apps = rsp[i].split(',');
|
||||
// Add column to table
|
||||
xcatmonTable.add(cols);
|
||||
origCont[m++] = cols;
|
||||
} else {
|
||||
if (!apps_flag) { // Check the apps setting
|
||||
if (rsp[i].indexOf("apps") > -1) {
|
||||
apps = rsp[i].split(',');
|
||||
|
||||
for ( var j = 0; j < apps.length; j++) {
|
||||
if (apps[j].count('"') % 2 == 1) {
|
||||
while (apps[j].count('"') % 2 == 1) {
|
||||
apps[j] = apps[j] + "," + apps[j + 1];
|
||||
apps.splice(j + 1, 1);
|
||||
}
|
||||
}
|
||||
apps[j] = apps[j].replace(new RegExp('"', 'g'), '');
|
||||
}
|
||||
for ( var j = 0; j < apps.length; j++) {
|
||||
if (apps[j].count('"') % 2 == 1) {
|
||||
while (apps[j].count('"') % 2 == 1) {
|
||||
apps[j] = apps[j] + "," + apps[j + 1];
|
||||
apps.splice(j + 1, 1);
|
||||
}
|
||||
}
|
||||
apps[j] = apps[j].replace(new RegExp('"', 'g'), '');
|
||||
}
|
||||
|
||||
apps_flag = 1; // Set the flag to 1 to avoid this subroute
|
||||
}
|
||||
}
|
||||
apps_flag = 1; // Set the flag to 1 to avoid this subroute
|
||||
}
|
||||
}
|
||||
|
||||
// Get into the ping settings
|
||||
if (!ping_flag) {
|
||||
// Check the ping interval
|
||||
if (rsp[i].indexOf("ping-interval") > -1) {
|
||||
ping = rsp[i].split(',');
|
||||
for ( var j = 0; j < ping.length; j++) {
|
||||
if (ping[j].count('"') % 2 == 1) {
|
||||
while (ping[j].count('"') % 2 == 1) {
|
||||
ping[j] = ping[j] + "," + ping[j + 1];
|
||||
ping.splice(j + 1, 1);
|
||||
}
|
||||
}
|
||||
ping[j] = ping[j].replace((new RegExp('"', 'g')),
|
||||
'');
|
||||
}
|
||||
ping_flag = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (pos != 1) {
|
||||
// The other monitor in the monsetting table
|
||||
var otherCols = rsp[i].split(',');
|
||||
for ( var k = 0; k < otherCols.length; k++) {
|
||||
if (otherCols[k].count('"') % 2 == 1) {
|
||||
while (otherCols[k].count('"') % 2 == 1) {
|
||||
otherCols[k] = otherCols[k] + "," + otherCols[k + 1];
|
||||
otherCols.splice(k + 1, 1);
|
||||
}
|
||||
}
|
||||
otherCols[k] = otherCols[k].replace(new RegExp('"', 'g'), '');
|
||||
}
|
||||
// Get into the ping settings
|
||||
if (!ping_flag) {
|
||||
// Check the ping interval
|
||||
if (rsp[i].indexOf("ping-interval") > -1) {
|
||||
ping = rsp[i].split(',');
|
||||
for ( var j = 0; j < ping.length; j++) {
|
||||
if (ping[j].count('"') % 2 == 1) {
|
||||
while (ping[j].count('"') % 2 == 1) {
|
||||
ping[j] = ping[j] + "," + ping[j + 1];
|
||||
ping.splice(j + 1, 1);
|
||||
}
|
||||
}
|
||||
ping[j] = ping[j].replace((new RegExp('"', 'g')),
|
||||
'');
|
||||
}
|
||||
ping_flag = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (pos != 1) {
|
||||
// The other monitor in the monsetting table
|
||||
var otherCols = rsp[i].split(',');
|
||||
for ( var k = 0; k < otherCols.length; k++) {
|
||||
if (otherCols[k].count('"') % 2 == 1) {
|
||||
while (otherCols[k].count('"') % 2 == 1) {
|
||||
otherCols[k] = otherCols[k] + "," + otherCols[k + 1];
|
||||
otherCols.splice(k + 1, 1);
|
||||
}
|
||||
}
|
||||
otherCols[k] = otherCols[k].replace(new RegExp('"', 'g'), '');
|
||||
}
|
||||
|
||||
otherCont[n++] = otherCols;
|
||||
otherCont[n++] = otherCols;
|
||||
|
||||
}
|
||||
}
|
||||
// If app is not in the monsetting table, then create default apps row
|
||||
if (!apps_flag) {
|
||||
apps = rsp[0].split(',');
|
||||
apps[0] = "xcatmon";
|
||||
apps[1] = "apps";
|
||||
apps[2] = "";
|
||||
apps[3] = "";
|
||||
apps[4] = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
// If app is not in the monsetting table, then create default apps row
|
||||
if (!apps_flag) {
|
||||
apps = rsp[0].split(',');
|
||||
apps[0] = "xcatmon";
|
||||
apps[1] = "apps";
|
||||
apps[2] = "";
|
||||
apps[3] = "";
|
||||
apps[4] = "";
|
||||
}
|
||||
|
||||
// If the ping interval is not in the monsetting table, then create the
|
||||
// default ping-interval
|
||||
if (!ping_flag) {
|
||||
ping = rsp[0].split(',');
|
||||
ping[0] = "xcatmon";
|
||||
ping[1] = "ping-interval";
|
||||
|
||||
// Set default ping-interval setting to 5
|
||||
ping[2] = "5";
|
||||
ping[3] = "";
|
||||
ping[4] = "";
|
||||
}
|
||||
// If the ping interval is not in the monsetting table, then create the
|
||||
// default ping-interval
|
||||
if (!ping_flag) {
|
||||
ping = rsp[0].split(',');
|
||||
ping[0] = "xcatmon";
|
||||
ping[1] = "ping-interval";
|
||||
|
||||
// Set default ping-interval setting to 5
|
||||
ping[2] = "5";
|
||||
ping[3] = "";
|
||||
ping[4] = "";
|
||||
}
|
||||
|
||||
// Set checkbox to be true
|
||||
var checked = apps[2].split(',');
|
||||
for ( var i = 0; i < checked.length; i++) {
|
||||
$("input:checkbox[name=" + checked[i] + "]").attr('checked', true);
|
||||
for ( var j = 0; j < origCont.length; j++) {
|
||||
if (origCont[j][1] == checked[i]) {
|
||||
origCont[j].splice(3, 1);
|
||||
origCont[j].push('<input type="checkbox" name="' + origCont[j][1] + '" title="Check this checkbox to add/remove the app from the configured app value." checked=true/>');
|
||||
}
|
||||
}
|
||||
// Set checkbox to be true
|
||||
var checked = apps[2].split(',');
|
||||
for ( var i = 0; i < checked.length; i++) {
|
||||
$("input:checkbox[name=" + checked[i] + "]").attr('checked', true);
|
||||
for ( var j = 0; j < origCont.length; j++) {
|
||||
if (origCont[j][1] == checked[i]) {
|
||||
origCont[j].splice(3, 1);
|
||||
origCont[j].push('<input type="checkbox" name="' + origCont[j][1] + '" title="Check this checkbox to add/remove the app from the configured app value." checked=true/>');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
$(":checkbox").tooltip();
|
||||
}
|
||||
$(":checkbox").tooltip();
|
||||
|
||||
// Make the table editable
|
||||
$('#' + xcatMonTableId + ' td:not(td:nth-child(1),td:last-child)').editable(function(value, settings) {
|
||||
var colPos = this.cellIndex;
|
||||
var rowPos = dTable.fnGetPosition(this.parentNode);
|
||||
dTable.fnUpdate(value, rowPos, colPos);
|
||||
return (value);
|
||||
}, {
|
||||
onblur : 'submit',
|
||||
type : 'textarea',
|
||||
placeholder : ' ',
|
||||
height : '30px'
|
||||
});
|
||||
// Make the table editable
|
||||
$('#' + xcatMonTableId + ' td:not(td:nth-child(1),td:last-child)').editable(function(value, settings) {
|
||||
var colPos = this.cellIndex;
|
||||
var rowPos = dTable.fnGetPosition(this.parentNode);
|
||||
dTable.fnUpdate(value, rowPos, colPos);
|
||||
return (value);
|
||||
}, {
|
||||
onblur : 'submit',
|
||||
type : 'textarea',
|
||||
placeholder : ' ',
|
||||
height : '30px'
|
||||
});
|
||||
|
||||
// Save datatable
|
||||
dTable = $('#' + xcatMonTableId).dataTable({
|
||||
'iDisplayLength' : 50,
|
||||
'bLengthChange' : false,
|
||||
"sScrollX" : "100%",
|
||||
"bAutoWidth" : true
|
||||
});
|
||||
// Save datatable
|
||||
dTable = $('#' + xcatMonTableId).dataTable({
|
||||
'iDisplayLength' : 50,
|
||||
'bLengthChange' : false,
|
||||
"sScrollX" : "100%",
|
||||
"bAutoWidth" : true
|
||||
});
|
||||
|
||||
// Create action bar
|
||||
var actionBar = $('<div class="actionBar"></div>');
|
||||
var addRowLnk = $('<a>Add row</a>');
|
||||
addRowLnk.bind('click', function(event) {
|
||||
// Create container for new row
|
||||
var row = new Array();
|
||||
// Create action bar
|
||||
var actionBar = $('<div class="actionBar"></div>');
|
||||
var addRowLnk = $('<a>Add row</a>');
|
||||
addRowLnk.bind('click', function(event) {
|
||||
// Create container for new row
|
||||
var row = new Array();
|
||||
|
||||
// Add delete button to row
|
||||
row.push('<span class="ui-icon ui-icon-close" onclick="deleteXcatMonRow(this)"></span>');
|
||||
for ( var i = 0; i < header.length - 2; i++)
|
||||
row.push('');
|
||||
// Add delete button to row
|
||||
row.push('<span class="ui-icon ui-icon-close" onclick="deleteXcatMonRow(this)"></span>');
|
||||
for ( var i = 0; i < header.length - 2; i++)
|
||||
row.push('');
|
||||
|
||||
// Add checkbox
|
||||
row.push('<input type="checkbox" name="' + row[2] + '" title="Checking this checkbox will add/remove the app from the configured apps value"/>');
|
||||
// Get the datatable of the table
|
||||
var dTable = $('#' + xcatMonTableId).dataTable();
|
||||
// Add the new row to the datatable
|
||||
dTable.fnAddData(row);
|
||||
// Add checkbox
|
||||
row.push('<input type="checkbox" name="' + row[2] + '" title="Checking this checkbox will add/remove the app from the configured apps value"/>');
|
||||
// Get the datatable of the table
|
||||
var dTable = $('#' + xcatMonTableId).dataTable();
|
||||
// Add the new row to the datatable
|
||||
dTable.fnAddData(row);
|
||||
|
||||
// make the datatable editable
|
||||
$(":checkbox[title]").tooltip();
|
||||
$('#' + xcatMonTableId + ' td:not(td:nth-child(1),td:last-child)').editable(function(value, settings) {
|
||||
var colPos = this.cellIndex;
|
||||
var rowPos = dTable
|
||||
.fnGetPosition(this.parentNode);
|
||||
dTable.fnUpdate(value, rowPos,
|
||||
colPos);
|
||||
return (value);
|
||||
}, {
|
||||
onblur : 'submit',
|
||||
type : 'textarea',
|
||||
placeholder : ' ',
|
||||
height : '30px'
|
||||
});
|
||||
});
|
||||
// make the datatable editable
|
||||
$(":checkbox[title]").tooltip();
|
||||
$('#' + xcatMonTableId + ' td:not(td:nth-child(1),td:last-child)').editable(function(value, settings) {
|
||||
var colPos = this.cellIndex;
|
||||
var rowPos = dTable
|
||||
.fnGetPosition(this.parentNode);
|
||||
dTable.fnUpdate(value, rowPos,
|
||||
colPos);
|
||||
return (value);
|
||||
}, {
|
||||
onblur : 'submit',
|
||||
type : 'textarea',
|
||||
placeholder : ' ',
|
||||
height : '30px'
|
||||
});
|
||||
});
|
||||
|
||||
// Create apply button to store the contents of the table to the monsetting table
|
||||
var applyLnk = $('<a>Apply</a>');
|
||||
applyLnk.bind('click', function(event) {
|
||||
// Get the datatable
|
||||
var dTable = $('#' + xcatMonTableId).dataTable();
|
||||
// Get datatable rows
|
||||
var dRows = dTable.fnGetNodes();
|
||||
var count = 0;
|
||||
|
||||
// Create a new container for the apps value
|
||||
var appValue = '';
|
||||
var tableName = 'monsetting';
|
||||
var closeBtn = createButton('close');
|
||||
// Create apply button to store the contents of the table to the monsetting table
|
||||
var applyLnk = $('<a>Apply</a>');
|
||||
applyLnk.bind('click', function(event) {
|
||||
// Get the datatable
|
||||
var dTable = $('#' + xcatMonTableId).dataTable();
|
||||
// Get datatable rows
|
||||
var dRows = dTable.fnGetNodes();
|
||||
var count = 0;
|
||||
|
||||
// Create a new container for the apps value
|
||||
var appValue = '';
|
||||
var tableName = 'monsetting';
|
||||
var closeBtn = createButton('close');
|
||||
|
||||
// Get the row contents
|
||||
for ( var i = 0; i < dRows.length; i++) {
|
||||
if (dRows[i]) {
|
||||
// Get the row columns
|
||||
var cols = dRows[i].childNodes;
|
||||
// Create a container for the new columns
|
||||
var vals = new Array();
|
||||
// Get the row contents
|
||||
for ( var i = 0; i < dRows.length; i++) {
|
||||
if (dRows[i]) {
|
||||
// Get the row columns
|
||||
var cols = dRows[i].childNodes;
|
||||
// Create a container for the new columns
|
||||
var vals = new Array();
|
||||
|
||||
for ( var j = 1; j < cols.length - 1; j++) {
|
||||
var val = cols.item(j).firstChild.nodeValue;
|
||||
if (val == ' ')
|
||||
vals[j - 1] = '';
|
||||
else
|
||||
vals[j - 1] = val;
|
||||
}
|
||||
for ( var j = 1; j < cols.length - 1; j++) {
|
||||
var val = cols.item(j).firstChild.nodeValue;
|
||||
if (val == ' ')
|
||||
vals[j - 1] = '';
|
||||
else
|
||||
vals[j - 1] = val;
|
||||
}
|
||||
|
||||
var vals_orig = new Array();
|
||||
// Copy data from vals to vals_orig
|
||||
for ( var p = 0; p < 2; p++) {
|
||||
var val = vals[p];
|
||||
vals_orig[p] = val;
|
||||
}
|
||||
var vals_orig = new Array();
|
||||
// Copy data from vals to vals_orig
|
||||
for ( var p = 0; p < 2; p++) {
|
||||
var val = vals[p];
|
||||
vals_orig[p] = val;
|
||||
}
|
||||
|
||||
vals.push('');
|
||||
vals.push('');
|
||||
vals.unshift('xcatmon');
|
||||
|
||||
// Stored new column to newCont
|
||||
newCont[i + 1] = vals;
|
||||
vals.push('');
|
||||
vals.push('');
|
||||
vals.unshift('xcatmon');
|
||||
|
||||
// Stored new column to newCont
|
||||
newCont[i + 1] = vals;
|
||||
|
||||
if (cols.item(cols.length - 1).firstChild.checked) {
|
||||
vals_orig.push('<input type="checkbox" name="' + vals_orig[0] + '" title="Checking this checkbox will add/remove the app from the configured apps value" checked=true/>');
|
||||
} else {
|
||||
vals_orig.push('<input type="checkbox" name="' + vals_orig[0] + '" title="Checking this checkbox will add/remove the app from the configured apps value"/>');
|
||||
}
|
||||
if (cols.item(cols.length - 1).firstChild.checked) {
|
||||
vals_orig.push('<input type="checkbox" name="' + vals_orig[0] + '" title="Checking this checkbox will add/remove the app from the configured apps value" checked=true/>');
|
||||
} else {
|
||||
vals_orig.push('<input type="checkbox" name="' + vals_orig[0] + '" title="Checking this checkbox will add/remove the app from the configured apps value"/>');
|
||||
}
|
||||
|
||||
// Add delete button to row
|
||||
vals_orig.unshift('<span class="ui-icon ui-icon-close" onclick="deleteXcatMonRow(this)"></span>');
|
||||
// Add row to origCont
|
||||
origCont[i + 1] = vals_orig;
|
||||
count = i + 1;
|
||||
// Add delete button to row
|
||||
vals_orig.unshift('<span class="ui-icon ui-icon-close" onclick="deleteXcatMonRow(this)"></span>');
|
||||
// Add row to origCont
|
||||
origCont[i + 1] = vals_orig;
|
||||
count = i + 1;
|
||||
|
||||
// Check checkbox for every row when merging the app name with the apps values
|
||||
if (cols.item(cols.length - 1).firstChild.checked)
|
||||
appValue = appValue.concat(cols.item(2).firstChild.nodeValue + ",");
|
||||
}
|
||||
}
|
||||
// Check checkbox for every row when merging the app name with the apps values
|
||||
if (cols.item(cols.length - 1).firstChild.checked)
|
||||
appValue = appValue.concat(cols.item(2).firstChild.nodeValue + ",");
|
||||
}
|
||||
}
|
||||
|
||||
count++;
|
||||
|
||||
// Delete the last comma of the apps value
|
||||
appValue = appValue.substring(0, (appValue.length - 1));
|
||||
apps[2] = appValue;
|
||||
count++;
|
||||
|
||||
// Delete the last comma of the apps value
|
||||
appValue = appValue.substring(0, (appValue.length - 1));
|
||||
apps[2] = appValue;
|
||||
|
||||
newCont[count++] = apps;
|
||||
newCont[count++] = ping;
|
||||
newCont[count++] = apps;
|
||||
newCont[count++] = ping;
|
||||
|
||||
// Add to other monitor settings
|
||||
for ( var j = 0; j < otherCont.length; j++) {
|
||||
newCont[count++] = otherCont[j];
|
||||
}
|
||||
// Add to other monitor settings
|
||||
for ( var j = 0; j < otherCont.length; j++) {
|
||||
newCont[count++] = otherCont[j];
|
||||
}
|
||||
|
||||
// Create save dialog
|
||||
var dialogSave = $('<div id="saveDialog" align="center">Saving configuration</div>');
|
||||
dialogSave.append(createLoader());
|
||||
|
||||
$('#xcatmon').append(dialogSave);
|
||||
$("#saveDialog").dialog({
|
||||
modal : true
|
||||
});
|
||||
|
||||
$('.ui-dialog-titlebar-close').hide();
|
||||
$.ajax({
|
||||
type : 'POST',
|
||||
url : 'lib/tabRestore.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
table : tableName,
|
||||
cont : newCont
|
||||
},
|
||||
success : function(data) {
|
||||
// empty the dialog.add the close button
|
||||
$("#saveDialog").empty().append('<p>Configuration saved!</p>');
|
||||
$("#saveDialog").append(closeBtn);
|
||||
}
|
||||
});
|
||||
// Create save dialog
|
||||
var dialogSave = $('<div id="saveDialog" align="center">Saving configuration</div>');
|
||||
dialogSave.append(createLoader());
|
||||
|
||||
$('#xcatmon').append(dialogSave);
|
||||
$("#saveDialog").dialog({
|
||||
modal : true
|
||||
});
|
||||
|
||||
$('.ui-dialog-titlebar-close').hide();
|
||||
$.ajax({
|
||||
type : 'POST',
|
||||
url : 'lib/tabRestore.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
table : tableName,
|
||||
cont : newCont
|
||||
},
|
||||
success : function(data) {
|
||||
// empty the dialog.add the close button
|
||||
$("#saveDialog").empty().append('<p>Configuration saved!</p>');
|
||||
$("#saveDialog").append(closeBtn);
|
||||
}
|
||||
});
|
||||
|
||||
// Close button
|
||||
closeBtn.bind('click', function(event) {
|
||||
$("#saveDialog").dialog("destroy");
|
||||
$("#saveDialog").remove();
|
||||
});
|
||||
// Close button
|
||||
closeBtn.bind('click', function(event) {
|
||||
$("#saveDialog").dialog("destroy");
|
||||
$("#saveDialog").remove();
|
||||
});
|
||||
|
||||
// Clear the newCont
|
||||
newCont = null;
|
||||
newCont = new Object();
|
||||
newCont[0] = rsp[0].split(",");
|
||||
});
|
||||
// Clear the newCont
|
||||
newCont = null;
|
||||
newCont = new Object();
|
||||
newCont[0] = rsp[0].split(",");
|
||||
});
|
||||
|
||||
var cancelLnk = $('<a>Cancel</a>');
|
||||
cancelLnk.bind('click', function(event) {
|
||||
// Get the datatable for the page
|
||||
var dTable = $('#' + xcatMonTableId).dataTable();
|
||||
var cancelLnk = $('<a>Cancel</a>');
|
||||
cancelLnk.bind('click', function(event) {
|
||||
// Get the datatable for the page
|
||||
var dTable = $('#' + xcatMonTableId).dataTable();
|
||||
|
||||
// Clear the datatable
|
||||
dTable.fnClearTable();
|
||||
// Clear the datatable
|
||||
dTable.fnClearTable();
|
||||
|
||||
// Add the contents of origCont to the datatable
|
||||
for ( var i = 1; i < origCont.length; i++)
|
||||
dTable.fnAddData(origCont[i], true);
|
||||
// Add the contents of origCont to the datatable
|
||||
for ( var i = 1; i < origCont.length; i++)
|
||||
dTable.fnAddData(origCont[i], true);
|
||||
|
||||
$(":checkbox[title]").tooltip();
|
||||
$('#' + xcatMonTableId + ' td:not(td:nth-child(1),td:last-child)').editable(function(value, settings) {
|
||||
var colPos = this.cellIndex;
|
||||
var rowPos = dTable.fnGetPosition(this.parentNode);
|
||||
dTable.fnUpdate(value, rowPos, colPos);
|
||||
return (value);
|
||||
}, {
|
||||
onblur : 'submit',
|
||||
type : 'textarea',
|
||||
placeholder : ' ',
|
||||
height : '30px'
|
||||
});
|
||||
});
|
||||
$(":checkbox[title]").tooltip();
|
||||
$('#' + xcatMonTableId + ' td:not(td:nth-child(1),td:last-child)').editable(function(value, settings) {
|
||||
var colPos = this.cellIndex;
|
||||
var rowPos = dTable.fnGetPosition(this.parentNode);
|
||||
dTable.fnUpdate(value, rowPos, colPos);
|
||||
return (value);
|
||||
}, {
|
||||
onblur : 'submit',
|
||||
type : 'textarea',
|
||||
placeholder : ' ',
|
||||
height : '30px'
|
||||
});
|
||||
});
|
||||
|
||||
// Create actions menu
|
||||
var actionsLnk = '<a>Actions</a>';
|
||||
var actsMenu = createMenu([ addRowLnk, applyLnk, cancelLnk ]);
|
||||
var actionsMenu = createMenu([ [ actionsLnk, actsMenu ] ]);
|
||||
actionsMenu.superfish();
|
||||
actionsMenu.css('display', 'inline-block');
|
||||
actionBar.append(actionsMenu);
|
||||
// Create actions menu
|
||||
var actionsLnk = '<a>Actions</a>';
|
||||
var actsMenu = createMenu([ addRowLnk, applyLnk, cancelLnk ]);
|
||||
var actionsMenu = createMenu([ [ actionsLnk, actsMenu ] ]);
|
||||
actionsMenu.superfish();
|
||||
actionsMenu.css('display', 'inline-block');
|
||||
actionBar.append(actionsMenu);
|
||||
|
||||
// Create a division to hold actions menu
|
||||
var menuDiv = $('<div id="' + xcatMonTableId + '_menuDiv" class="menuDiv"></div>');
|
||||
$('#' + xcatMonTableId + '_wrapper').prepend(menuDiv);
|
||||
menuDiv.append(actionBar);
|
||||
$('#' + xcatMonTableId + '_filter').appendTo(menuDiv);
|
||||
// Create a division to hold actions menu
|
||||
var menuDiv = $('<div id="' + xcatMonTableId + '_menuDiv" class="menuDiv"></div>');
|
||||
$('#' + xcatMonTableId + '_wrapper').prepend(menuDiv);
|
||||
menuDiv.append(actionBar);
|
||||
$('#' + xcatMonTableId + '_filter').appendTo(menuDiv);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a row from the table
|
||||
*/
|
||||
function deleteXcatMonRow(obj) {
|
||||
var dTable = $('#' + xcatMonTableId).dataTable();
|
||||
var rows = dTable.fnGetNodes();
|
||||
var tgtRow = $(obj).parent().parent().get(0);
|
||||
for ( var i in rows) {
|
||||
if (rows[i] == tgtRow) {
|
||||
dTable.fnDeleteRow(i, null, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
var dTable = $('#' + xcatMonTableId).dataTable();
|
||||
var rows = dTable.fnGetNodes();
|
||||
var tgtRow = $(obj).parent().parent().get(0);
|
||||
for ( var i in rows) {
|
||||
if (rows[i] == tgtRow) {
|
||||
dTable.fnDeleteRow(i, null, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,39 +1,39 @@
|
||||
var hardwareInfo = {
|
||||
'7037-A50' : [ 'P5-185', 5 ],
|
||||
'9115-505' : [ 'P5-505', 1 ],
|
||||
'9110-510' : [ 'P5-510', 2 ],
|
||||
'9110-51A' : [ 'P5-510', 2 ],
|
||||
'9111-520' : [ 'P5-520', 4 ],
|
||||
'913A-52A' : [ 'P5-52A', 4 ],
|
||||
'9113-550' : [ 'P5-550', 4 ],
|
||||
'9133-55A' : [ 'P5-55A', 4 ],
|
||||
'9116-561' : [ 'P5-560Q', 4 ],
|
||||
'9117-570' : [ 'P5-570', 4 ],
|
||||
'9118-575' : [ 'P5-575', 42 ],
|
||||
'9119-590' : [ 'P5-590', 42 ],
|
||||
'9119-595' : [ 'P5-595', 42 ],
|
||||
'7037-A50' : [ 'P5-185', 5 ],
|
||||
'9115-505' : [ 'P5-505', 1 ],
|
||||
'9110-510' : [ 'P5-510', 2 ],
|
||||
'9110-51A' : [ 'P5-510', 2 ],
|
||||
'9111-520' : [ 'P5-520', 4 ],
|
||||
'913A-52A' : [ 'P5-52A', 4 ],
|
||||
'9113-550' : [ 'P5-550', 4 ],
|
||||
'9133-55A' : [ 'P5-55A', 4 ],
|
||||
'9116-561' : [ 'P5-560Q', 4 ],
|
||||
'9117-570' : [ 'P5-570', 4 ],
|
||||
'9118-575' : [ 'P5-575', 42 ],
|
||||
'9119-590' : [ 'P5-590', 42 ],
|
||||
'9119-595' : [ 'P5-595', 42 ],
|
||||
|
||||
//P6
|
||||
'8203-E4A' : [ 'P6-520', 4 ],
|
||||
'9407-M15' : [ 'P6-520', 4 ],
|
||||
'9408-M25' : [ 'P6-520', 4 ],
|
||||
'8204-E8A' : [ 'P6-550', 4 ],
|
||||
'9409-M50' : [ 'P6-550', 4 ],
|
||||
'8234-EMA' : [ 'P6-560', 4 ],
|
||||
'9117-MMA' : [ 'P6-570', 4 ],
|
||||
'9125-F2A' : [ 'P6-575', 42 ],
|
||||
'9119-FHA' : [ 'P6-595', 42 ],
|
||||
// P6
|
||||
'8203-E4A' : [ 'P6-520', 4 ],
|
||||
'9407-M15' : [ 'P6-520', 4 ],
|
||||
'9408-M25' : [ 'P6-520', 4 ],
|
||||
'8204-E8A' : [ 'P6-550', 4 ],
|
||||
'9409-M50' : [ 'P6-550', 4 ],
|
||||
'8234-EMA' : [ 'P6-560', 4 ],
|
||||
'9117-MMA' : [ 'P6-570', 4 ],
|
||||
'9125-F2A' : [ 'P6-575', 42 ],
|
||||
'9119-FHA' : [ 'P6-595', 42 ],
|
||||
|
||||
//P7
|
||||
'8202-E4B' : [ 'P7-720', 4 ],
|
||||
'8205-E6B' : [ 'P7-740', 4 ],
|
||||
'8231-E2B' : [ 'P7-710/730', 2 ],
|
||||
'8233-E8B' : [ 'P7-750', 4 ],
|
||||
'8236-E8C' : [ 'P7-755', 4 ],
|
||||
'9117-MMB' : [ 'P7-770', 4 ],
|
||||
'9119-FHB' : [ 'P7-795', 4 ],
|
||||
'9179-MHB' : [ 'P7-780', 42 ],
|
||||
'8231-E2C' : [ 'P7 HE', 4 ],
|
||||
'9125-F2C' : [ 'Power 775', 2],
|
||||
'78AC-100' : [ 'Power 775', 2] //fsp
|
||||
// P7
|
||||
'8202-E4B' : [ 'P7-720', 4 ],
|
||||
'8205-E6B' : [ 'P7-740', 4 ],
|
||||
'8231-E2B' : [ 'P7-710/730', 2 ],
|
||||
'8233-E8B' : [ 'P7-750', 4 ],
|
||||
'8236-E8C' : [ 'P7-755', 4 ],
|
||||
'9117-MMB' : [ 'P7-770', 4 ],
|
||||
'9119-FHB' : [ 'P7-795', 4 ],
|
||||
'9179-MHB' : [ 'P7-780', 42 ],
|
||||
'8231-E2C' : [ 'P7 HE', 4 ],
|
||||
'9125-F2C' : [ 'Power 775', 2],
|
||||
'78AC-100' : [ 'Power 775', 2] // FSP
|
||||
};
|
File diff suppressed because it is too large
Load Diff
@ -1,379 +1,375 @@
|
||||
/**
|
||||
* Load nodeset page
|
||||
*
|
||||
* @param tgtNodes
|
||||
* Targets to run nodeset against
|
||||
* @return Nothing
|
||||
* @param tgtNodes Targets to run nodeset against
|
||||
*/
|
||||
function loadNodesetPage(tgtNodes) {
|
||||
// Get OS images
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'tabdump',
|
||||
tgt : '',
|
||||
args : 'osimage',
|
||||
msg : ''
|
||||
},
|
||||
// Get OS images
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'tabdump',
|
||||
tgt : '',
|
||||
args : 'osimage',
|
||||
msg : ''
|
||||
},
|
||||
|
||||
success : setOSImageCookies
|
||||
});
|
||||
success : setOSImageCookies
|
||||
});
|
||||
|
||||
// Get nodes tab
|
||||
var tab = getNodesTab();
|
||||
// Get nodes tab
|
||||
var tab = getNodesTab();
|
||||
|
||||
// Generate new tab ID
|
||||
var inst = 0;
|
||||
var tabId = 'nodesetTab' + inst;
|
||||
while ($('#' + tabId).length) {
|
||||
// If one already exists, generate another one
|
||||
inst = inst + 1;
|
||||
tabId = 'nodesetTab' + inst;
|
||||
}
|
||||
// Generate new tab ID
|
||||
var inst = 0;
|
||||
var tabId = 'nodesetTab' + inst;
|
||||
while ($('#' + tabId).length) {
|
||||
// If one already exists, generate another one
|
||||
inst = inst + 1;
|
||||
tabId = 'nodesetTab' + inst;
|
||||
}
|
||||
|
||||
// Open new tab & create nodeset form
|
||||
var nodesetForm = $('<div class="form"></div>');
|
||||
// Open new tab & create nodeset form
|
||||
var nodesetForm = $('<div class="form"></div>');
|
||||
|
||||
// Create status bar
|
||||
var statBarId = 'nodesetStatusBar' + inst;
|
||||
var statBar = createStatusBar(statBarId).hide();
|
||||
nodesetForm.append(statBar);
|
||||
// Create status bar
|
||||
var statBarId = 'nodesetStatusBar' + inst;
|
||||
var statBar = createStatusBar(statBarId).hide();
|
||||
nodesetForm.append(statBar);
|
||||
|
||||
// Create loader
|
||||
var loader = createLoader('nodesetLoader');
|
||||
statBar.find('div').append(loader);
|
||||
// Create loader
|
||||
var loader = createLoader('nodesetLoader');
|
||||
statBar.find('div').append(loader);
|
||||
|
||||
// Create info bar
|
||||
var infoBar = createInfoBar('Set the boot state for a node range');
|
||||
nodesetForm.append(infoBar);
|
||||
// Create info bar
|
||||
var infoBar = createInfoBar('Set the boot state for a node range');
|
||||
nodesetForm.append(infoBar);
|
||||
|
||||
// Create target node or group
|
||||
var tgt = $('<div><label for="target">Target node range:</label><input type="text" name="target" value="' + tgtNodes + '" title="The node or node range to set the boot state for"/></div>');
|
||||
nodesetForm.append(tgt);
|
||||
// Create target node or group
|
||||
var tgt = $('<div><label for="target">Target node range:</label><input type="text" name="target" value="' + tgtNodes + '" title="The node or node range to set the boot state for"/></div>');
|
||||
nodesetForm.append(tgt);
|
||||
|
||||
// Create boot method drop down
|
||||
var method = $('<div></div>');
|
||||
var methodLabel = $('<label for="method">Boot method:</label>');
|
||||
var methodSelect = $('<select id="bootMethod" name="bootMethod"></select>');
|
||||
methodSelect.append('<option value="boot">boot</option>'
|
||||
+ '<option value="install">install</option>'
|
||||
+ '<option value="iscsiboot">iscsiboot</option>'
|
||||
+ '<option value="netboot">netboot</option>'
|
||||
+ '<option value="statelite">statelite</option>'
|
||||
);
|
||||
method.append(methodLabel);
|
||||
method.append(methodSelect);
|
||||
nodesetForm.append(method);
|
||||
// Create boot method drop down
|
||||
var method = $('<div></div>');
|
||||
var methodLabel = $('<label for="method">Boot method:</label>');
|
||||
var methodSelect = $('<select id="bootMethod" name="bootMethod"></select>');
|
||||
methodSelect.append('<option value="boot">boot</option>'
|
||||
+ '<option value="install">install</option>'
|
||||
+ '<option value="iscsiboot">iscsiboot</option>'
|
||||
+ '<option value="netboot">netboot</option>'
|
||||
+ '<option value="statelite">statelite</option>'
|
||||
);
|
||||
method.append(methodLabel);
|
||||
method.append(methodSelect);
|
||||
nodesetForm.append(method);
|
||||
|
||||
// Create boot type drop down
|
||||
var type = $('<div></div>');
|
||||
var typeLabel = $('<label for="type">Boot type:</label>');
|
||||
var typeSelect = $('<select id="bootType" name="bootType"></select>');
|
||||
typeSelect.append('<option value="zvm">zvm</option>'
|
||||
+ '<option value="install">pxe</option>'
|
||||
+ '<option value="iscsiboot">yaboot</option>'
|
||||
);
|
||||
type.append(typeLabel);
|
||||
type.append(typeSelect);
|
||||
nodesetForm.append(type);
|
||||
// Create boot type drop down
|
||||
var type = $('<div></div>');
|
||||
var typeLabel = $('<label for="type">Boot type:</label>');
|
||||
var typeSelect = $('<select id="bootType" name="bootType"></select>');
|
||||
typeSelect.append('<option value="zvm">zvm</option>'
|
||||
+ '<option value="install">pxe</option>'
|
||||
+ '<option value="iscsiboot">yaboot</option>'
|
||||
);
|
||||
type.append(typeLabel);
|
||||
type.append(typeSelect);
|
||||
nodesetForm.append(type);
|
||||
|
||||
// Create operating system input
|
||||
var os = $('<div></div>');
|
||||
var osLabel = $('<label for="os">Operating system:</label>');
|
||||
var osInput = $('<input type="text" name="os" title="You must give the operating system of this node or node range, e.g. rhel5.5"/>');
|
||||
osInput.one('focus', function(){
|
||||
var tmp = $.cookie('osvers');
|
||||
if (tmp) {
|
||||
// Turn on auto complete
|
||||
$(this).autocomplete({
|
||||
source: tmp.split(',')
|
||||
});
|
||||
}
|
||||
});
|
||||
os.append(osLabel);
|
||||
os.append(osInput);
|
||||
nodesetForm.append(os);
|
||||
// Create operating system input
|
||||
var os = $('<div></div>');
|
||||
var osLabel = $('<label for="os">Operating system:</label>');
|
||||
var osInput = $('<input type="text" name="os" title="You must give the operating system of this node or node range, e.g. rhel5.5"/>');
|
||||
osInput.one('focus', function(){
|
||||
var tmp = $.cookie('osvers');
|
||||
if (tmp) {
|
||||
// Turn on auto complete
|
||||
$(this).autocomplete({
|
||||
source: tmp.split(',')
|
||||
});
|
||||
}
|
||||
});
|
||||
os.append(osLabel);
|
||||
os.append(osInput);
|
||||
nodesetForm.append(os);
|
||||
|
||||
// Create architecture input
|
||||
var arch = $('<div></div>');
|
||||
var archLabel = $('<label for="arch">Architecture:</label>');
|
||||
var archInput = $('<input type="text" name="arch" title="You must give the architecture of this node or node range, e.g. s390x"/>');
|
||||
archInput.one('focus', function(){
|
||||
var tmp = $.cookie('osarchs');
|
||||
if (tmp) {
|
||||
// Turn on auto complete
|
||||
$(this).autocomplete({
|
||||
source: tmp.split(',')
|
||||
});
|
||||
}
|
||||
});
|
||||
arch.append(archLabel);
|
||||
arch.append(archInput);
|
||||
nodesetForm.append(arch);
|
||||
// Create architecture input
|
||||
var arch = $('<div></div>');
|
||||
var archLabel = $('<label for="arch">Architecture:</label>');
|
||||
var archInput = $('<input type="text" name="arch" title="You must give the architecture of this node or node range, e.g. s390x"/>');
|
||||
archInput.one('focus', function(){
|
||||
var tmp = $.cookie('osarchs');
|
||||
if (tmp) {
|
||||
// Turn on auto complete
|
||||
$(this).autocomplete({
|
||||
source: tmp.split(',')
|
||||
});
|
||||
}
|
||||
});
|
||||
arch.append(archLabel);
|
||||
arch.append(archInput);
|
||||
nodesetForm.append(arch);
|
||||
|
||||
// Create profiles input
|
||||
var profile = $('<div></div>');
|
||||
var profileLabel = $('<label for="profile">Profile:</label>');
|
||||
var profileInput = $('<input type="text" name="profile" title="You must give the profile for this node or node range. The typical default profile is: compute."/>');
|
||||
profileInput.one('focus', function(){
|
||||
tmp = $.cookie('profiles');
|
||||
if (tmp) {
|
||||
// Turn on auto complete
|
||||
$(this).autocomplete({
|
||||
source: tmp.split(',')
|
||||
});
|
||||
}
|
||||
});
|
||||
profile.append(profileLabel);
|
||||
profile.append(profileInput);
|
||||
nodesetForm.append(profile);
|
||||
// Create profiles input
|
||||
var profile = $('<div></div>');
|
||||
var profileLabel = $('<label for="profile">Profile:</label>');
|
||||
var profileInput = $('<input type="text" name="profile" title="You must give the profile for this node or node range. The typical default profile is: compute."/>');
|
||||
profileInput.one('focus', function(){
|
||||
tmp = $.cookie('profiles');
|
||||
if (tmp) {
|
||||
// Turn on auto complete
|
||||
$(this).autocomplete({
|
||||
source: tmp.split(',')
|
||||
});
|
||||
}
|
||||
});
|
||||
profile.append(profileLabel);
|
||||
profile.append(profileInput);
|
||||
nodesetForm.append(profile);
|
||||
|
||||
// Generate tooltips
|
||||
nodesetForm.find('div input[title]').tooltip({
|
||||
position: "center right",
|
||||
offset: [-2, 10],
|
||||
effect: "fade",
|
||||
opacity: 0.7,
|
||||
predelay: 800,
|
||||
events : {
|
||||
def : "mouseover,mouseout",
|
||||
input : "mouseover,mouseout",
|
||||
widget : "focus mouseover,blur mouseout",
|
||||
tooltip : "mouseover,mouseout"
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Ok
|
||||
*/
|
||||
var okBtn = createButton('Ok');
|
||||
okBtn.bind('click', function(event) {
|
||||
// Remove any warning messages
|
||||
$(this).parent().parent().find('.ui-state-error').remove();
|
||||
|
||||
// Check state, OS, arch, and profile
|
||||
var ready = true;
|
||||
var inputs = $('#' + tabId + ' input');
|
||||
for ( var i = 0; i < inputs.length; i++) {
|
||||
if (!inputs.eq(i).val() && inputs.eq(i).attr('name') != 'diskPw') {
|
||||
inputs.eq(i).css('border', 'solid #FF0000 1px');
|
||||
ready = false;
|
||||
} else {
|
||||
inputs.eq(i).css('border', 'solid #BDBDBD 1px');
|
||||
}
|
||||
}
|
||||
// Generate tooltips
|
||||
nodesetForm.find('div input[title]').tooltip({
|
||||
position: "center right",
|
||||
offset: [-2, 10],
|
||||
effect: "fade",
|
||||
opacity: 0.7,
|
||||
predelay: 800,
|
||||
events : {
|
||||
def : "mouseover,mouseout",
|
||||
input : "mouseover,mouseout",
|
||||
widget : "focus mouseover,blur mouseout",
|
||||
tooltip : "mouseover,mouseout"
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Ok
|
||||
*/
|
||||
var okBtn = createButton('Ok');
|
||||
okBtn.bind('click', function(event) {
|
||||
// Remove any warning messages
|
||||
$(this).parent().parent().find('.ui-state-error').remove();
|
||||
|
||||
// Check state, OS, arch, and profile
|
||||
var ready = true;
|
||||
var inputs = $('#' + tabId + ' input');
|
||||
for ( var i = 0; i < inputs.length; i++) {
|
||||
if (!inputs.eq(i).val() && inputs.eq(i).attr('name') != 'diskPw') {
|
||||
inputs.eq(i).css('border', 'solid #FF0000 1px');
|
||||
ready = false;
|
||||
} else {
|
||||
inputs.eq(i).css('border', 'solid #BDBDBD 1px');
|
||||
}
|
||||
}
|
||||
|
||||
if (ready) {
|
||||
// Get nodes
|
||||
var tgts = $('#' + tabId + ' input[name=target]').val();
|
||||
// Get boot method
|
||||
var method = $('#' + tabId + ' select[id=bootMethod]').val();
|
||||
// Get boot type
|
||||
var type = $('#' + tabId + ' select[id=bootType]').val();
|
||||
if (ready) {
|
||||
// Get nodes
|
||||
var tgts = $('#' + tabId + ' input[name=target]').val();
|
||||
// Get boot method
|
||||
var method = $('#' + tabId + ' select[id=bootMethod]').val();
|
||||
// Get boot type
|
||||
var type = $('#' + tabId + ' select[id=bootType]').val();
|
||||
|
||||
// Get OS, arch, and profile
|
||||
var os = $('#' + tabId + ' input[name=os]').val();
|
||||
var arch = $('#' + tabId + ' input[name=arch]').val();
|
||||
var profile = $('#' + tabId + ' input[name=profile]').val();
|
||||
// Get OS, arch, and profile
|
||||
var os = $('#' + tabId + ' input[name=os]').val();
|
||||
var arch = $('#' + tabId + ' input[name=arch]').val();
|
||||
var profile = $('#' + tabId + ' input[name=profile]').val();
|
||||
|
||||
// Disable all inputs, selects, and Ok button
|
||||
inputs.attr('disabled', 'disabled');
|
||||
$('#' + tabId + ' select').attr('disabled', 'disabled');
|
||||
$(this).attr('disabled', 'true');
|
||||
// Disable all inputs, selects, and Ok button
|
||||
inputs.attr('disabled', 'disabled');
|
||||
$('#' + tabId + ' select').attr('disabled', 'disabled');
|
||||
$(this).attr('disabled', 'true');
|
||||
|
||||
/**
|
||||
* (1) Set the OS, arch, and profile
|
||||
*/
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'nodeadd',
|
||||
tgt : '',
|
||||
args : tgts + ';noderes.netboot=' + type
|
||||
+ ';nodetype.os=' + os
|
||||
+ ';nodetype.arch=' + arch
|
||||
+ ';nodetype.profile=' + profile,
|
||||
msg : 'cmd=nodeadd;inst=' + inst
|
||||
},
|
||||
/**
|
||||
* (1) Set the OS, arch, and profile
|
||||
*/
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'nodeadd',
|
||||
tgt : '',
|
||||
args : tgts + ';noderes.netboot=' + type
|
||||
+ ';nodetype.os=' + os
|
||||
+ ';nodetype.arch=' + arch
|
||||
+ ';nodetype.profile=' + profile,
|
||||
msg : 'cmd=nodeadd;inst=' + inst
|
||||
},
|
||||
|
||||
success : updateNodesetStatus
|
||||
});
|
||||
success : updateNodesetStatus
|
||||
});
|
||||
|
||||
// Show status bar
|
||||
statBar.show();
|
||||
} else {
|
||||
// Show warning message
|
||||
var warn = createWarnBar('You are missing some values');
|
||||
warn.prependTo($(this).parent().parent());
|
||||
}
|
||||
});
|
||||
nodesetForm.append(okBtn);
|
||||
// Show status bar
|
||||
statBar.show();
|
||||
} else {
|
||||
// Show warning message
|
||||
var warn = createWarnBar('You are missing some values');
|
||||
warn.prependTo($(this).parent().parent());
|
||||
}
|
||||
});
|
||||
nodesetForm.append(okBtn);
|
||||
|
||||
// Append to discover tab
|
||||
tab.add(tabId, 'Nodeset', nodesetForm, true);
|
||||
// Append to discover tab
|
||||
tab.add(tabId, 'Nodeset', nodesetForm, true);
|
||||
|
||||
// Select new tab
|
||||
tab.select(tabId);
|
||||
// Select new tab
|
||||
tab.select(tabId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update nodeset status
|
||||
*
|
||||
* @param data
|
||||
* Data returned from HTTP request
|
||||
* @return Nothing
|
||||
* @param data Data returned from HTTP request
|
||||
*/
|
||||
function updateNodesetStatus(data) {
|
||||
// Get ajax response
|
||||
var rsp = data.rsp;
|
||||
var args = data.msg.split(';');
|
||||
var cmd = args[0].replace('cmd=', '');
|
||||
// Get ajax response
|
||||
var rsp = data.rsp;
|
||||
var args = data.msg.split(';');
|
||||
var cmd = args[0].replace('cmd=', '');
|
||||
|
||||
// Get nodeset instance
|
||||
var inst = args[1].replace('inst=', '');
|
||||
// Get status bar ID
|
||||
var statBarId = 'nodesetStatusBar' + inst;
|
||||
// Get tab ID
|
||||
var tabId = 'nodesetTab' + inst;
|
||||
// Get nodeset instance
|
||||
var inst = args[1].replace('inst=', '');
|
||||
// Get status bar ID
|
||||
var statBarId = 'nodesetStatusBar' + inst;
|
||||
// Get tab ID
|
||||
var tabId = 'nodesetTab' + inst;
|
||||
|
||||
// Get nodes
|
||||
var tgts = $('#' + tabId + ' input[name=target]').val();
|
||||
// Get boot method
|
||||
var method = $('#' + tabId + ' select[id=bootMethod]').val();
|
||||
// Get nodes
|
||||
var tgts = $('#' + tabId + ' input[name=target]').val();
|
||||
// Get boot method
|
||||
var method = $('#' + tabId + ' select[id=bootMethod]').val();
|
||||
|
||||
/**
|
||||
* (2) Update /etc/hosts
|
||||
*/
|
||||
if (cmd == 'nodeadd') {
|
||||
if (rsp.length) {
|
||||
$('#' + statBarId).find('img').hide();
|
||||
$('#' + statBarId).find('div').append('<pre>(Error) Failed to create node definition</pre>');
|
||||
} else {
|
||||
// Create target nodes string
|
||||
var tgtNodesStr = '';
|
||||
var nodes = tgts.split(',');
|
||||
|
||||
// Loop through each node
|
||||
for ( var i in nodes) {
|
||||
// If it is the 1st and only node
|
||||
if (i == 0 && i == nodes.length - 1) {
|
||||
tgtNodesStr += nodes[i];
|
||||
}
|
||||
// If it is the 1st node of many nodes
|
||||
else if (i == 0 && i != nodes.length - 1) {
|
||||
// Append a comma to the string
|
||||
tgtNodesStr += nodes[i] + ', ';
|
||||
} else {
|
||||
// If it is the last node
|
||||
if (i == nodes.length - 1) {
|
||||
// Append nothing to the string
|
||||
tgtNodesStr += nodes[i];
|
||||
} else {
|
||||
// Append a comma to the string
|
||||
tgtNodesStr += nodes[i] + ', ';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$('#' + statBarId).find('div').append('<pre>Node definition created for ' + tgtNodesStr + '</pre>');
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'makehosts',
|
||||
tgt : '',
|
||||
args : '',
|
||||
msg : 'cmd=makehosts;inst=' + inst
|
||||
},
|
||||
/**
|
||||
* (2) Update /etc/hosts
|
||||
*/
|
||||
if (cmd == 'nodeadd') {
|
||||
if (rsp.length) {
|
||||
$('#' + statBarId).find('img').hide();
|
||||
$('#' + statBarId).find('div').append('<pre>(Error) Failed to create node definition</pre>');
|
||||
} else {
|
||||
// Create target nodes string
|
||||
var tgtNodesStr = '';
|
||||
var nodes = tgts.split(',');
|
||||
|
||||
// Loop through each node
|
||||
for ( var i in nodes) {
|
||||
// If it is the 1st and only node
|
||||
if (i == 0 && i == nodes.length - 1) {
|
||||
tgtNodesStr += nodes[i];
|
||||
}
|
||||
// If it is the 1st node of many nodes
|
||||
else if (i == 0 && i != nodes.length - 1) {
|
||||
// Append a comma to the string
|
||||
tgtNodesStr += nodes[i] + ', ';
|
||||
} else {
|
||||
// If it is the last node
|
||||
if (i == nodes.length - 1) {
|
||||
// Append nothing to the string
|
||||
tgtNodesStr += nodes[i];
|
||||
} else {
|
||||
// Append a comma to the string
|
||||
tgtNodesStr += nodes[i] + ', ';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$('#' + statBarId).find('div').append('<pre>Node definition created for ' + tgtNodesStr + '</pre>');
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'makehosts',
|
||||
tgt : '',
|
||||
args : '',
|
||||
msg : 'cmd=makehosts;inst=' + inst
|
||||
},
|
||||
|
||||
success : updateNodesetStatus
|
||||
});
|
||||
}
|
||||
}
|
||||
success : updateNodesetStatus
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* (4) Update DNS
|
||||
*/
|
||||
else if (cmd == 'makehosts') {
|
||||
// If no output, no errors occurred
|
||||
if (rsp.length) {
|
||||
$('#' + statBarId).find('div').append('<pre>(Error) Failed to update /etc/hosts</pre>');
|
||||
} else {
|
||||
$('#' + statBarId).find('div').append('<pre>/etc/hosts updated</pre>');
|
||||
}
|
||||
/**
|
||||
* (4) Update DNS
|
||||
*/
|
||||
else if (cmd == 'makehosts') {
|
||||
// If no output, no errors occurred
|
||||
if (rsp.length) {
|
||||
$('#' + statBarId).find('div').append('<pre>(Error) Failed to update /etc/hosts</pre>');
|
||||
} else {
|
||||
$('#' + statBarId).find('div').append('<pre>/etc/hosts updated</pre>');
|
||||
}
|
||||
|
||||
// Update DNS
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'makedns',
|
||||
tgt : '',
|
||||
args : '',
|
||||
msg : 'cmd=makedns;inst=' + inst
|
||||
},
|
||||
// Update DNS
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'makedns',
|
||||
tgt : '',
|
||||
args : '',
|
||||
msg : 'cmd=makedns;inst=' + inst
|
||||
},
|
||||
|
||||
success : updateNodesetStatus
|
||||
});
|
||||
}
|
||||
success : updateNodesetStatus
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* (5) Update DHCP
|
||||
*/
|
||||
else if (cmd == 'makedns') {
|
||||
// Write ajax response to status bar
|
||||
var prg = writeRsp(rsp, '');
|
||||
$('#' + statBarId).find('div').append(prg);
|
||||
|
||||
// Update DHCP
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'makedhcp',
|
||||
tgt : '',
|
||||
args : '-a',
|
||||
msg : 'cmd=makedhcp;inst=' + inst
|
||||
},
|
||||
/**
|
||||
* (5) Update DHCP
|
||||
*/
|
||||
else if (cmd == 'makedns') {
|
||||
// Write ajax response to status bar
|
||||
var prg = writeRsp(rsp, '');
|
||||
$('#' + statBarId).find('div').append(prg);
|
||||
|
||||
// Update DHCP
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'makedhcp',
|
||||
tgt : '',
|
||||
args : '-a',
|
||||
msg : 'cmd=makedhcp;inst=' + inst
|
||||
},
|
||||
|
||||
success : updateNodesetStatus
|
||||
});
|
||||
}
|
||||
success : updateNodesetStatus
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* (6) Prepare node for boot
|
||||
*/
|
||||
else if (cmd == 'makedhcp') {
|
||||
// Write ajax response to status bar
|
||||
var prg = writeRsp(rsp, '');
|
||||
$('#' + statBarId).find('div').append(prg);
|
||||
/**
|
||||
* (6) Prepare node for boot
|
||||
*/
|
||||
else if (cmd == 'makedhcp') {
|
||||
// Write ajax response to status bar
|
||||
var prg = writeRsp(rsp, '');
|
||||
$('#' + statBarId).find('div').append(prg);
|
||||
|
||||
// Prepare node for boot
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'nodeset',
|
||||
tgt : tgts,
|
||||
args : method,
|
||||
msg : 'cmd=nodeset;inst=' + inst
|
||||
},
|
||||
// Prepare node for boot
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'nodeset',
|
||||
tgt : tgts,
|
||||
args : method,
|
||||
msg : 'cmd=nodeset;inst=' + inst
|
||||
},
|
||||
|
||||
success : updateNodesetStatus
|
||||
});
|
||||
}
|
||||
success : updateNodesetStatus
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* (7) Boot node from network
|
||||
*/
|
||||
else if (cmd == 'nodeset') {
|
||||
// Write ajax response to status bar
|
||||
var prg = writeRsp(rsp, '');
|
||||
$('#' + statBarId).find('div').append(prg);
|
||||
/**
|
||||
* (7) Boot node from network
|
||||
*/
|
||||
else if (cmd == 'nodeset') {
|
||||
// Write ajax response to status bar
|
||||
var prg = writeRsp(rsp, '');
|
||||
$('#' + statBarId).find('div').append(prg);
|
||||
|
||||
// Hide loader
|
||||
$('#' + statBarId).find('img').hide();
|
||||
}
|
||||
// Hide loader
|
||||
$('#' + statBarId).find('img').hide();
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,202 +1,200 @@
|
||||
/**
|
||||
* Load netboot page
|
||||
*
|
||||
* @param tgtNodes
|
||||
* Targets to run rnetboot against
|
||||
* @return Nothing
|
||||
* @param tgtNodes Targets to run rnetboot against
|
||||
*/
|
||||
function loadNetbootPage(tgtNodes) {
|
||||
// Get node OS
|
||||
var osHash = new Object();
|
||||
var nodes = tgtNodes.split(',');
|
||||
for (var i in nodes) {
|
||||
var os = getNodeAttr(nodes[i], 'os');
|
||||
var osBase = os.match(/[a-zA-Z]+/);
|
||||
if (osBase) {
|
||||
nodes[osBase] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Get nodes tab
|
||||
var tab = getNodesTab();
|
||||
|
||||
// Generate new tab ID
|
||||
var inst = 0;
|
||||
var newTabId = 'netbootTab' + inst;
|
||||
while ($('#' + newTabId).length) {
|
||||
// If one already exists, generate another one
|
||||
inst = inst + 1;
|
||||
newTabId = 'netbootTab' + inst;
|
||||
}
|
||||
// Get node OS
|
||||
var osHash = new Object();
|
||||
var nodes = tgtNodes.split(',');
|
||||
for (var i in nodes) {
|
||||
var os = getNodeAttr(nodes[i], 'os');
|
||||
var osBase = os.match(/[a-zA-Z]+/);
|
||||
if (osBase) {
|
||||
nodes[osBase] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Get nodes tab
|
||||
var tab = getNodesTab();
|
||||
|
||||
// Generate new tab ID
|
||||
var inst = 0;
|
||||
var newTabId = 'netbootTab' + inst;
|
||||
while ($('#' + newTabId).length) {
|
||||
// If one already exists, generate another one
|
||||
inst = inst + 1;
|
||||
newTabId = 'netbootTab' + inst;
|
||||
}
|
||||
|
||||
// Create netboot form
|
||||
var netbootForm = $('<div class="form"></div>');
|
||||
// Create netboot form
|
||||
var netbootForm = $('<div class="form"></div>');
|
||||
|
||||
// Create status bar
|
||||
var statBarId = 'netbootStatusBar' + inst;
|
||||
var statusBar = createStatusBar(statBarId).hide();
|
||||
netbootForm.append(statusBar);
|
||||
// Create status bar
|
||||
var statBarId = 'netbootStatusBar' + inst;
|
||||
var statusBar = createStatusBar(statBarId).hide();
|
||||
netbootForm.append(statusBar);
|
||||
|
||||
// Create loader
|
||||
var loader = createLoader('netbootLoader');
|
||||
statusBar.find('div').append(loader);
|
||||
// Create loader
|
||||
var loader = createLoader('netbootLoader');
|
||||
statusBar.find('div').append(loader);
|
||||
|
||||
// Create info bar
|
||||
var infoBar = createInfoBar('Cause the range of nodes to boot to network');
|
||||
netbootForm.append(infoBar);
|
||||
// Create info bar
|
||||
var infoBar = createInfoBar('Cause the range of nodes to boot to network');
|
||||
netbootForm.append(infoBar);
|
||||
|
||||
// Create target node or group input
|
||||
var target = $('<div><label for="target">Target node range:</label><input type="text" name="target" value="' + tgtNodes + '" title="The node or node range to boot to network"/></div>');
|
||||
netbootForm.append(target);
|
||||
// Create target node or group input
|
||||
var target = $('<div><label for="target">Target node range:</label><input type="text" name="target" value="' + tgtNodes + '" title="The node or node range to boot to network"/></div>');
|
||||
netbootForm.append(target);
|
||||
|
||||
// Create options
|
||||
var optsDIV = $('<div></div>');
|
||||
var optsLabel = $('<label>Options:</label>');
|
||||
var optsList = $('<ul></ul>');
|
||||
var opt = $('<li></li>');
|
||||
optsList.append(opt);
|
||||
optsDIV.append(optsLabel);
|
||||
optsDIV.append(optsList);
|
||||
netbootForm.append(optsDIV);
|
||||
|
||||
// Create boot order checkbox
|
||||
var bootOrderChkBox = $('<input type="checkbox" id="s" name="s"/>');
|
||||
opt.append(bootOrderChkBox);
|
||||
opt.append('Set the boot device order');
|
||||
// Create boot order input
|
||||
var bootOrder = $('<li><label for="bootOrder">Boot order:</label><input type="text" name="bootOrder"/></li>');
|
||||
bootOrder.hide();
|
||||
optsList.append(bootOrder);
|
||||
|
||||
// Create force reboot checkbox
|
||||
optsList.append('<li><input type="checkbox" id="F" name="F"/>Force reboot</li>');
|
||||
// Create force shutdown checkbox
|
||||
optsList.append('<li><input type="checkbox" id="f" name="f"/>Force immediate shutdown of the partition</li>');
|
||||
if (osHash['AIX']) {
|
||||
// Create iscsi dump checkbox
|
||||
optsList.append('<li><input type="checkbox" id="I" name="I"/>Do a iscsi dump on AIX</li>');
|
||||
}
|
||||
|
||||
// Show boot order when checkbox is checked
|
||||
bootOrderChkBox.bind('click', function(event) {
|
||||
if ($(this).is(':checked')) {
|
||||
bootOrder.show();
|
||||
} else {
|
||||
bootOrder.hide();
|
||||
}
|
||||
});
|
||||
// Create options
|
||||
var optsDIV = $('<div></div>');
|
||||
var optsLabel = $('<label>Options:</label>');
|
||||
var optsList = $('<ul></ul>');
|
||||
var opt = $('<li></li>');
|
||||
optsList.append(opt);
|
||||
optsDIV.append(optsLabel);
|
||||
optsDIV.append(optsList);
|
||||
netbootForm.append(optsDIV);
|
||||
|
||||
// Create boot order checkbox
|
||||
var bootOrderChkBox = $('<input type="checkbox" id="s" name="s"/>');
|
||||
opt.append(bootOrderChkBox);
|
||||
opt.append('Set the boot device order');
|
||||
// Create boot order input
|
||||
var bootOrder = $('<li><label for="bootOrder">Boot order:</label><input type="text" name="bootOrder"/></li>');
|
||||
bootOrder.hide();
|
||||
optsList.append(bootOrder);
|
||||
|
||||
// Create force reboot checkbox
|
||||
optsList.append('<li><input type="checkbox" id="F" name="F"/>Force reboot</li>');
|
||||
// Create force shutdown checkbox
|
||||
optsList.append('<li><input type="checkbox" id="f" name="f"/>Force immediate shutdown of the partition</li>');
|
||||
if (osHash['AIX']) {
|
||||
// Create iscsi dump checkbox
|
||||
optsList.append('<li><input type="checkbox" id="I" name="I"/>Do a iscsi dump on AIX</li>');
|
||||
}
|
||||
|
||||
// Show boot order when checkbox is checked
|
||||
bootOrderChkBox.bind('click', function(event) {
|
||||
if ($(this).is(':checked')) {
|
||||
bootOrder.show();
|
||||
} else {
|
||||
bootOrder.hide();
|
||||
}
|
||||
});
|
||||
|
||||
// Determine plugin
|
||||
var tmp = tgtNodes.split(',');
|
||||
for ( var i = 0; i < tmp.length; i++) {
|
||||
var mgt = getNodeAttr(tmp[i], 'mgt');
|
||||
// If it is zvm
|
||||
if (mgt == 'zvm') {
|
||||
// Add IPL input
|
||||
netbootForm.append('<div><label for="ipl">IPL:</label><input type="text" name="ipl" title="The virtual address to IPL"/></div>');
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Determine plugin
|
||||
var tmp = tgtNodes.split(',');
|
||||
for ( var i = 0; i < tmp.length; i++) {
|
||||
var mgt = getNodeAttr(tmp[i], 'mgt');
|
||||
// If it is zvm
|
||||
if (mgt == 'zvm') {
|
||||
// Add IPL input
|
||||
netbootForm.append('<div><label for="ipl">IPL:</label><input type="text" name="ipl" title="The virtual address to IPL"/></div>');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Generate tooltips
|
||||
netbootForm.find('div input[title]').tooltip({
|
||||
position: "center right",
|
||||
offset: [-2, 10],
|
||||
effect: "fade",
|
||||
opacity: 0.7,
|
||||
predelay: 800,
|
||||
events : {
|
||||
def : "mouseover,mouseout",
|
||||
input : "mouseover,mouseout",
|
||||
widget : "focus mouseover,blur mouseout",
|
||||
tooltip : "mouseover,mouseout"
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Ok
|
||||
*/
|
||||
var okBtn = createButton('Ok');
|
||||
okBtn.bind('click', function(event) {
|
||||
// Remove any warning messages
|
||||
$(this).parent().parent().find('.ui-state-error').remove();
|
||||
|
||||
// Check inputs
|
||||
var ready = true;
|
||||
var inputs = $("#" + newTabId + " input[type='text']:visible");
|
||||
for ( var i = 0; i < inputs.length; i++) {
|
||||
if (!inputs.eq(i).val()) {
|
||||
inputs.eq(i).css('border', 'solid #FF0000 1px');
|
||||
ready = false;
|
||||
} else {
|
||||
inputs.eq(i).css('border', 'solid #BDBDBD 1px');
|
||||
}
|
||||
}
|
||||
// Generate tooltips
|
||||
netbootForm.find('div input[title]').tooltip({
|
||||
position: "center right",
|
||||
offset: [-2, 10],
|
||||
effect: "fade",
|
||||
opacity: 0.7,
|
||||
predelay: 800,
|
||||
events : {
|
||||
def : "mouseover,mouseout",
|
||||
input : "mouseover,mouseout",
|
||||
widget : "focus mouseover,blur mouseout",
|
||||
tooltip : "mouseover,mouseout"
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Ok
|
||||
*/
|
||||
var okBtn = createButton('Ok');
|
||||
okBtn.bind('click', function(event) {
|
||||
// Remove any warning messages
|
||||
$(this).parent().parent().find('.ui-state-error').remove();
|
||||
|
||||
// Check inputs
|
||||
var ready = true;
|
||||
var inputs = $("#" + newTabId + " input[type='text']:visible");
|
||||
for ( var i = 0; i < inputs.length; i++) {
|
||||
if (!inputs.eq(i).val()) {
|
||||
inputs.eq(i).css('border', 'solid #FF0000 1px');
|
||||
ready = false;
|
||||
} else {
|
||||
inputs.eq(i).css('border', 'solid #BDBDBD 1px');
|
||||
}
|
||||
}
|
||||
|
||||
// Generate arguments
|
||||
var chkBoxes = $("#" + newTabId + " input[type='checkbox']:checked");
|
||||
var optStr = '';
|
||||
var opt;
|
||||
for ( var i = 0; i < chkBoxes.length; i++) {
|
||||
opt = chkBoxes.eq(i).attr('name');
|
||||
optStr += '-' + opt;
|
||||
|
||||
// If it is the boot order
|
||||
if (opt == 's') {
|
||||
// Get the boot order
|
||||
optStr += ';' + $('#' + newTabId + ' input[name=bootOrder]').val();
|
||||
}
|
||||
|
||||
// Append ; to end of string
|
||||
if (i < (chkBoxes.length - 1)) {
|
||||
optStr += ';';
|
||||
}
|
||||
}
|
||||
// Generate arguments
|
||||
var chkBoxes = $("#" + newTabId + " input[type='checkbox']:checked");
|
||||
var optStr = '';
|
||||
var opt;
|
||||
for ( var i = 0; i < chkBoxes.length; i++) {
|
||||
opt = chkBoxes.eq(i).attr('name');
|
||||
optStr += '-' + opt;
|
||||
|
||||
// If it is the boot order
|
||||
if (opt == 's') {
|
||||
// Get the boot order
|
||||
optStr += ';' + $('#' + newTabId + ' input[name=bootOrder]').val();
|
||||
}
|
||||
|
||||
// Append ; to end of string
|
||||
if (i < (chkBoxes.length - 1)) {
|
||||
optStr += ';';
|
||||
}
|
||||
}
|
||||
|
||||
// If no inputs are empty
|
||||
if (ready) {
|
||||
// Get nodes
|
||||
var tgts = $('#' + newTabId + ' input[name=target]').val();
|
||||
// If no inputs are empty
|
||||
if (ready) {
|
||||
// Get nodes
|
||||
var tgts = $('#' + newTabId + ' input[name=target]').val();
|
||||
|
||||
// Get IPL address
|
||||
var ipl = $('#' + newTabId + ' input[name=ipl]');
|
||||
if (ipl) {
|
||||
optStr += 'ipl=' + ipl.val();
|
||||
}
|
||||
// Get IPL address
|
||||
var ipl = $('#' + newTabId + ' input[name=ipl]');
|
||||
if (ipl) {
|
||||
optStr += 'ipl=' + ipl.val();
|
||||
}
|
||||
|
||||
// Disable all inputs and Ok button
|
||||
$('#' + newTabId + ' input').attr('disabled', 'disabled');
|
||||
$(this).attr('disabled', 'true');
|
||||
// Disable all inputs and Ok button
|
||||
$('#' + newTabId + ' input').attr('disabled', 'disabled');
|
||||
$(this).attr('disabled', 'true');
|
||||
|
||||
/**
|
||||
* (1) Boot to network
|
||||
*/
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'rnetboot',
|
||||
tgt : tgts,
|
||||
args : optStr,
|
||||
msg : 'out=' + statBarId + ';cmd=rnetboot;tgt=' + tgts
|
||||
},
|
||||
/**
|
||||
* (1) Boot to network
|
||||
*/
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'rnetboot',
|
||||
tgt : tgts,
|
||||
args : optStr,
|
||||
msg : 'out=' + statBarId + ';cmd=rnetboot;tgt=' + tgts
|
||||
},
|
||||
|
||||
success : updateStatusBar
|
||||
});
|
||||
success : updateStatusBar
|
||||
});
|
||||
|
||||
// Show status bar
|
||||
statusBar.show();
|
||||
} else {
|
||||
// Show warning message
|
||||
var warn = createWarnBar('Please provide a value for each missing field.');
|
||||
warn.prependTo($(this).parent().parent());
|
||||
}
|
||||
});
|
||||
netbootForm.append(okBtn);
|
||||
// Show status bar
|
||||
statusBar.show();
|
||||
} else {
|
||||
// Show warning message
|
||||
var warn = createWarnBar('Please provide a value for each missing field.');
|
||||
warn.prependTo($(this).parent().parent());
|
||||
}
|
||||
});
|
||||
netbootForm.append(okBtn);
|
||||
|
||||
// Append to discover tab
|
||||
tab.add(newTabId, 'Boot', netbootForm, true);
|
||||
// Append to discover tab
|
||||
tab.add(newTabId, 'Boot', netbootForm, true);
|
||||
|
||||
// Select new tab
|
||||
tab.select(newTabId);
|
||||
// Select new tab
|
||||
tab.select(newTabId);
|
||||
}
|
@ -1,386 +1,384 @@
|
||||
/**
|
||||
* Load updatenode page
|
||||
*
|
||||
* @param tgtNodes
|
||||
* Targets to run updatenode against
|
||||
* @return Nothing
|
||||
* @param tgtNodes Targets to run updatenode against
|
||||
*/
|
||||
function loadUpdatenodePage(tgtNodes) {
|
||||
// Get OS images
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'tabdump',
|
||||
tgt : '',
|
||||
args : 'osimage',
|
||||
msg : ''
|
||||
},
|
||||
// Get OS images
|
||||
$.ajax({
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'tabdump',
|
||||
tgt : '',
|
||||
args : 'osimage',
|
||||
msg : ''
|
||||
},
|
||||
|
||||
success : setOSImageCookies
|
||||
});
|
||||
|
||||
// Get node OS
|
||||
var osHash = new Object();
|
||||
var nodes = tgtNodes.split(',');
|
||||
for (var i in nodes) {
|
||||
var os = getNodeAttr(nodes[i], 'os');
|
||||
var osBase = os.match(/[a-zA-Z]+/);
|
||||
if (osBase) {
|
||||
nodes[osBase] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Get nodes tab
|
||||
var tab = getNodesTab();
|
||||
success : setOSImageCookies
|
||||
});
|
||||
|
||||
// Get node OS
|
||||
var osHash = new Object();
|
||||
var nodes = tgtNodes.split(',');
|
||||
for (var i in nodes) {
|
||||
var os = getNodeAttr(nodes[i], 'os');
|
||||
var osBase = os.match(/[a-zA-Z]+/);
|
||||
if (osBase) {
|
||||
nodes[osBase] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Get nodes tab
|
||||
var tab = getNodesTab();
|
||||
|
||||
// Generate new tab ID
|
||||
var inst = 0;
|
||||
var newTabId = 'updatenodeTab' + inst;
|
||||
while ($('#' + newTabId).length) {
|
||||
// If one already exists, generate another one
|
||||
inst = inst + 1;
|
||||
newTabId = 'updatenodeTab' + inst;
|
||||
}
|
||||
|
||||
// Create updatenode form
|
||||
var updatenodeForm = $('<div class="form"></div>');
|
||||
// Generate new tab ID
|
||||
var inst = 0;
|
||||
var newTabId = 'updatenodeTab' + inst;
|
||||
while ($('#' + newTabId).length) {
|
||||
// If one already exists, generate another one
|
||||
inst = inst + 1;
|
||||
newTabId = 'updatenodeTab' + inst;
|
||||
}
|
||||
|
||||
// Create updatenode form
|
||||
var updatenodeForm = $('<div class="form"></div>');
|
||||
|
||||
// Create status bar
|
||||
var statBarId = 'updatenodeStatusBar' + inst;
|
||||
var statusBar = createStatusBar(statBarId).hide();
|
||||
updatenodeForm.append(statusBar);
|
||||
// Create status bar
|
||||
var statBarId = 'updatenodeStatusBar' + inst;
|
||||
var statusBar = createStatusBar(statBarId).hide();
|
||||
updatenodeForm.append(statusBar);
|
||||
|
||||
// Create loader
|
||||
var loader = createLoader('updatenodeLoader');
|
||||
statusBar.find('div').append(loader);
|
||||
// Create loader
|
||||
var loader = createLoader('updatenodeLoader');
|
||||
statusBar.find('div').append(loader);
|
||||
|
||||
// Create info bar
|
||||
var infoBar = createInfoBar('Update nodes in an xCAT environment');
|
||||
updatenodeForm.append(infoBar);
|
||||
|
||||
// Create target node or group input
|
||||
var tgt = $('<div><label for="target">Target node range:</label><input type="text" name="target" value="' + tgtNodes + '" title="The node or node range to update"/></div>');
|
||||
updatenodeForm.append(tgt);
|
||||
// Create info bar
|
||||
var infoBar = createInfoBar('Update nodes in an xCAT environment');
|
||||
updatenodeForm.append(infoBar);
|
||||
|
||||
// Create target node or group input
|
||||
var tgt = $('<div><label for="target">Target node range:</label><input type="text" name="target" value="' + tgtNodes + '" title="The node or node range to update"/></div>');
|
||||
updatenodeForm.append(tgt);
|
||||
|
||||
// Create options
|
||||
var options = $('<div></div>');
|
||||
var optionsLabel = $('<label>Options:</label>');
|
||||
var optionsList = $('<ul></ul>');
|
||||
options.append(optionsLabel);
|
||||
options.append(optionsList);
|
||||
updatenodeForm.append(options);
|
||||
|
||||
// Create update all software checkbox (only AIX)
|
||||
if (osHash['AIX']) {
|
||||
var updateAllOption = $('<li></li>');
|
||||
var updateAllChkBox = $('<input type="checkbox" id="A" name="A"/>');
|
||||
updateAllOption.append(updateAllChkBox);
|
||||
optionsList.append(updateAllOption);
|
||||
updateAllOption.append('Install or update all software contained in the source directory');
|
||||
|
||||
// Create source directory input
|
||||
var allSwScrDirectory = $('<li><label for="allSwSrcDirectory" style="vertical-align: middle">Source directory:</label><input type="text" id="allSwSrcDirectory" name="allSwSrcDirectory"/></li>');
|
||||
// Browse server directory and files
|
||||
var allSWSrcDirBrowse = createButton('Browse');
|
||||
allSWSrcDirBrowse.serverBrowser({
|
||||
onSelect : function(path) {
|
||||
$('#allSwSrcDirectory').val(path);
|
||||
},
|
||||
onLoad : function() {
|
||||
return $('#allSwSrcDirectory').val();
|
||||
},
|
||||
knownExt : [ 'exe', 'js', 'txt' ],
|
||||
knownPaths : [ {
|
||||
text : 'Install',
|
||||
image : 'desktop.png',
|
||||
path : '/install'
|
||||
} ],
|
||||
imageUrl : 'images/serverbrowser/',
|
||||
systemImageUrl : 'images/serverbrowser/',
|
||||
handlerUrl : 'lib/getpath.php',
|
||||
title : 'Browse',
|
||||
requestMethod : 'POST',
|
||||
width : '500',
|
||||
height : '300',
|
||||
basePath : '/install' // Limit user to only install directory
|
||||
});
|
||||
allSwScrDirectory.append(allSWSrcDirBrowse);
|
||||
allSwScrDirectory.hide();
|
||||
optionsList.append(allSwScrDirectory);
|
||||
// Create options
|
||||
var options = $('<div></div>');
|
||||
var optionsLabel = $('<label>Options:</label>');
|
||||
var optionsList = $('<ul></ul>');
|
||||
options.append(optionsLabel);
|
||||
options.append(optionsList);
|
||||
updatenodeForm.append(options);
|
||||
|
||||
// Create update all software checkbox (only AIX)
|
||||
if (osHash['AIX']) {
|
||||
var updateAllOption = $('<li></li>');
|
||||
var updateAllChkBox = $('<input type="checkbox" id="A" name="A"/>');
|
||||
updateAllOption.append(updateAllChkBox);
|
||||
optionsList.append(updateAllOption);
|
||||
updateAllOption.append('Install or update all software contained in the source directory');
|
||||
|
||||
// Create source directory input
|
||||
var allSwScrDirectory = $('<li><label for="allSwSrcDirectory" style="vertical-align: middle">Source directory:</label><input type="text" id="allSwSrcDirectory" name="allSwSrcDirectory"/></li>');
|
||||
// Browse server directory and files
|
||||
var allSWSrcDirBrowse = createButton('Browse');
|
||||
allSWSrcDirBrowse.serverBrowser({
|
||||
onSelect : function(path) {
|
||||
$('#allSwSrcDirectory').val(path);
|
||||
},
|
||||
onLoad : function() {
|
||||
return $('#allSwSrcDirectory').val();
|
||||
},
|
||||
knownExt : [ 'exe', 'js', 'txt' ],
|
||||
knownPaths : [ {
|
||||
text : 'Install',
|
||||
image : 'desktop.png',
|
||||
path : '/install'
|
||||
} ],
|
||||
imageUrl : 'images/serverbrowser/',
|
||||
systemImageUrl : 'images/serverbrowser/',
|
||||
handlerUrl : 'lib/getpath.php',
|
||||
title : 'Browse',
|
||||
requestMethod : 'POST',
|
||||
width : '500',
|
||||
height : '300',
|
||||
basePath : '/install' // Limit user to only install directory
|
||||
});
|
||||
allSwScrDirectory.append(allSWSrcDirBrowse);
|
||||
allSwScrDirectory.hide();
|
||||
optionsList.append(allSwScrDirectory);
|
||||
|
||||
// Show source directory when checked
|
||||
updateAllChkBox.bind('click', function(event) {
|
||||
if ($(this).is(':checked')) {
|
||||
allSwScrDirectory.show();
|
||||
} else {
|
||||
allSwScrDirectory.hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Create update software checkbox
|
||||
var updateOption = $('<li></li>');
|
||||
var updateChkBox = $('<input type="checkbox" id="S" name="S"/>');
|
||||
optionsList.append(updateOption);
|
||||
updateOption.append(updateChkBox);
|
||||
updateOption.append('Update existing software');
|
||||
|
||||
// Create source directory input
|
||||
var scrDirectory = $('<li><label for="srcDirectory" style="vertical-align: middle">Source directory:</label><input type="text" id="srcDirectory" name="srcDirectory" title="You must give the source directory containing the updated software packages"/></li>');
|
||||
// Browse server directory and files
|
||||
var srcDirBrowse = createButton('Browse');
|
||||
srcDirBrowse.serverBrowser({
|
||||
onSelect : function(path) {
|
||||
$('#srcDirectory').val(path);
|
||||
},
|
||||
onLoad : function() {
|
||||
return $('#srcDirectory').val();
|
||||
},
|
||||
knownExt : [ 'exe', 'js', 'txt' ],
|
||||
knownPaths : [ {
|
||||
text : 'Install',
|
||||
image : 'desktop.png',
|
||||
path : '/install'
|
||||
} ],
|
||||
imageUrl : 'images/serverbrowser/',
|
||||
systemImageUrl : 'images/serverbrowser/',
|
||||
handlerUrl : 'lib/getpath.php',
|
||||
title : 'Browse',
|
||||
requestMethod : 'POST',
|
||||
width : '500',
|
||||
height : '300',
|
||||
basePath : '/install' // Limit user to only install directory
|
||||
});
|
||||
scrDirectory.append(srcDirBrowse);
|
||||
scrDirectory.hide();
|
||||
optionsList.append(scrDirectory);
|
||||
|
||||
// Create other packages input
|
||||
var otherPkgs = $('<li><label for="otherpkgs" style="vertical-align: middle">otherpkgs:</label><input type="text" id="otherpkgs" name="otherpkgs"/></li>');
|
||||
otherPkgs.hide();
|
||||
optionsList.append(otherPkgs);
|
||||
|
||||
// Create RPM flags input (only AIX)
|
||||
var aixRpmFlags = $('<li><label for="rpm_flags">rpm_flags:</label><input type="text" name="rpm_flags"/></li>');
|
||||
aixRpmFlags.hide();
|
||||
optionsList.append(aixRpmFlags);
|
||||
|
||||
// Create installp flags input (only AIX)
|
||||
var aixInstallPFlags = $('<li><label for="installp_flags">installp_flags:</label><input type="text" name="installp_flags"/></li>');
|
||||
aixInstallPFlags.hide();
|
||||
optionsList.append(aixInstallPFlags);
|
||||
|
||||
// Create emgr flags input (only AIX)
|
||||
var aixEmgrFlags = $('<li><label for="emgr_flags">emgr_flags:</label><input type="text" name="emgr_flags"/></li>');
|
||||
aixEmgrFlags.hide();
|
||||
optionsList.append(aixEmgrFlags);
|
||||
|
||||
// Show flags when checked
|
||||
updateChkBox.bind('click', function(event) {
|
||||
if ($(this).is(':checked')) {
|
||||
scrDirectory.show();
|
||||
otherPkgs.show();
|
||||
if (osHash['AIX']) {
|
||||
aixRpmFlags.show();
|
||||
aixInstallPFlags.show();
|
||||
aixEmgrFlags.show();
|
||||
}
|
||||
} else {
|
||||
scrDirectory.hide();
|
||||
otherPkgs.hide();
|
||||
if (osHash['AIX']) {
|
||||
aixRpmFlags.hide();
|
||||
aixInstallPFlags.hide();
|
||||
aixEmgrFlags.hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Create postscripts input
|
||||
var postOption = $('<li></li>');
|
||||
var postChkBox = $('<input type="checkbox" id="P" name="P"/>');
|
||||
optionsList.append(postOption);
|
||||
postOption.append(postChkBox);
|
||||
postOption.append('Run postscripts');
|
||||
var postscripts = $('<li><label for="postscripts" style="vertical-align: middle">Postscripts:</label><input type="text" id="postscripts" name="postscripts" title="You must give the postscript(s) to run"/></li>');
|
||||
postscripts.hide();
|
||||
optionsList.append(postscripts);
|
||||
|
||||
// Show alternate source directory when checked
|
||||
postChkBox.bind('click', function(event) {
|
||||
if ($(this).is(':checked')) {
|
||||
postscripts.show();
|
||||
} else {
|
||||
postscripts.hide();
|
||||
}
|
||||
});
|
||||
optionsList.append('<li><input type="checkbox" id="F" name="F"/>Distribute and synchronize files</li>');
|
||||
optionsList.append('<li><input type="checkbox" id="k" name="k"/>Update the ssh keys and host keys for the service nodes and compute nodes</li>');
|
||||
|
||||
// Create update OS checkbox
|
||||
if (!osHash['AIX']) {
|
||||
var osOption = $('<li></li>');
|
||||
var osChkBox = $('<input type="checkbox" id="o" name="o"/>');
|
||||
optionsList.append(osOption);
|
||||
osOption.append(osChkBox);
|
||||
osOption.append('Update the operating system');
|
||||
|
||||
var os = $('<li></li>').hide();
|
||||
var osLabel = $('<label for="os">Operating system:</label>');
|
||||
var osInput = $('<input type="text" name="os" title="You must give the operating system to upgrade to, e.g. rhel5.5"/>');
|
||||
osInput.one('focus', function(){
|
||||
var tmp = $.cookie('osvers');
|
||||
if (tmp) {
|
||||
// Turn on auto complete
|
||||
$(this).autocomplete({
|
||||
source: tmp.split(',')
|
||||
});
|
||||
}
|
||||
});
|
||||
os.append(osLabel);
|
||||
os.append(osInput);
|
||||
optionsList.append(os);
|
||||
|
||||
// Show alternate source directory when checked
|
||||
osChkBox.bind('click', function(event) {
|
||||
if ($(this).is(':checked')) {
|
||||
os.show();
|
||||
} else {
|
||||
os.hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Generate tooltips
|
||||
updatenodeForm.find('div input[title]').tooltip({
|
||||
position: "center right",
|
||||
offset: [-2, 10],
|
||||
effect: "fade",
|
||||
opacity: 0.7,
|
||||
predelay: 800,
|
||||
events : {
|
||||
def : "mouseover,mouseout",
|
||||
input : "mouseover,mouseout",
|
||||
widget : "focus mouseover,blur mouseout",
|
||||
tooltip : "mouseover,mouseout"
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Ok
|
||||
*/
|
||||
var okBtn = createButton('Ok');
|
||||
okBtn.bind('click', function(event) {
|
||||
// Remove any warning messages
|
||||
$(this).parent().parent().find('.ui-state-error').remove();
|
||||
var ready = true;
|
||||
|
||||
// Generate arguments
|
||||
var chkBoxes = $("#" + newTabId + " input[type='checkbox']:checked");
|
||||
var optionsStr = '';
|
||||
var option;
|
||||
for ( var i = 0; i < chkBoxes.length; i++) {
|
||||
option = chkBoxes.eq(i).attr('name');
|
||||
optionsStr += '-' + option;
|
||||
|
||||
// If update all software is checked
|
||||
if (option == 'S') {
|
||||
var srcDir = $('#' + newTabId + ' input[name=allSwSrcDirectory]').val();
|
||||
if (srcDir) {
|
||||
optionsStr += ';-d ' + srcDir;
|
||||
}
|
||||
}
|
||||
// Show source directory when checked
|
||||
updateAllChkBox.bind('click', function(event) {
|
||||
if ($(this).is(':checked')) {
|
||||
allSwScrDirectory.show();
|
||||
} else {
|
||||
allSwScrDirectory.hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Create update software checkbox
|
||||
var updateOption = $('<li></li>');
|
||||
var updateChkBox = $('<input type="checkbox" id="S" name="S"/>');
|
||||
optionsList.append(updateOption);
|
||||
updateOption.append(updateChkBox);
|
||||
updateOption.append('Update existing software');
|
||||
|
||||
// Create source directory input
|
||||
var scrDirectory = $('<li><label for="srcDirectory" style="vertical-align: middle">Source directory:</label><input type="text" id="srcDirectory" name="srcDirectory" title="You must give the source directory containing the updated software packages"/></li>');
|
||||
// Browse server directory and files
|
||||
var srcDirBrowse = createButton('Browse');
|
||||
srcDirBrowse.serverBrowser({
|
||||
onSelect : function(path) {
|
||||
$('#srcDirectory').val(path);
|
||||
},
|
||||
onLoad : function() {
|
||||
return $('#srcDirectory').val();
|
||||
},
|
||||
knownExt : [ 'exe', 'js', 'txt' ],
|
||||
knownPaths : [ {
|
||||
text : 'Install',
|
||||
image : 'desktop.png',
|
||||
path : '/install'
|
||||
} ],
|
||||
imageUrl : 'images/serverbrowser/',
|
||||
systemImageUrl : 'images/serverbrowser/',
|
||||
handlerUrl : 'lib/getpath.php',
|
||||
title : 'Browse',
|
||||
requestMethod : 'POST',
|
||||
width : '500',
|
||||
height : '300',
|
||||
basePath : '/install' // Limit user to only install directory
|
||||
});
|
||||
scrDirectory.append(srcDirBrowse);
|
||||
scrDirectory.hide();
|
||||
optionsList.append(scrDirectory);
|
||||
|
||||
// Create other packages input
|
||||
var otherPkgs = $('<li><label for="otherpkgs" style="vertical-align: middle">otherpkgs:</label><input type="text" id="otherpkgs" name="otherpkgs"/></li>');
|
||||
otherPkgs.hide();
|
||||
optionsList.append(otherPkgs);
|
||||
|
||||
// Create RPM flags input (only AIX)
|
||||
var aixRpmFlags = $('<li><label for="rpm_flags">rpm_flags:</label><input type="text" name="rpm_flags"/></li>');
|
||||
aixRpmFlags.hide();
|
||||
optionsList.append(aixRpmFlags);
|
||||
|
||||
// Create installp flags input (only AIX)
|
||||
var aixInstallPFlags = $('<li><label for="installp_flags">installp_flags:</label><input type="text" name="installp_flags"/></li>');
|
||||
aixInstallPFlags.hide();
|
||||
optionsList.append(aixInstallPFlags);
|
||||
|
||||
// Create emgr flags input (only AIX)
|
||||
var aixEmgrFlags = $('<li><label for="emgr_flags">emgr_flags:</label><input type="text" name="emgr_flags"/></li>');
|
||||
aixEmgrFlags.hide();
|
||||
optionsList.append(aixEmgrFlags);
|
||||
|
||||
// Show flags when checked
|
||||
updateChkBox.bind('click', function(event) {
|
||||
if ($(this).is(':checked')) {
|
||||
scrDirectory.show();
|
||||
otherPkgs.show();
|
||||
if (osHash['AIX']) {
|
||||
aixRpmFlags.show();
|
||||
aixInstallPFlags.show();
|
||||
aixEmgrFlags.show();
|
||||
}
|
||||
} else {
|
||||
scrDirectory.hide();
|
||||
otherPkgs.hide();
|
||||
if (osHash['AIX']) {
|
||||
aixRpmFlags.hide();
|
||||
aixInstallPFlags.hide();
|
||||
aixEmgrFlags.hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Create postscripts input
|
||||
var postOption = $('<li></li>');
|
||||
var postChkBox = $('<input type="checkbox" id="P" name="P"/>');
|
||||
optionsList.append(postOption);
|
||||
postOption.append(postChkBox);
|
||||
postOption.append('Run postscripts');
|
||||
var postscripts = $('<li><label for="postscripts" style="vertical-align: middle">Postscripts:</label><input type="text" id="postscripts" name="postscripts" title="You must give the postscript(s) to run"/></li>');
|
||||
postscripts.hide();
|
||||
optionsList.append(postscripts);
|
||||
|
||||
// Show alternate source directory when checked
|
||||
postChkBox.bind('click', function(event) {
|
||||
if ($(this).is(':checked')) {
|
||||
postscripts.show();
|
||||
} else {
|
||||
postscripts.hide();
|
||||
}
|
||||
});
|
||||
optionsList.append('<li><input type="checkbox" id="F" name="F"/>Distribute and synchronize files</li>');
|
||||
optionsList.append('<li><input type="checkbox" id="k" name="k"/>Update the ssh keys and host keys for the service nodes and compute nodes</li>');
|
||||
|
||||
// Create update OS checkbox
|
||||
if (!osHash['AIX']) {
|
||||
var osOption = $('<li></li>');
|
||||
var osChkBox = $('<input type="checkbox" id="o" name="o"/>');
|
||||
optionsList.append(osOption);
|
||||
osOption.append(osChkBox);
|
||||
osOption.append('Update the operating system');
|
||||
|
||||
var os = $('<li></li>').hide();
|
||||
var osLabel = $('<label for="os">Operating system:</label>');
|
||||
var osInput = $('<input type="text" name="os" title="You must give the operating system to upgrade to, e.g. rhel5.5"/>');
|
||||
osInput.one('focus', function(){
|
||||
var tmp = $.cookie('osvers');
|
||||
if (tmp) {
|
||||
// Turn on auto complete
|
||||
$(this).autocomplete({
|
||||
source: tmp.split(',')
|
||||
});
|
||||
}
|
||||
});
|
||||
os.append(osLabel);
|
||||
os.append(osInput);
|
||||
optionsList.append(os);
|
||||
|
||||
// Show alternate source directory when checked
|
||||
osChkBox.bind('click', function(event) {
|
||||
if ($(this).is(':checked')) {
|
||||
os.show();
|
||||
} else {
|
||||
os.hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Generate tooltips
|
||||
updatenodeForm.find('div input[title]').tooltip({
|
||||
position: "center right",
|
||||
offset: [-2, 10],
|
||||
effect: "fade",
|
||||
opacity: 0.7,
|
||||
predelay: 800,
|
||||
events : {
|
||||
def : "mouseover,mouseout",
|
||||
input : "mouseover,mouseout",
|
||||
widget : "focus mouseover,blur mouseout",
|
||||
tooltip : "mouseover,mouseout"
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Ok
|
||||
*/
|
||||
var okBtn = createButton('Ok');
|
||||
okBtn.bind('click', function(event) {
|
||||
// Remove any warning messages
|
||||
$(this).parent().parent().find('.ui-state-error').remove();
|
||||
var ready = true;
|
||||
|
||||
// Generate arguments
|
||||
var chkBoxes = $("#" + newTabId + " input[type='checkbox']:checked");
|
||||
var optionsStr = '';
|
||||
var option;
|
||||
for ( var i = 0; i < chkBoxes.length; i++) {
|
||||
option = chkBoxes.eq(i).attr('name');
|
||||
optionsStr += '-' + option;
|
||||
|
||||
// If update all software is checked
|
||||
if (option == 'S') {
|
||||
var srcDir = $('#' + newTabId + ' input[name=allSwSrcDirectory]').val();
|
||||
if (srcDir) {
|
||||
optionsStr += ';-d ' + srcDir;
|
||||
}
|
||||
}
|
||||
|
||||
// If update software is checked
|
||||
if (option == 'S') {
|
||||
// Get source directory
|
||||
var srcDirectory = $('#' + newTabId + ' input[name=srcDirectory]').val();
|
||||
if (srcDirectory) {
|
||||
optionsStr += ';-d;' + srcDirectory;
|
||||
}
|
||||
|
||||
// Get otherpkgs
|
||||
var otherpkgs = $('#' + newTabId + ' input[name=otherpkgs]').val();
|
||||
if (otherpkgs) {
|
||||
optionsStr += ';otherpkgs=' + otherpkgs;
|
||||
}
|
||||
|
||||
// Get rpm_flags
|
||||
var rpm_flags = $('#' + newTabId + ' input[name=rpm_flags]').val();
|
||||
if (rpm_flags) {
|
||||
optionsStr += ';rpm_flags=' + rpm_flags;
|
||||
}
|
||||
|
||||
// Get installp_flags
|
||||
var installp_flags = $('#' + newTabId + ' input[name=installp_flags]').val();
|
||||
if (installp_flags) {
|
||||
optionsStr += ';installp_flags=' + installp_flags;
|
||||
}
|
||||
|
||||
// Get emgr_flags
|
||||
var emgr_flags = $('#' + newTabId + ' input[name=emgr_flags]').val();
|
||||
if (emgr_flags) {
|
||||
optionsStr += ';emgr_flags=' + emgr_flags;
|
||||
}
|
||||
}
|
||||
|
||||
// If postscripts is checked
|
||||
if (option == 'P') {
|
||||
// Get postscripts
|
||||
optionsStr += ';' + $('#' + newTabId + ' input[name=postscripts]').val();
|
||||
}
|
||||
|
||||
// If operating system is checked
|
||||
if (option == 'o') {
|
||||
// Get the OS
|
||||
optionsStr += ';' + $('#' + newTabId + ' input[name=os]').val();
|
||||
}
|
||||
|
||||
// Append ; to end of string
|
||||
if (i < (chkBoxes.length - 1)) {
|
||||
optionsStr += ';';
|
||||
}
|
||||
}
|
||||
|
||||
// If no inputs are empty
|
||||
if (ready) {
|
||||
// Get nodes
|
||||
var tgts = $('#' + newTabId + ' input[name=target]').val();
|
||||
// If update software is checked
|
||||
if (option == 'S') {
|
||||
// Get source directory
|
||||
var srcDirectory = $('#' + newTabId + ' input[name=srcDirectory]').val();
|
||||
if (srcDirectory) {
|
||||
optionsStr += ';-d;' + srcDirectory;
|
||||
}
|
||||
|
||||
// Get otherpkgs
|
||||
var otherpkgs = $('#' + newTabId + ' input[name=otherpkgs]').val();
|
||||
if (otherpkgs) {
|
||||
optionsStr += ';otherpkgs=' + otherpkgs;
|
||||
}
|
||||
|
||||
// Get rpm_flags
|
||||
var rpm_flags = $('#' + newTabId + ' input[name=rpm_flags]').val();
|
||||
if (rpm_flags) {
|
||||
optionsStr += ';rpm_flags=' + rpm_flags;
|
||||
}
|
||||
|
||||
// Get installp_flags
|
||||
var installp_flags = $('#' + newTabId + ' input[name=installp_flags]').val();
|
||||
if (installp_flags) {
|
||||
optionsStr += ';installp_flags=' + installp_flags;
|
||||
}
|
||||
|
||||
// Get emgr_flags
|
||||
var emgr_flags = $('#' + newTabId + ' input[name=emgr_flags]').val();
|
||||
if (emgr_flags) {
|
||||
optionsStr += ';emgr_flags=' + emgr_flags;
|
||||
}
|
||||
}
|
||||
|
||||
// If postscripts is checked
|
||||
if (option == 'P') {
|
||||
// Get postscripts
|
||||
optionsStr += ';' + $('#' + newTabId + ' input[name=postscripts]').val();
|
||||
}
|
||||
|
||||
// If operating system is checked
|
||||
if (option == 'o') {
|
||||
// Get the OS
|
||||
optionsStr += ';' + $('#' + newTabId + ' input[name=os]').val();
|
||||
}
|
||||
|
||||
// Append ; to end of string
|
||||
if (i < (chkBoxes.length - 1)) {
|
||||
optionsStr += ';';
|
||||
}
|
||||
}
|
||||
|
||||
// If no inputs are empty
|
||||
if (ready) {
|
||||
// Get nodes
|
||||
var tgts = $('#' + newTabId + ' input[name=target]').val();
|
||||
|
||||
// Disable all inputs and Ok button
|
||||
$('#' + newTabId + ' input').attr('disabled', 'disabled');
|
||||
$(this).attr('disabled', 'true');
|
||||
|
||||
/**
|
||||
* (1) Boot to network
|
||||
*/
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'updatenode',
|
||||
tgt : tgts,
|
||||
args : optionsStr,
|
||||
msg : 'out=' + statBarId + ';cmd=updatenode;tgt=' + tgts
|
||||
},
|
||||
// Disable all inputs and Ok button
|
||||
$('#' + newTabId + ' input').attr('disabled', 'disabled');
|
||||
$(this).attr('disabled', 'true');
|
||||
|
||||
/**
|
||||
* (1) Boot to network
|
||||
*/
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'updatenode',
|
||||
tgt : tgts,
|
||||
args : optionsStr,
|
||||
msg : 'out=' + statBarId + ';cmd=updatenode;tgt=' + tgts
|
||||
},
|
||||
|
||||
success : updateStatusBar
|
||||
});
|
||||
success : updateStatusBar
|
||||
});
|
||||
|
||||
// Show status bar
|
||||
statusBar.show();
|
||||
} else {
|
||||
// Show warning message
|
||||
var warn = createWarnBar('You are missing some values');
|
||||
warn.prependTo($(this).parent().parent());
|
||||
}
|
||||
});
|
||||
updatenodeForm.append(okBtn);
|
||||
// Show status bar
|
||||
statusBar.show();
|
||||
} else {
|
||||
// Show warning message
|
||||
var warn = createWarnBar('You are missing some values');
|
||||
warn.prependTo($(this).parent().parent());
|
||||
}
|
||||
});
|
||||
updatenodeForm.append(okBtn);
|
||||
|
||||
// Append to discover tab
|
||||
tab.add(newTabId, 'Update', updatenodeForm, true);
|
||||
// Append to discover tab
|
||||
tab.add(newTabId, 'Update', updatenodeForm, true);
|
||||
|
||||
// Select new tab
|
||||
tab.select(newTabId);
|
||||
// Select new tab
|
||||
tab.select(newTabId);
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -6,12 +6,10 @@ var provisionTabs; // Provision tabs
|
||||
/**
|
||||
* Set the provision tab
|
||||
*
|
||||
* @param obj
|
||||
* Tab object
|
||||
* @return Nothing
|
||||
* @param obj Tab object
|
||||
*/
|
||||
function setProvisionTab(obj) {
|
||||
provisionTabs = obj;
|
||||
provisionTabs = obj;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -21,157 +19,155 @@ function setProvisionTab(obj) {
|
||||
* @return Tab object
|
||||
*/
|
||||
function getProvisionTab() {
|
||||
return provisionTabs;
|
||||
return provisionTabs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load provision page
|
||||
*
|
||||
* @return Nothing
|
||||
*/
|
||||
function loadProvisionPage() {
|
||||
// If the page is loaded
|
||||
if ($('#content').children().length) {
|
||||
// Do not load again
|
||||
return;
|
||||
}
|
||||
// If the page is loaded
|
||||
if ($('#content').children().length) {
|
||||
// Do not load again
|
||||
return;
|
||||
}
|
||||
|
||||
// Get OS image names
|
||||
if (!$.cookie('imagenames')){
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'tabdump',
|
||||
tgt : '',
|
||||
args : 'osimage',
|
||||
msg : ''
|
||||
},
|
||||
// Get OS image names
|
||||
if (!$.cookie('imagenames')){
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'tabdump',
|
||||
tgt : '',
|
||||
args : 'osimage',
|
||||
msg : ''
|
||||
},
|
||||
|
||||
success : setOSImageCookies
|
||||
});
|
||||
}
|
||||
success : setOSImageCookies
|
||||
});
|
||||
}
|
||||
|
||||
// Get groups
|
||||
if (!$.cookie('groups')){
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'extnoderange',
|
||||
tgt : '/.*',
|
||||
args : 'subgroups',
|
||||
msg : ''
|
||||
},
|
||||
// Get groups
|
||||
if (!$.cookie('groups')){
|
||||
$.ajax( {
|
||||
url : 'lib/cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'extnoderange',
|
||||
tgt : '/.*',
|
||||
args : 'subgroups',
|
||||
msg : ''
|
||||
},
|
||||
|
||||
success : setGroupsCookies
|
||||
});
|
||||
}
|
||||
|
||||
// Create info bar
|
||||
var infoBar = createInfoBar('Select a platform to provision or re-provision a node on, then click Ok.');
|
||||
|
||||
// Create provision page
|
||||
var provPg = $('<div class="form"></div>');
|
||||
provPg.append(infoBar);
|
||||
success : setGroupsCookies
|
||||
});
|
||||
}
|
||||
|
||||
// Create info bar
|
||||
var infoBar = createInfoBar('Select a platform to provision or re-provision a node on, then click Ok.');
|
||||
|
||||
// Create provision page
|
||||
var provPg = $('<div class="form"></div>');
|
||||
provPg.append(infoBar);
|
||||
|
||||
// Create provision tab
|
||||
var tab = new Tab('provisionPageTabs');
|
||||
setProvisionTab(tab);
|
||||
tab.init();
|
||||
$('#content').append(tab.object());
|
||||
// Create provision tab
|
||||
var tab = new Tab('provisionPageTabs');
|
||||
setProvisionTab(tab);
|
||||
tab.init();
|
||||
$('#content').append(tab.object());
|
||||
|
||||
// Create radio buttons for platforms
|
||||
var hwList = $('<ol>Platforms available:</ol>');
|
||||
var esx = $('<li><input type="radio" name="hw" value="esx" checked/>ESX</li>');
|
||||
var kvm = $('<li><input type="radio" name="hw" value="kvm"/>KVM</li>');
|
||||
var zvm = $('<li><input type="radio" name="hw" value="zvm"/>z\/VM</li>');
|
||||
var ipmi = $('<li><input type="radio" name="hw" value="ipmi"/>iDataPlex</li>');
|
||||
var blade = $('<li><input type="radio" name="hw" value="blade"/>BladeCenter</li>');
|
||||
var hmc = $('<li><input type="radio" name="hw" value="hmc"/>System p</li>');
|
||||
|
||||
hwList.append(esx);
|
||||
hwList.append(kvm);
|
||||
hwList.append(zvm);
|
||||
hwList.append(blade);
|
||||
hwList.append(ipmi);
|
||||
hwList.append(hmc);
|
||||
provPg.append(hwList);
|
||||
// Create radio buttons for platforms
|
||||
var hwList = $('<ol>Platforms available:</ol>');
|
||||
var esx = $('<li><input type="radio" name="hw" value="esx" checked/>ESX</li>');
|
||||
var kvm = $('<li><input type="radio" name="hw" value="kvm"/>KVM</li>');
|
||||
var zvm = $('<li><input type="radio" name="hw" value="zvm"/>z\/VM</li>');
|
||||
var ipmi = $('<li><input type="radio" name="hw" value="ipmi"/>iDataPlex</li>');
|
||||
var blade = $('<li><input type="radio" name="hw" value="blade"/>BladeCenter</li>');
|
||||
var hmc = $('<li><input type="radio" name="hw" value="hmc"/>System p</li>');
|
||||
|
||||
hwList.append(esx);
|
||||
hwList.append(kvm);
|
||||
hwList.append(zvm);
|
||||
hwList.append(blade);
|
||||
hwList.append(ipmi);
|
||||
hwList.append(hmc);
|
||||
provPg.append(hwList);
|
||||
|
||||
/**
|
||||
* Ok
|
||||
*/
|
||||
var okBtn = createButton('Ok');
|
||||
okBtn.bind('click', function(event) {
|
||||
// Get hardware that was selected
|
||||
var hw = $(this).parent().find('input[name="hw"]:checked').val();
|
||||
|
||||
var inst = 0;
|
||||
var newTabId = hw + 'ProvisionTab' + inst;
|
||||
while ($('#' + newTabId).length) {
|
||||
// If one already exists, generate another one
|
||||
inst = inst + 1;
|
||||
newTabId = hw + 'ProvisionTab' + inst;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ok
|
||||
*/
|
||||
var okBtn = createButton('Ok');
|
||||
okBtn.bind('click', function(event) {
|
||||
// Get hardware that was selected
|
||||
var hw = $(this).parent().find('input[name="hw"]:checked').val();
|
||||
|
||||
var inst = 0;
|
||||
var newTabId = hw + 'ProvisionTab' + inst;
|
||||
while ($('#' + newTabId).length) {
|
||||
// If one already exists, generate another one
|
||||
inst = inst + 1;
|
||||
newTabId = hw + 'ProvisionTab' + inst;
|
||||
}
|
||||
|
||||
// Create an instance of the plugin
|
||||
var title = '';
|
||||
var title = '';
|
||||
var plugin;
|
||||
switch (hw) {
|
||||
case "kvm":
|
||||
plugin = new kvmPlugin();
|
||||
title = 'KVM';
|
||||
break;
|
||||
case "esx":
|
||||
plugin = new esxPlugin();
|
||||
title = 'ESX';
|
||||
break;
|
||||
case "blade":
|
||||
plugin = new bladePlugin();
|
||||
title = 'BladeCenter';
|
||||
break;
|
||||
case "hmc":
|
||||
plugin = new hmcPlugin();
|
||||
title = 'System p';
|
||||
break;
|
||||
case "ipmi":
|
||||
plugin = new ipmiPlugin();
|
||||
title = 'iDataPlex';
|
||||
break;
|
||||
case "zvm":
|
||||
plugin = new zvmPlugin();
|
||||
title = 'z/VM';
|
||||
break;
|
||||
case "kvm":
|
||||
plugin = new kvmPlugin();
|
||||
title = 'KVM';
|
||||
break;
|
||||
case "esx":
|
||||
plugin = new esxPlugin();
|
||||
title = 'ESX';
|
||||
break;
|
||||
case "blade":
|
||||
plugin = new bladePlugin();
|
||||
title = 'BladeCenter';
|
||||
break;
|
||||
case "hmc":
|
||||
plugin = new hmcPlugin();
|
||||
title = 'System p';
|
||||
break;
|
||||
case "ipmi":
|
||||
plugin = new ipmiPlugin();
|
||||
title = 'iDataPlex';
|
||||
break;
|
||||
case "zvm":
|
||||
plugin = new zvmPlugin();
|
||||
title = 'z/VM';
|
||||
break;
|
||||
}
|
||||
|
||||
// Select tab
|
||||
tab.add(newTabId, title, '', true);
|
||||
tab.select(newTabId);
|
||||
plugin.loadProvisionPage(newTabId);
|
||||
});
|
||||
provPg.append(okBtn);
|
||||
});
|
||||
provPg.append(okBtn);
|
||||
|
||||
// Add provision tab
|
||||
tab.add('provisionTab', 'Provision', provPg, false);
|
||||
// Add image tab
|
||||
tab.add('imagesTab', 'Images', '', false);
|
||||
|
||||
// Load tabs onselect
|
||||
$('#provisionPageTabs').bind('tabsselect', function(event, ui){
|
||||
// Load image page
|
||||
if (!$('#imagesTab').children().length && ui.index == 1) {
|
||||
$('#imagesTab').append($('<center></center>').append(createLoader('')));
|
||||
loadImagesPage();
|
||||
}
|
||||
});
|
||||
|
||||
// Open the quick provision tab
|
||||
if (window.location.search) {
|
||||
tab.add('quickProvisionTab', 'Quick Provision', '', true);
|
||||
tab.select('quickProvisionTab');
|
||||
|
||||
var provForm = $('<div class="form"></div>');
|
||||
$('#quickProvisionTab').append(provForm);
|
||||
appendProvisionSection('quick', provForm);
|
||||
}
|
||||
// Add provision tab
|
||||
tab.add('provisionTab', 'Provision', provPg, false);
|
||||
// Add image tab
|
||||
tab.add('imagesTab', 'Images', '', false);
|
||||
|
||||
// Load tabs onselect
|
||||
$('#provisionPageTabs').bind('tabsselect', function(event, ui){
|
||||
// Load image page
|
||||
if (!$('#imagesTab').children().length && ui.index == 1) {
|
||||
$('#imagesTab').append($('<center></center>').append(createLoader('')));
|
||||
loadImagesPage();
|
||||
}
|
||||
});
|
||||
|
||||
// Open the quick provision tab
|
||||
if (window.location.search) {
|
||||
tab.add('quickProvisionTab', 'Quick Provision', '', true);
|
||||
tab.select('quickProvisionTab');
|
||||
|
||||
var provForm = $('<div class="form"></div>');
|
||||
$('#quickProvisionTab').append(provForm);
|
||||
appendProvisionSection('quick', provForm);
|
||||
}
|
||||
}
|
@ -1,288 +1,288 @@
|
||||
rconsTerm = function(nodeName, height, width) {
|
||||
var sid = nodeName;
|
||||
var keyBuf = [];
|
||||
var receivingFlag = false;
|
||||
var sendTimeout = "";
|
||||
var errorTimeout = "";
|
||||
var queryStable = 's=' + sid + '&w=' + height + '&h=' + width + '&c=1&k=';
|
||||
var maxDelay = 200;
|
||||
var firstFlag = true;
|
||||
var sid = nodeName;
|
||||
var keyBuf = [];
|
||||
var receivingFlag = false;
|
||||
var sendTimeout = "";
|
||||
var errorTimeout = "";
|
||||
var queryStable = 's=' + sid + '&w=' + height + '&h=' + width + '&c=1&k=';
|
||||
var maxDelay = 200;
|
||||
var firstFlag = true;
|
||||
|
||||
var workingStatus = "";
|
||||
var termArea = "";
|
||||
var errorArea = "";
|
||||
var workingStatus = "";
|
||||
var termArea = "";
|
||||
var errorArea = "";
|
||||
|
||||
var ie = 0;
|
||||
if (window.ActiveXObject) {
|
||||
ie = 1;
|
||||
}
|
||||
var ie = 0;
|
||||
if (window.ActiveXObject) {
|
||||
ie = 1;
|
||||
}
|
||||
|
||||
rconsInit();
|
||||
// init
|
||||
function rconsInit() {
|
||||
// create status, configure the css
|
||||
workingStatus = $('<span>.</span>');
|
||||
workingStatus.attr('class', 'off');
|
||||
rconsInit();
|
||||
// init
|
||||
function rconsInit() {
|
||||
// Create status, configure the css
|
||||
workingStatus = $('<span>.</span>');
|
||||
workingStatus.attr('class', 'off');
|
||||
|
||||
// create the disconnect button
|
||||
var disconnectButton = $('<a class="off">Disconnect</a>');
|
||||
disconnectButton.bind('click', function() {
|
||||
window.close();
|
||||
});
|
||||
// Create the disconnect button
|
||||
var disconnectButton = $('<a class="off">Disconnect</a>');
|
||||
disconnectButton.bind('click', function() {
|
||||
window.close();
|
||||
});
|
||||
|
||||
// create the control panel, add to the rcons div
|
||||
var controlPanel = $('<pre class="stat"></pre>');
|
||||
$('#term').append(controlPanel);
|
||||
// Create the control panel, add to the rcons div
|
||||
var controlPanel = $('<pre class="stat"></pre>');
|
||||
$('#term').append(controlPanel);
|
||||
|
||||
// create the error erea
|
||||
errorArea = $('<span></span>');
|
||||
// Create the error erea
|
||||
errorArea = $('<span></span>');
|
||||
|
||||
// add all item to controlPanel
|
||||
controlPanel.append(workingStatus);
|
||||
controlPanel.append(disconnectButton);
|
||||
controlPanel.append(errorArea);
|
||||
// Add all item to control panel
|
||||
controlPanel.append(workingStatus);
|
||||
controlPanel.append(disconnectButton);
|
||||
controlPanel.append(errorArea);
|
||||
|
||||
// create the termArea
|
||||
termArea = $('<div></div>');
|
||||
$('#term').append(termArea);
|
||||
// Create the termArea
|
||||
termArea = $('<div></div>');
|
||||
$('#term').append(termArea);
|
||||
|
||||
// bind keypress event
|
||||
document.onkeypress = rconsKeypress;
|
||||
document.onkeydown = rconsKeydown;
|
||||
window.onbeforeunload = function() {
|
||||
rconsDisconnect();
|
||||
alert("Closing remote console");
|
||||
};
|
||||
// Bind keypress event
|
||||
document.onkeypress = rconsKeypress;
|
||||
document.onkeydown = rconsKeydown;
|
||||
window.onbeforeunload = function() {
|
||||
rconsDisconnect();
|
||||
alert("Closing remote console");
|
||||
};
|
||||
|
||||
rconsSend();
|
||||
}
|
||||
rconsSend();
|
||||
}
|
||||
|
||||
// close the connection
|
||||
function rconsDisconnect() {
|
||||
window.clearTimeout(sendTimeout);
|
||||
window.clearTimeout(errorTimeout);
|
||||
// Close the connection
|
||||
function rconsDisconnect() {
|
||||
window.clearTimeout(sendTimeout);
|
||||
window.clearTimeout(errorTimeout);
|
||||
|
||||
$.ajax({
|
||||
type : "POST",
|
||||
url : "lib/rcons.php",
|
||||
data : queryStable + '&q=1',
|
||||
dataType : 'json'
|
||||
});
|
||||
}
|
||||
$.ajax({
|
||||
type : "POST",
|
||||
url : "lib/rcons.php",
|
||||
data : queryStable + '&q=1',
|
||||
dataType : 'json'
|
||||
});
|
||||
}
|
||||
|
||||
// translate the key press
|
||||
function rconsKeypress(event) {
|
||||
if (!event)
|
||||
var event = window.event;
|
||||
var kc = "";
|
||||
var k = "";
|
||||
if (event.keyCode)
|
||||
kc = event.keyCode;
|
||||
if (event.which)
|
||||
kc = event.which;
|
||||
if (event.altKey) {
|
||||
if (kc >= 65 && kc <= 90)
|
||||
kc += 32;
|
||||
if (kc >= 97 && kc <= 122) {
|
||||
k = String.fromCharCode(27) + String.fromCharCode(kc);
|
||||
}
|
||||
} else if (event.ctrlKey) {
|
||||
if (kc >= 65 && kc <= 90)
|
||||
k = String.fromCharCode(kc - 64); // Ctrl-A..Z
|
||||
else if (kc >= 97 && kc <= 122)
|
||||
k = String.fromCharCode(kc - 96); // Ctrl-A..Z
|
||||
else if (kc == 54)
|
||||
k = String.fromCharCode(30); // Ctrl-^
|
||||
else if (kc == 109)
|
||||
k = String.fromCharCode(31); // Ctrl-_
|
||||
else if (kc == 219)
|
||||
k = String.fromCharCode(27); // Ctrl-[
|
||||
else if (kc == 220)
|
||||
k = String.fromCharCode(28); // Ctrl-\
|
||||
else if (kc == 221)
|
||||
k = String.fromCharCode(29); // Ctrl-]
|
||||
else if (kc == 219)
|
||||
k = String.fromCharCode(29); // Ctrl-]
|
||||
else if (kc == 219)
|
||||
k = String.fromCharCode(0); // Ctrl-@
|
||||
} else if (event.which == 0) {
|
||||
if (kc == 9)
|
||||
k = String.fromCharCode(9); // Tab
|
||||
else if (kc == 8)
|
||||
k = String.fromCharCode(127); // Backspace
|
||||
else if (kc == 27)
|
||||
k = String.fromCharCode(27); // Escape
|
||||
else {
|
||||
if (kc == 33)
|
||||
k = "[5~"; // PgUp
|
||||
else if (kc == 34)
|
||||
k = "[6~"; // PgDn
|
||||
else if (kc == 35)
|
||||
k = "[4~"; // End
|
||||
else if (kc == 36)
|
||||
k = "[1~"; // Home
|
||||
else if (kc == 37)
|
||||
k = "[D"; // Left
|
||||
else if (kc == 38)
|
||||
k = "[A"; // Up
|
||||
else if (kc == 39)
|
||||
k = "[C"; // Right
|
||||
else if (kc == 40)
|
||||
k = "[B"; // Down
|
||||
else if (kc == 45)
|
||||
k = "[2~"; // Ins
|
||||
else if (kc == 46)
|
||||
k = "[3~"; // Del
|
||||
else if (kc == 112)
|
||||
k = "[[A"; // F1
|
||||
else if (kc == 113)
|
||||
k = "[[B"; // F2
|
||||
else if (kc == 114)
|
||||
k = "[[C"; // F3
|
||||
else if (kc == 115)
|
||||
k = "[[D"; // F4
|
||||
else if (kc == 116)
|
||||
k = "[[E"; // F5
|
||||
else if (kc == 117)
|
||||
k = "[17~"; // F6
|
||||
else if (kc == 118)
|
||||
k = "[18~"; // F7
|
||||
else if (kc == 119)
|
||||
k = "[19~"; // F8
|
||||
else if (kc == 120)
|
||||
k = "[20~"; // F9
|
||||
else if (kc == 121)
|
||||
k = "[21~"; // F10
|
||||
else if (kc == 122)
|
||||
k = "[23~"; // F11
|
||||
else if (kc == 123)
|
||||
k = "[24~"; // F12
|
||||
if (k.length) {
|
||||
k = String.fromCharCode(27) + k;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (kc == 8)
|
||||
k = String.fromCharCode(127); // Backspace
|
||||
else
|
||||
k = String.fromCharCode(kc);
|
||||
}
|
||||
if (k.length) {
|
||||
if (k == "+") {
|
||||
rconsQueue("%2B");
|
||||
} else {
|
||||
rconsQueue(escape(k));
|
||||
}
|
||||
}
|
||||
event.cancelBubble = true;
|
||||
if (event.stopPropagation)
|
||||
event.stopPropagation();
|
||||
if (event.preventDefault)
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}
|
||||
// Translate the key press
|
||||
function rconsKeypress(event) {
|
||||
if (!event)
|
||||
var event = window.event;
|
||||
var kc = "";
|
||||
var k = "";
|
||||
if (event.keyCode)
|
||||
kc = event.keyCode;
|
||||
if (event.which)
|
||||
kc = event.which;
|
||||
if (event.altKey) {
|
||||
if (kc >= 65 && kc <= 90)
|
||||
kc += 32;
|
||||
if (kc >= 97 && kc <= 122) {
|
||||
k = String.fromCharCode(27) + String.fromCharCode(kc);
|
||||
}
|
||||
} else if (event.ctrlKey) {
|
||||
if (kc >= 65 && kc <= 90)
|
||||
k = String.fromCharCode(kc - 64); // Ctrl-A..Z
|
||||
else if (kc >= 97 && kc <= 122)
|
||||
k = String.fromCharCode(kc - 96); // Ctrl-A..Z
|
||||
else if (kc == 54)
|
||||
k = String.fromCharCode(30); // Ctrl-^
|
||||
else if (kc == 109)
|
||||
k = String.fromCharCode(31); // Ctrl-_
|
||||
else if (kc == 219)
|
||||
k = String.fromCharCode(27); // Ctrl-[
|
||||
else if (kc == 220)
|
||||
k = String.fromCharCode(28); // Ctrl-\
|
||||
else if (kc == 221)
|
||||
k = String.fromCharCode(29); // Ctrl-]
|
||||
else if (kc == 219)
|
||||
k = String.fromCharCode(29); // Ctrl-]
|
||||
else if (kc == 219)
|
||||
k = String.fromCharCode(0); // Ctrl-@
|
||||
} else if (event.which == 0) {
|
||||
if (kc == 9)
|
||||
k = String.fromCharCode(9); // Tab
|
||||
else if (kc == 8)
|
||||
k = String.fromCharCode(127); // Backspace
|
||||
else if (kc == 27)
|
||||
k = String.fromCharCode(27); // Escape
|
||||
else {
|
||||
if (kc == 33)
|
||||
k = "[5~"; // PgUp
|
||||
else if (kc == 34)
|
||||
k = "[6~"; // PgDn
|
||||
else if (kc == 35)
|
||||
k = "[4~"; // End
|
||||
else if (kc == 36)
|
||||
k = "[1~"; // Home
|
||||
else if (kc == 37)
|
||||
k = "[D"; // Left
|
||||
else if (kc == 38)
|
||||
k = "[A"; // Up
|
||||
else if (kc == 39)
|
||||
k = "[C"; // Right
|
||||
else if (kc == 40)
|
||||
k = "[B"; // Down
|
||||
else if (kc == 45)
|
||||
k = "[2~"; // Ins
|
||||
else if (kc == 46)
|
||||
k = "[3~"; // Del
|
||||
else if (kc == 112)
|
||||
k = "[[A"; // F1
|
||||
else if (kc == 113)
|
||||
k = "[[B"; // F2
|
||||
else if (kc == 114)
|
||||
k = "[[C"; // F3
|
||||
else if (kc == 115)
|
||||
k = "[[D"; // F4
|
||||
else if (kc == 116)
|
||||
k = "[[E"; // F5
|
||||
else if (kc == 117)
|
||||
k = "[17~"; // F6
|
||||
else if (kc == 118)
|
||||
k = "[18~"; // F7
|
||||
else if (kc == 119)
|
||||
k = "[19~"; // F8
|
||||
else if (kc == 120)
|
||||
k = "[20~"; // F9
|
||||
else if (kc == 121)
|
||||
k = "[21~"; // F10
|
||||
else if (kc == 122)
|
||||
k = "[23~"; // F11
|
||||
else if (kc == 123)
|
||||
k = "[24~"; // F12
|
||||
if (k.length) {
|
||||
k = String.fromCharCode(27) + k;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (kc == 8)
|
||||
k = String.fromCharCode(127); // Backspace
|
||||
else
|
||||
k = String.fromCharCode(kc);
|
||||
}
|
||||
if (k.length) {
|
||||
if (k == "+") {
|
||||
rconsQueue("%2B");
|
||||
} else {
|
||||
rconsQueue(escape(k));
|
||||
}
|
||||
}
|
||||
event.cancelBubble = true;
|
||||
if (event.stopPropagation)
|
||||
event.stopPropagation();
|
||||
if (event.preventDefault)
|
||||
event.preventDefault();
|
||||
return false;
|
||||
}
|
||||
|
||||
// translate the key press, same with rconsKeypress
|
||||
function rconsKeydown(event) {
|
||||
if (!event)
|
||||
var event = window.event;
|
||||
if (ie) {
|
||||
o = {
|
||||
9 : 1,
|
||||
8 : 1,
|
||||
27 : 1,
|
||||
33 : 1,
|
||||
34 : 1,
|
||||
35 : 1,
|
||||
36 : 1,
|
||||
37 : 1,
|
||||
38 : 1,
|
||||
39 : 1,
|
||||
40 : 1,
|
||||
45 : 1,
|
||||
46 : 1,
|
||||
112 : 1,
|
||||
113 : 1,
|
||||
114 : 1,
|
||||
115 : 1,
|
||||
116 : 1,
|
||||
117 : 1,
|
||||
118 : 1,
|
||||
119 : 1,
|
||||
120 : 1,
|
||||
121 : 1,
|
||||
122 : 1,
|
||||
123 : 1
|
||||
};
|
||||
if (o[event.keyCode] || event.ctrlKey || event.altKey) {
|
||||
event.which = 0;
|
||||
return keypress(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Translate the key press, same with rconsKeypress
|
||||
function rconsKeydown(event) {
|
||||
if (!event)
|
||||
var event = window.event;
|
||||
if (ie) {
|
||||
o = {
|
||||
9 : 1,
|
||||
8 : 1,
|
||||
27 : 1,
|
||||
33 : 1,
|
||||
34 : 1,
|
||||
35 : 1,
|
||||
36 : 1,
|
||||
37 : 1,
|
||||
38 : 1,
|
||||
39 : 1,
|
||||
40 : 1,
|
||||
45 : 1,
|
||||
46 : 1,
|
||||
112 : 1,
|
||||
113 : 1,
|
||||
114 : 1,
|
||||
115 : 1,
|
||||
116 : 1,
|
||||
117 : 1,
|
||||
118 : 1,
|
||||
119 : 1,
|
||||
120 : 1,
|
||||
121 : 1,
|
||||
122 : 1,
|
||||
123 : 1
|
||||
};
|
||||
if (o[event.keyCode] || event.ctrlKey || event.altKey) {
|
||||
event.which = 0;
|
||||
return keypress(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// send the command and request to server
|
||||
function rconsSend() {
|
||||
var keyPressList = '';
|
||||
var requireString = '';
|
||||
if (receivingFlag) {
|
||||
return;
|
||||
}
|
||||
// Send the command and request to server
|
||||
function rconsSend() {
|
||||
var keyPressList = '';
|
||||
var requireString = '';
|
||||
if (receivingFlag) {
|
||||
return;
|
||||
}
|
||||
|
||||
receivingFlag = true;
|
||||
workingStatus.attr('class', 'on');
|
||||
receivingFlag = true;
|
||||
workingStatus.attr('class', 'on');
|
||||
|
||||
while (keyBuf.length > 0) {
|
||||
keyPressList += keyBuf.pop();
|
||||
}
|
||||
while (keyBuf.length > 0) {
|
||||
keyPressList += keyBuf.pop();
|
||||
}
|
||||
|
||||
if (firstFlag) {
|
||||
requireString = queryStable + keyPressList + '&f=1';
|
||||
firstFlag = false;
|
||||
} else {
|
||||
requireString = queryStable + keyPressList;
|
||||
}
|
||||
if (firstFlag) {
|
||||
requireString = queryStable + keyPressList + '&f=1';
|
||||
firstFlag = false;
|
||||
} else {
|
||||
requireString = queryStable + keyPressList;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type : "POST",
|
||||
url : "lib/rcons.php",
|
||||
data : requireString,
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
rconsUpdate(data);
|
||||
}
|
||||
});
|
||||
$.ajax({
|
||||
type : "POST",
|
||||
url : "lib/rcons.php",
|
||||
data : requireString,
|
||||
dataType : 'json',
|
||||
success : function(data) {
|
||||
rconsUpdate(data);
|
||||
}
|
||||
});
|
||||
|
||||
errorTimeout = window.setTimeout(rconsSendError, 15000);
|
||||
errorTimeout = window.setTimeout(rconsSendError, 15000);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// when receive the response, update the term area
|
||||
function rconsUpdate(data) {
|
||||
window.clearTimeout(errorTimeout);
|
||||
errorArea.empty();
|
||||
if (data.term) {
|
||||
termArea.empty().append(data.term);
|
||||
maxDelay = 200;
|
||||
} else {
|
||||
maxDelay = 2000;
|
||||
}
|
||||
// When response received, update the term area
|
||||
function rconsUpdate(data) {
|
||||
window.clearTimeout(errorTimeout);
|
||||
errorArea.empty();
|
||||
if (data.term) {
|
||||
termArea.empty().append(data.term);
|
||||
maxDelay = 200;
|
||||
} else {
|
||||
maxDelay = 2000;
|
||||
}
|
||||
|
||||
receivingFlag = false;
|
||||
workingStatus.attr('class', 'off');
|
||||
sendTimeout = window.setTimeout(rconsSend, maxDelay);
|
||||
}
|
||||
receivingFlag = false;
|
||||
workingStatus.attr('class', 'off');
|
||||
sendTimeout = window.setTimeout(rconsSend, maxDelay);
|
||||
}
|
||||
|
||||
function rconsSendError() {
|
||||
workingStatus.attr('class', 'off');
|
||||
errorArea.empty().append('Send require error.');
|
||||
}
|
||||
function rconsSendError() {
|
||||
workingStatus.attr('class', 'off');
|
||||
errorArea.empty().append('Send require error.');
|
||||
}
|
||||
|
||||
function rconsQueue(kc) {
|
||||
keyBuf.unshift(kc);
|
||||
if (false == receivingFlag) {
|
||||
window.clearTimeout(sendTimeout);
|
||||
sendTimeout = window.setTimeout(rconsSend, 1);
|
||||
}
|
||||
}
|
||||
function rconsQueue(kc) {
|
||||
keyBuf.unshift(kc);
|
||||
if (false == receivingFlag) {
|
||||
window.clearTimeout(sendTimeout);
|
||||
sendTimeout = window.setTimeout(rconsSend, 1);
|
||||
}
|
||||
}
|
||||
};
|
File diff suppressed because it is too large
Load Diff
@ -6,355 +6,340 @@
|
||||
* @return String of nodes shown
|
||||
*/
|
||||
function getNodesShown(tableId) {
|
||||
// String of nodes shown
|
||||
var shownNodes = '';
|
||||
|
||||
// Get rows of shown nodes
|
||||
var nodes = $('#' + tableId + ' tbody tr');
|
||||
|
||||
// Go through each row
|
||||
var cols;
|
||||
for (var i = 0; i < nodes.length; i++) {
|
||||
// Get second column containing node name
|
||||
cols = nodes.eq(i).find('td');
|
||||
shownNodes += cols.eq(1).text() + ',';
|
||||
}
|
||||
|
||||
// Remove last comma
|
||||
shownNodes = shownNodes.substring(0, shownNodes.length-1);
|
||||
return shownNodes;
|
||||
// String of nodes shown
|
||||
var shownNodes = '';
|
||||
|
||||
// Get rows of shown nodes
|
||||
var nodes = $('#' + tableId + ' tbody tr');
|
||||
|
||||
// Go through each row
|
||||
var cols;
|
||||
for (var i = 0; i < nodes.length; i++) {
|
||||
// Get second column containing node name
|
||||
cols = nodes.eq(i).find('td');
|
||||
shownNodes += cols.eq(1).text() + ',';
|
||||
}
|
||||
|
||||
// Remove last comma
|
||||
shownNodes = shownNodes.substring(0, shownNodes.length-1);
|
||||
return shownNodes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the row index containing a column with a given string
|
||||
*
|
||||
* @param str
|
||||
* String to search for
|
||||
* @param table
|
||||
* Table to check
|
||||
* @param col
|
||||
* Column to find string under
|
||||
* @param str String to search for
|
||||
* @param table Table to check
|
||||
* @param col Column to find string under
|
||||
* @return The row index containing the search string
|
||||
*/
|
||||
function findRow(str, table, col){
|
||||
var dTable, rows;
|
||||
|
||||
// Get datatable
|
||||
dTable = $(table).dataTable();
|
||||
rows = dTable.fnGetData();
|
||||
|
||||
// Loop through each row
|
||||
for (var i in rows) {
|
||||
// If the column contains the search string
|
||||
if (rows[i][col].indexOf(str) > -1) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
var dTable, rows;
|
||||
|
||||
// Get datatable
|
||||
dTable = $(table).dataTable();
|
||||
rows = dTable.fnGetData();
|
||||
|
||||
// Loop through each row
|
||||
for (var i in rows) {
|
||||
// If the column contains the search string
|
||||
if (rows[i][col].indexOf(str) > -1) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Select all checkboxes in the datatable
|
||||
*
|
||||
* @param event
|
||||
* Event on element
|
||||
* @param obj
|
||||
* Object triggering event
|
||||
* @return Nothing
|
||||
* @param event Event on element
|
||||
* @param obj Object triggering event
|
||||
*/
|
||||
function selectAll(event, obj) {
|
||||
var status = obj.attr('checked');
|
||||
var checkboxes = obj.parents('.dataTables_scroll').find('.dataTables_scrollBody input:checkbox');
|
||||
if (status) {
|
||||
checkboxes.attr('checked', true);
|
||||
} else {
|
||||
checkboxes.attr('checked', false);
|
||||
}
|
||||
|
||||
event.stopPropagation();
|
||||
var status = obj.attr('checked');
|
||||
var checkboxes = obj.parents('.dataTables_scroll').find('.dataTables_scrollBody input:checkbox');
|
||||
if (status) {
|
||||
checkboxes.attr('checked', true);
|
||||
} else {
|
||||
checkboxes.attr('checked', false);
|
||||
}
|
||||
|
||||
event.stopPropagation();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get node attributes from HTTP request data
|
||||
*
|
||||
* @param propNames
|
||||
* Hash table of property names
|
||||
* @param keys
|
||||
* Property keys
|
||||
* @param data
|
||||
* Data from HTTP request
|
||||
* @param propNames Hash table of property names
|
||||
* @param keys Property keys
|
||||
* @param data Data from HTTP request
|
||||
* @return Hash table of property values
|
||||
*/
|
||||
function getAttrs(keys, propNames, data) {
|
||||
// Create hash table for property values
|
||||
var attrs = new Object();
|
||||
// Create hash table for property values
|
||||
var attrs = new Object();
|
||||
|
||||
// Go through inventory and separate each property out
|
||||
var curKey; // Current property key
|
||||
var addLine; // Add a line to the current property?
|
||||
for ( var i = 1; i < data.length; i++) {
|
||||
addLine = true;
|
||||
// Go through inventory and separate each property out
|
||||
var curKey; // Current property key
|
||||
var addLine; // Add a line to the current property?
|
||||
for ( var i = 1; i < data.length; i++) {
|
||||
addLine = true;
|
||||
|
||||
// Loop through property keys
|
||||
// Does this line contains one of the properties?
|
||||
for ( var j = 0; j < keys.length; j++) {
|
||||
// Find property name
|
||||
if (data[i].indexOf(propNames[keys[j]]) > -1) {
|
||||
attrs[keys[j]] = new Array();
|
||||
// Loop through property keys
|
||||
// Does this line contains one of the properties?
|
||||
for ( var j = 0; j < keys.length; j++) {
|
||||
// Find property name
|
||||
if (data[i].indexOf(propNames[keys[j]]) > -1) {
|
||||
attrs[keys[j]] = new Array();
|
||||
|
||||
// Get rid of property name in the line
|
||||
data[i] = data[i].replace(propNames[keys[j]], '');
|
||||
// Trim the line
|
||||
data[i] = jQuery.trim(data[i]);
|
||||
// Get rid of property name in the line
|
||||
data[i] = data[i].replace(propNames[keys[j]], '');
|
||||
// Trim the line
|
||||
data[i] = jQuery.trim(data[i]);
|
||||
|
||||
// Do not insert empty line
|
||||
if (data[i].length > 0) {
|
||||
attrs[keys[j]].push(data[i]);
|
||||
}
|
||||
// Do not insert empty line
|
||||
if (data[i].length > 0) {
|
||||
attrs[keys[j]].push(data[i]);
|
||||
}
|
||||
|
||||
curKey = keys[j];
|
||||
addLine = false; // This line belongs to a property
|
||||
}
|
||||
}
|
||||
curKey = keys[j];
|
||||
addLine = false; // This line belongs to a property
|
||||
}
|
||||
}
|
||||
|
||||
// Line does not contain a property
|
||||
// Must belong to previous property
|
||||
if (addLine && data[i].length > 1) {
|
||||
data[i] = jQuery.trim(data[i]);
|
||||
attrs[curKey].push(data[i]);
|
||||
}
|
||||
}
|
||||
// Line does not contain a property
|
||||
// Must belong to previous property
|
||||
if (addLine && data[i].length > 1) {
|
||||
data[i] = jQuery.trim(data[i]);
|
||||
attrs[curKey].push(data[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return attrs;
|
||||
return attrs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a tool tip for comments
|
||||
*
|
||||
* @param comment
|
||||
* Comments to be placed in a tool tip
|
||||
* @param comment Comments to be placed in a tool tip
|
||||
* @return Tool tip
|
||||
*/
|
||||
function createCommentsToolTip(comment) {
|
||||
// Create tooltip container
|
||||
var toolTip = $('<div class="tooltip"></div>');
|
||||
// Create textarea to hold comment
|
||||
var txtArea = $('<textarea>' + comment + '</textarea>').css({
|
||||
'font-size': '10px',
|
||||
'height': '50px',
|
||||
'width': '200px',
|
||||
'background-color': '#000',
|
||||
'color': '#fff',
|
||||
'border': '0px',
|
||||
'display': 'block'
|
||||
});
|
||||
|
||||
// Create links to save and cancel changes
|
||||
var lnkStyle = {
|
||||
'color': '#58ACFA',
|
||||
'font-size': '10px',
|
||||
'display': 'inline-block',
|
||||
'padding': '5px',
|
||||
'float': 'right'
|
||||
};
|
||||
|
||||
var saveLnk = $('<a>Save</a>').css(lnkStyle).hide();
|
||||
var cancelLnk = $('<a>Cancel</a>').css(lnkStyle).hide();
|
||||
var infoSpan = $('<span>Click to edit</span>').css(lnkStyle);
|
||||
|
||||
// Save changes onclick
|
||||
saveLnk.bind('click', function(){
|
||||
// Get node and comment
|
||||
var node = $(this).parent().parent().find('img').attr('id').replace('Tip', '');
|
||||
var comments = $(this).parent().find('textarea').val();
|
||||
|
||||
// Save comment
|
||||
$.ajax( {
|
||||
url : 'lib/srv_cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'chdef',
|
||||
tgt : '',
|
||||
args : '-t;node;-o;' + node + ';usercomment=' + comments,
|
||||
msg : 'out=manageTab;tgt=' + node
|
||||
},
|
||||
|
||||
success: showChdefOutput
|
||||
});
|
||||
|
||||
// Hide cancel and save links
|
||||
$(this).hide();
|
||||
cancelLnk.hide();
|
||||
});
|
||||
|
||||
// Cancel changes onclick
|
||||
cancelLnk.bind('click', function(){
|
||||
// Get original comment and put it back
|
||||
var orignComments = $(this).parent().find('textarea').text();
|
||||
$(this).parent().find('textarea').val(orignComments);
|
||||
|
||||
// Hide cancel and save links
|
||||
$(this).hide();
|
||||
saveLnk.hide();
|
||||
infoSpan.show();
|
||||
});
|
||||
|
||||
// Show save link when comment is edited
|
||||
txtArea.bind('click', function(){
|
||||
saveLnk.show();
|
||||
cancelLnk.show();
|
||||
infoSpan.hide();
|
||||
});
|
||||
|
||||
toolTip.append(txtArea);
|
||||
toolTip.append(cancelLnk);
|
||||
toolTip.append(saveLnk);
|
||||
toolTip.append(infoSpan);
|
||||
|
||||
return toolTip;
|
||||
// Create tooltip container
|
||||
var toolTip = $('<div class="tooltip"></div>');
|
||||
// Create textarea to hold comment
|
||||
var txtArea = $('<textarea>' + comment + '</textarea>').css({
|
||||
'font-size': '10px',
|
||||
'height': '50px',
|
||||
'width': '200px',
|
||||
'background-color': '#000',
|
||||
'color': '#fff',
|
||||
'border': '0px',
|
||||
'display': 'block'
|
||||
});
|
||||
|
||||
// Create links to save and cancel changes
|
||||
var lnkStyle = {
|
||||
'color': '#58ACFA',
|
||||
'font-size': '10px',
|
||||
'display': 'inline-block',
|
||||
'padding': '5px',
|
||||
'float': 'right'
|
||||
};
|
||||
|
||||
var saveLnk = $('<a>Save</a>').css(lnkStyle).hide();
|
||||
var cancelLnk = $('<a>Cancel</a>').css(lnkStyle).hide();
|
||||
var infoSpan = $('<span>Click to edit</span>').css(lnkStyle);
|
||||
|
||||
// Save changes onclick
|
||||
saveLnk.bind('click', function(){
|
||||
// Get node and comment
|
||||
var node = $(this).parent().parent().find('img').attr('id').replace('Tip', '');
|
||||
var comments = $(this).parent().find('textarea').val();
|
||||
|
||||
// Save comment
|
||||
$.ajax( {
|
||||
url : 'lib/srv_cmd.php',
|
||||
dataType : 'json',
|
||||
data : {
|
||||
cmd : 'chdef',
|
||||
tgt : '',
|
||||
args : '-t;node;-o;' + node + ';usercomment=' + comments,
|
||||
msg : 'out=manageTab;tgt=' + node
|
||||
},
|
||||
|
||||
success: showChdefOutput
|
||||
});
|
||||
|
||||
// Hide cancel and save links
|
||||
$(this).hide();
|
||||
cancelLnk.hide();
|
||||
});
|
||||
|
||||
// Cancel changes onclick
|
||||
cancelLnk.bind('click', function(){
|
||||
// Get original comment and put it back
|
||||
var orignComments = $(this).parent().find('textarea').text();
|
||||
$(this).parent().find('textarea').val(orignComments);
|
||||
|
||||
// Hide cancel and save links
|
||||
$(this).hide();
|
||||
saveLnk.hide();
|
||||
infoSpan.show();
|
||||
});
|
||||
|
||||
// Show save link when comment is edited
|
||||
txtArea.bind('click', function(){
|
||||
saveLnk.show();
|
||||
cancelLnk.show();
|
||||
infoSpan.hide();
|
||||
});
|
||||
|
||||
toolTip.append(txtArea);
|
||||
toolTip.append(cancelLnk);
|
||||
toolTip.append(saveLnk);
|
||||
toolTip.append(infoSpan);
|
||||
|
||||
return toolTip;
|
||||
}
|
||||
|
||||
/**
|
||||
* Open a dialog and show given message
|
||||
*
|
||||
* @param type
|
||||
* Type of dialog, i.e. warn or info
|
||||
* @param msg
|
||||
* Message to show
|
||||
* @return Nothing
|
||||
* @param type Type of dialog, i.e. warn or info
|
||||
* @param msg Message to show
|
||||
*/
|
||||
function prompt(type, msg) {
|
||||
var style = {
|
||||
'display': 'inline-block',
|
||||
'margin': '5px',
|
||||
'vertical-align': 'middle'
|
||||
};
|
||||
msg.css({
|
||||
'display': 'inline',
|
||||
'margin': '5px',
|
||||
'vertical-align': 'middle'
|
||||
});
|
||||
|
||||
// Append icon
|
||||
var icon;
|
||||
var dialog = $('<div></div>');
|
||||
if (type == "Warning") {
|
||||
icon = $('<span class="ui-icon ui-icon-alert"></span>').css(style);
|
||||
} else {
|
||||
icon = $('<span class="ui-icon ui-icon-info"></span>').css(style);
|
||||
}
|
||||
|
||||
dialog.append(icon);
|
||||
dialog.append(msg);
|
||||
|
||||
// Open dialog
|
||||
dialog.dialog({
|
||||
title: type,
|
||||
modal: true,
|
||||
width: 400,
|
||||
buttons: {
|
||||
"Ok": function(){
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}
|
||||
});
|
||||
var style = {
|
||||
'display': 'inline-block',
|
||||
'margin': '5px',
|
||||
'vertical-align': 'middle'
|
||||
};
|
||||
msg.css({
|
||||
'display': 'inline',
|
||||
'margin': '5px',
|
||||
'vertical-align': 'middle'
|
||||
});
|
||||
|
||||
// Append icon
|
||||
var icon;
|
||||
var dialog = $('<div></div>');
|
||||
if (type == "Warning") {
|
||||
icon = $('<span class="ui-icon ui-icon-alert"></span>').css(style);
|
||||
} else {
|
||||
icon = $('<span class="ui-icon ui-icon-info"></span>').css(style);
|
||||
}
|
||||
|
||||
dialog.append(icon);
|
||||
dialog.append(msg);
|
||||
|
||||
// Open dialog
|
||||
dialog.dialog({
|
||||
title: type,
|
||||
modal: true,
|
||||
close: function(){
|
||||
$(this).remove();
|
||||
},
|
||||
width: 400,
|
||||
buttons: {
|
||||
"Ok": function(){
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get nodes that are checked in a given datatable
|
||||
*
|
||||
* @param dTableId
|
||||
* The datatable ID
|
||||
* @param dTableId The datatable ID
|
||||
* @return Nodes that were checked
|
||||
*/
|
||||
function getNodesChecked(dTableId) {
|
||||
var tgts = '';
|
||||
var tgts = '';
|
||||
|
||||
// Get nodes that were checked
|
||||
var nodes = $('#' + dTableId + ' input[type=checkbox]:checked');
|
||||
for (var i in nodes) {
|
||||
var tgtNode = nodes.eq(i).attr('name');
|
||||
|
||||
if (tgtNode){
|
||||
tgts += tgtNode;
|
||||
|
||||
// Add a comma at the end
|
||||
if (i < nodes.length - 1) {
|
||||
tgts += ',';
|
||||
}
|
||||
}
|
||||
}
|
||||
// Get nodes that were checked
|
||||
var nodes = $('#' + dTableId + ' input[type=checkbox]:checked');
|
||||
for (var i in nodes) {
|
||||
var tgtNode = nodes.eq(i).attr('name');
|
||||
|
||||
if (tgtNode){
|
||||
tgts += tgtNode;
|
||||
|
||||
// Add a comma at the end
|
||||
if (i < nodes.length - 1) {
|
||||
tgts += ',';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return tgts;
|
||||
return tgts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show chdef output
|
||||
*
|
||||
* @param data
|
||||
* Data returned from HTTP request
|
||||
* @return Nothing
|
||||
* @param data Data returned from HTTP request
|
||||
*/
|
||||
function showChdefOutput(data) {
|
||||
// Get output
|
||||
var out = data.rsp;
|
||||
var args = data.msg.split(';');
|
||||
var tabID = args[0].replace('out=', '');
|
||||
var tgt = args[1].replace('tgt=', '');
|
||||
|
||||
// Find info bar on nodes tab, if any
|
||||
var info = $('#' + tabID).find('.ui-state-highlight');
|
||||
if (!info.length) {
|
||||
// Create info bar if one does not exist
|
||||
info = createInfoBar('');
|
||||
$('#' + tabID).append(info);
|
||||
}
|
||||
|
||||
// Go through output and append to paragraph
|
||||
var prg = $('<p></p>');
|
||||
for (var i in out) {
|
||||
prg.append(tgt + ': ' + out[i] + '<br>');
|
||||
}
|
||||
|
||||
info.append(prg);
|
||||
// Get output
|
||||
var out = data.rsp;
|
||||
var args = data.msg.split(';');
|
||||
var tabID = args[0].replace('out=', '');
|
||||
var tgt = args[1].replace('tgt=', '');
|
||||
|
||||
// Find info bar on nodes tab, if any
|
||||
var info = $('#' + tabID).find('.ui-state-highlight');
|
||||
if (!info.length) {
|
||||
// Create info bar if one does not exist
|
||||
info = createInfoBar('');
|
||||
$('#' + tabID).append(info);
|
||||
}
|
||||
|
||||
// Go through output and append to paragraph
|
||||
var prg = $('<p></p>');
|
||||
for (var i in out) {
|
||||
prg.append(tgt + ': ' + out[i] + '<br>');
|
||||
}
|
||||
|
||||
info.append(prg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an attribute of a given node
|
||||
*
|
||||
* @param node
|
||||
* The node
|
||||
* @param attrName
|
||||
* The attribute
|
||||
* @param node The node
|
||||
* @param attrName The attribute
|
||||
* @return The attribute of the node
|
||||
*/
|
||||
function getUserNodeAttr(node, attrName) {
|
||||
// Get the row
|
||||
var row = $('[id=' + node + ']').parents('tr');
|
||||
// Get the row
|
||||
var row = $('[id=' + node + ']').parents('tr');
|
||||
|
||||
// Search for the column containing the attribute
|
||||
var attrCol;
|
||||
|
||||
var cols = row.parents('.dataTables_scroll').find('.dataTables_scrollHead thead tr:eq(0) th');
|
||||
// Loop through each column
|
||||
for (var i in cols) {
|
||||
// Find column that matches the attribute
|
||||
if (cols.eq(i).html() == attrName) {
|
||||
attrCol = cols.eq(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// If the column containing the attribute is found
|
||||
if (attrCol) {
|
||||
// Get the attribute column index
|
||||
var attrIndex = attrCol.index();
|
||||
// Search for the column containing the attribute
|
||||
var attrCol = null;
|
||||
|
||||
var cols = row.parents('.dataTables_scroll').find('.dataTables_scrollHead thead tr:eq(0) th');
|
||||
// Loop through each column
|
||||
for (var i in cols) {
|
||||
// Find column that matches the attribute
|
||||
if (cols.eq(i).html() == attrName) {
|
||||
attrCol = cols.eq(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// If the column containing the attribute is found
|
||||
if (attrCol) {
|
||||
// Get the attribute column index
|
||||
var attrIndex = attrCol.index();
|
||||
|
||||
// Get the attribute for the given node
|
||||
var attr = row.find('td:eq(' + attrIndex + ')');
|
||||
return attr.text();
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
// Get the attribute for the given node
|
||||
var attr = row.find('td:eq(' + attrIndex + ')');
|
||||
return attr.text();
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
@ -13,78 +13,76 @@ $(document).ready(function() {
|
||||
// The window's height is to small to show the dialog
|
||||
var tmpHeight = 0;
|
||||
if ((winHeight - 50) < diagHeight){
|
||||
tmpHeight = 0;
|
||||
tmpHeight = 0;
|
||||
} else {
|
||||
tmpHeight = parseInt((winHeight - diagHeight - 50) / 2);
|
||||
tmpHeight = parseInt((winHeight - diagHeight - 50) / 2);
|
||||
}
|
||||
|
||||
$('#login').css('margin', tmpHeight + 'px auto');
|
||||
$('button').bind('click', function(){
|
||||
authenticate();
|
||||
authenticate();
|
||||
}).button();
|
||||
|
||||
if (document.location.protocol == 'http:') {
|
||||
$('#login_status').html('You are using an unencrypted session!');
|
||||
$('#login_status').css('color', 'red');
|
||||
}
|
||||
|
||||
if (!$("#login input[name='username']").val()) {
|
||||
$("#login input[name='username']").focus();
|
||||
} else {
|
||||
$("#login input[name='password']").focus();
|
||||
}
|
||||
if (document.location.protocol == 'http:') {
|
||||
$('#login-status').html('You are using an unencrypted session!');
|
||||
$('#login-status').css('color', 'red');
|
||||
}
|
||||
|
||||
if (!$("#login input[name='username']").val()) {
|
||||
$("#login input[name='username']").focus();
|
||||
} else {
|
||||
$("#login input[name='password']").focus();
|
||||
}
|
||||
|
||||
// When enter is hit while in username, advance to password
|
||||
$("#login input[name='username']").keydown(function(event) {
|
||||
if (event.keyCode == 13) {
|
||||
$("#login input[name='password']").focus();
|
||||
}
|
||||
});
|
||||
// When enter is hit while in username, advance to password
|
||||
$("#login input[name='username']").keydown(function(event) {
|
||||
if (event.keyCode == 13) {
|
||||
$("#login input[name='password']").focus();
|
||||
}
|
||||
});
|
||||
|
||||
// Submit authentication if enter is pressed in password field
|
||||
$("#login input[name='password']").keydown(function(event) {
|
||||
if (event.keyCode == 13) {
|
||||
authenticate();
|
||||
}
|
||||
});
|
||||
// Submit authentication if enter is pressed in password field
|
||||
$("#login input[name='password']").keydown(function(event) {
|
||||
if (event.keyCode == 13) {
|
||||
authenticate();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Update login dialog
|
||||
*
|
||||
* @param data
|
||||
* Data returned from AJAX call
|
||||
* @param txtStatus
|
||||
* Status of login
|
||||
* @param data Data returned from AJAX call
|
||||
* @param txtStatus Status of login
|
||||
*/
|
||||
function onlogin(data, txtStatus) {
|
||||
// Clear password field regardless of what happens
|
||||
var usrName = $("#login input[name='username']").val();
|
||||
$("#login input[name='password']").val('');
|
||||
if (data.authenticated == 'yes') {
|
||||
$('#login_status').text('Login successful');
|
||||
window.location = 'service.php';
|
||||
|
||||
// Set user name cookie
|
||||
var exDate = new Date();
|
||||
exDate.setTime(exDate.getTime() + (240 * 60 * 1000));
|
||||
$.cookie('xcat_username', usrName, { expires: exDate });
|
||||
} else {
|
||||
$('#login_status').text('Authentication failure');
|
||||
$('#login_status').css('color', '#FF0000');
|
||||
}
|
||||
// Clear password field regardless of what happens
|
||||
var usrName = $("#login input[name='username']").val();
|
||||
$("#login input[name='password']").val('');
|
||||
if (data.authenticated == 'yes') {
|
||||
$('#login-status').text('Login successful');
|
||||
window.location = 'service.php';
|
||||
|
||||
// Set user name cookie
|
||||
var exDate = new Date();
|
||||
exDate.setTime(exDate.getTime() + (240 * 60 * 1000));
|
||||
$.cookie('xcat_username', usrName, { expires: exDate });
|
||||
} else {
|
||||
$('#login-status').text('Authentication failure');
|
||||
$('#login-status').css('color', '#FF0000');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Authenticate user for new session
|
||||
*/
|
||||
function authenticate() {
|
||||
$('#login_status').css('color', '#000000');
|
||||
$('#login_status').html('Authenticating...');
|
||||
|
||||
var passwd = $("#login input[name='password']").val();
|
||||
$.post('lib/srv_log.php', {
|
||||
username : $("#login input[name='username']").val(),
|
||||
password : passwd
|
||||
}, onlogin, 'json');
|
||||
$('#login-status').css('color', '#000000');
|
||||
$('#login-status').html('Authenticating...');
|
||||
|
||||
var passwd = $("#login input[name='password']").val();
|
||||
$.post('lib/srv_log.php', {
|
||||
username : $("#login input[name='username']").val(),
|
||||
password : passwd
|
||||
}, onlogin, 'json');
|
||||
}
|
||||
|
1554
xCAT-UI/js/ui.js
1554
xCAT-UI/js/ui.js
File diff suppressed because it is too large
Load Diff
@ -13,95 +13,90 @@ $(document).ready(function() {
|
||||
// The window's height is to small to show the dialog
|
||||
var tempheight = 0;
|
||||
if ((winheight - 50) < diaheight){
|
||||
tempheight = 0;
|
||||
tempheight = 0;
|
||||
} else {
|
||||
tempheight = parseInt((winheight - diaheight - 50) / 2);
|
||||
tempheight = parseInt((winheight - diaheight - 50) / 2);
|
||||
}
|
||||
|
||||
$('#login').css('margin', tempheight + 'px auto');
|
||||
$('button').bind('click', function(){
|
||||
authenticate();
|
||||
authenticate();
|
||||
});
|
||||
|
||||
$('#login button').button();
|
||||
|
||||
if (document.location.protocol == "http:") {
|
||||
$("#login_status").html("You are using an unencrypted session!");
|
||||
$("#login_status").css("color", "#ff0000");
|
||||
}
|
||||
|
||||
if ($("#login input[name='username']").val() == "") {
|
||||
$("#login input[name='username']").focus();
|
||||
} else {
|
||||
$("#login input[name='password']").focus();
|
||||
}
|
||||
if (document.location.protocol == "http:") {
|
||||
$("#login-status").html("You are using an unencrypted session!");
|
||||
$("#login-status").css("color", "#ff0000");
|
||||
}
|
||||
|
||||
if ($("#login input[name='username']").val() == "") {
|
||||
$("#login input[name='username']").focus();
|
||||
} else {
|
||||
$("#login input[name='password']").focus();
|
||||
}
|
||||
|
||||
// When enter is hit while in username, advance to password
|
||||
$("#login input[name='username']").keydown(function(event) {
|
||||
if (event.keyCode == 13) {
|
||||
$("#login input[name='password']").focus();
|
||||
}
|
||||
});
|
||||
// When enter is hit while in username, advance to password
|
||||
$("#login input[name='username']").keydown(function(event) {
|
||||
if (event.keyCode == 13) {
|
||||
$("#login input[name='password']").focus();
|
||||
}
|
||||
});
|
||||
|
||||
// Submit authentication if enter is pressed in password field
|
||||
$("#login input[name='password']").keydown(function(event) {
|
||||
if (event.keyCode == 13) {
|
||||
authenticate();
|
||||
}
|
||||
});
|
||||
// Submit authentication if enter is pressed in password field
|
||||
$("#login input[name='password']").keydown(function(event) {
|
||||
if (event.keyCode == 13) {
|
||||
authenticate();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Update login dialog
|
||||
*
|
||||
* @param data
|
||||
* Data returned from AJAX call
|
||||
* @param txtStatus
|
||||
* Status of login
|
||||
* @return
|
||||
* @param data Data returned from AJAX call
|
||||
* @param txtStatus Status of login
|
||||
*/
|
||||
function onlogin(data, txtStatus) {
|
||||
// Clear password field regardless of what happens
|
||||
$("#login input[name='password']").val("");
|
||||
if (data.authenticated == "yes") {
|
||||
$("#login_status").text("Login successful");
|
||||
// Clear password field regardless of what happens
|
||||
$("#login input[name='password']").val("");
|
||||
if (data.authenticated == "yes") {
|
||||
$("#login-status").text("Login successful");
|
||||
|
||||
// Not the first time to log
|
||||
if ($.cookie('logonflag')){
|
||||
// Remembered what page they were trying to go to
|
||||
window.location = window.location.pathname;
|
||||
} else {
|
||||
window.location = 'help.php';
|
||||
}
|
||||
|
||||
// Set user name cookie
|
||||
var usrName = $("#login input[name='username']").val();
|
||||
var exDate = new Date();
|
||||
exDate.setTime(exDate.getTime() + (240 * 60 * 1000));
|
||||
$.cookie('xcat_username', usrName, { expires: exDate });
|
||||
|
||||
// Set the logonflag
|
||||
$.cookie('logonflag', 'yes', {
|
||||
path : '/xcat',
|
||||
expires : 100
|
||||
});
|
||||
|
||||
} else {
|
||||
$("#login_status").text("Authentication failure").css("color", "#FF0000");
|
||||
}
|
||||
// Not the first time to log
|
||||
if ($.cookie('logonflag')){
|
||||
// Remembered what page they were trying to go to
|
||||
window.location = window.location.pathname;
|
||||
} else {
|
||||
window.location = 'help.php';
|
||||
}
|
||||
|
||||
// Set user name cookie
|
||||
var usrName = $("#login input[name='username']").val();
|
||||
var exDate = new Date();
|
||||
exDate.setTime(exDate.getTime() + (240 * 60 * 1000));
|
||||
$.cookie('xcat_username', usrName, { expires: exDate });
|
||||
|
||||
// Set the logonflag
|
||||
$.cookie('logonflag', 'yes', {
|
||||
path : '/xcat',
|
||||
expires : 100
|
||||
});
|
||||
|
||||
} else {
|
||||
$("#login-status").text("Authentication failure").css("color", "#FF0000");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Authenticate user for new session
|
||||
*
|
||||
* @return Nothing
|
||||
*/
|
||||
function authenticate() {
|
||||
$("#login_status").css("color", "#000000");
|
||||
$("#login_status").html('Authenticating...');
|
||||
var passwd = $("#login input[name='password']").val();
|
||||
$.post("lib/log.php", {
|
||||
username : $("#login input[name='username']").val(),
|
||||
password : passwd
|
||||
}, onlogin, "json");
|
||||
$("#login-status").css("color", "#000000");
|
||||
$("#login-status").html('Authenticating...');
|
||||
var passwd = $("#login input[name='password']").val();
|
||||
$.post("lib/log.php", {
|
||||
username : $("#login input[name='username']").val(),
|
||||
password : passwd
|
||||
}, onlogin, "json");
|
||||
}
|
||||
|
@ -6,21 +6,26 @@ require_once "$TOPDIR/lib/jsonwrapper.php";
|
||||
|
||||
/**
|
||||
* Issue a xCAT command, e.g. rinv gpok123 all
|
||||
* This will handle most commands. If not, you can create your
|
||||
* own .php. Look at zCmd.php for an example.
|
||||
* This will handle most commands. If not, you can create your own .php.
|
||||
* Look at zCmd.php for an example.
|
||||
*
|
||||
* @param $cmd The xCAT command
|
||||
* @param $tgt The target node or group
|
||||
* @param $args The xCAT command arguments, separated by semicolons
|
||||
* @param $opts The xCAT command options, separated by semicolons
|
||||
* @return The xCAT response. Replies are in the form of JSON
|
||||
* @param $cmd The xCAT command
|
||||
* @param $tgt The target node or group
|
||||
* @param $args The xCAT command arguments, separated by semicolons
|
||||
* @param $opts The xCAT command options, separated by semicolons
|
||||
* @return The xCAT response. Replies are in the form of JSON
|
||||
*/
|
||||
if (isset($_GET["cmd"])) {
|
||||
// HTTP GET requests
|
||||
$cmd = $_GET["cmd"];
|
||||
$tgt = $_GET["tgt"];
|
||||
$args = $_GET["args"];
|
||||
|
||||
|
||||
// File contents in case of file write
|
||||
if (isset($_GET["cont"])) {
|
||||
$cont = $_GET["cont"];
|
||||
}
|
||||
|
||||
// Special messages put here
|
||||
// This gets sent back to the AJAX request as is.
|
||||
$msg = $_GET["msg"];
|
||||
@ -29,7 +34,7 @@ if (isset($_GET["cmd"])) {
|
||||
if (!$tgt) {
|
||||
$tgt = NULL;
|
||||
}
|
||||
|
||||
|
||||
// If no $msg is given, set $msg to NULL
|
||||
if (!$msg) {
|
||||
$msg = NULL;
|
||||
@ -47,12 +52,12 @@ if (isset($_GET["cmd"])) {
|
||||
$args_array = array($args);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// If no $opts are given, set $opts_array to NULL
|
||||
$opts_array = array();
|
||||
if (isset($_GET["opts"])) {
|
||||
$opts = $_GET["opts"];
|
||||
|
||||
|
||||
// If $args contains multiple arguments, split it into an array
|
||||
if (strpos($opts,";")) {
|
||||
// Split the arguments into an array
|
||||
@ -69,7 +74,7 @@ if (isset($_GET["cmd"])) {
|
||||
if (in_array("flush", $opts_array)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$rsp = array();
|
||||
|
||||
// webrun pping and gangliastatus output needs special handling
|
||||
@ -86,26 +91,37 @@ if (isset($_GET["cmd"])) {
|
||||
else if(strncasecmp($cmd, "extnoderange", 12) == 0) {
|
||||
$rsp = extractExtnoderange($xml);
|
||||
}
|
||||
// Write contents to file
|
||||
else if(strncasecmp($cmd, "write", 4) == 0) {
|
||||
// Directory should be /var/opt/xcat/profiles
|
||||
// You can write anything to that directory
|
||||
$file = "$tgt";
|
||||
$handle = fopen($file, 'w') or die("Cannot open $file");
|
||||
fwrite($handle, $cont);
|
||||
fclose($handle);
|
||||
|
||||
$rsp = "Directory entry written to $file";
|
||||
}
|
||||
// Handle the typical output
|
||||
else {
|
||||
foreach ($xml->children() as $child) {
|
||||
foreach ($child->children() as $data) {
|
||||
if($data->name) {
|
||||
$node = $data->name;
|
||||
|
||||
|
||||
if ($data->data->contents) {
|
||||
$cont = $data->data->contents;
|
||||
} else {
|
||||
$cont = $data->data;
|
||||
}
|
||||
|
||||
|
||||
if ($data->data->desc) {
|
||||
$cont = $data->data->desc . ": " . $cont;
|
||||
}
|
||||
|
||||
|
||||
$cont = str_replace(":|:", "\n", $cont);
|
||||
array_push($rsp, "$node: $cont");
|
||||
} else if(strlen("$data") > 2) {
|
||||
} else if (strlen("$data") > 2) {
|
||||
$data = str_replace(":|:", "\n", $data);
|
||||
array_push($rsp, "$data");
|
||||
}
|
||||
@ -121,8 +137,8 @@ if (isset($_GET["cmd"])) {
|
||||
/**
|
||||
* Extract the output for a webrun command
|
||||
*
|
||||
* @param $xml The XML output from docmd()
|
||||
* @return An array containing the output
|
||||
* @param $xml The XML output from docmd()
|
||||
* @return An array containing the output
|
||||
*/
|
||||
function extractWebrun($xml) {
|
||||
$rsp = array();
|
||||
@ -133,7 +149,7 @@ function extractWebrun($xml) {
|
||||
foreach($nodes->children() as $node){
|
||||
// Get the node name
|
||||
$name = $node->name;
|
||||
|
||||
|
||||
// Get the content
|
||||
$status = $node->data;
|
||||
$status = str_replace(":|:", "\n", $status);
|
||||
@ -150,8 +166,8 @@ function extractWebrun($xml) {
|
||||
/**
|
||||
* Extract the output for a nodels command
|
||||
*
|
||||
* @param $xml The XML output from docmd()
|
||||
* @return An array containing the output
|
||||
* @param $xml The XML output from docmd()
|
||||
* @return An array containing the output
|
||||
*/
|
||||
function extractNodels($xml) {
|
||||
$rsp = array();
|
||||
@ -179,8 +195,8 @@ function extractNodels($xml) {
|
||||
/**
|
||||
* Extract the output for a extnoderange command
|
||||
*
|
||||
* @param $xml The XML output from docmd()
|
||||
* @return The nodes and groups
|
||||
* @param $xml The XML output from docmd()
|
||||
* @return The nodes and groups
|
||||
*/
|
||||
function extractExtnoderange($xml) {
|
||||
$rsp = array();
|
||||
|
@ -5,22 +5,21 @@
|
||||
|
||||
// Retain session variables across page requests
|
||||
session_start();
|
||||
session_write_close(); // Do not block HTTP requests
|
||||
session_write_close(); // Do not block other HTTP requests
|
||||
|
||||
// The settings below display error on the screen,
|
||||
// instead of giving blank pages.
|
||||
// The settings below display error on the screen, instead of giving blank pages.
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', true);
|
||||
|
||||
/**
|
||||
* Run a command using the xCAT client/server protocol
|
||||
*
|
||||
* @param $cmd The xCAT command
|
||||
* @param $nr Node range or group
|
||||
* @param $args_array Command arguments
|
||||
* @param $opts_array Command options
|
||||
* @return A tree of SimpleXML objects.
|
||||
* See perl-xCAT/xCAT/Client.pm for the format
|
||||
* @param $cmd The xCAT command
|
||||
* @param $nr Node range or group
|
||||
* @param $args_array Command arguments
|
||||
* @param $opts_array Command options
|
||||
* @return A tree of SimpleXML objects.
|
||||
* See perl-xCAT/xCAT/Client.pm for the format
|
||||
*/
|
||||
function docmd($cmd, $nr, $args_array, $opts_array){
|
||||
// If we are not logged in,
|
||||
@ -34,7 +33,9 @@ function docmd($cmd, $nr, $args_array, $opts_array){
|
||||
// Add command, node range, and arguments to request
|
||||
$request = simplexml_load_string('<xcatrequest></xcatrequest>');
|
||||
$request->addChild('command', $cmd);
|
||||
if(!empty($nr)) { $request->addChild('noderange', $nr); }
|
||||
if (!empty($nr)) {
|
||||
$request->addChild('noderange', $nr);
|
||||
}
|
||||
if (!empty($args_array)) {
|
||||
foreach ($args_array as $a) {
|
||||
$request->addChild('arg',$a);
|
||||
@ -53,9 +54,9 @@ function docmd($cmd, $nr, $args_array, $opts_array){
|
||||
/**
|
||||
* Used by docmd() to submit request to xCAT
|
||||
*
|
||||
* @param $req Tree of SimpleXML objects
|
||||
* @param $opts_array Request options
|
||||
* @return A tree of SimpleXML objects
|
||||
* @param $req Tree of SimpleXML objects
|
||||
* @param $opts_array Request options
|
||||
* @return A tree of SimpleXML objects
|
||||
*/
|
||||
function submit_request($req, $skipVerify, $opts_array){
|
||||
$xcathost = "localhost";
|
||||
@ -63,46 +64,46 @@ function submit_request($req, $skipVerify, $opts_array){
|
||||
$rsp = FALSE;
|
||||
$response = '';
|
||||
$cleanexit = 0;
|
||||
|
||||
|
||||
// Determine whether to flush output or not
|
||||
$flush = false;
|
||||
if ($opts_array && in_array("flush", $opts_array)) {
|
||||
$flush = true;
|
||||
}
|
||||
|
||||
|
||||
// Determine how to handle the flush output
|
||||
// You can specify a function name, in place of TBD, to handle the flush output
|
||||
$flush_format = "";
|
||||
if ($opts_array && in_array("flush-format=TBD", $opts_array)) {
|
||||
$flush_format = "TBD";
|
||||
}
|
||||
|
||||
// Open syslog, include the process ID and also send
|
||||
// the log to standard error, and use a user defined
|
||||
// logging mechanism
|
||||
|
||||
// Open syslog, include the process ID and also send the log to standard error,
|
||||
// and use a user defined logging mechanism
|
||||
openlog("xCAT-UI", LOG_PID | LOG_PERROR, LOG_LOCAL0);
|
||||
|
||||
// Open a socket to xcatd
|
||||
syslog(LOG_INFO, "Opening socket to xcatd...");
|
||||
if($fp = stream_socket_client('ssl://'.$xcathost.':'.$port, $errno, $errstr, 30, STREAM_CLIENT_CONNECT)){
|
||||
if ($fp = stream_socket_client('ssl://'.$xcathost.':'.$port, $errno, $errstr, 30, STREAM_CLIENT_CONNECT)){
|
||||
$reqXML = $req->asXML();
|
||||
$nr = $req->noderange;
|
||||
$cmd = $req->command;
|
||||
|
||||
|
||||
syslog(LOG_INFO, "Sending request: $cmd $nr");
|
||||
stream_set_blocking($fp, 0); // Set as non-blocking
|
||||
fwrite($fp,$req->asXML()); // Send XML to xcatd
|
||||
set_time_limit(900); // Set 15 minutes timeout (for long running requests)
|
||||
// The default is 30 seconds which is too short for some requests
|
||||
|
||||
stream_set_blocking($fp, 0); // Set as non-blocking
|
||||
fwrite($fp,$req->asXML()); // Send XML to xcatd
|
||||
set_time_limit(900); // Set 15 minutes timeout (for long running requests)
|
||||
// The default is 30 seconds which is too short for some requests
|
||||
|
||||
// Turn on output buffering
|
||||
ob_start();
|
||||
while(!feof($fp)) { // Read until there is no more
|
||||
while (!feof($fp)) {
|
||||
// Read until there is no more
|
||||
// Remove newlines and add it to the response
|
||||
$str = fread($fp, 8192);
|
||||
if ($str) {
|
||||
$response .= preg_replace('/>\n\s*</', '><', $str);
|
||||
|
||||
|
||||
// Flush output to browser
|
||||
if ($flush) {
|
||||
// Strip HTML tags from output
|
||||
@ -117,50 +118,48 @@ function submit_request($req, $skipVerify, $opts_array){
|
||||
flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Look for serverdone response
|
||||
$fullpattern = '/<xcatresponse>\s*<serverdone>\s*<\/serverdone>\s*<\/xcatresponse>/';
|
||||
$mixedpattern = '/<serverdone>\s*<\/serverdone>.*<\/xcatresponse>/';
|
||||
$recentpattern = '/<\/xcatresponse>/';
|
||||
if(preg_match($recentpattern,$str) && preg_match($mixedpattern,$response)) {
|
||||
// Transaction is done,
|
||||
// Package up XML and return it
|
||||
if (preg_match($recentpattern,$str) && preg_match($mixedpattern,$response)) {
|
||||
// Transaction is done, package up XML and return it
|
||||
// Remove the serverdone response and put an xcat tag around the rest
|
||||
$count = 0;
|
||||
$response = preg_replace($fullpattern,'', $response, -1, $count); // 1st try to remove the long pattern
|
||||
if (!$count) { $response = preg_replace($mixedpattern,'', $response) . '</xcatresponse>/'; } // if its not there, then remove the short pattern
|
||||
$response = preg_replace($fullpattern,'', $response, -1, $count); // 1st try to remove the long pattern
|
||||
if (!$count) {
|
||||
$response = preg_replace($mixedpattern,'', $response) . '</xcatresponse>/';
|
||||
}
|
||||
$response = "<xcat>$response</xcat>";
|
||||
//delete the \n between '>' and '<'
|
||||
$response = preg_replace('/>\n\s*</', '><', $response);
|
||||
//replace the '\n' by ':|:' in the data area.
|
||||
$response = preg_replace('/\n/', ':|:', $response);
|
||||
$rsp = simplexml_load_string($response,'SimpleXMLElement', LIBXML_NOCDATA);
|
||||
$cleanexit = 1;
|
||||
break;
|
||||
}
|
||||
} // End of while(!feof($fp))
|
||||
|
||||
|
||||
syslog(LOG_INFO, "($cmd $nr) Sending response");
|
||||
fclose($fp);
|
||||
} else {
|
||||
echo "<p>xCAT submit request socket error: $errno - $errstr</p>";
|
||||
}
|
||||
|
||||
|
||||
// Flush (send) the output buffer and turn off output buffering
|
||||
ob_end_flush();
|
||||
|
||||
// Close syslog
|
||||
closelog();
|
||||
|
||||
|
||||
if(! $cleanexit) {
|
||||
if (preg_match('/^\s*<xcatresponse>.*<\/xcatresponse>\s*$/',$response)) {
|
||||
// Probably an error message
|
||||
$response = "<xcat>$response</xcat>";
|
||||
$rsp = simplexml_load_string($response,'SimpleXMLElement', LIBXML_NOCDATA);
|
||||
}
|
||||
elseif(!$skipVerify) {
|
||||
} else if(!$skipVerify) {
|
||||
echo "<p>(Error) xCAT response ended prematurely: ", htmlentities($response), "</p>";
|
||||
$rsp = FALSE;
|
||||
}
|
||||
@ -170,10 +169,6 @@ function submit_request($req, $skipVerify, $opts_array){
|
||||
|
||||
/**
|
||||
* Enable password storage to split between cookie and session variable
|
||||
*
|
||||
* @param $data
|
||||
* @param $key
|
||||
* @return
|
||||
*/
|
||||
function xorcrypt($data, $key) {
|
||||
$datalen = strlen($data);
|
||||
@ -187,9 +182,6 @@ function xorcrypt($data, $key) {
|
||||
|
||||
/**
|
||||
* Get password
|
||||
*
|
||||
* @param Nothing
|
||||
* @return
|
||||
*/
|
||||
function getpassword() {
|
||||
if (isset($GLOBALS['xcatauthsecret'])) {
|
||||
@ -204,13 +196,11 @@ function getpassword() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the password splitting knowledge between server
|
||||
* and client side persistant storage. Caller should regenerate
|
||||
* session ID when contemplating a new user/password, to preclude
|
||||
* session fixation, though fixation is limited without the secret.
|
||||
* Get the password splitting knowledge between server and client side persistant storage.
|
||||
* Caller should regenerate session ID when contemplating a new user/password,
|
||||
* to preclude session fixation, though fixation is limited without the secret.
|
||||
*
|
||||
* @param $password Password
|
||||
* @return Nothing
|
||||
* @param $password Password
|
||||
*/
|
||||
function setpassword($password) {
|
||||
$randlen = strlen($password);
|
||||
@ -227,8 +217,8 @@ function setpassword($password) {
|
||||
/**
|
||||
* Get RAND characters
|
||||
*
|
||||
* @param $length Length of characters
|
||||
* @return RAND characters
|
||||
* @param $length Length of characters
|
||||
* @return RAND characters
|
||||
*/
|
||||
function getrandchars($length) {
|
||||
$charset = '0123456789abcdefghijklmnopqrstuvwxyz!@#$%^&*';
|
||||
@ -246,9 +236,7 @@ function getrandchars($length) {
|
||||
/**
|
||||
* Determine if a user/password session exists
|
||||
*
|
||||
* @param Nothing
|
||||
* @return True If user has a session.
|
||||
* False Otherwise
|
||||
* @return True if user has a session, false otherwise
|
||||
*/
|
||||
function is_logged() {
|
||||
if (isset($_SESSION["username"]) and !is_bool(getpassword())) {
|
||||
@ -260,10 +248,8 @@ function is_logged() {
|
||||
|
||||
/**
|
||||
* Determine if a user is currently logged in successfully
|
||||
*
|
||||
* @param Nothing
|
||||
* @return True If the user is currently logged in successfully
|
||||
* False Otherwise
|
||||
*
|
||||
* @return True if the user is currently logged in successfully, false otherwise
|
||||
*/
|
||||
function isAuthenticated() {
|
||||
if (is_logged()) {
|
||||
@ -290,12 +276,10 @@ function isAuthenticated() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a user has root access
|
||||
*
|
||||
* @param Nothing
|
||||
* @return True If the user has root access
|
||||
* False Otherwise
|
||||
*/
|
||||
* Determine if a user has root access
|
||||
*
|
||||
* @return True if the user has root access, false otherwise
|
||||
*/
|
||||
function isRootAcess() {
|
||||
if (is_logged() && $_SESSION["xcatpassvalid"]) {
|
||||
$testacc = docmd('tabdump', '', array('policy', '-w', "name==" . $_SESSION["username"]), array());
|
||||
@ -304,7 +288,7 @@ function isRootAcess() {
|
||||
$result = str_replace('"', '', $result);
|
||||
$args = array();
|
||||
$args = explode(",", $result);
|
||||
|
||||
|
||||
// Get the comments which contains the privilege
|
||||
$comments = $args[8];
|
||||
$args = explode(";", $comments);
|
||||
@ -319,13 +303,13 @@ function isRootAcess() {
|
||||
$privilege = 'root';
|
||||
$_SESSION["xcatpassvalid"] = 1;
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (strcmp($_SESSION["username"], 'root') == 0) {
|
||||
$_SESSION["xcatpassvalid"] = 1;
|
||||
}
|
||||
@ -338,10 +322,7 @@ function isRootAcess() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Log out of the current user session
|
||||
*
|
||||
* @param Nothing
|
||||
* @return Nothing
|
||||
* Log out of current user session
|
||||
*/
|
||||
function logout() {
|
||||
// Clear the secret cookie from browser
|
||||
@ -360,12 +341,9 @@ function logout() {
|
||||
|
||||
/**
|
||||
* Format a given string and echo it back to the browser
|
||||
*
|
||||
* @param $str String
|
||||
* @return Nothing
|
||||
*/
|
||||
function format_TBD($str) {
|
||||
// Format a given string however you want it
|
||||
// Format a given string however you want it
|
||||
echo $tmp . '<br/>';
|
||||
flush();
|
||||
}
|
||||
|
@ -77,14 +77,14 @@ function rconsSynchronise($parameter) {
|
||||
if (0 == strlen($line)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if ('<' == substr($line, 0, 1)) {
|
||||
$flag = true;
|
||||
$return .= $line;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($flag) {
|
||||
while (!feof($fp)) {
|
||||
$return .= fgets($fp, 1024);
|
||||
|
@ -5,22 +5,21 @@ require_once "$TOPDIR/lib/srv_functions.php";
|
||||
require_once "$TOPDIR/lib/jsonwrapper.php";
|
||||
|
||||
/**
|
||||
* Issue a xCAT command, e.g. rinv gpok123 all
|
||||
* This will handle most commands. If not, you can create your
|
||||
* own .php. Look at zCmd.php for an example.
|
||||
* Issue a xCAT command, e.g. rinv gpok123 all. This will handle most commands.
|
||||
* If not, you can create your own .php. Look at zCmd.php for an example.
|
||||
*
|
||||
* @param $cmd The xCAT command
|
||||
* @param $tgt The target node or group
|
||||
* @param $args The xCAT command arguments, separated by semicolons
|
||||
* @param $opts The xCAT command options, separated by semicolons
|
||||
* @return The xCAT response. Replies are in the form of JSON
|
||||
* @param $cmd The xCAT command
|
||||
* @param $tgt The target node or group
|
||||
* @param $args The xCAT command arguments, separated by semicolons
|
||||
* @param $opts The xCAT command options, separated by semicolons
|
||||
* @return The xCAT response. Replies are in the form of JSON
|
||||
*/
|
||||
if (isset($_GET["cmd"])) {
|
||||
// HTTP GET requests
|
||||
$cmd = $_GET["cmd"];
|
||||
$tgt = $_GET["tgt"];
|
||||
$args = $_GET["args"];
|
||||
|
||||
|
||||
// Special messages put here
|
||||
// This gets sent back to the AJAX request as is.
|
||||
$msg = $_GET["msg"];
|
||||
@ -29,7 +28,7 @@ if (isset($_GET["cmd"])) {
|
||||
if (!$tgt) {
|
||||
$tgt = NULL;
|
||||
}
|
||||
|
||||
|
||||
// If no $msg is given, set $msg to NULL
|
||||
if (!$msg) {
|
||||
$msg = NULL;
|
||||
@ -47,12 +46,12 @@ if (isset($_GET["cmd"])) {
|
||||
$args_array = array($args);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// If no $opts are given, set $opts_array to NULL
|
||||
$opts_array = array();
|
||||
if (isset($_GET["opts"])) {
|
||||
$opts = $_GET["opts"];
|
||||
|
||||
|
||||
// If $args contains multiple arguments, split it into an array
|
||||
if (strpos($opts,";")) {
|
||||
// Split the arguments into an array
|
||||
@ -69,7 +68,7 @@ if (isset($_GET["cmd"])) {
|
||||
if (in_array("flush", $opts_array)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$rsp = array();
|
||||
|
||||
// webrun pping and gangliastatus output needs special handling
|
||||
@ -92,17 +91,16 @@ if (isset($_GET["cmd"])) {
|
||||
foreach ($child->children() as $data) {
|
||||
if($data->name) {
|
||||
$node = $data->name;
|
||||
|
||||
|
||||
if($data->data->contents){
|
||||
$cont = $data->data->contents;
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
$cont = $data->data;
|
||||
}
|
||||
|
||||
|
||||
$cont = str_replace(":|:", "\n", $cont);
|
||||
array_push($rsp, "$node: $cont");
|
||||
} else if(strlen("$data") > 2) {
|
||||
} else if (strlen("$data") > 2) {
|
||||
$data = str_replace(":|:", "\n", $data);
|
||||
array_push($rsp, "$data");
|
||||
}
|
||||
@ -118,8 +116,8 @@ if (isset($_GET["cmd"])) {
|
||||
/**
|
||||
* Extract the output for a webrun command
|
||||
*
|
||||
* @param $xml The XML output from docmd()
|
||||
* @return An array containing the output
|
||||
* @param $xml The XML output from docmd()
|
||||
* @return An array containing the output
|
||||
*/
|
||||
function extractWebrun($xml) {
|
||||
$rsp = array();
|
||||
@ -130,7 +128,7 @@ function extractWebrun($xml) {
|
||||
foreach($nodes->children() as $node){
|
||||
// Get the node name
|
||||
$name = $node->name;
|
||||
|
||||
|
||||
// Get the content
|
||||
$status = $node->data;
|
||||
$status = str_replace(":|:", "\n", $status);
|
||||
@ -147,8 +145,8 @@ function extractWebrun($xml) {
|
||||
/**
|
||||
* Extract the output for a nodels command
|
||||
*
|
||||
* @param $xml The XML output from docmd()
|
||||
* @return An array containing the output
|
||||
* @param $xml The XML output from docmd()
|
||||
* @return An array containing the output
|
||||
*/
|
||||
function extractNodels($xml) {
|
||||
$rsp = array();
|
||||
@ -176,8 +174,8 @@ function extractNodels($xml) {
|
||||
/**
|
||||
* Extract the output for a extnoderange command
|
||||
*
|
||||
* @param $xml The XML output from docmd()
|
||||
* @return The nodes and groups
|
||||
* @param $xml The XML output from docmd()
|
||||
* @return The nodes and groups
|
||||
*/
|
||||
function extractExtnoderange($xml) {
|
||||
$rsp = array();
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
// Retain session variables across page requests
|
||||
session_start();
|
||||
session_write_close(); // Do not block HTTP requests
|
||||
session_write_close(); // Do not block HTTP requests
|
||||
|
||||
// The settings below display error on the screen,
|
||||
// instead of giving blank pages.
|
||||
@ -15,310 +15,286 @@ ini_set('display_errors', true);
|
||||
/**
|
||||
* Run a command using the xCAT client/server protocol
|
||||
*
|
||||
* @param $cmd The xCAT command
|
||||
* @param $nr Node range or group
|
||||
* @param $args_array Command arguments
|
||||
* @param $opts_array Command options
|
||||
* @return A tree of SimpleXML objects.
|
||||
* See perl-xCAT/xCAT/Client.pm for the format
|
||||
* @param $cmd The xCAT command
|
||||
* @param $nr Node range or group
|
||||
* @param $args_array Command arguments
|
||||
* @param $opts_array Command options
|
||||
* @return A tree of SimpleXML objects. See perl-xCAT/xCAT/Client.pm for the format
|
||||
*/
|
||||
function docmd($cmd, $nr, $args_array, $opts_array){
|
||||
// If we are not logged in,
|
||||
// do not try to communicate with xcatd
|
||||
if (!is_logged()) {
|
||||
echo "<p>You are not logged in! Failed to run command.</p>";
|
||||
return simplexml_load_string('<xcat></xcat>', 'SimpleXMLElement', LIBXML_NOCDATA);
|
||||
}
|
||||
// If we are not logged in,
|
||||
// do not try to communicate with xcatd
|
||||
if (!is_logged()) {
|
||||
echo "<p>You are not logged in! Failed to run command.</p>";
|
||||
return simplexml_load_string('<xcat></xcat>', 'SimpleXMLElement', LIBXML_NOCDATA);
|
||||
}
|
||||
|
||||
// Create xCAT request
|
||||
// Add command, node range, and arguments to request
|
||||
$request = simplexml_load_string('<xcatrequest></xcatrequest>');
|
||||
$request->addChild('command', $cmd);
|
||||
if(!empty($nr)) { $request->addChild('noderange', $nr); }
|
||||
if (!empty($args_array)) {
|
||||
foreach ($args_array as $a) {
|
||||
$request->addChild('arg',$a);
|
||||
}
|
||||
}
|
||||
// Create xCAT request
|
||||
// Add command, node range, and arguments to request
|
||||
$request = simplexml_load_string('<xcatrequest></xcatrequest>');
|
||||
$request->addChild('command', $cmd);
|
||||
if (!empty($nr)) { $request->addChild('noderange', $nr); }
|
||||
if (!empty($args_array)) {
|
||||
foreach ($args_array as $a) {
|
||||
$request->addChild('arg',$a);
|
||||
}
|
||||
}
|
||||
|
||||
// Add user and password to request
|
||||
$usernode=$request->addChild('becomeuser');
|
||||
$usernode->addChild('username',$_SESSION["srv_username"]);
|
||||
$usernode->addChild('password',getpassword());
|
||||
// Add user and password to request
|
||||
$usernode=$request->addChild('becomeuser');
|
||||
$usernode->addChild('username',$_SESSION["srv_username"]);
|
||||
$usernode->addChild('password',getpassword());
|
||||
|
||||
$xml = submit_request($request, 0, $opts_array);
|
||||
return $xml;
|
||||
$xml = submit_request($request, 0, $opts_array);
|
||||
return $xml;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by docmd() to submit request to xCAT
|
||||
*
|
||||
* @param $req Tree of SimpleXML objects
|
||||
* @param $opts_array Request options
|
||||
* @return A tree of SimpleXML objects
|
||||
* @param $req Tree of SimpleXML objects
|
||||
* @param $opts_array Request options
|
||||
* @return A tree of SimpleXML objects
|
||||
*/
|
||||
function submit_request($req, $skipVerify, $opts_array){
|
||||
$xcathost = "localhost";
|
||||
$port = "3001";
|
||||
$rsp = FALSE;
|
||||
$response = '';
|
||||
$cleanexit = 0;
|
||||
|
||||
// Determine whether to flush output or not
|
||||
$flush = false;
|
||||
if ($opts_array && in_array("flush", $opts_array)) {
|
||||
$flush = true;
|
||||
}
|
||||
|
||||
// Determine how to handle the flush output
|
||||
// You can specify a function name, in place of TBD, to handle the flush output
|
||||
$flush_format = "";
|
||||
if ($opts_array && in_array("flush-format=TBD", $opts_array)) {
|
||||
$flush_format = "TBD";
|
||||
}
|
||||
|
||||
// Open syslog, include the process ID and also send
|
||||
// the log to standard error, and use a user defined
|
||||
// logging mechanism
|
||||
openlog("xCAT-UI", LOG_PID | LOG_PERROR, LOG_LOCAL0);
|
||||
$xcathost = "localhost";
|
||||
$port = "3001";
|
||||
$rsp = FALSE;
|
||||
$response = '';
|
||||
$cleanexit = 0;
|
||||
|
||||
// Determine whether to flush output or not
|
||||
$flush = false;
|
||||
if ($opts_array && in_array("flush", $opts_array)) {
|
||||
$flush = true;
|
||||
}
|
||||
|
||||
// Determine how to handle the flush output
|
||||
// You can specify a function name, in place of TBD, to handle the flush output
|
||||
$flush_format = "";
|
||||
if ($opts_array && in_array("flush-format=TBD", $opts_array)) {
|
||||
$flush_format = "TBD";
|
||||
}
|
||||
|
||||
// Open syslog, include the process ID and also send
|
||||
// the log to standard error, and use a user defined
|
||||
// logging mechanism
|
||||
openlog("xCAT-UI", LOG_PID | LOG_PERROR, LOG_LOCAL0);
|
||||
|
||||
// Open a socket to xcatd
|
||||
syslog(LOG_INFO, "Opening socket to xcatd...");
|
||||
if($fp = stream_socket_client('ssl://'.$xcathost.':'.$port, $errno, $errstr, 30, STREAM_CLIENT_CONNECT)){
|
||||
$reqXML = $req->asXML();
|
||||
$nr = $req->noderange;
|
||||
$cmd = $req->command;
|
||||
|
||||
syslog(LOG_INFO, "Sending request: $cmd $nr");
|
||||
stream_set_blocking($fp, 0); // Set as non-blocking
|
||||
fwrite($fp,$req->asXML()); // Send XML to xcatd
|
||||
set_time_limit(900); // Set 15 minutes timeout (for long running requests)
|
||||
// The default is 30 seconds which is too short for some requests
|
||||
|
||||
// Turn on output buffering
|
||||
ob_start();
|
||||
while(!feof($fp)) { // Read until there is no more
|
||||
// Remove newlines and add it to the response
|
||||
$str = fread($fp, 8192);
|
||||
if ($str) {
|
||||
$response .= preg_replace('/>\n\s*</', '><', $str);
|
||||
|
||||
// Flush output to browser
|
||||
if ($flush) {
|
||||
// Strip HTML tags from output
|
||||
if ($tmp = trim(strip_tags($str))) {
|
||||
// Format the output based on what was given for $flush_format
|
||||
if ($flush_format == "TDB") {
|
||||
format_TBD($tmp);
|
||||
} else {
|
||||
// Print out output by default
|
||||
echo '<pre style="font-size: 10px;">' . $tmp . '</pre>';
|
||||
ob_flush();
|
||||
flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Look for serverdone response
|
||||
$fullpattern = '/<xcatresponse>\s*<serverdone>\s*<\/serverdone>\s*<\/xcatresponse>/';
|
||||
$mixedpattern = '/<serverdone>\s*<\/serverdone>.*<\/xcatresponse>/';
|
||||
$recentpattern = '/<\/xcatresponse>/';
|
||||
if(preg_match($recentpattern,$str) && preg_match($mixedpattern,$response)) {
|
||||
// Transaction is done,
|
||||
// Package up XML and return it
|
||||
// Remove the serverdone response and put an xcat tag around the rest
|
||||
$count = 0;
|
||||
$response = preg_replace($fullpattern,'', $response, -1, $count); // 1st try to remove the long pattern
|
||||
if (!$count) { $response = preg_replace($mixedpattern,'', $response) . '</xcatresponse>/'; } // if its not there, then remove the short pattern
|
||||
$response = "<xcat>$response</xcat>";
|
||||
//delete the \n between '>' and '<'
|
||||
$response = preg_replace('/>\n\s*</', '><', $response);
|
||||
//replace the '\n' by ':|:' in the data area.
|
||||
$response = preg_replace('/\n/', ':|:', $response);
|
||||
$rsp = simplexml_load_string($response,'SimpleXMLElement', LIBXML_NOCDATA);
|
||||
$cleanexit = 1;
|
||||
break;
|
||||
}
|
||||
} // End of while(!feof($fp))
|
||||
|
||||
syslog(LOG_INFO, "($cmd $nr) Sending response");
|
||||
fclose($fp);
|
||||
} else {
|
||||
echo "<p>xCAT submit request socket error: $errno - $errstr</p>";
|
||||
}
|
||||
|
||||
// Flush (send) the output buffer and turn off output buffering
|
||||
ob_end_flush();
|
||||
// Open a socket to xcatd
|
||||
syslog(LOG_INFO, "Opening socket to xcatd...");
|
||||
if ($fp = stream_socket_client('ssl://'.$xcathost.':'.$port, $errno, $errstr, 30, STREAM_CLIENT_CONNECT)){
|
||||
$reqXML = $req->asXML();
|
||||
$nr = $req->noderange;
|
||||
$cmd = $req->command;
|
||||
|
||||
syslog(LOG_INFO, "Sending request: $cmd $nr");
|
||||
stream_set_blocking($fp, 0); // Set as non-blocking
|
||||
fwrite($fp,$req->asXML()); // Send XML to xcatd
|
||||
set_time_limit(900); // Set 15 minutes timeout (for long running requests)
|
||||
// The default is 30 seconds which is too short for some requests
|
||||
|
||||
// Turn on output buffering
|
||||
ob_start();
|
||||
while(!feof($fp)) { // Read until there is no more
|
||||
// Remove newlines and add it to the response
|
||||
$str = fread($fp, 8192);
|
||||
if ($str) {
|
||||
$response .= preg_replace('/>\n\s*</', '><', $str);
|
||||
|
||||
// Flush output to browser
|
||||
if ($flush) {
|
||||
// Strip HTML tags from output
|
||||
if ($tmp = trim(strip_tags($str))) {
|
||||
// Format the output based on what was given for $flush_format
|
||||
if ($flush_format == "TDB") {
|
||||
format_TBD($tmp);
|
||||
} else {
|
||||
// Print out output by default
|
||||
echo '<pre style="font-size: 10px;">' . $tmp . '</pre>';
|
||||
ob_flush();
|
||||
flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Look for serverdone response
|
||||
$fullpattern = '/<xcatresponse>\s*<serverdone>\s*<\/serverdone>\s*<\/xcatresponse>/';
|
||||
$mixedpattern = '/<serverdone>\s*<\/serverdone>.*<\/xcatresponse>/';
|
||||
$recentpattern = '/<\/xcatresponse>/';
|
||||
if(preg_match($recentpattern,$str) && preg_match($mixedpattern,$response)) {
|
||||
// Transaction is done, package up XML and return it
|
||||
// Remove the serverdone response and put an xcat tag around the rest
|
||||
$count = 0;
|
||||
$response = preg_replace($fullpattern,'', $response, -1, $count); // 1st try to remove the long pattern
|
||||
if (!$count) { $response = preg_replace($mixedpattern,'', $response) . '</xcatresponse>/'; }
|
||||
$response = "<xcat>$response</xcat>";
|
||||
$response = preg_replace('/>\n\s*</', '><', $response);
|
||||
$response = preg_replace('/\n/', ':|:', $response);
|
||||
$rsp = simplexml_load_string($response,'SimpleXMLElement', LIBXML_NOCDATA);
|
||||
$cleanexit = 1;
|
||||
break;
|
||||
}
|
||||
} // End of while(!feof($fp))
|
||||
|
||||
syslog(LOG_INFO, "($cmd $nr) Sending response");
|
||||
fclose($fp);
|
||||
} else {
|
||||
echo "<p>xCAT submit request socket error: $errno - $errstr</p>";
|
||||
}
|
||||
|
||||
// Flush (send) the output buffer and turn off output buffering
|
||||
ob_end_flush();
|
||||
|
||||
// Close syslog
|
||||
closelog();
|
||||
|
||||
if(! $cleanexit) {
|
||||
if (preg_match('/^\s*<xcatresponse>.*<\/xcatresponse>\s*$/',$response)) {
|
||||
// Probably an error message
|
||||
$response = "<xcat>$response</xcat>";
|
||||
$rsp = simplexml_load_string($response,'SimpleXMLElement', LIBXML_NOCDATA);
|
||||
}
|
||||
elseif(!$skipVerify) {
|
||||
echo "<p>(Error) xCAT response ended prematurely: ", htmlentities($response), "</p>";
|
||||
$rsp = FALSE;
|
||||
}
|
||||
}
|
||||
return $rsp;
|
||||
// Close syslog
|
||||
closelog();
|
||||
|
||||
if(! $cleanexit) {
|
||||
if (preg_match('/^\s*<xcatresponse>.*<\/xcatresponse>\s*$/',$response)) {
|
||||
// Probably an error message
|
||||
$response = "<xcat>$response</xcat>";
|
||||
$rsp = simplexml_load_string($response,'SimpleXMLElement', LIBXML_NOCDATA);
|
||||
} else if (!$skipVerify) {
|
||||
echo "<p>(Error) xCAT response ended prematurely: ", htmlentities($response), "</p>";
|
||||
$rsp = FALSE;
|
||||
}
|
||||
}
|
||||
return $rsp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable password storage to split between cookie and session variable
|
||||
*
|
||||
* @param $data
|
||||
* @param $key
|
||||
* @return
|
||||
*/
|
||||
function xorcrypt($data, $key) {
|
||||
$datalen = strlen($data);
|
||||
$keylen = strlen($key);
|
||||
for ($i=0;$i<$datalen;$i++) {
|
||||
$data[$i] = chr(ord($data[$i])^ord($key[$i]));
|
||||
}
|
||||
$datalen = strlen($data);
|
||||
$keylen = strlen($key);
|
||||
for ($i=0;$i<$datalen;$i++) {
|
||||
$data[$i] = chr(ord($data[$i])^ord($key[$i]));
|
||||
}
|
||||
|
||||
return $data;
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get RAND characters
|
||||
*
|
||||
* @param $length Length of characters
|
||||
* @return RAND characters
|
||||
* @param $length Length of characters
|
||||
* @return RAND characters
|
||||
*/
|
||||
function getrandchars($length) {
|
||||
$charset = '0123456789abcdefghijklmnopqrstuvwxyz!@#$%^&*';
|
||||
$charsize = strlen($charset);
|
||||
srand();
|
||||
$chars = '';
|
||||
for ($i=0;$i<$length;$i++) {
|
||||
$num=rand()%$charsize;
|
||||
$chars=$chars.substr($charset,$num,1);
|
||||
}
|
||||
$charset = '0123456789abcdefghijklmnopqrstuvwxyz!@#$%^&*';
|
||||
$charsize = strlen($charset);
|
||||
srand();
|
||||
$chars = '';
|
||||
for ($i=0;$i<$length;$i++) {
|
||||
$num=rand()%$charsize;
|
||||
$chars=$chars.substr($charset,$num,1);
|
||||
}
|
||||
|
||||
return $chars;
|
||||
return $chars;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format a given string and echo it back to the browser
|
||||
*
|
||||
* @param $str String
|
||||
* @return Nothing
|
||||
*/
|
||||
function format_TBD($str) {
|
||||
// Format a given string however you want it
|
||||
echo $tmp . '<br/>';
|
||||
flush();
|
||||
// Format a given string however you want it
|
||||
echo $tmp . '<br/>';
|
||||
flush();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get password
|
||||
*
|
||||
* @param Nothing
|
||||
* @return
|
||||
*/
|
||||
function getpassword() {
|
||||
if (isset($GLOBALS['xcatauthsecret'])) {
|
||||
$cryptext = $GLOBALS['xcatauthsecret'];
|
||||
} else if (isset($_COOKIE["xcatauthsecret"])) {
|
||||
$cryptext = $_COOKIE["xcatauthsecret"];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
if (isset($GLOBALS['xcatauthsecret'])) {
|
||||
$cryptext = $GLOBALS['xcatauthsecret'];
|
||||
} else if (isset($_COOKIE["xcatauthsecret"])) {
|
||||
$cryptext = $_COOKIE["xcatauthsecret"];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return xorcrypt($_SESSION["secretkey"], base64_decode($cryptext));
|
||||
return xorcrypt($_SESSION["secretkey"], base64_decode($cryptext));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the password splitting knowledge between server
|
||||
* and client side persistant storage. Caller should regenerate
|
||||
* session ID when contemplating a new user/password, to preclude
|
||||
* session fixation, though fixation is limited without the secret.
|
||||
* Get the password splitting knowledge between server and client side persistant storage.
|
||||
* Caller should regenerate session ID when contemplating a new user/password,
|
||||
* to preclude session fixation, though fixation is limited without the secret.
|
||||
*
|
||||
* @param $password Password
|
||||
* @return Nothing
|
||||
* @param $password Password
|
||||
*/
|
||||
function setpassword($password) {
|
||||
$randlen = strlen($password);
|
||||
$key = getrandchars($randlen);
|
||||
$cryptext = xorcrypt($password,$key);
|
||||
$randlen = strlen($password);
|
||||
$key = getrandchars($randlen);
|
||||
$cryptext = xorcrypt($password,$key);
|
||||
|
||||
// Non-ascii characters, encode it in base64
|
||||
$cryptext = base64_encode($cryptext);
|
||||
setcookie("xcatauthsecret",$cryptext,0,'/');
|
||||
$GLOBALS["xcatauthsecret"] = $cryptext;
|
||||
$_SESSION["secretkey"] = $key;
|
||||
// Non-ascii characters, encode it in base64
|
||||
$cryptext = base64_encode($cryptext);
|
||||
setcookie("xcatauthsecret",$cryptext,0,'/');
|
||||
$GLOBALS["xcatauthsecret"] = $cryptext;
|
||||
$_SESSION["secretkey"] = $key;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a user/password session exists
|
||||
*
|
||||
* @param Nothing
|
||||
* @return True If user has a session.
|
||||
* False Otherwise
|
||||
* @return True if user has a session, false otherwise
|
||||
*/
|
||||
function is_logged() {
|
||||
if (isset($_SESSION["srv_username"]) and !is_bool(getpassword())) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
if (isset($_SESSION["srv_username"]) and !is_bool(getpassword())) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a user is currently logged in successfully
|
||||
*
|
||||
* @param Nothing
|
||||
* @return True If the user is currently logged in successfully
|
||||
* False Otherwise
|
||||
*
|
||||
* @return True if the user is currently logged in successfully, false otherwise
|
||||
*/
|
||||
function isAuthenticated() {
|
||||
if (is_logged()) {
|
||||
if ($_SESSION["srv_xcatpassvalid"] != 1) {
|
||||
$testcred = docmd("authcheck", "", NULL, NULL);
|
||||
if (isset($testcred->{'xcatresponse'}->{'data'})) {
|
||||
$result = "".$testcred->{'xcatresponse'}->{'data'};
|
||||
if (is_numeric(strpos("Authenticated",$result))) {
|
||||
// Logged in successfully
|
||||
$_SESSION["srv_xcatpassvalid"] = 1;
|
||||
} else {
|
||||
// Not logged in
|
||||
$_SESSION["srv_xcatpassvalid"] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (is_logged()) {
|
||||
if ($_SESSION["srv_xcatpassvalid"] != 1) {
|
||||
$testcred = docmd("authcheck", "", NULL, NULL);
|
||||
if (isset($testcred->{'xcatresponse'}->{'data'})) {
|
||||
$result = "".$testcred->{'xcatresponse'}->{'data'};
|
||||
if (is_numeric(strpos("Authenticated",$result))) {
|
||||
// Logged in successfully
|
||||
$_SESSION["srv_xcatpassvalid"] = 1;
|
||||
} else {
|
||||
// Not logged in
|
||||
$_SESSION["srv_xcatpassvalid"] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_SESSION["srv_xcatpassvalid"]) and $_SESSION["srv_xcatpassvalid"]==1) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
if (isset($_SESSION["srv_xcatpassvalid"]) and $_SESSION["srv_xcatpassvalid"]==1) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Log out of the current user session
|
||||
*
|
||||
* @param Nothing
|
||||
* @return Nothing
|
||||
*/
|
||||
function logout() {
|
||||
// Clear the secret cookie from browser
|
||||
if (isset($_COOKIE["xcatauthsecret"])) {
|
||||
setcookie("xcatauthsecret",'',time()-86400*7,'/');
|
||||
}
|
||||
// Clear the secret cookie from browser
|
||||
if (isset($_COOKIE["xcatauthsecret"])) {
|
||||
setcookie("xcatauthsecret",'',time()-86400*7,'/');
|
||||
}
|
||||
|
||||
// Expire session cookie
|
||||
if (isset($_COOKIE[session_name()])) {
|
||||
setcookie(session_name(),"",time()-86400*7,"/");
|
||||
}
|
||||
// Expire session cookie
|
||||
if (isset($_COOKIE[session_name()])) {
|
||||
setcookie(session_name(),"",time()-86400*7,"/");
|
||||
}
|
||||
|
||||
// Clear server store of data
|
||||
$_SESSION=array();
|
||||
// Clear server store of data
|
||||
$_SESSION=array();
|
||||
}
|
||||
?>
|
||||
|
@ -11,29 +11,29 @@ header("Cache-Control: post-check=0, pre-check=0", false);
|
||||
header("Pragma: no-cache");
|
||||
|
||||
if (isset($_REQUEST["password"])) {
|
||||
// Clear data from session
|
||||
$_SESSION = array();
|
||||
// Clear data from session
|
||||
$_SESSION = array();
|
||||
|
||||
// Zap existing session entirely
|
||||
session_regenerate_id(true);
|
||||
setpassword($_REQUEST["password"]);
|
||||
// Zap existing session entirely
|
||||
session_regenerate_id(true);
|
||||
setpassword($_REQUEST["password"]);
|
||||
|
||||
// Invalid password
|
||||
$_SESSION["srv_xcatpassvalid"] = -1;
|
||||
// Invalid password
|
||||
$_SESSION["srv_xcatpassvalid"] = -1;
|
||||
}
|
||||
|
||||
if (isset($_REQUEST["username"])) {
|
||||
$_SESSION["srv_username"] = $_REQUEST["username"];
|
||||
$_SESSION["srv_username"] = $_REQUEST["username"];
|
||||
|
||||
// Invalid user name
|
||||
$_SESSION["srv_xcatpassvalid"]=-1;
|
||||
// Invalid user name
|
||||
$_SESSION["srv_xcatpassvalid"]=-1;
|
||||
}
|
||||
|
||||
$jdata = array();
|
||||
if (isAuthenticated()) {
|
||||
$jdata["authenticated"]="yes";
|
||||
$jdata["authenticated"]="yes";
|
||||
} else {
|
||||
$jdata["authenticated"]="no";
|
||||
$jdata["authenticated"]="no";
|
||||
}
|
||||
|
||||
echo json_encode($jdata);
|
||||
|
@ -7,30 +7,30 @@ require_once "$TOPDIR/lib/jsonwrapper.php";
|
||||
/**
|
||||
* This will handle system commands, e.g. rpm -qa xCAT
|
||||
*
|
||||
* @param $cmd The system command
|
||||
* @return The system response. Replies are in the form of JSON
|
||||
* @param $cmd The system command
|
||||
* @return The system response. Replies are in the form of JSON
|
||||
*/
|
||||
if (!isAuthenticated()) {
|
||||
echo ("<b>Please login before continuing!</b>");
|
||||
exit;
|
||||
echo ("<b>Please login before continuing!</b>");
|
||||
exit;
|
||||
}
|
||||
|
||||
if (isset($_GET["cmd"])) {
|
||||
// HTTP GET requests
|
||||
$cmd = $_GET["cmd"];
|
||||
$msg = NULL;
|
||||
$ret = "";
|
||||
// HTTP GET requests
|
||||
$cmd = $_GET["cmd"];
|
||||
$msg = NULL;
|
||||
$ret = "";
|
||||
|
||||
if (isset($_GET["msg"])) {
|
||||
$msg = $_GET["msg"];
|
||||
}
|
||||
|
||||
if ($cmd == "ostype") {
|
||||
$ret = strtolower(PHP_OS);
|
||||
} else {
|
||||
$ret = shell_exec($cmd);
|
||||
}
|
||||
if (isset($_GET["msg"])) {
|
||||
$msg = $_GET["msg"];
|
||||
}
|
||||
|
||||
if ($cmd == "ostype") {
|
||||
$ret = strtolower(PHP_OS);
|
||||
} else {
|
||||
$ret = shell_exec($cmd);
|
||||
}
|
||||
|
||||
echo json_encode(array("rsp"=>$ret, "msg" => $msg));
|
||||
echo json_encode(array("rsp"=>$ret, "msg" => $msg));
|
||||
}
|
||||
?>
|
@ -7,8 +7,8 @@ require_once "$TOPDIR/lib/jsonwrapper.php";
|
||||
/**
|
||||
* Replace the contents of an xCAT table
|
||||
*
|
||||
* @param $tab The xCAT table
|
||||
* @param $cont The xCAT table contents
|
||||
* @param $tab The xCAT table
|
||||
* @param $cont The xCAT table contents
|
||||
* @return The xCAT response. Replies are in the form of JSON
|
||||
*/
|
||||
if (isset($_POST["table"])) {
|
||||
@ -24,7 +24,7 @@ $request = simplexml_load_string('<xcatrequest></xcatrequest>');
|
||||
$request->addChild('command', 'tabrestore');
|
||||
|
||||
// Setup authentication
|
||||
$usernode=$request->addChild('becomeuser');
|
||||
$usernode = $request->addChild('becomeuser');
|
||||
$usernode->addChild('username', $_SESSION["username"]);
|
||||
$usernode->addChild('password', getpassword());
|
||||
|
||||
@ -43,7 +43,7 @@ foreach($cont as $line){
|
||||
}
|
||||
|
||||
// Go through each column
|
||||
foreach($line as &$col){
|
||||
foreach ($line as &$col){
|
||||
// If the column does begins and end with a quote
|
||||
// Change quotes to "
|
||||
if(!empty($col) && !preg_match('/^".*"$/', $col)) {
|
||||
@ -55,9 +55,11 @@ foreach($cont as $line){
|
||||
ksort($line, SORT_NUMERIC);
|
||||
$keys = array_keys($line);
|
||||
$max = count($line) - 1;
|
||||
if($keys[$max] != $max){
|
||||
if ($keys[$max] != $max){
|
||||
for ($i = 0; $i <= $keys[$max]; $i++) {
|
||||
if (!isset($line[$i])) {$line[$i]='';}
|
||||
if (!isset($line[$i])) {
|
||||
$line[$i]='';
|
||||
}
|
||||
}
|
||||
ksort($line, SORT_NUMERIC);
|
||||
}
|
||||
|
@ -1,96 +1,87 @@
|
||||
<?php
|
||||
/**
|
||||
* Load page
|
||||
*
|
||||
* @param Nothing
|
||||
* @return Nothing
|
||||
*/
|
||||
function loadPage() {
|
||||
// Include CSS and Javascripts
|
||||
echo
|
||||
'<html>
|
||||
<head>
|
||||
<title>xCAT</title>
|
||||
<link rel="shortcut icon" href="images/favicon.ico">
|
||||
<link href="css/login.css" rel=stylesheet type="text/css">
|
||||
<script type="text/javascript" src="js/jquery/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="js/jquery/jquery-ui.min.js"></script>
|
||||
<script type="text/javascript" src="js/jquery/jquery.cookie.min.js"></script>
|
||||
<script type="text/javascript" src="js/ui.js"></script>
|
||||
</head>';
|
||||
// Include CSS and Javascripts
|
||||
echo
|
||||
'<html>
|
||||
<head>
|
||||
<title>xCAT</title>
|
||||
<link rel="shortcut icon" href="images/favicon.ico">
|
||||
<link href="css/login.css" rel=stylesheet type="text/css">
|
||||
<script type="text/javascript" src="js/jquery/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="js/jquery/jquery-ui.min.js"></script>
|
||||
<script type="text/javascript" src="js/jquery/jquery.cookie.min.js"></script>
|
||||
<script type="text/javascript" src="js/ui.js"></script>
|
||||
</head>';
|
||||
|
||||
// Header menu
|
||||
echo
|
||||
'<body>
|
||||
<div id="header">
|
||||
<ul>
|
||||
<li><img src="images/logo.gif" height="39px" style="margin-right: 60px;"/></li>
|
||||
<li><a href="index.php" class="top_link">Nodes</a></li>
|
||||
<li><a href="configure.php" class="top_link">Configure</a></li>
|
||||
<li><a href="provision.php" class="top_link">Provision</a></li>
|
||||
<li><a href="monitor.php" class="top_link">Monitor</a></li>
|
||||
<li><a href="help.php" class="top_link">Help</a></li>
|
||||
</ul>';
|
||||
|
||||
// User name and log out section
|
||||
if (isset($_SESSION['username'])){
|
||||
echo
|
||||
"<div>
|
||||
<span id='login_user' style='padding: 0 6px; font-weight: bold;'>{$_SESSION['username']}</span> | <a id='xcat_settings'>Settings</a> | <a href='lib/logout.php'>Log out</a>
|
||||
</div>";
|
||||
}
|
||||
// Header menu
|
||||
echo
|
||||
'<body>
|
||||
<div id="header">
|
||||
<ul>
|
||||
<li><img src="images/logo.gif" height="39px" style="margin-right: 60px;"/></li>
|
||||
<li><a href="index.php" class="top_link">Nodes</a></li>
|
||||
<li><a href="configure.php" class="top_link">Configure</a></li>
|
||||
<li><a href="provision.php" class="top_link">Provision</a></li>
|
||||
<li><a href="monitor.php" class="top_link">Monitor</a></li>
|
||||
<li><a href="help.php" class="top_link">Help</a></li>
|
||||
</ul>';
|
||||
|
||||
// User name and log out section
|
||||
if (isset($_SESSION['username'])){
|
||||
echo
|
||||
"<div>
|
||||
<span id='login_user' style='padding: 0 6px; font-weight: bold;'>{$_SESSION['username']}</span> | <a id='xcat_settings'>Settings</a> | <a href='lib/logout.php'>Log out</a>
|
||||
</div>";
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
// Content
|
||||
echo '<div class="content" id="content"></div>';
|
||||
echo '</div>';
|
||||
// Content
|
||||
echo '<div class="content" id="content"></div>';
|
||||
|
||||
// End of page
|
||||
echo
|
||||
'</body>
|
||||
</html>';
|
||||
// End of page
|
||||
echo
|
||||
'</body>
|
||||
</html>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Load page content
|
||||
*
|
||||
* @param Nothing
|
||||
* @return Nothing
|
||||
*/
|
||||
function loadContent() {
|
||||
// Initialize page
|
||||
echo
|
||||
'<script language="JavaScript" type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
initPage();
|
||||
});
|
||||
</script>';
|
||||
// Initialize page
|
||||
echo
|
||||
'<script language="JavaScript" type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
initPage();
|
||||
});
|
||||
</script>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Login user into a new session
|
||||
*
|
||||
* @param Nothing
|
||||
* @return Nothing
|
||||
*/
|
||||
function login() {
|
||||
// xcatauth.js will open a dialog box
|
||||
// asking for the user name and password
|
||||
echo
|
||||
'<script src="js/jquery/jquery.cookie.min.js" type="text/javascript"></script>
|
||||
<script src="js/xcatauth.js" type="text/javascript"></script>
|
||||
<div id="login">
|
||||
<div id="login_form">
|
||||
<table>
|
||||
<tr><td colspan=5></td></tr>
|
||||
<tr><td align=right><img src="images/logo.png" width="50" height="35"></img></td><td colspan=4 style="font-size: 18px;">eXtreme Cloud Administration Toolkit</td></tr>
|
||||
<tr><td colspan=5></td></tr>
|
||||
<tr><td></td><td><label for=username>User name:</label></td><td colspan=2><input type=text name=username></td><td></td></tr>
|
||||
<tr><td></td><td><label for=password>Password:</label></td><td colspan=2><input type=password name=password></td><td></td></tr>
|
||||
<tr><td></td><td></td><td></td><td align=right><button style="padding: 5px;">Login</button></td><td></td></tr>
|
||||
<tr><td></td><td colspan=4><span id=login_status></span></td></tr>
|
||||
</table>
|
||||
</div>
|
||||
<div id="loginfo">Open Source. EPL License.</div>
|
||||
</div>';
|
||||
// xcatauth.js will open a dialog box
|
||||
// asking for the user name and password
|
||||
echo
|
||||
'<script src="js/jquery/jquery.cookie.min.js" type="text/javascript"></script>
|
||||
<script src="js/xcatauth.js" type="text/javascript"></script>
|
||||
<div id="login">
|
||||
<div id="login-form">
|
||||
<table>
|
||||
<tr><td colspan=5></td></tr>
|
||||
<tr><td align=right><img src="images/logo.png" width="50" height="35"></img></td><td colspan=4 style="font-size: 18px;">eXtreme Cloud Administration Toolkit</td></tr>
|
||||
<tr><td colspan=5></td></tr>
|
||||
<tr><td></td><td><label for=username>User name:</label></td><td colspan=2><input type=text name=username></td><td></td></tr>
|
||||
<tr><td></td><td><label for=password>Password:</label></td><td colspan=2><input type=password name=password></td><td></td></tr>
|
||||
<tr><td></td><td></td><td></td><td align=right><button style="padding: 5px;">Login</button></td><td></td></tr>
|
||||
<tr><td></td><td colspan=4><span id=login-status></span></td></tr>
|
||||
</table>
|
||||
</div>
|
||||
<div id="log-info">Open Source. EPL License.</div>
|
||||
</div>';
|
||||
}
|
||||
?>
|
@ -4,26 +4,26 @@
|
||||
*/
|
||||
$type = $_FILES["file"]["type"];
|
||||
if ($type == "text/plain" || $type == "application/octet-stream" || $type == "application/x-shellscript" || $type == "application/x-sh") {
|
||||
$error = $_FILES["file"]["error"];
|
||||
if ($error) {
|
||||
echo "Return Code: " . $error;
|
||||
} else {
|
||||
$file = $_FILES["file"]["name"];
|
||||
$path = "/var/tmp/" . $file;
|
||||
move_uploaded_file($_FILES["file"]["tmp_name"], $path);
|
||||
$error = $_FILES["file"]["error"];
|
||||
if ($error) {
|
||||
echo "Return Code: " . $error;
|
||||
} else {
|
||||
$file = $_FILES["file"]["name"];
|
||||
$path = "/var/tmp/" . $file;
|
||||
move_uploaded_file($_FILES["file"]["tmp_name"], $path);
|
||||
|
||||
// Open and read given file
|
||||
$handler = fopen($path, "r");
|
||||
$data = fread($handler, filesize($path));
|
||||
fclose($handler);
|
||||
// Open and read given file
|
||||
$handler = fopen($path, "r");
|
||||
$data = fread($handler, filesize($path));
|
||||
fclose($handler);
|
||||
|
||||
// Print out file contents
|
||||
echo $data;
|
||||
// Print out file contents
|
||||
echo $data;
|
||||
|
||||
// Remove this file
|
||||
unlink($path);
|
||||
}
|
||||
// Remove this file
|
||||
unlink($path);
|
||||
}
|
||||
} else {
|
||||
echo "(Error) File type $type not supported";
|
||||
echo "(Error) File type $type not supported";
|
||||
}
|
||||
?>
|
@ -7,9 +7,9 @@ require_once "$TOPDIR/lib/jsonwrapper.php";
|
||||
/**
|
||||
* Issue an xCAT command (only for z)
|
||||
*
|
||||
* @param $cmd The xCAT command
|
||||
* @param $tgt The target node or group
|
||||
* @param $args The xCAT command arguments, separated by semicolons
|
||||
* @param $cmd The xCAT command
|
||||
* @param $tgt The target node or group
|
||||
* @param $args The xCAT command arguments, separated by semicolons
|
||||
* @return The xCAT response. Replies are in the form of JSON
|
||||
*/
|
||||
if (isset($_GET["cmd"])) {
|
||||
@ -56,7 +56,7 @@ if (isset($_GET["cmd"])) {
|
||||
$rsp = array();
|
||||
|
||||
// Replace user entry
|
||||
if(strncasecmp($cmd, "chvm", 4) == 0 && strncasecmp($arr[0], "--replacevs", 11) == 0) {
|
||||
if (strncasecmp($cmd, "chvm", 4) == 0 && strncasecmp($arr[0], "--replacevs", 11) == 0) {
|
||||
// Directory /var/tmp permissions = 777
|
||||
// You can write anything to that directory
|
||||
$userEntry = "/var/tmp/$tgt.txt";
|
||||
@ -77,7 +77,7 @@ if (isset($_GET["cmd"])) {
|
||||
}
|
||||
|
||||
// Create virtual server
|
||||
else if(strncasecmp($cmd, "mkvm", 4) == 0) {
|
||||
else if (strncasecmp($cmd, "mkvm", 4) == 0) {
|
||||
// Directory /var/tmp permissions = 777
|
||||
// You can write anything to that directory
|
||||
$userEntry = "/var/tmp/$tgt.txt";
|
||||
|
@ -10,8 +10,8 @@ loadPage();
|
||||
|
||||
/* Login user */
|
||||
if (!isAuthenticated()) {
|
||||
login();
|
||||
login();
|
||||
} else {
|
||||
loadContent();
|
||||
loadContent();
|
||||
}
|
||||
?>
|
@ -10,8 +10,8 @@ loadPage();
|
||||
|
||||
/* Login user */
|
||||
if (!isAuthenticated()) {
|
||||
login();
|
||||
login();
|
||||
} else {
|
||||
loadContent();
|
||||
loadContent();
|
||||
}
|
||||
?>
|
@ -1,21 +1,21 @@
|
||||
<?php
|
||||
echo <<<EEE
|
||||
<html>
|
||||
<head>
|
||||
<title>{$_GET['rconsnd']}</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
|
||||
<link rel="stylesheet" type="text/css" href="css/ajaxterm.css"/>
|
||||
<script type="text/javascript" src="js/jquery/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="js/rcons/rcons.js"></script>
|
||||
<script type="text/javascript">
|
||||
window.onload=function() {
|
||||
t=new rconsTerm("{$_GET['rconsnd']}", 80, 25);
|
||||
};
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="term"></div>
|
||||
</body>
|
||||
<head>
|
||||
<title>{$_GET['rconsnd']}</title>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
|
||||
<link rel="stylesheet" type="text/css" href="css/ajaxterm.css"/>
|
||||
<script type="text/javascript" src="js/jquery/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="js/rcons/rcons.js"></script>
|
||||
<script type="text/javascript">
|
||||
window.onload=function() {
|
||||
t=new rconsTerm("{$_GET['rconsnd']}", 80, 25);
|
||||
};
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="term"></div>
|
||||
</body>
|
||||
</html>
|
||||
EEE;
|
||||
?>
|
||||
|
@ -12,30 +12,30 @@ require_once "lib/jsonwrapper.php";
|
||||
// Include CSS and Javascripts
|
||||
echo
|
||||
'<html>
|
||||
<head>
|
||||
<title>xCAT Service Portal</title>
|
||||
<link rel="shortcut icon" href="images/favicon.ico">
|
||||
<link href="css/login.css" rel=stylesheet type="text/css">
|
||||
<script type="text/javascript" src="js/jquery/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="js/jquery/jquery-ui.min.js"></script>
|
||||
<script type="text/javascript" src="js/jquery/jquery.cookie.min.js"></script>
|
||||
<script type="text/javascript" src="js/ui.js"></script>
|
||||
<script type="text/javascript" src="js/service/service.js"></script>
|
||||
</head>';
|
||||
<head>
|
||||
<title>xCAT Service Portal</title>
|
||||
<link rel="shortcut icon" href="images/favicon.ico">
|
||||
<link href="css/login.css" rel=stylesheet type="text/css">
|
||||
<script type="text/javascript" src="js/jquery/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="js/jquery/jquery-ui.min.js"></script>
|
||||
<script type="text/javascript" src="js/jquery/jquery.cookie.min.js"></script>
|
||||
<script type="text/javascript" src="js/ui.js"></script>
|
||||
<script type="text/javascript" src="js/service/service.js"></script>
|
||||
</head>';
|
||||
|
||||
// Create header menu
|
||||
echo
|
||||
'<body>
|
||||
<div id="header" class="ui-widget-header">
|
||||
<img style="margin: 0px 20px; position: relative; float: left;" src="images/logo.gif" height="100%"/>
|
||||
<div style="margin: 10px 20px; position: relative; float: left; color: white; font: bold 14px sans-serif;">xCAT Service Portal</div>';
|
||||
|
||||
<div id="header" class="ui-widget-header">
|
||||
<img style="margin: 0px 20px; position: relative; float: left;" src="images/logo.gif" height="100%"/>
|
||||
<div style="margin: 10px 20px; position: relative; float: left; color: white; font: bold 14px sans-serif;">xCAT Service Portal</div>';
|
||||
|
||||
// Create user name and log out section
|
||||
if (isset($_SESSION['srv_username'])){
|
||||
echo
|
||||
"<div>
|
||||
<span style='padding: 0 6px; color: white; font-weight: bold;'>{$_SESSION['srv_username']}</span> | <a id='xcat_settings'>Settings</a> | <a href='lib/srv_logout.php'>Log out</a>
|
||||
</div>";
|
||||
echo
|
||||
"<div>
|
||||
<span style='padding: 0 6px; color: white; font-weight: bold;'>{$_SESSION['srv_username']}</span> | <a id='xcat_settings'>Settings</a> | <a href='lib/srv_logout.php'>Log out</a>
|
||||
</div>";
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
@ -45,35 +45,35 @@ echo '<div class="content" id="content"></div>';
|
||||
|
||||
// End of page
|
||||
echo
|
||||
'</body>
|
||||
'</body>
|
||||
</html>';
|
||||
|
||||
// Login user
|
||||
if (!isAuthenticated()) {
|
||||
// xcatauth.js will open a dialog box asking for the user name and password
|
||||
echo
|
||||
'<script src="js/srv_xcatauth.js" type="text/javascript"></script>
|
||||
<div id="login">
|
||||
<div id="login_form">
|
||||
<table>
|
||||
<tr><td colspan=5></td></tr>
|
||||
<tr><td align=right><img src="images/logo.png" width="50" height="35"></img></td><td colspan=4 style="font-size: 18px;">eXtreme Cloud Administration Toolkit</td></tr>
|
||||
<tr><td colspan=5></td></tr>
|
||||
<tr><td></td><td><label for=username>User name:</label></td><td colspan=2><input type=text name=username></td><td></td></tr>
|
||||
<tr><td></td><td><label for=password>Password:</label></td><td colspan=2><input type=password name=password></td><td></td></tr>
|
||||
<tr><td></td><td></td><td></td><td align=right><button style="padding: 5px;">Login</button></td><td></td></tr>
|
||||
<tr><td></td><td colspan=4><span id=login_status></span></td></tr>
|
||||
</table>
|
||||
</div>
|
||||
<div id="loginfo">Open Source. EPL License.</div>
|
||||
</div>';
|
||||
// xcatauth.js will open a dialog box asking for the user name and password
|
||||
echo
|
||||
'<script src="js/srv_xcatauth.js" type="text/javascript"></script>
|
||||
<div id="login">
|
||||
<div id="login-form">
|
||||
<table>
|
||||
<tr><td colspan=5></td></tr>
|
||||
<tr><td align=right><img src="images/logo.png" width="50" height="35"></img></td><td colspan=4 style="font-size: 18px;">eXtreme Cloud Administration Toolkit</td></tr>
|
||||
<tr><td colspan=5></td></tr>
|
||||
<tr><td></td><td><label for=username>User name:</label></td><td colspan=2><input type=text name=username></td><td></td></tr>
|
||||
<tr><td></td><td><label for=password>Password:</label></td><td colspan=2><input type=password name=password></td><td></td></tr>
|
||||
<tr><td></td><td></td><td></td><td align=right><button style="padding: 5px;">Login</button></td><td></td></tr>
|
||||
<tr><td></td><td colspan=4><span id=login-status></span></td></tr>
|
||||
</table>
|
||||
</div>
|
||||
<div id="log-info">Open Source. EPL License.</div>
|
||||
</div>';
|
||||
} else {
|
||||
// Initialize page
|
||||
echo
|
||||
'<script language="JavaScript" type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
initServicePage();
|
||||
});
|
||||
</script>';
|
||||
// Initialize page
|
||||
echo
|
||||
'<script language="JavaScript" type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
initServicePage();
|
||||
});
|
||||
</script>';
|
||||
}
|
||||
?>
|
||||
|
@ -82,6 +82,16 @@ mkdir -p $RPM_BUILD_ROOT%{prefix}/ui
|
||||
cp -r * $RPM_BUILD_ROOT%{prefix}/ui
|
||||
chmod 755 $RPM_BUILD_ROOT%{prefix}/ui/*
|
||||
|
||||
# Copy over xCAT UI plugins
|
||||
mkdir -p $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin
|
||||
cp xcat/plugins/* $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin
|
||||
chmod 644 $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/web.pm
|
||||
chmod 644 $RPM_BUILD_ROOT/%{prefix}/lib/perl/xCAT_plugin/webportal.pm
|
||||
|
||||
# Create symbolic link to webportal command
|
||||
mkdir -p $RPM_BUILD_ROOT/%{prefix}/bin
|
||||
ln -sf ../bin/xcatclientnnr $RPM_BUILD_ROOT/%{prefix}/bin/webportal
|
||||
|
||||
%files
|
||||
%defattr(-,root,root)
|
||||
%{prefix}
|
||||
@ -110,7 +120,7 @@ chmod 755 $RPM_BUILD_ROOT%{prefix}/ui/*
|
||||
echo "Installing xCAT-UI on AIX..."
|
||||
else
|
||||
echo ""
|
||||
echo "Error! IBM HTTP Server is not installed or not installed in the default directory (/usr/IBM/HTTPServer/)."
|
||||
echo "Error! IBM HTTP Server has not been installed or has not been installed in the default directory (/usr/IBM/HTTPServer/)."
|
||||
exit -1;
|
||||
fi
|
||||
%endif
|
||||
@ -141,10 +151,7 @@ chmod 755 $RPM_BUILD_ROOT%{prefix}/ui/*
|
||||
|
||||
if [ "$1" = 1 ] || [ "$1" = 2 ] # Install or upgrade
|
||||
then
|
||||
# Copy xCAT plugins to /opt/xcat/lib/perl/xCAT_plugin
|
||||
cp %{prefix}/ui/xcat/plugins/web.pm /opt/xcat/lib/perl/xCAT_plugin/
|
||||
cp %{prefix}/ui/xcat/plugins/webportal.pm /opt/xcat/lib/perl/xCAT_plugin/
|
||||
/bin/ln -s /opt/xcat/bin/xcatclientnnr /opt/xcat/bin/webportal
|
||||
# Restart xCAT
|
||||
/etc/init.d/xcatd restart
|
||||
|
||||
# Copy php.ini file into /opt/xcat/ui and turn off output_buffering
|
||||
@ -154,7 +161,7 @@ chmod 755 $RPM_BUILD_ROOT%{prefix}/ui/*
|
||||
/bin/sed /etc/php5/apache2/php.ini -e 's/output_buffering = 4096/output_buffering = Off/g' > %{prefix}/ui/php.ini
|
||||
fi
|
||||
|
||||
# Restart Apache Web Server
|
||||
# Restart Apache Server
|
||||
/etc/init.d/$apachedaemon restart
|
||||
true
|
||||
fi
|
||||
@ -167,7 +174,7 @@ chmod 755 $RPM_BUILD_ROOT%{prefix}/ui/*
|
||||
echo "Updating IBM HTTP server configuration for xCAT..."
|
||||
bin/rm -f /usr/IBM/HTTPServer/conf/xcat-ui.conf
|
||||
cp /usr/IBM/HTTPServer/conf/httpd.conf /usr/IBM/HTTPServer/conf/httpd.conf.xcat.ui.bak
|
||||
cat /opt/xcat/ui/etc/apache2/conf.d/xcat-ui.conf >> /usr/IBM/HTTPServer/conf/httpd.conf
|
||||
cat ../ui/etc/apache2/conf.d/xcat-ui.conf >> /usr/IBM/HTTPServer/conf/httpd.conf
|
||||
/usr/IBM/HTTPServer/bin/apachectl restart
|
||||
|
||||
# Put the encrypted password in /etc/security/passwd into the xcat passwd database
|
||||
@ -210,4 +217,4 @@ chmod 755 $RPM_BUILD_ROOT%{prefix}/ui/*
|
||||
rm -rf /usr/IBM/HTTPServer/conf/httpd.conf.xcat.ui.bak
|
||||
fi
|
||||
/usr/IBM/HTTPServer/bin/apachectl restart
|
||||
%endif
|
||||
%endif
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user