Refactor and enhance code readability across multiple components
- Updated SQL query in `VMs-Backups.php` to include `policy` condition. - Improved formatting and indentation in `StdOut-detail.php`, `StdOut.php`, and `Server-Detail.php`. - Simplified conditional checks and removed redundant spaces for better clarity. - Modified `.idea/sqldialects.xml` file to add new SQL dialect mappings.
This commit is contained in:
@@ -24,162 +24,222 @@
|
||||
<script src="/js/tableExport.min.js"></script>
|
||||
<script src="/js/bootstrap-table-export.min.js"></script>
|
||||
<script src="/js/libs/js-xlsx/xlsx.core.min.js"></script>
|
||||
|
||||
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body class="bg-light text-dark">
|
||||
<?php include $_SERVER['DOCUMENT_ROOT'] . "/include/all.php"; ?> <!-- Include All -->
|
||||
<?php $script = $_GET['s']; ?>
|
||||
<!-- HTML -->
|
||||
<div class="container-fluid" id="content">
|
||||
<div class="row flex-nowrap">
|
||||
<!-- Left NAVBAR -->
|
||||
<div class="col-auto col-md-2 col-xl-2 px-sm-2 px-0 bg-dark" style="-ms-flex: 0 0 230px;flex: 0 0 230px;">
|
||||
<?php include $_SERVER['DOCUMENT_ROOT'] . "/navbar.html"; ?>
|
||||
</div>
|
||||
<!-- Display -->
|
||||
<div class="col py-3">
|
||||
<!-- Page Title -->
|
||||
<h1><span class="badge text-bg-secondary font-weight-bold" style="width:100%;">Script <b><?php echo $script; ?></b> Details</span></h1>
|
||||
<?php include $_SERVER['DOCUMENT_ROOT'] . "/include/all.php"; ?> <!-- Include All -->
|
||||
<?php $script = $_GET['s']; ?>
|
||||
<!-- HTML -->
|
||||
<div class="container-fluid" id="content">
|
||||
<div class="row flex-nowrap">
|
||||
<!-- Left NAVBAR -->
|
||||
<div class="col-auto col-md-2 col-xl-2 px-sm-2 px-0 bg-dark" style="-ms-flex: 0 0 230px;flex: 0 0 230px;">
|
||||
<?php include $_SERVER['DOCUMENT_ROOT'] . "/navbar.html"; ?>
|
||||
</div>
|
||||
<!-- Display -->
|
||||
<div class="col py-3">
|
||||
<!-- Page Title -->
|
||||
<h1><span class="badge text-bg-secondary font-weight-bold"
|
||||
style="width:100%;">Script <b><?php echo $script; ?></b> Details</span></h1>
|
||||
|
||||
<!-- Main content -->
|
||||
<div class="container-fluid">
|
||||
<!-- MODAL WAIT -->
|
||||
<div class="modal fade bs-example-modal-sm" id="wait" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static" style="padding-top: 15%;">
|
||||
<div class="modal-dialog modal-sm">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title mb-1 text-dark text-uppercase">
|
||||
<center><i class="bi bi-hourglass-split"></i><br> Work in progress ...</center>
|
||||
</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="progress">
|
||||
<div class="progress-bar progress-bar-secondary progress-bar-striped progress-bar-animated" style="width: 100%"></div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Main content -->
|
||||
<div class="container-fluid">
|
||||
<!-- MODAL WAIT -->
|
||||
<div class="modal fade bs-example-modal-sm" id="wait" tabindex="-1" role="dialog" aria-hidden="true"
|
||||
data-backdrop="static" style="padding-top: 15%;">
|
||||
<div class="modal-dialog modal-sm">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title mb-1 text-dark text-uppercase text-center" style="font-size: 1.2rem;">
|
||||
<i class="bi bi-hourglass-split"></i><br> Work in progress ...
|
||||
</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="progress">
|
||||
<div class="progress-bar progress-bar-secondary progress-bar-striped progress-bar-animated"
|
||||
style="width: 100%"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- TABLE -->
|
||||
<div>
|
||||
<?php // DATA
|
||||
$aix=$linux=$dun=$azt=$other="Checked";
|
||||
$where = " and OS_TYPE IN (";
|
||||
if (isset($_GET['AIX'])) {if ($_GET['AIX'] == 1) {$aix = "Checked"; $where .= "'AIX',";} else {$aix = "Unchecked";}} else {$aix = "Unchecked";}
|
||||
if (isset($_GET['linux'])) {if ($_GET['linux'] == 1) {$linux = "Checked"; $where .= "'LINUX',";} else {$linux = "Unchecked";}} else {$linux = "Unchecked";}
|
||||
$where = rtrim($where,',').")";
|
||||
$site = "";
|
||||
if (isset($_GET['DUN'])) {if ($_GET['DUN'] == 1) {$dun = "Checked"; $site .= " or UPPER(HOSTNAME) like 'DUN%' or UPPER(HOSTNAME) like 'DMV%' or UPPER(HOSTNAME) like 'MDK%' or UPPER(HOSTNAME) like 'APPQPC%'";} else {$dun = "Unchecked";}} else {$dun = "Unchecked";}
|
||||
if (isset($_GET['AZT'])) {if ($_GET['AZT'] == 1) {$azt = "Checked"; $site .=" or UPPER(HOSTNAME) like 'AZT%'";} else {$azt = "Unchecked";}} else {$azt = "Unchecked";}
|
||||
if (isset($_GET['other'])) {if ($_GET['other'] == 1) {$other = "Checked"; $site .=" or UPPER(HOSTNAME) like 'BAD%' or UPPER(HOSTNAME) like 'FLO%' or UPPER(HOSTNAME) like 'MON%'";} else {$other = "Unchecked";}} else {$other = "Unchecked";}
|
||||
$site = " and (".ltrim($site,' or').") ";
|
||||
$where .= $site ;
|
||||
</div>
|
||||
<!-- TABLE -->
|
||||
<div>
|
||||
<?php // DATA
|
||||
$aix = $linux = $dun = $azt = $other = "Checked";
|
||||
$where = " and OS_TYPE IN (";
|
||||
if (isset($_GET['AIX'])) {
|
||||
if ($_GET['AIX'] == 1) {
|
||||
$where .= "'AIX',";
|
||||
} else {
|
||||
$aix = "Unchecked";
|
||||
}
|
||||
} else {
|
||||
$aix = "Unchecked";
|
||||
}
|
||||
if (isset($_GET['linux'])) {
|
||||
if ($_GET['linux'] == 1) {
|
||||
$where .= "'LINUX',";
|
||||
} else {
|
||||
$linux = "Unchecked";
|
||||
}
|
||||
} else {
|
||||
$linux = "Unchecked";
|
||||
}
|
||||
$where = rtrim($where, ',') . ")";
|
||||
$site = "";
|
||||
if (isset($_GET['DUN'])) {
|
||||
if ($_GET['DUN'] == 1) {
|
||||
$site .= " or UPPER(HOSTNAME) like 'DUN%' or UPPER(HOSTNAME) like 'DMV%' or UPPER(HOSTNAME) like 'MDK%' or UPPER(HOSTNAME) like 'APPQPC%'";
|
||||
} else {
|
||||
$dun = "Unchecked";
|
||||
}
|
||||
} else {
|
||||
$dun = "Unchecked";
|
||||
}
|
||||
if (isset($_GET['AZT'])) {
|
||||
if ($_GET['AZT'] == 1) {
|
||||
$site .= " or UPPER(HOSTNAME) like 'AZT%'";
|
||||
} else {
|
||||
$azt = "Unchecked";
|
||||
}
|
||||
} else {
|
||||
$azt = "Unchecked";
|
||||
}
|
||||
if (isset($_GET['other'])) {
|
||||
if ($_GET['other'] == 1) {
|
||||
$site .= " or UPPER(HOSTNAME) like 'BAD%' or UPPER(HOSTNAME) like 'FLO%' or UPPER(HOSTNAME) like 'MON%'";
|
||||
} else {
|
||||
$other = "Unchecked";
|
||||
}
|
||||
} else {
|
||||
$other = "Unchecked";
|
||||
}
|
||||
$site = " and (" . ltrim($site, ' or') . ") ";
|
||||
$where .= $site;
|
||||
|
||||
$sql = "select hostname, os_type from srvall where decomtime is null and (ucase(filter) not like 'X_%' or filter is null) $where order by hostname";
|
||||
$hosts = Invoke_aixcmdb($sql);
|
||||
$sql = "select hostname, os_type from srvall where decomtime is null and (ucase(filter) not like 'X_%' or filter is null) $where order by hostname";
|
||||
$hosts = Invoke_aixcmdb($sql);
|
||||
|
||||
$taix=$aixok=$aixko=$tlinux=$linuxok=$linuxko=0;
|
||||
#print_r($hosts);
|
||||
?>
|
||||
<form class="row">
|
||||
<div class="col border rounded">
|
||||
<b>Filters : </b>
|
||||
<div class="form-check form-check-inline form-switch">
|
||||
<input class="form-check-input" type="checkbox" role="switch" id="AIX" <?php echo $aix; ?>
|
||||
name="AIX" value="1">
|
||||
<label class="form-check-label" for="None">AIX</label>
|
||||
</div>
|
||||
|
||||
<div class="form-check form-check-inline form-switch">
|
||||
<input class="form-check-input" type="checkbox" role="switch" id="linux" <?php echo $linux; ?>
|
||||
name="linux" value="1">
|
||||
<label class="form-check-label" for="Manu">Linux</label>
|
||||
</div>
|
||||
|
|
||||
<div class="form-check form-check-inline form-switch">
|
||||
<input class="form-check-input" type="checkbox" role="switch" id="DUN" <?php echo $dun; ?>
|
||||
name="DUN" value="1">
|
||||
<label class="form-check-label" for="Done">DMV/DUN/MDK</label>
|
||||
</div>
|
||||
|
||||
<div class="form-check form-check-inline form-switch">
|
||||
<input class="form-check-input" type="checkbox" role="switch" id="AZT" <?php echo $azt; ?>
|
||||
name="AZT" value="1">
|
||||
<label class="form-check-label" for="Done">Azure</label>
|
||||
</div>
|
||||
|
||||
<div class="form-check form-check-inline form-switch">
|
||||
<input class="form-check-input" type="checkbox" role="switch" id="other" <?php echo $other; ?>
|
||||
name="other" value="1">
|
||||
<label class="form-check-label" for="Done">Other</label>
|
||||
</div>
|
||||
<input type="hidden" name="s" value="<?php echo $script; ?>">
|
||||
<button type="submit" class="btn btn-success btn-small mb-2 mt-2">Apply</button>
|
||||
$taix = $aixok = $aixko = $tlinux = $linuxok = $linuxko = 0;
|
||||
#print_r($hosts);
|
||||
?>
|
||||
<form class="row">
|
||||
<div class="col border rounded">
|
||||
<b>Filters : </b>
|
||||
<div class="form-check form-check-inline form-switch">
|
||||
<input class="form-check-input" type="checkbox" role="switch" id="AIX" <?php echo $aix; ?>
|
||||
name="AIX" value="1">
|
||||
<label class="form-check-label" for="AIX">AIX</label>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
|
||||
<table class='table table-bordered table-hover table-sm' id='t1' data-height="620" data-toggle="table" data-search="true" data-show-columns="true" data-export-types="['xlsx','csv','json']" data-show-export="true" data-sortable="true" data-sort-name="vm">
|
||||
|
||||
<div class="form-check form-check-inline form-switch">
|
||||
<input class="form-check-input" type="checkbox" role="switch" id="linux" <?php echo $linux; ?>
|
||||
name="linux" value="1">
|
||||
<label class="form-check-label" for="linux">Linux</label>
|
||||
</div>
|
||||
|
|
||||
<div class="form-check form-check-inline form-switch">
|
||||
<input class="form-check-input" type="checkbox" role="switch" id="DUN" <?php echo $dun; ?>
|
||||
name="DUN" value="1">
|
||||
<label class="form-check-label" for="DUN">DMV/DUN/MDK</label>
|
||||
</div>
|
||||
|
||||
<div class="form-check form-check-inline form-switch">
|
||||
<input class="form-check-input" type="checkbox" role="switch" id="AZT" <?php echo $azt; ?>
|
||||
name="AZT" value="1">
|
||||
<label class="form-check-label" for="AZT">Azure</label>
|
||||
</div>
|
||||
|
||||
<div class="form-check form-check-inline form-switch">
|
||||
<input class="form-check-input" type="checkbox" role="switch" id="other" <?php echo $other; ?>
|
||||
name="other" value="1">
|
||||
<label class="form-check-label" for="other">Other</label>
|
||||
</div>
|
||||
<input type="hidden" name="s" value="<?php echo $script; ?>">
|
||||
<button type="submit" class="btn btn-success btn-small mb-2 mt-2">Apply</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
|
||||
<table class='table table-bordered table-hover table-sm' id='t1' data-height="620" data-toggle="table"
|
||||
data-search="true" data-show-columns="true" data-export-types="['xlsx','csv','json']"
|
||||
data-show-export="true" data-sortable="true" data-sort-name="vm">
|
||||
<thead> <!-- Header -->
|
||||
<th data-field='host' data-sortable='true'>Host</th>
|
||||
<th data-field='OS' data-sortable='true'>OS</th>
|
||||
<th data-field='TimeStamp' data-sortable='true'>TimeStamp</th>
|
||||
<th data-field='RC' data-sortable='true'>RC</th>
|
||||
<th data-field='Result' data-sortable='true'>StdOut</th>
|
||||
<th data-field='host' data-sortable='true'>Host</th>
|
||||
<th data-field='OS' data-sortable='true'>OS</th>
|
||||
<th data-field='TimeStamp' data-sortable='true'>TimeStamp</th>
|
||||
<th data-field='RC' data-sortable='true'>RC</th>
|
||||
<th data-field='Result' data-sortable='true'>StdOut</th>
|
||||
</thead>
|
||||
|
||||
<tbody> <!-- Body -->
|
||||
<?php
|
||||
foreach($hosts as $h){
|
||||
$host = strtoupper($h['HOSTNAME']);
|
||||
$os = strtoupper($h['OS_TYPE']);
|
||||
if(strtoupper($h['OS_TYPE']) == "AIX"){$taix++;}else{$tlinux++;}
|
||||
$answer = Invoke_infra("SELECT * FROM x_stdout where cmd ='$script' and host ='$host'");
|
||||
if(is_array($answer)){
|
||||
$rc = $answer[0]['rc'];
|
||||
$stdout = $answer[0]['stdout'];
|
||||
$ts = $answer[0]['ts'];
|
||||
if(strtoupper($h['OS_TYPE']) == "AIX"){
|
||||
if($rc == 0 && (string)$rc <> ""){$aixok++;}else{if((string)$rc <> ""){$aixko++;}}
|
||||
}else{
|
||||
if($rc == 0 && (string)$rc <> ""){$linuxok++;}else{if((string)$rc <> ""){$linuxko++;}}
|
||||
}
|
||||
}else{
|
||||
$rc=$stdout=$ts="";
|
||||
}
|
||||
echo "<tr><td><b>$host</b></td>";
|
||||
echo "<td>$os</td>";
|
||||
echo "<td>".$ts."</td>";
|
||||
if($rc == 0 && (string)$rc <> ""){
|
||||
echo "<td class='table-success'>".$rc."</td>";
|
||||
}else{
|
||||
if((string)$rc <> ""){
|
||||
echo "<td class='table-danger'>".(string)$rc."</td>";
|
||||
}else{
|
||||
echo "<td></td>";
|
||||
<?php
|
||||
foreach ($hosts as $h) {
|
||||
$host = strtoupper($h['HOSTNAME']);
|
||||
$os = strtoupper($h['OS_TYPE']);
|
||||
if (strtoupper($h['OS_TYPE']) == "AIX") {
|
||||
$taix++;
|
||||
} else {
|
||||
$tlinux++;
|
||||
}
|
||||
$answer = Invoke_infra("SELECT * FROM x_stdout where cmd ='$script' and host ='$host'");
|
||||
if (is_array($answer)) {
|
||||
$rc = $answer[0]['rc'];
|
||||
$stdout = $answer[0]['stdout'];
|
||||
$ts = $answer[0]['ts'];
|
||||
if (strtoupper($h['OS_TYPE']) == "AIX") {
|
||||
if ($rc == 0 && (string)$rc <> "") {
|
||||
$aixok++;
|
||||
} else {
|
||||
if ((string)$rc <> "") {
|
||||
$aixko++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ($rc == 0 && (string)$rc <> "") {
|
||||
$linuxok++;
|
||||
} else {
|
||||
if ((string)$rc <> "") {
|
||||
$linuxko++;
|
||||
}
|
||||
}
|
||||
echo "<td>".$stdout."</td></tr>";
|
||||
}
|
||||
?>
|
||||
} else {
|
||||
$rc = $stdout = $ts = "";
|
||||
}
|
||||
echo "<tr><td><b>$host</b></td>";
|
||||
echo "<td>$os</td>";
|
||||
echo "<td>" . $ts . "</td>";
|
||||
if ($rc == 0 && (string)$rc <> "") {
|
||||
echo "<td class='table-success'>" . $rc . "</td>";
|
||||
} else {
|
||||
if ((string)$rc <> "") {
|
||||
echo "<td class='table-danger'>" . $rc . "</td>";
|
||||
} else {
|
||||
echo "<td></td>";
|
||||
}
|
||||
}
|
||||
echo "<td>" . $stdout . "</td></tr>";
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
<br>
|
||||
<?php
|
||||
$aixNO = $taix-$aixok-$aixko; $linuxNO=$tlinux-$linuxok-$linuxko;
|
||||
<?php
|
||||
$aixNO = $taix - $aixok - $aixko;
|
||||
$linuxNO = $tlinux - $linuxok - $linuxko;
|
||||
echo "<div class='row'><div class='col text-center h4'><b>$taix AIX : </b>";
|
||||
echo "<span class='badge bg-success'>$aixok</span> <span class='badge bg-danger'>$aixko</span> <span class='badge bg-secondary'>$aixNO</span></div>";
|
||||
echo "<span class='badge bg-success'>$aixok</span> <span class='badge bg-danger'>$aixko</span> <span class='badge bg-secondary'>$aixNO</span></div>";
|
||||
echo "<div class='col text-center h4'><b>$tlinux Linux : </b>";
|
||||
echo "<span class='badge bg-success'>$linuxok</span> <span class='badge bg-danger'>$linuxko</span> <span class='badge bg-secondary'>$linuxNO</span></div></div> "; ?>
|
||||
</div>
|
||||
echo "<span class='badge bg-success'>$linuxok</span> <span class='badge bg-danger'>$linuxko</span> <span class='badge bg-secondary'>$linuxNO</span></div></div> "; ?>
|
||||
</div>
|
||||
<!-- End of main content -->
|
||||
</div>
|
||||
<!-- End of main content -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<script src="/js/switch.js"></script>
|
||||
</HTML>
|
||||
@@ -49,8 +49,8 @@
|
||||
<div class="modal-dialog modal-sm">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title mb-1 text-dark text-uppercase">
|
||||
<center><i class="bi bi-hourglass-split"></i><br> Work in progress ...</center>
|
||||
<h4 class="modal-title mb-1 text-dark text-uppercase text-center" style="font-size: 1.5rem;">
|
||||
<i class="bi bi-hourglass-split"></i><br> Work in progress ...
|
||||
</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
||||
Reference in New Issue
Block a user