pf-sdn/webui/src/pages/SRM.js

42 lines
2.0 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import $ from 'jquery';
function getBaseUrl() {
return window.location.origin;
}
export const SRMPage = {
render: () => {
const baseUrl = getBaseUrl();
const updateUrl = `${baseUrl}/webhook/SRM/update`;
const subnetsUrl = `${baseUrl}/webhook/SRM/subnets`;
return `
<h1 class="page-title">SRM Webhooks</h1>
<div class="component-config-form">
<p class="hint-text" style="margin-bottom: 20px;">
SRM предоставляет HTTP webhook'ы для получения информации о текущем состоянии подсетей.
Настройка не требуется — компонент отслеживает изменения автоматически.
</p>
<div class="form-group">
<label for="srm-update-url">Последнее обновление</label>
<textarea id="srm-update-url" class="form-control" readonly rows="1"
style="font-family: monospace; resize: vertical; cursor: text;"
onclick="this.select();">${updateUrl}</textarea>
<small class="hint-text">Возвращает временную метку (unix timestamp) последнего обновления списка подсетей.</small>
</div>
<div class="form-group" style="margin-top: 20px;">
<label for="srm-subnets-url">Список подсетей</label>
<textarea id="srm-subnets-url" class="form-control" readonly rows="1"
style="font-family: monospace; resize: vertical; cursor: text;"
onclick="this.select();">${subnetsUrl}</textarea>
<small class="hint-text">Возвращает текущий список подсетей в формате JSON array.</small>
</div>
</div>
`;
},
mount: async () => {},
unmount: () => {}
};