handle different types of OMS from SUV status page

This commit is contained in:
Michael Becker 2025-03-25 10:52:15 -04:00
parent 2cc1a4f37c
commit 70a9255d1e
5 changed files with 26 additions and 15 deletions

View File

@ -96,7 +96,9 @@ function mocha_get_current_user() : ?InstanceReference
{
$currentTenant = $oms->getTenantByName($path[0]);
}
$oms->setTenant($currentTenant);
if ($currentTenant != null) {
$oms->setTenant($currentTenant);
}
}
if ($currentTenant !== null)
@ -142,10 +144,6 @@ function mocha_get_current_user() : ?InstanceReference
// echo ("user_token is NOT set"); die();
}
}
else
{
echo ("currentTenant is null"); die();
}
return null;
}
/**

View File

@ -20,6 +20,8 @@
abstract class Oms
{
public abstract function getBackendName() : string;
public ?array $MethodImplementations;
public function __construct()

View File

@ -32,6 +32,8 @@
class HttpOmsClient extends Oms
{
public function getBackendName() : string { return "dotnet"; }
public string $ServerName;
public int $PortNumber;
@ -340,9 +342,9 @@
{
foreach ($json["tenants"] as $tenant)
{
if ($tenant == $tenantName)
if ($tenant["name"] == $tenantName)
{
return new TenantReference($i, $tenant, null);
return new TenantReference($i, $tenant["name"], null);
}
$i++;
}

View File

@ -12,6 +12,8 @@
{
private \PDO $PDO;
public function getBackendName() : string { return "mysql"; }
public function query($query, array $parms)
{
$stmt = $this->PDO->prepare($query);

View File

@ -56,7 +56,7 @@
{
$tenants[] = array
(
"name" => $tenant,
"name" => $tenant["name"],
"status" => "Active",
"tenantType" => "Development",
"dataCenter" => "Local",
@ -122,6 +122,7 @@
protected function OnPreRender(CancelEventArgs $e)
{
global $basepath;
$oms = mocha_get_oms();
$e->Cancel = true;
@ -194,10 +195,11 @@
),
"database" => array
(
"backend" => "mysql",
"userName" => System::GetConfigurationValue("Database.UserName"),
"hostName" => System::GetConfigurationValue("Database.ServerName"),
"portNumber" => intval(System::GetConfigurationValue("Database.PortNumber")),
"backend" => $oms->getBackendName(),
// "userName" => System::GetConfigurationValue("Database.UserName"),
"hostName" => $oms->ServerName, // System::GetConfigurationValue("Database.ServerName"),
"portNumber" => $oms->PortNumber,
// "portNumber" => intval(System::GetConfigurationValue("Database.PortNumber")),
"status" => "running"
)
);
@ -482,6 +484,7 @@ EOF
$page->Title = "Database";
$page->Content = function()
{
$oms = mocha_get_oms();
?>
<table class="uwt-listview">
<thead>
@ -493,11 +496,15 @@ EOF
<tbody>
<tr>
<td>Backend</td>
<td>mysql</td>
<td><?php echo($oms->getBackendName()); ?></td>
</tr>
<tr>
<td>User</td>
<td><?php echo(System::GetConfigurationValue("Database.UserName")); ?></td>
<td><?php
if ($oms->getBackendName() == "mysql") {
echo (System::GetConfigurationValue("Database.UserName"));
}
?></td>
</tr>
<tr>
<td>Host</td>
@ -505,7 +512,7 @@ EOF
</tr>
<tr>
<td>Port</td>
<td><?php echo(System::GetConfigurationValue("Database.PortNumber")); ?></td>
<td><?php echo($oms->PortNumber); ?></td>
</tr>
<tr>
<td>Status</td>