diff --git a/deploy/phpConfig/sidePanel/admin.json b/deploy/phpConfig/sidePanel/admin.json index 71bba2b4221410e14f0799c142122184c4dc87bc..a103290826d7e2c6cd3605cda0fcfa1b2f881b5a 100644 --- a/deploy/phpConfig/sidePanel/admin.json +++ b/deploy/phpConfig/sidePanel/admin.json @@ -31,7 +31,8 @@ { "Title": "Рстория авторизаций", "Anchor": "logs" }, { "Title": "Рстория выставления баллов", "Anchor": "#", "Disabled": "true" }, { "Title": "Токены авторизации", "Anchor": "authTokens" }, - { "Title": "Поддержка", "Anchor": "support" } + { "Title": "Поддержка", "Anchor": "support" }, + { "Title": "Синхронизация СЃ 1РЎ", "Anchor": "sync" } ] }, { diff --git a/deploy/phpConfig/sidePanel/dean.json b/deploy/phpConfig/sidePanel/dean.json index 345304260b9385c16001f5ed1b3dba86a7724f2c..7b6acfc089e7fa34dfb7874cab7f04f0fb2f3983 100644 --- a/deploy/phpConfig/sidePanel/dean.json +++ b/deploy/phpConfig/sidePanel/dean.json @@ -28,7 +28,8 @@ "Items": [ { "Title": "Рстория авторизаций", "Anchor": "logs" }, { "Title": "Рстория выставления баллов", "Anchor": "#", "Disabled": "true" }, - { "Title": "Поддержка", "Anchor": "support" } + { "Title": "Поддержка", "Anchor": "support" }, + { "Title": "Синхронизация СЃ 1РЎ", "Anchor": "sync" } ] } ] diff --git a/deploy/phpConfig/sync.php b/deploy/phpConfig/sync.php new file mode 100644 index 0000000000000000000000000000000000000000..3b116764045075f1b6da1d9626719ff894dcebb5 --- /dev/null +++ b/deploy/phpConfig/sync.php @@ -0,0 +1,13 @@ +<?php defined('SYSPATH') or die('No direct script access.'); + +return array( + /* + * Настройки доступа Рє серверу синхронизации + */ + 'syncDaemon' => array( + /* + * адрес + */ + 'url' => 'http://localhost:3000', + ) +); diff --git a/media/js/office/sync.js b/media/js/office/sync.js index 68636ccdb3d434b163f3c755c9b978af604667fe..dc51e4e9020817498dc9012d677750d695cb8dbc 100644 --- a/media/js/office/sync.js +++ b/media/js/office/sync.js @@ -1,11 +1,26 @@ "use strict"; $(document).ready(()=>{ - const pathToSfeduAPIAdapter = 'http://grade.local/sync/'; - - $('#syncInnerDepartments').click(()=>{ - $.get(pathToSfeduAPIAdapter + 'subdivisions/inner'); - }); + //const pathToSfeduAPIAdapter = $('#sync_api_url').html(); + const pathToSfeduAPIAdapter = 'http://localhost:3000/'; + + //$('#syncInnerDepartments').click(()=>{ + // $.get(pathToSfeduAPIAdapter + 'subdivisions/inner'); + //}); + function parseLogs() { + let $logs = $('#json_logs'); + + let logsRaw = JSON.parse($logs.html() || '{}'); + return logsRaw; + } + + //let logs = parseLogs(); + + //$('.syncErrorMessage').click(()=>{ + // const rowIndex = $(this).parent().index(); + // var opened = window.open(""); + // opened.document.write(logs[rowIndex].content); + //}); $('#syncDepartments').click(()=>{ $.get(pathToSfeduAPIAdapter + 'subdivisions'); diff --git a/~dev_rating/application/classes/Controller/Office/Sync.php b/~dev_rating/application/classes/Controller/Office/Sync.php index 2b69919e4baa315ed61136104a80bcf9ed3de4a0..dc50909092c351300a0e72210772ec2739f6d32d 100644 --- a/~dev_rating/application/classes/Controller/Office/Sync.php +++ b/~dev_rating/application/classes/Controller/Office/Sync.php @@ -19,8 +19,8 @@ class Controller_Office_Sync extends Controller_Environment_Office */ private function getLog() { - //next example will recieve all messages for specific conversation - $service_url = 'http://grade.local/sync/syncLog'; + $config = Kohana::$config->load('sync.syncDaemon'); + $service_url = $config['url'].'/logs'; $curl = curl_init($service_url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); $curl_response = curl_exec($curl); @@ -49,9 +49,12 @@ class Controller_Office_Sync extends Controller_Environment_Office { $log = $this->getLog(); + $config = Kohana::$config->load('sync.syncDaemon'); + $service_url = $config['url']; $this->twig->set([ - 'log' => $log + 'log' => $log, + 'api_url' => $service_url, ])->set_filename(static::OFFICE . 'sync'); } } diff --git a/~dev_rating/application/views/office/sync.twig b/~dev_rating/application/views/office/sync.twig index 06c68726562d6f6ac698a1e7e618b3f688bbd6b1..2a5aa2e8d20f6b07b6c568c48c293a9586b2e6d8 100644 --- a/~dev_rating/application/views/office/sync.twig +++ b/~dev_rating/application/views/office/sync.twig @@ -159,7 +159,11 @@ <tr style="background-color: #F0622E"> {% endif %} <td>{{ line.type }}</td> + {% if line.success %} <td>{{ line.message }}</td> + {% else %} + <td> <a class="syncErrorMessage">{{ line.message }} </a> </td> + {% endif %} <td>{{ line.localTimestamp }}</td> </tr> {% endfor %} @@ -167,4 +171,13 @@ </table> </div> + + <div id="json_logs" style="display: none"> + {{ log|json_encode|raw }} + </div> + + {# TODO: передать адрес демона РІ js здесь #} + {# <div id="sync_api_url" style="display: none"> + {{ api_url }} + </div> #} {% endblock %}