Fixes agent config
parent
72b1442b77
commit
6d07744ab7
|
@ -33,21 +33,21 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
|||
// }
|
||||
|
||||
// an update to an existing agent
|
||||
} else {
|
||||
$updatedAgent = [
|
||||
'id' => $agent,
|
||||
'type_id' => 1,
|
||||
'url' => $_POST['url'],
|
||||
'secret_key' => $_POST['secret_key'],
|
||||
];
|
||||
$result = $agentObject->editAgent($platform_id, $updatedAgent);
|
||||
if ($result === true) {
|
||||
$_SESSION['notice'] = "Agent id \"{$_REQUEST['agent']}\" edited.";
|
||||
} else {
|
||||
$_SESSION['error'] = "Editing the agent failed. Error: $result";
|
||||
}
|
||||
|
||||
}
|
||||
// } else {
|
||||
// $updatedAgent = [
|
||||
// 'id' => $agent,
|
||||
// 'type_id' => 1,
|
||||
// 'url' => $_POST['url'],
|
||||
// 'secret_key' => $_POST['secret_key'],
|
||||
// ];
|
||||
// $result = $agentObject->editAgent($platform_id, $updatedAgent);
|
||||
// if ($result === true) {
|
||||
// $_SESSION['notice'] = "Agent id \"{$_REQUEST['agent']}\" edited.";
|
||||
// } else {
|
||||
// $_SESSION['error'] = "Editing the agent failed. Error: $result";
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
header("Location: $app_root?platform=$platform_id&page=agents");
|
||||
exit();
|
||||
|
|
|
@ -54,6 +54,21 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
|||
$platform = $_POST['platform'];
|
||||
$platformObject->deletePlatform($platform);
|
||||
|
||||
// an update to an existing agent
|
||||
} elseif (isset($_POST['agent'])) {
|
||||
$updatedAgent = [
|
||||
'id' => $agent,
|
||||
'agent_type_id' => 1,
|
||||
'url' => $_POST['url'],
|
||||
'secret_key' => $_POST['secret_key'],
|
||||
];
|
||||
$result = $agentObject->editAgent($platform_id, $updatedAgent);
|
||||
if ($result === true) {
|
||||
$_SESSION['notice'] = "Agent id \"{$_REQUEST['agent']}\" edited.";
|
||||
} else {
|
||||
$_SESSION['error'] = "Editing the agent failed. Error: $result";
|
||||
}
|
||||
|
||||
// an update to an existing platform
|
||||
} else {
|
||||
$platform = $_POST['platform'];
|
||||
|
|
Loading…
Reference in New Issue