fix: remove Aktiven badge, add config migration with legacyId
Publish Fast Tabler Docker image / build-and-push-fast (push) Successful in 1m43s
Publish Fast Tabler Docker image / build-and-push-fast (push) Successful in 1m43s
This commit is contained in:
@@ -886,10 +886,39 @@ function FilterManager() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleLoadServerConfig = async (serverId) => {
|
const handleLoadServerConfig = async (serverId, legacyId = null) => {
|
||||||
try {
|
try {
|
||||||
const response = await api.get(`/server-configs/${serverId}`);
|
const response = await api.get(`/server-configs/${serverId}`);
|
||||||
setGeneratedConfig(response.data.config);
|
const config = response.data?.config;
|
||||||
|
|
||||||
|
// Если конфигурация найдена и не пустая
|
||||||
|
if (config && config !== '// Конфигурация не найдена') {
|
||||||
|
setGeneratedConfig(config);
|
||||||
|
setPreviewModalOpen(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Пробуем загрузить по legacyId
|
||||||
|
if (legacyId && legacyId !== serverId) {
|
||||||
|
try {
|
||||||
|
const legacyResponse = await api.get(`/server-configs/${legacyId}`);
|
||||||
|
const legacyConfig = legacyResponse.data?.config;
|
||||||
|
|
||||||
|
if (legacyConfig && legacyConfig !== '// Конфигурация не найдена') {
|
||||||
|
// Мигрируем конфигурацию на новый id
|
||||||
|
await api.post(`/server-configs/${serverId}`, { config: legacyConfig });
|
||||||
|
setGeneratedConfig(legacyConfig);
|
||||||
|
setPreviewModalOpen(true);
|
||||||
|
setSuccess(`Конфигурация мигрирована с legacy id: ${legacyId}`);
|
||||||
|
setTimeout(() => setSuccess(''), 3000);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} catch (legacyError) {
|
||||||
|
console.log('No legacy config found');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setGeneratedConfig('// Конфигурация не найдена');
|
||||||
setPreviewModalOpen(true);
|
setPreviewModalOpen(true);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error loading server config:', error);
|
console.error('Error loading server config:', error);
|
||||||
@@ -1620,7 +1649,6 @@ function FilterManager() {
|
|||||||
<div className="flex-grow-1">
|
<div className="flex-grow-1">
|
||||||
<div className="d-flex align-items-center gap-2">
|
<div className="d-flex align-items-center gap-2">
|
||||||
<div className="fw-bold text-truncate" title={server.name}>{server.name}</div>
|
<div className="fw-bold text-truncate" title={server.name}>{server.name}</div>
|
||||||
<span className="badge bg-green-lt text-green">Активен</span>
|
|
||||||
</div>
|
</div>
|
||||||
{(() => {
|
{(() => {
|
||||||
const meta = inventoryServers.find(
|
const meta = inventoryServers.find(
|
||||||
|
|||||||
Reference in New Issue
Block a user