fix: update all API links in frontend to match new route structure

This commit is contained in:
Сергей Антропов 2025-08-20 16:53:46 +03:00
parent 40f614304b
commit 039c6e05c7

View File

@ -873,7 +873,7 @@ function setLayout(cls){
async function fetchProjects(){ async function fetchProjects(){
try { try {
console.log('Fetching projects...'); console.log('Fetching projects...');
const url = new URL(location.origin + '/api/projects'); const url = new URL(location.origin + '/api/containers/projects');
const token = localStorage.getItem('access_token'); const token = localStorage.getItem('access_token');
if (!token) { if (!token) {
console.error('No access token found'); console.error('No access token found');
@ -1017,7 +1017,7 @@ async function loadExcludedContainers() {
return []; return [];
} }
const response = await fetch('/api/excluded-containers', { const response = await fetch('/api/containers/excluded', {
headers: { headers: {
'Authorization': `Bearer ${token}` 'Authorization': `Bearer ${token}`
} }
@ -1047,7 +1047,7 @@ async function saveExcludedContainers(containers) {
return false; return false;
} }
const response = await fetch('/api/excluded-containers', { const response = await fetch('/api/containers/excluded', {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
@ -1999,7 +1999,7 @@ function applyWrapSettings() {
async function fetchServices(){ async function fetchServices(){
try { try {
console.log('Fetching services...'); console.log('Fetching services...');
const url = new URL(location.origin + '/api/services'); const url = new URL(location.origin + '/api/containers/services');
const selectedProjects = getSelectedProjects(); const selectedProjects = getSelectedProjects();
// Если выбраны конкретные проекты (не "all"), добавляем их в URL как строку через запятую // Если выбраны конкретные проекты (не "all"), добавляем их в URL как строку через запятую
@ -2094,9 +2094,9 @@ function wsUrl(containerId, service, project){
const pj = project?`&project=${encodeURIComponent(project)}`:''; const pj = project?`&project=${encodeURIComponent(project)}`:'';
if (els.aggregate && els.aggregate.checked && service){ if (els.aggregate && els.aggregate.checked && service){
// fan-in by service // fan-in by service
return `${proto}://${location.host}/ws/fan/${encodeURIComponent(service)}?tail=${tail}&token=${token}${pj}`; return `${proto}://${location.host}/api/websocket/fan/${encodeURIComponent(service)}?tail=${tail}&token=${token}${pj}`;
} }
return `${proto}://${location.host}/ws/logs/${encodeURIComponent(containerId)}?tail=${tail}&token=${token}${sp}${pj}`; return `${proto}://${location.host}/api/websocket/logs/${encodeURIComponent(containerId)}?tail=${tail}&token=${token}${sp}${pj}`;
} }
function closeWs(id){ function closeWs(id){
@ -2137,7 +2137,7 @@ async function sendSnapshot(id){
const payload = {container_id: containerId, service: serviceName, content: text}; const payload = {container_id: containerId, service: serviceName, content: text};
try { try {
const res = await fetch('/api/snapshot', { const res = await fetch('/api/logs/snapshot', {
method:'POST', method:'POST',
headers:{ headers:{
'Content-Type':'application/json', 'Content-Type':'application/json',
@ -2198,7 +2198,7 @@ async function sendSnapshot(id){
const serviceName = o.serviceName || id; const serviceName = o.serviceName || id;
const payload = {container_id: id, service: serviceName, content: text}; const payload = {container_id: id, service: serviceName, content: text};
const res = await fetch('/api/snapshot', { const res = await fetch('/api/logs/snapshot', {
method:'POST', method:'POST',
headers:{ headers:{
'Content-Type':'application/json', 'Content-Type':'application/json',
@ -3439,7 +3439,7 @@ function fanGroupUrl(servicesCsv, project){
const tail = els.tail.value || '500'; const tail = els.tail.value || '500';
const token = encodeURIComponent(localStorage.getItem('access_token') || ''); const token = encodeURIComponent(localStorage.getItem('access_token') || '');
const pj = project?`&project=${encodeURIComponent(project)}`:''; const pj = project?`&project=${encodeURIComponent(project)}`:'';
return `${proto}://${location.host}/ws/fan_group?services=${encodeURIComponent(servicesCsv)}&tail=${tail}&token=${token}${pj}`; return `${proto}://${location.host}/api/websocket/fan_group?services=${encodeURIComponent(servicesCsv)}&tail=${tail}&token=${token}${pj}`;
} }
function openFanGroup(services){ function openFanGroup(services){