Skip to content
Snippets Groups Projects
Commit 3bfd9a31 authored by Anton Bagliy's avatar Anton Bagliy
Browse files

REF: return old sync page #297

parent 4b11f8ab
Branches
No related merge requests found
......@@ -31,7 +31,8 @@
{ "Title": "История авторизаций", "Anchor": "logs" },
{ "Title": "История выставления баллов", "Anchor": "#", "Disabled": "true" },
{ "Title": "Токены авторизации", "Anchor": "authTokens" },
{ "Title": "Поддержка", "Anchor": "support" }
{ "Title": "Поддержка", "Anchor": "support" },
{ "Title": "Синхронизация с 1С", "Anchor": "sync" }
]
},
{
......
......@@ -28,7 +28,8 @@
"Items": [
{ "Title": "История авторизаций", "Anchor": "logs" },
{ "Title": "История выставления баллов", "Anchor": "#", "Disabled": "true" },
{ "Title": "Поддержка", "Anchor": "support" }
{ "Title": "Поддержка", "Anchor": "support" },
{ "Title": "Синхронизация с 1С", "Anchor": "sync" }
]
}
]
<?php defined('SYSPATH') or die('No direct script access.');
return array(
/*
* Настройки доступа к серверу синхронизации
*/
'syncDaemon' => array(
/*
* адрес
*/
'url' => 'http://localhost:3000',
)
);
"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');
......
......@@ -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');
}
}
......@@ -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 %}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment