Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/zabbix/zabbix.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'ui/app/controllers/CControllerServiceTimeValidate.php')
-rw-r--r--ui/app/controllers/CControllerServiceTimeValidate.php33
1 files changed, 27 insertions, 6 deletions
diff --git a/ui/app/controllers/CControllerServiceTimeValidate.php b/ui/app/controllers/CControllerServiceTimeValidate.php
index 820ddd2f608..02d4c446ec9 100644
--- a/ui/app/controllers/CControllerServiceTimeValidate.php
+++ b/ui/app/controllers/CControllerServiceTimeValidate.php
@@ -24,6 +24,10 @@ class CControllerServiceTimeValidate extends CController {
private $ts_from;
private $ts_to;
+ protected function init() {
+ $this->setPostContentType(self::POST_CONTENT_TYPE_JSON);
+ }
+
protected function checkInput(): bool {
$fields = [
'row_index' => 'required|int32',
@@ -109,19 +113,36 @@ class CControllerServiceTimeValidate extends CController {
}
protected function doAction(): void {
+ switch ($this->getInput('type')) {
+ case SERVICE_TIME_TYPE_UPTIME:
+ case SERVICE_TIME_TYPE_DOWNTIME:
+ $from = dowHrMinToStr($this->ts_from);
+ $till = dowHrMinToStr($this->ts_to, true);
+ break;
+
+ case SERVICE_TIME_TYPE_ONETIME_DOWNTIME:
+ $from = zbx_date2str(DATE_TIME_FORMAT, $this->ts_from);
+ $till = zbx_date2str(DATE_TIME_FORMAT, $this->ts_to);
+ break;
+ }
+
$data = [
- 'row_index' => $this->getInput('row_index'),
- 'form' => [
+ 'body' => [
+ 'row_index' => $this->getInput('row_index'),
'type' => $this->getInput('type'),
'ts_from' => $this->ts_from,
+ 'from' => $from,
'ts_to' => $this->ts_to,
+ 'till' => $till,
'note' => $this->getInput('note', '')
- ],
- 'user' => [
- 'debug_mode' => $this->getDebugMode()
]
];
- $this->setResponse(new CControllerResponseData($data));
+ if ($this->getDebugMode() == GROUP_DEBUG_MODE_ENABLED) {
+ CProfiler::getInstance()->stop();
+ $data['debug'] = CProfiler::getInstance()->make()->toString();
+ }
+
+ $this->setResponse(new CControllerResponseData(['main_block' => json_encode($data)]));
}
}