Skip to content

Commit 2fc7bd9

Browse files
committed
fix: исправление подсчета баз в массовом бэкапе
- Убрана фильтрация текущей базы из функций backupAllServer и backupAllWorkspace - Теперь 'Backup All Databases' и 'Backup All Workspace' включают все базы, включая текущую - Исправлено отображение количества баз в подтверждениях (10 вместо 9, 20 вместо 19) - Обновлены сообщения об ошибках
1 parent bc8051a commit 2fc7bd9

1 file changed

Lines changed: 11 additions & 15 deletions

File tree

frontend/src/features/backups/ui/BackupsComponent.tsx

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -210,13 +210,13 @@ export const BackupsComponent = ({ database, isCanManageDBs, scrollContainerRef,
210210
// Get all databases in workspace
211211
const allDatabases = await databaseApi.getDatabases(workspaceId);
212212

213-
// Filter databases by serverId (exclude current database)
213+
// Filter databases by serverId (include all databases on server)
214214
const serverDatabases = allDatabases.filter(
215-
(db) => db.serverId === database.serverId && db.id !== database.id,
215+
(db) => db.serverId === database.serverId,
216216
);
217217

218218
if (serverDatabases.length === 0) {
219-
message.info('No other databases found on this server');
219+
message.info('No databases found on this server');
220220
setIsBackupAllServerLoading(false);
221221
return;
222222
}
@@ -265,11 +265,8 @@ export const BackupsComponent = ({ database, isCanManageDBs, scrollContainerRef,
265265
// Get all databases in workspace
266266
const allDatabases = await databaseApi.getDatabases(workspaceId);
267267

268-
// Exclude current database
269-
const workspaceDatabases = allDatabases.filter((db) => db.id !== database.id);
270-
271-
if (workspaceDatabases.length === 0) {
272-
message.info('No other databases found in workspace');
268+
if (allDatabases.length === 0) {
269+
message.info('No databases found in workspace');
273270
setIsBackupAllWorkspaceLoading(false);
274271
return;
275272
}
@@ -278,7 +275,7 @@ export const BackupsComponent = ({ database, isCanManageDBs, scrollContainerRef,
278275
let successCount = 0;
279276
let failCount = 0;
280277

281-
for (const db of workspaceDatabases) {
278+
for (const db of allDatabases) {
282279
try {
283280
await backupsApi.makeBackup(db.id);
284281
successCount++;
@@ -316,11 +313,11 @@ export const BackupsComponent = ({ database, isCanManageDBs, scrollContainerRef,
316313
// Get all databases to count
317314
const allDatabases = await databaseApi.getDatabases(workspaceId);
318315
const serverDatabases = allDatabases.filter(
319-
(db) => db.serverId === database.serverId && db.id !== database.id,
316+
(db) => db.serverId === database.serverId,
320317
);
321318

322319
if (serverDatabases.length === 0) {
323-
message.info('No other databases found on this server');
320+
message.info('No databases found on this server');
324321
return;
325322
}
326323

@@ -338,14 +335,13 @@ export const BackupsComponent = ({ database, isCanManageDBs, scrollContainerRef,
338335
try {
339336
// Get all databases to count
340337
const allDatabases = await databaseApi.getDatabases(workspaceId);
341-
const workspaceDatabases = allDatabases.filter((db) => db.id !== database.id);
342338

343-
if (workspaceDatabases.length === 0) {
344-
message.info('No other databases found in workspace');
339+
if (allDatabases.length === 0) {
340+
message.info('No databases found in workspace');
345341
return;
346342
}
347343

348-
setBackupAllWorkspaceCount(workspaceDatabases.length);
344+
setBackupAllWorkspaceCount(allDatabases.length);
349345
setShowBackupAllWorkspaceConfirm(true);
350346
} catch (e) {
351347
alert((e as Error).message);

0 commit comments

Comments
 (0)