Pilots tab: drop categories and cred-hint fields

Pilots are invite-only and never appear in category-browsable
self-service catalogs, so the category checklist served no purpose
there. Dropped the login/password hint field too - not requested
for pilots.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-10-02 06:58:41 +00:00
parent ae630f9115
commit c3521f605f
+3 -24
View File
@@ -621,7 +621,7 @@
<input class="list-search" id="pilot_search" placeholder="Поиск пилота..." oninput="filterList('pilot_search', '#pilot_list .pilot-item')" /> <input class="list-search" id="pilot_search" placeholder="Поиск пилота..." oninput="filterList('pilot_search', '#pilot_list .pilot-item')" />
<div class="list-box" id="pilot_list"> <div class="list-box" id="pilot_list">
{% for s in pilot_services %} {% for s in pilot_services %}
<button class="list-item service-row pilot-item" data-service-id="{{s.id}}" data-filter="{{(s.name ~ ' ' ~ s.slug)|lower}}" onclick='selectPilotService({{s.id}}, {{s.name|tojson}}, {{s.slug|tojson}}, {{s.target|tojson}}, {{s.comment|tojson}}, {{s.icon_path|tojson}}, {{s.active|tojson}}, {{s.svc_login|tojson}}, {{s.svc_password|tojson}}, {{s.svc_cred_hint|tojson}})'> <button class="list-item service-row pilot-item" data-service-id="{{s.id}}" data-filter="{{(s.name ~ ' ' ~ s.slug)|lower}}" onclick='selectPilotService({{s.id}}, {{s.name|tojson}}, {{s.slug|tojson}}, {{s.target|tojson}}, {{s.comment|tojson}}, {{s.icon_path|tojson}}, {{s.active|tojson}}, {{s.svc_login|tojson}}, {{s.svc_password|tojson}})'>
<img class="service-thumb" src="{{ s.icon_path or '/static/service-placeholder.svg' }}" alt="icon" /> <img class="service-thumb" src="{{ s.icon_path or '/static/service-placeholder.svg' }}" alt="icon" />
<div> <div>
<div>{{s.name}}</div> <div>{{s.name}}</div>
@@ -654,15 +654,8 @@
<textarea id="p_comment" placeholder="Описание пилота для пользователя (что это, какой проект)"></textarea> <textarea id="p_comment" placeholder="Описание пилота для пользователя (что это, какой проект)"></textarea>
<input id="p_svc_login" placeholder="Логин сервиса (показывается на карточке)" /> <input id="p_svc_login" placeholder="Логин сервиса (показывается на карточке)" />
<input id="p_svc_password" placeholder="Пароль сервиса (показывается на карточке)" /> <input id="p_svc_password" placeholder="Пароль сервиса (показывается на карточке)" />
<input id="p_svc_cred_hint" placeholder="Подсказка к логину/паролю (необязательно)" />
<select id="p_active"><option value="true">active</option><option value="false">inactive</option></select> <select id="p_active"><option value="true">active</option><option value="false">inactive</option></select>
</div> </div>
<div class="list-title">Категории</div>
<div class="acl-grid compact-grid" id="p_categories">
{% for c in categories %}
<label><input type="checkbox" class="p_cat" value="{{c.id}}" /> {{c.name}}</label>
{% endfor %}
</div>
<div class="actions"> <div class="actions">
<button onclick="savePilotService()">Save</button> <button onclick="savePilotService()">Save</button>
<button onclick="deleteService('p_id')">Delete</button> <button onclick="deleteService('p_id')">Delete</button>
@@ -716,15 +709,8 @@
<textarea id="new_p_comment" placeholder="Описание пилота для пользователя"></textarea> <textarea id="new_p_comment" placeholder="Описание пилота для пользователя"></textarea>
<input id="new_p_svc_login" placeholder="Логин сервиса (необязательно)" /> <input id="new_p_svc_login" placeholder="Логин сервиса (необязательно)" />
<input id="new_p_svc_password" placeholder="Пароль сервиса (необязательно)" /> <input id="new_p_svc_password" placeholder="Пароль сервиса (необязательно)" />
<input id="new_p_svc_cred_hint" placeholder="Подсказка к логину/паролю (необязательно)" />
<select id="new_p_active"><option value="true">active</option><option value="false">inactive</option></select> <select id="new_p_active"><option value="true">active</option><option value="false">inactive</option></select>
</div> </div>
<div class="list-title">Категории</div>
<div class="acl-grid compact-grid" id="new_p_categories">
{% for c in categories %}
<label><input type="checkbox" class="new_p_cat" value="{{c.id}}" /> {{c.name}}</label>
{% endfor %}
</div>
<button onclick="createPilotService()">Add Pilot</button> <button onclick="createPilotService()">Add Pilot</button>
</div> </div>
</div> </div>
@@ -1339,7 +1325,7 @@
location.reload(); location.reload();
} }
function selectPilotService(id, name, slug, target, comment, iconPath, active, svcLogin, svcPassword, svcCredHint) { function selectPilotService(id, name, slug, target, comment, iconPath, active, svcLogin, svcPassword) {
const cfg = parseRdpTarget(target); const cfg = parseRdpTarget(target);
document.getElementById('p_id').value = id; document.getElementById('p_id').value = id;
document.getElementById('p_name').value = name; document.getElementById('p_name').value = name;
@@ -1352,9 +1338,7 @@
document.getElementById('p_comment').value = comment || ''; document.getElementById('p_comment').value = comment || '';
document.getElementById('p_svc_login').value = svcLogin || ''; document.getElementById('p_svc_login').value = svcLogin || '';
document.getElementById('p_svc_password').value = svcPassword || ''; document.getElementById('p_svc_password').value = svcPassword || '';
document.getElementById('p_svc_cred_hint').value = svcCredHint || '';
document.getElementById('p_active').value = String(active); document.getElementById('p_active').value = String(active);
setCategoryChecks('.p_cat', serviceCategoryMap[id] || []);
document.getElementById('p_icon_preview').src = iconPath || placeholderIcon; document.getElementById('p_icon_preview').src = iconPath || placeholderIcon;
markSelected('.pilot-item', 'data-service-id', id); markSelected('.pilot-item', 'data-service-id', id);
renderPilotSlots(id); renderPilotSlots(id);
@@ -1371,8 +1355,6 @@
comment: document.getElementById('new_p_comment').value, comment: document.getElementById('new_p_comment').value,
svc_login: document.getElementById('new_p_svc_login').value, svc_login: document.getElementById('new_p_svc_login').value,
svc_password: document.getElementById('new_p_svc_password').value, svc_password: document.getElementById('new_p_svc_password').value,
svc_cred_hint: document.getElementById('new_p_svc_cred_hint').value,
category_ids: checkedCategoryIds('.new_p_cat'),
active: document.getElementById('new_p_active').value === 'true', active: document.getElementById('new_p_active').value === 'true',
is_pilot: true, is_pilot: true,
}); });
@@ -1391,8 +1373,6 @@
comment: document.getElementById('p_comment').value, comment: document.getElementById('p_comment').value,
svc_login: document.getElementById('p_svc_login').value, svc_login: document.getElementById('p_svc_login').value,
svc_password: document.getElementById('p_svc_password').value, svc_password: document.getElementById('p_svc_password').value,
svc_cred_hint: document.getElementById('p_svc_cred_hint').value,
category_ids: checkedCategoryIds('.p_cat'),
active: document.getElementById('p_active').value === 'true', active: document.getElementById('p_active').value === 'true',
is_pilot: true, is_pilot: true,
}); });
@@ -1400,11 +1380,10 @@
} }
function clearPilotForm() { function clearPilotForm() {
['p_id','p_name','p_slug','p_target','p_host','p_port','p_domain','p_comment','p_svc_login','p_svc_password','p_svc_cred_hint'].forEach(id => document.getElementById(id).value = ''); ['p_id','p_name','p_slug','p_target','p_host','p_port','p_domain','p_comment','p_svc_login','p_svc_password'].forEach(id => document.getElementById(id).value = '');
document.getElementById('pilot_slots_box').style.display = 'none'; document.getElementById('pilot_slots_box').style.display = 'none';
document.getElementById('p_sec').value = ''; document.getElementById('p_sec').value = '';
document.getElementById('p_active').value = 'true'; document.getElementById('p_active').value = 'true';
setCategoryChecks('.p_cat', []);
document.getElementById('p_icon_preview').src = placeholderIcon; document.getElementById('p_icon_preview').src = placeholderIcon;
document.querySelectorAll('.pilot-item').forEach((el) => el.classList.remove('selected-item')); document.querySelectorAll('.pilot-item').forEach((el) => el.classList.remove('selected-item'));
} }