diff --git a/CHANGELOG.md b/CHANGELOG.md index 58ed8d9..f14d4cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ There are next changes: +## 1.2.12 + +There are next changes: + +- added a method to return all saved methods + ## 1.2.11 There are next changes: diff --git a/src/Badoo/LiveProfilerUI/DataProviders/Interfaces/MethodInterface.php b/src/Badoo/LiveProfilerUI/DataProviders/Interfaces/MethodInterface.php index 8c8afe0..4601bd7 100644 --- a/src/Badoo/LiveProfilerUI/DataProviders/Interfaces/MethodInterface.php +++ b/src/Badoo/LiveProfilerUI/DataProviders/Interfaces/MethodInterface.php @@ -9,6 +9,7 @@ interface MethodInterface { public function findByName(string $method_name, bool $strict = false) : array; + public function all() : array; public function getListByNames(array $names) : array; public function getListByIds(array $ids) : array; public function insertMany(array $inserts) : bool; diff --git a/src/Badoo/LiveProfilerUI/DataProviders/Method.php b/src/Badoo/LiveProfilerUI/DataProviders/Method.php index fe1f6f3..84bc0f2 100644 --- a/src/Badoo/LiveProfilerUI/DataProviders/Method.php +++ b/src/Badoo/LiveProfilerUI/DataProviders/Method.php @@ -42,6 +42,23 @@ public function findByName(string $method_name, bool $strict = false) : array return $methods; } + public function all() : array + { + $result = $this->AggregatorStorage->getAll( + self::TABLE_NAME, + ['all'], + [] + ); + $methods = []; + if (!empty($result)) { + foreach ($result as $row) { + $methods[$row['id']] = $row; + } + } + + return $methods; + } + public function getListByNames(array $names) : array { if (empty($names)) { diff --git a/src/Badoo/LiveProfilerUI/Pages/AjaxPages.php b/src/Badoo/LiveProfilerUI/Pages/AjaxPages.php index b2dc9ca..39a4b7f 100644 --- a/src/Badoo/LiveProfilerUI/Pages/AjaxPages.php +++ b/src/Badoo/LiveProfilerUI/Pages/AjaxPages.php @@ -160,6 +160,22 @@ public function searchMethods(string $term) : array } } + public function allMethods() : array + { + try { + $methods = $this->Method->all(); + + $result = []; + foreach ($methods as $method) { + $result[$method['name']] = $method['date']; + } + + return $result; + } catch (\Throwable $Ex) { + return []; + } + } + public function getSourceAppList() : array { try { diff --git a/src/www/index.php b/src/www/index.php index 7f9ce6f..d991900 100644 --- a/src/www/index.php +++ b/src/www/index.php @@ -127,6 +127,15 @@ echo json_encode($result); break; + case '/profiler/all-methods.json': + header('Content-Type: application/json;charset=UTF-8'); + + /** @var \Badoo\LiveProfilerUI\Pages\AjaxPages $Page */ + $Page = $App->getPage('ajax_pages'); + + echo json_encode($Page->allMethods()); + break; + case '/profiler/get-source-app-list.json': header('Content-Type: application/json;charset=UTF-8');