Skip to content

Sync-in · Sovereign platform for file storage, sharing, synchronization, and collaboration.

feat(admin): add indexing box to admin tools

johaven8686147e01c1
diff --git a/backend/src/applications/files/adapters/files-content-store-mysql.service.spec.ts b/backend/src/applications/files/adapters/files-content-store-mysql.service.spec.ts
index b46e2f50..d1aee830 100644
--- a/backend/src/applications/files/adapters/files-content-store-mysql.service.spec.ts
+++ b/backend/src/applications/files/adapters/files-content-store-mysql.service.spec.ts
@@ -1,5 +1,4 @@
import { Test, TestingModule } from '@nestjs/testing'
-import { Cache } from '../../../infrastructure/cache/services/cache.service'
import { DB_TOKEN_PROVIDER } from '../../../infrastructure/database/constants'
import { FilesContentStoreMySQL } from './files-content-store-mysql.service'
@@ -7,18 +6,12 @@ describe(FilesContentStoreMySQL.name, () => {
let module: TestingModule
let filesIndexerMySQL: FilesContentStoreMySQL
let db: { execute: jest.Mock }
- let cache: { genSlugKey: jest.Mock; get: jest.Mock; set: jest.Mock }
beforeAll(async () => {
db = { execute: jest.fn() }
- cache = {
- genSlugKey: jest.fn(() => 'cache:indexesList:key'),
- get: jest.fn(),
- set: jest.fn().mockResolvedValue(undefined)
- }
module = await Test.createTestingModule({
- providers: [FilesContentStoreMySQL, { provide: DB_TOKEN_PROVIDER, useValue: db }, { provide: Cache, useValue: cache }]
+ providers: [FilesContentStoreMySQL, { provide: DB_TOKEN_PROVIDER, useValue: db }]
}).compile()
module.useLogger(['fatal'])
@@ -39,15 +32,11 @@ describe(FilesContentStoreMySQL.name, () => {
describe('indexesList', () => {
it('should list tables starting with prefix', async () => {
- // Force a cache hit to avoid decorator calling the original method with a bad `this`
- cache.get.mockResolvedValueOnce(['files_content_u_1', 'files_content_s_2'])
+ db.execute.mockResolvedValueOnce([[{ t: 'files_content_u_1' }, { t: 'files_content_s_2' }]])
const res = await filesIndexerMySQL.indexesList()
expect(res).toEqual(['files_content_u_1', 'files_content_s_2'])
- expect(cache.genSlugKey).toHaveBeenCalled()
- expect(cache.get).toHaveBeenCalled()
- // DB should not be called on cache hit
- expect(db.execute).not.toHaveBeenCalled()
+ expect(db.execute).toHaveBeenCalledTimes(1)
})
})
diff --git a/backend/src/applications/files/adapters/files-content-store-mysql.service.ts b/backend/src/applications/files/adapters/files-content-store-mysql.service.ts
index 03d8e808..097dcc29 100644
--- a/backend/src/applications/files/adapters/files-content-store-mysql.service.ts
+++ b/backend/src/applications/files/adapters/files-content-store-mysql.service.ts
@@ -1,7 +1,6 @@
import { Inject, Injectable, Logger } from '@nestjs/common'
import { SQL, sql } from 'drizzle-orm'
import { MySqlQueryResult } from 'drizzle-orm/mysql2'
-import { CacheDecorator } from '../../../infrastructure/cache/cache.decorator'
import { DB_TOKEN_PROVIDER } from '../../../infrastructure/database/constants'
import { DBSchema } from '../../../infrastructure/database/interfaces/database.interface'
import { FilesContentStore } from '../models/files-content-store'
@@ -15,11 +14,12 @@ export class FilesContentStoreMySQL implements FilesContentStore {
constructor(@Inject(DB_TOKEN_PROVIDER) private readonly db: DBSchema) {}
- @CacheDecorator(60)
async indexesList(): Promise<string[]> {
- return ((await this.db.execute(sql`SHOW TABLES LIKE '${sql.raw(FILES_CONTENT_TABLE_PREFIX)}%'`))[0] as any).flatMap((r: Record<string, string>) =>
- Object.values(r)
- )
+ return (await this.getIndexes()).flatMap((r: Record<string, string>) => Object.values(r))
+ }
+
+ async indexesCount(): Promise<number> {
+ return (await this.getIndexes()).length
}
getIndexName(tableSuffix: string): string {
@@ -136,7 +136,7 @@ export class FilesContentStoreMySQL implements FilesContentStore {
}
async cleanIndexes(tableSuffixes: string[]): Promise<void> {
- // remove old tables
+ // remove outdated tables based on table suffixes
if (!tableSuffixes.length) return
const tableNames = tableSuffixes.map((s) => this.getIndexName(s))
const tablesToDrop: string[] = (await this.indexesList()).filter((t: string) => tableNames.indexOf(t) === -1)
@@ -145,4 +145,14 @@ export class FilesContentStoreMySQL implements FilesContentStore {
await this.dropIndex(t)
}
}
+
+ async dropAllIndexes(): Promise<void> {
+ for (const i of (await this.getIndexes()).flatMap((r: Record<string, string>) => Object.values(r))) {
+ await this.dropIndex(i)
+ }
+ }
+
+ private async getIndexes(): Promise<Record<string, string>[]> {
+ return (await this.db.execute(sql`SHOW TABLES LIKE '${sql.raw(FILES_CONTENT_TABLE_PREFIX)}%'`))[0] as any
+ }
}
diff --git a/backend/src/applications/files/constants/indexing.ts b/backend/src/applications/files/constants/indexing.ts
index 03486c0b..dfc56d72 100644
--- a/backend/src/applications/files/constants/indexing.ts
+++ b/backend/src/applications/files/constants/indexing.ts
@@ -1,4 +1,8 @@
export const MIN_CHARS_TO_SEARCH = 3
export const INDEXABLE_EXTENSIONS = new Set(['docx', 'pptx', 'xlsx', 'odt', 'odp', 'ods', 'pdf', 'txt', 'md', 'html', 'htm'])
-export const CACHE_INDEXING_UPDATE_PREFIX = 'event-update-indexing' as const
-export const CACHE_INDEXING_TTL = 86400 // 1 day
+export const CACHE_INDEXING_EVENT_PREFIX = 'event-update-indexing' as const
+export const CACHE_INDEXING_EVENT_LAST_RUN_KEY = 'indexing-update-last-run' as const
+export const CACHE_INDEXING_EVENT_TTL = 86400 // 1 day
+export const CACHE_INDEXING_RUNNING_KEY = 'indexing-running' as const
+export const CACHE_INDEXING_RUNNING_TTL = 28800 // 8 hours
+export const CACHE_INDEXING_LAST_RUN_KEY = 'indexing-last-run' as const
diff --git a/backend/src/applications/files/constants/routes.ts b/backend/src/applications/files/constants/routes.ts
index 1e98a069..c5e58105 100644
--- a/backend/src/applications/files/constants/routes.ts
+++ b/backend/src/applications/files/constants/routes.ts
@@ -8,7 +8,10 @@ export const FILES_ROUTE = {
TASKS: 'tasks',
TASKS_DOWNLOAD: 'download',
RECENTS: 'recents',
- SEARCH: 'search'
+ SEARCH: 'search',
+ INDEXING: 'indexing',
+ INDEXING_START: 'start',
+ INDEXING_STOP: 'stop'
} as const
export const API_FILES_OPERATION = `${FILES_ROUTE.BASE}/${FILES_ROUTE.OPERATION}`
@@ -23,3 +26,6 @@ export const API_FILES_TASKS = `${FILES_ROUTE.BASE}/${FILES_ROUTE.TASKS}`
export const API_FILES_TASKS_DOWNLOAD = `${FILES_ROUTE.BASE}/${FILES_ROUTE.TASKS}/${FILES_ROUTE.TASKS_DOWNLOAD}`
export const API_FILES_RECENTS = `${FILES_ROUTE.BASE}/${FILES_ROUTE.RECENTS}`
export const API_FILES_SEARCH = `${FILES_ROUTE.BASE}/${FILES_ROUTE.SEARCH}`
+export const API_FILES_INDEXING = `${FILES_ROUTE.BASE}/${FILES_ROUTE.INDEXING}`
+export const API_FILES_INDEXING_START = `${API_FILES_INDEXING}/${FILES_ROUTE.INDEXING_START}`
+export const API_FILES_INDEXING_STOP = `${API_FILES_INDEXING}/${FILES_ROUTE.INDEXING_STOP}`
diff --git a/backend/src/applications/files/files.controller.spec.ts b/backend/src/applications/files/files.controller.spec.ts
index b06719f4..60990954 100644
--- a/backend/src/applications/files/files.controller.spec.ts
+++ b/backend/src/applications/files/files.controller.spec.ts
@@ -8,6 +8,7 @@ import { FilesMethods } from './services/files-methods.service'
import { FilesRecents } from './services/files-recents.service'
import { FilesSearchManager } from './services/files-search-manager.service'
import { FilesTasksManager } from './services/files-tasks-manager.service'
+import { FilesContentIndexer } from './services/files-content-indexer.service'
describe(FilesController.name, () => {
let filesController: FilesController
@@ -53,6 +54,7 @@ describe(FilesController.name, () => {
{ provide: FilesRecents, useValue: filesRecentsMock },
{ provide: FilesSearchManager, useValue: filesSearchMock },
{ provide: ContextManager, useValue: filesSearchMock },
+ { provide: FilesContentIndexer, useValue: {} },
ContextInterceptor
]
})
diff --git a/backend/src/applications/files/files.controller.ts b/backend/src/applications/files/files.controller.ts
index fc2c0503..84188534 100644
--- a/backend/src/applications/files/files.controller.ts
+++ b/backend/src/applications/files/files.controller.ts
@@ -44,6 +44,11 @@ import { FilesMethods } from './services/files-methods.service'
import { FilesRecents } from './services/files-recents.service'
import { FilesSearchManager } from './services/files-search-manager.service'
import { FilesTasksManager } from './services/files-tasks-manager.service'
+import { FilesContentIndexer } from './services/files-content-indexer.service'
+import { UserHaveRole } from '../users/decorators/roles.decorator'
+import { USER_ROLE } from '../users/constants/user'
+import { UserRolesGuard } from '../users/guards/roles.guard'
+import { IndexingStatus } from './interfaces/indexing.interface'
@Controller(FILES_ROUTE.BASE)
@UseGuards(SpaceGuard)
@@ -54,7 +59,8 @@ export class FilesController {
private readonly filesMethods: FilesMethods,
private readonly filesTasksManager: FilesTasksManager,
private readonly filesRecents: FilesRecents,
- private readonly filesSearch: FilesSearchManager
+ private readonly filesSearch: FilesSearchManager,
+ private readonly filesContentIndexer: FilesContentIndexer
) {}
// OPERATIONS
@@ -207,4 +213,38 @@ export class FilesController {
search(@GetUser() user: UserModel, @Body() search: SearchFilesDto): Promise<FileContent[]> {
return this.filesSearch.search(user, search)
}
+
+ // CONTENT INDEXING (requires ADMIN role)
+
+ @Get(FILES_ROUTE.INDEXING)
+ @SkipSpaceGuard()
+ @UserHaveRole(USER_ROLE.ADMINISTRATOR)
+ @UseGuards(UserRolesGuard)
+ status(): Promise<IndexingStatus> {
+ return this.filesContentIndexer.status()
+ }
+
+ @Post(`${FILES_ROUTE.INDEXING}/${FILES_ROUTE.INDEXING_START}`)
+ @SkipSpaceGuard()
+ @UserHaveRole(USER_ROLE.ADMINISTRATOR)
+ @UseGuards(UserRolesGuard)
+ startIndexing(): Promise<boolean> {
+ return this.filesContentIndexer.startIndexing()
+ }
+
+ @Post(`${FILES_ROUTE.INDEXING}/${FILES_ROUTE.INDEXING_STOP}`)
+ @SkipSpaceGuard()
+ @UserHaveRole(USER_ROLE.ADMINISTRATOR)
+ @UseGuards(UserRolesGuard)
+ stopIndexing(): Promise<boolean> {
+ return this.filesContentIndexer.stopIndexing()
+ }
+
+ @Delete(FILES_ROUTE.INDEXING)
+ @SkipSpaceGuard()
+ @UserHaveRole(USER_ROLE.ADMINISTRATOR)
+ @UseGuards(UserRolesGuard)
+ dropIndexes(): Promise<void> {
+ return this.filesContentIndexer.dropIndexes()
+ }
}
diff --git a/backend/src/applications/files/interfaces/indexing.interface.ts b/backend/src/applications/files/interfaces/indexing.interface.ts
new file mode 100644
index 00000000..37ed50e7
--- /dev/null
+++ b/backend/src/applications/files/interfaces/indexing.interface.ts
@@ -0,0 +1,12 @@
+export enum IndexingState {
+ RUNNING = 'running',
+ STOPPING = 'stopping',
+ IDLE = 'idle'
+}
+
+export interface IndexingStatus {
+ indexesCount: number
+ state: IndexingState
+ lastFullRunAt: number | null
+ lastPartialRunAt: number | null
+}
diff --git a/backend/src/applications/files/models/files-content-store.ts b/backend/src/applications/files/models/files-content-store.ts
index 437bc7ca..a3b4e806 100644
--- a/backend/src/applications/files/models/files-content-store.ts
+++ b/backend/src/applications/files/models/files-content-store.ts
@@ -1,6 +1,8 @@
import { FileContent } from '../schemas/file-content.interface'
export abstract class FilesContentStore {
+ abstract indexesCount(): Promise<number>
+
abstract indexesList(): Promise<string[]>
abstract getIndexName(indexSuffix: string): string
@@ -20,4 +22,6 @@ export abstract class FilesContentStore {
abstract deleteRecords(indexName: string, ids: number[]): Promise<void>
abstract cleanIndexes(indexSuffixes: string[]): Promise<void>
+
+ abstract dropAllIndexes(): Promise<void>
}
diff --git a/backend/src/applications/files/services/files-content-indexer.service.spec.ts b/backend/src/applications/files/services/files-content-indexer.service.spec.ts
index 0fcbf85b..63e117d0 100644
--- a/backend/src/applications/files/services/files-content-indexer.service.spec.ts
+++ b/backend/src/applications/files/services/files-content-indexer.service.spec.ts
@@ -2,9 +2,15 @@ import { Test, TestingModule } from '@nestjs/testing'
import fs from 'fs/promises'
import path from 'node:path'
import { Cache } from '../../../infrastructure/cache/services/cache.service'
-import { CACHE_INDEXING_UPDATE_PREFIX } from '../constants/indexing'
+import {
+ CACHE_INDEXING_EVENT_PREFIX,
+ CACHE_INDEXING_LAST_RUN_KEY,
+ CACHE_INDEXING_RUNNING_KEY,
+ CACHE_INDEXING_RUNNING_TTL
+} from '../constants/indexing'
import { FILE_REPOSITORY } from '../constants/operations'
import { FileParseContext } from '../interfaces/file-parse-index'
+import { IndexingState } from '../interfaces/indexing.interface'
import { FilesContentStore } from '../models/files-content-store'
import * as docTextifyModule from '../utils/doc-textify/doc-textify'
import { OCRManager } from '../utils/doc-textify/utils/ocr'
@@ -14,10 +20,14 @@ import { FilesContentIndexer } from './files-content-indexer.service'
describe(FilesContentIndexer.name, () => {
let service: FilesContentIndexer
let cache: {
+ has: jest.Mock
keys: jest.Mock
+ get: jest.Mock
+ set: jest.Mock
del: jest.Mock
}
let filesIndexer: {
+ indexesCount: jest.Mock
getIndexName: jest.Mock
createIndex: jest.Mock
getRecordStats: jest.Mock
@@ -25,6 +35,7 @@ describe(FilesContentIndexer.name, () => {
deleteRecords: jest.Mock
dropIndex: jest.Mock
cleanIndexes: jest.Mock
+ dropAllIndexes: jest.Mock
}
let filesParser: {
allPaths: jest.Mock
@@ -39,17 +50,22 @@ describe(FilesContentIndexer.name, () => {
beforeEach(async () => {
cache = {
+ has: jest.fn().mockResolvedValue(false),
keys: jest.fn().mockResolvedValue([]),
+ get: jest.fn().mockResolvedValue(null),
+ set: jest.fn().mockResolvedValue(true),
del: jest.fn().mockResolvedValue(true)
}
filesIndexer = {
+ indexesCount: jest.fn().mockResolvedValue(0),
getIndexName: jest.fn((suffix: string) => `files_content_${suffix}`),
createIndex: jest.fn().mockResolvedValue(true),
getRecordStats: jest.fn().mockResolvedValue(new Map()),
insertRecord: jest.fn().mockResolvedValue(undefined),
deleteRecords: jest.fn().mockResolvedValue(undefined),
dropIndex: jest.fn().mockResolvedValue(true),
- cleanIndexes: jest.fn().mockResolvedValue(undefined)
+ cleanIndexes: jest.fn().mockResolvedValue(undefined),
+ dropAllIndexes: jest.fn().mockResolvedValue(undefined)
}
filesParser = {
allPaths: jest.fn().mockReturnValue(asyncGen([]))
@@ -76,33 +92,102 @@ describe(FilesContentIndexer.name, () => {
expect(service).toBeDefined()
})
+ it('should report running state from cache', async () => {
+ cache.has.mockResolvedValueOnce(true)
+ await expect(service.isRunning()).resolves.toBe(true)
+ expect(cache.has).toHaveBeenCalledWith(CACHE_INDEXING_RUNNING_KEY)
+ })
+
+ it('should reset running state in cache', async () => {
+ await service.resetRunningState()
+ expect(cache.del).toHaveBeenCalledWith(CACHE_INDEXING_RUNNING_KEY)
+ })
+
+ it('should start indexing only when no run is active', async () => {
+ cache.has.mockResolvedValueOnce(false)
+ const parseSpy = jest.spyOn(service, 'parseAndIndexAllFiles').mockResolvedValueOnce(undefined)
+
+ await expect(service.startIndexing()).resolves.toBe(true)
+ expect(parseSpy).toHaveBeenCalledTimes(1)
+ })
+
+ it('should not start indexing when a run is already active', async () => {
+ cache.has.mockResolvedValueOnce(true)
+ const parseSpy = jest.spyOn(service, 'parseAndIndexAllFiles').mockResolvedValueOnce(undefined)
+
+ await expect(service.startIndexing()).resolves.toBe(false)
+ expect(parseSpy).not.toHaveBeenCalled()
+ })
+
+ it('should stop indexing by setting STOPPING state', async () => {
+ cache.has.mockResolvedValueOnce(true)
+
+ await expect(service.stopIndexing()).resolves.toBe(true)
+ expect(cache.set).toHaveBeenCalledWith(CACHE_INDEXING_RUNNING_KEY, IndexingState.STOPPING, CACHE_INDEXING_RUNNING_TTL)
+ })
+
+ it('should not stop indexing when no run is active', async () => {
+ cache.has.mockResolvedValueOnce(false)
+
+ await expect(service.stopIndexing()).resolves.toBe(false)
+ expect(cache.set).not.toHaveBeenCalledWith(CACHE_INDEXING_RUNNING_KEY, IndexingState.STOPPING, CACHE_INDEXING_RUNNING_TTL)
+ })
+
+ it('should return indexing status with index count and full/partial runs', async () => {
+ cache.get.mockResolvedValueOnce(IndexingState.RUNNING).mockResolvedValueOnce(1700000000000).mockResolvedValueOnce(1700000500000)
+ filesIndexer.indexesCount.mockResolvedValueOnce(7)
+
+ await expect(service.status()).resolves.toEqual({
+ indexesCount: 7,
+ state: IndexingState.RUNNING,
+ lastFullRunAt: 1700000000000,
+ lastPartialRunAt: 1700000500000
+ })
+ })
+
+ it('should keep default index count when count retrieval fails', async () => {
+ cache.get.mockResolvedValueOnce(null).mockResolvedValueOnce(null).mockResolvedValueOnce(null)
+ filesIndexer.indexesCount.mockRejectedValueOnce(new Error('db offline'))
+
+ await expect(service.status()).resolves.toEqual({
+ indexesCount: 0,
+ state: IndexingState.IDLE,
+ lastFullRunAt: null,
+ lastPartialRunAt: null
+ })
+ })
+
+ it('should drop all indexes', async () => {
+ await service.dropIndexes()
+ expect(filesIndexer.dropAllIndexes).toHaveBeenCalledTimes(1)
+ })
+
it('should aggregate indexing event keys, parse matching entries and clean cache keys', async () => {
cache.keys.mockResolvedValueOnce([
- `${CACHE_INDEXING_UPDATE_PREFIX}-user-1`,
- `${CACHE_INDEXING_UPDATE_PREFIX}-space-2`,
- `${CACHE_INDEXING_UPDATE_PREFIX}-share-3`,
- `${CACHE_INDEXING_UPDATE_PREFIX}-unknown-9`
+ `${CACHE_INDEXING_EVENT_PREFIX}-user-1`,
+ `${CACHE_INDEXING_EVENT_PREFIX}-space-2`,
+ `${CACHE_INDEXING_EVENT_PREFIX}-share-3`,
+ `${CACHE_INDEXING_EVENT_PREFIX}-unknown-9`
])
const parseSpy = jest.spyOn(service, 'parseAndIndexAllFiles').mockResolvedValueOnce(undefined)
await service.updateIndexEntries()
expect(parseSpy).toHaveBeenCalledWith([1], [2], [3])
- expect(cache.del).toHaveBeenCalledTimes(4)
- expect(cache.del).toHaveBeenCalledWith(`${CACHE_INDEXING_UPDATE_PREFIX}-user-1`)
- expect(cache.del).toHaveBeenCalledWith(`${CACHE_INDEXING_UPDATE_PREFIX}-space-2`)
- expect(cache.del).toHaveBeenCalledWith(`${CACHE_INDEXING_UPDATE_PREFIX}-share-3`)
- expect(cache.del).toHaveBeenCalledWith(`${CACHE_INDEXING_UPDATE_PREFIX}-unknown-9`)
+ expect(cache.del).toHaveBeenCalledWith(`${CACHE_INDEXING_EVENT_PREFIX}-user-1`)
+ expect(cache.del).toHaveBeenCalledWith(`${CACHE_INDEXING_EVENT_PREFIX}-space-2`)
+ expect(cache.del).toHaveBeenCalledWith(`${CACHE_INDEXING_EVENT_PREFIX}-share-3`)
+ expect(cache.del).toHaveBeenCalledWith(`${CACHE_INDEXING_EVENT_PREFIX}-unknown-9`)
})
it('should only clean keys when no valid indexing repository type is found', async () => {
- cache.keys.mockResolvedValueOnce([`${CACHE_INDEXING_UPDATE_PREFIX}-unknown-10`])
+ cache.keys.mockResolvedValueOnce([`${CACHE_INDEXING_EVENT_PREFIX}-unknown-10`])
const parseSpy = jest.spyOn(service, 'parseAndIndexAllFiles').mockResolvedValueOnce(undefined)
await service.updateIndexEntries()
expect(parseSpy).not.toHaveBeenCalled()
- expect(cache.del).toHaveBeenCalledWith(`${CACHE_INDEXING_UPDATE_PREFIX}-unknown-10`)
+ expect(cache.del).toHaveBeenCalledWith(`${CACHE_INDEXING_EVENT_PREFIX}-unknown-10`)
})
it('should start and stop OCR manager, index all parser paths and clean stale indexes on full reindex', async () => {
@@ -126,6 +211,33 @@ describe(FilesContentIndexer.name, () => {
expect(indexSpy).toHaveBeenNthCalledWith(1, 'user_1', [{ realPath: '/u/john', pathPrefix: 'files/personal', isDir: true }])
expect(indexSpy).toHaveBeenNthCalledWith(2, 'space_5', [{ realPath: '/s/project', pathPrefix: 'files/project', isDir: true }])
expect(filesIndexer.cleanIndexes).toHaveBeenCalledWith(['user_1', 'space_5'])
+ expect(cache.set).toHaveBeenCalledWith(CACHE_INDEXING_LAST_RUN_KEY, expect.any(Number), 0)
+ expect(ocrManager.stop).toHaveBeenCalledTimes(1)
+ })
+
+ it('should stop parsing early when STOPPING state is detected', async () => {
+ const ocrManager = {
+ worker: null,
+ start: jest.fn().mockResolvedValue(null),
+ stop: jest.fn().mockResolvedValue(undefined)
+ }
+ jest.spyOn(OCRManager, 'getInstance').mockReturnValue(ocrManager as any)
+ filesParser.allPaths.mockReturnValue(
+ asyncGen([[1, FILE_REPOSITORY.USER, [{ realPath: '/u/john', pathPrefix: 'files/personal', isDir: true }]]] as [
+ number,
+ FILE_REPOSITORY,
+ FileParseContext[]
+ ][])
+ )
+ cache.get
+ .mockResolvedValueOnce(IndexingState.STOPPING) // setRunning(true) guard
+ .mockResolvedValueOnce(IndexingState.STOPPING) // loop STOPPING check
+ const indexSpy = jest.spyOn(service as any, 'indexFiles').mockResolvedValue(undefined)
+
+ await service.parseAndIndexAllFiles()
+
+ expect(indexSpy).not.toHaveBeenCalled()
+ expect(filesIndexer.cleanIndexes).not.toHaveBeenCalled()
expect(ocrManager.stop).toHaveBeenCalledTimes(1)
})
diff --git a/backend/src/applications/files/services/files-content-indexer.service.ts b/backend/src/applications/files/services/files-content-indexer.service.ts
index d7863b44..8c3ec87b 100644
--- a/backend/src/applications/files/services/files-content-indexer.service.ts
+++ b/backend/src/applications/files/services/files-content-indexer.service.ts
@@ -2,7 +2,14 @@ import { Injectable, Logger } from '@nestjs/common'
import fs from 'fs/promises'
import { Stats } from 'node:fs'
import path from 'node:path'
-import { CACHE_INDEXING_UPDATE_PREFIX, INDEXABLE_EXTENSIONS } from '../constants/indexing'
+import {
+ CACHE_INDEXING_EVENT_LAST_RUN_KEY,
+ CACHE_INDEXING_EVENT_PREFIX,
+ CACHE_INDEXING_LAST_RUN_KEY,
+ CACHE_INDEXING_RUNNING_KEY,
+ CACHE_INDEXING_RUNNING_TTL,
+ INDEXABLE_EXTENSIONS
+} from '../constants/indexing'
import { FileIndexContext, FileParseContext } from '../interfaces/file-parse-index'
import { FilesContentStore } from '../models/files-content-store'
import { FileContent } from '../schemas/file-content.interface'
@@ -13,6 +20,8 @@ import { FilesParser } from './files-parser.service'
import { genIndexingKey } from '../utils/indexing'
import { FILE_REPOSITORY } from '../constants/operations'
import { Cache } from '../../../infrastructure/cache/services/cache.service'
+import { IndexingState, IndexingStatus } from '../interfaces/indexing.interface'
+import { escapePath } from '../../../common/functions'
@Injectable()
export class FilesContentIndexer {
@@ -22,55 +31,111 @@ export class FilesContentIndexer {
constructor(
private readonly cache: Cache,
- private readonly filesIndexer: FilesContentStore,
+ private readonly filesContentStore: FilesContentStore,
private readonly filesParser: FilesParser
) {}
+ isRunning(): Promise<boolean> {
+ return this.cache.has(CACHE_INDEXING_RUNNING_KEY)
+ }
+
+ async resetRunningState(): Promise<void> {
+ await this.cache.del(CACHE_INDEXING_RUNNING_KEY)
+ }
+
+ async startIndexing(): Promise<boolean> {
+ if (await this.isRunning()) return false
+ this.parseAndIndexAllFiles().catch((e) => this.logger.error({ tag: this.startIndexing.name, msg: `${e}` }))
+ return true
+ }
+
+ async stopIndexing(): Promise<boolean> {
+ if (!(await this.isRunning())) return false
+ await this.cache.set(CACHE_INDEXING_RUNNING_KEY, IndexingState.STOPPING, CACHE_INDEXING_RUNNING_TTL)
+ return true
+ }
+
+ async status(): Promise<IndexingStatus> {
+ const status: IndexingStatus = {
+ indexesCount: 0,
+ state: (await this.cache.get(CACHE_INDEXING_RUNNING_KEY)) ?? IndexingState.IDLE,
+ lastFullRunAt: (await this.cache.get(CACHE_INDEXING_LAST_RUN_KEY)) ?? null,
+ lastPartialRunAt: (await this.cache.get(CACHE_INDEXING_EVENT_LAST_RUN_KEY)) ?? null
+ }
+ try {
+ status.indexesCount = await this.filesContentStore.indexesCount()
+ } catch (e) {
+ this.logger.error({ tag: this.status.name, msg: `${e}` })
+ }
+ return status
+ }
+
+ async dropIndexes(): Promise<void> {
+ const state: IndexingState = await this.cache.get(CACHE_INDEXING_RUNNING_KEY)
+ if (!state || state === IndexingState.IDLE) {
+ await this.filesContentStore.dropAllIndexes()
+ }
+ }
+
async updateIndexEntries() {
- const cacheKeys: string[] = []
- const [userIds, spaceIds, shareIds]: [number[], number[], number[]] = [[], [], []]
- for (const k of await this.cache.keys(`${CACHE_INDEXING_UPDATE_PREFIX}-*`)) {
- cacheKeys.push(k)
- const keySegments = k.split('-')
- const [repository, idPart] = keySegments.slice(-2)
- const id = Number.parseInt(idPart ?? '', 10)
-
- if (repository === FILE_REPOSITORY.USER) {
- userIds.push(id)
- } else if (repository === FILE_REPOSITORY.SPACE) {
- spaceIds.push(id)
- } else if (repository === FILE_REPOSITORY.SHARE) {
- shareIds.push(id)
- } else {
- this.logger.warn({ tag: this.updateIndexEntries.name, msg: `Unknown type: ${repository}` })
+ await this.setRunning(true)
+ try {
+ const cacheKeys: string[] = []
+ const [userIds, spaceIds, shareIds]: [number[], number[], number[]] = [[], [], []]
+ for (const k of await this.cache.keys(`${CACHE_INDEXING_EVENT_PREFIX}-*`)) {
+ cacheKeys.push(k)
+ const keySegments = k.split('-')
+ const [repository, idPart] = keySegments.slice(-2)
+ const id = Number.parseInt(idPart ?? '', 10)
+
+ if (repository === FILE_REPOSITORY.USER) {
+ userIds.push(id)
+ } else if (repository === FILE_REPOSITORY.SPACE) {
+ spaceIds.push(id)
+ } else if (repository === FILE_REPOSITORY.SHARE) {
+ shareIds.push(id)
+ } else {
+ this.logger.warn({ tag: this.updateIndexEntries.name, msg: `Unknown type: ${repository}` })
+ }
}
- }
- if (userIds.length || spaceIds.length || shareIds.length) {
- try {
- await this.parseAndIndexAllFiles(userIds, spaceIds, shareIds)
- } catch (e) {
- this.logger.error({ tag: this.updateIndexEntries.name, msg: `${e}` })
+ if (userIds.length || spaceIds.length || shareIds.length) {
+ if ((await this.cache.get(CACHE_INDEXING_RUNNING_KEY)) !== IndexingState.STOPPING) {
+ try {
+ await this.parseAndIndexAllFiles(userIds, spaceIds, shareIds)
+ await this.cache.set(CACHE_INDEXING_EVENT_LAST_RUN_KEY, Date.now(), 0)
+ } catch (e) {
+ this.logger.error({ tag: this.updateIndexEntries.name, msg: `${e}` })
+ }
+ }
}
- }
- // Clean up event keys even if incremental indexing fails.
- // Ignore cache deletion errors, the full reindex restores consistency.
- for (const k of cacheKeys) {
- this.cache.del(k).catch((e) => this.logger.warn({ tag: this.updateIndexEntries.name, msg: `Unable to clean key: ${k} - ${e}` }))
+ // Clean up event keys even if incremental indexing fails.
+ // Ignore cache deletion errors, the full reindex restores consistency.
+ for (const k of cacheKeys) {
+ this.cache.del(k).catch((e) => this.logger.warn({ tag: this.updateIndexEntries.name, msg: `Unable to clean key: ${k} - ${e}` }))
+ }
+ } finally {
+ await this.setRunning(false)
}
}
async parseAndIndexAllFiles(userIds?: number[], spaceIds?: number[], shareIds?: number[]): Promise<void> {
+ await this.setRunning(true)
this.ocrManager = OCRManager.getInstance(this.logger)
try {
- await this.ocrManager.start()
- } catch (e) {
- this.logger.warn({ tag: this.parseAndIndexAllFiles.name, msg: `unable to initialize OCR worker: ${e}` })
- }
- try {
+ try {
+ await this.ocrManager.start()
+ } catch (e) {
+ this.logger.warn({ tag: this.parseAndIndexAllFiles.name, msg: `unable to initialize OCR worker: ${e}` })
+ }
const indexSuffixes: string[] = []
+ let stopped = false
for await (const [id, type, paths] of this.filesParser.allPaths(userIds, spaceIds, shareIds)) {
+ if ((await this.cache.get(CACHE_INDEXING_RUNNING_KEY)) === IndexingState.STOPPING) {
+ stopped = true
+ break
+ }
const indexSuffix = genIndexingKey(id, type)
try {
await this.indexFiles(indexSuffix, paths)
@@ -78,40 +143,63 @@ export class FilesContentIndexer {
this.logger.error({ tag: this.parseAndIndexAllFiles.name, msg: `${e}` })
}
indexSuffixes.push(indexSuffix)
+ // renew the TTL after each indexed space to prevent expiration during long runs
+ this.renewRunningTTL().catch((e) => this.logger.warn({ tag: this.parseAndIndexAllFiles.name, msg: `unable to refresh running TTL: ${e}` }))
}
// clean up old tables only when all indexes have been indexed
- if (!userIds?.length && !spaceIds?.length && !shareIds?.length) {
- await this.filesIndexer.cleanIndexes(indexSuffixes)
+ if (!stopped && !userIds?.length && !spaceIds?.length && !shareIds?.length) {
+ await this.filesContentStore.cleanIndexes(indexSuffixes)
+ await this.cache.set(CACHE_INDEXING_LAST_RUN_KEY, Date.now(), 0)
}
} finally {
await this.ocrManager?.stop()
this.ocrManager = null
+ await this.setRunning(false)
+ }
+ }
+
+ private async setRunning(value: boolean): Promise<void> {
+ if (value) {
+ const current: IndexingState = await this.cache.get(CACHE_INDEXING_RUNNING_KEY)
+ if (current !== IndexingState.STOPPING) {
+ await this.cache.set(CACHE_INDEXING_RUNNING_KEY, IndexingState.RUNNING, CACHE_INDEXING_RUNNING_TTL)
+ }
+ } else {
+ await this.cache.del(CACHE_INDEXING_RUNNING_KEY)
+ }
+ }
+
+ private async renewRunningTTL(): Promise<void> {
+ // only renew if still running, preserve the stopping state
+ const state: IndexingState = await this.cache.get(CACHE_INDEXING_RUNNING_KEY)
+ if (state === IndexingState.RUNNING) {
+ await this.cache.set(CACHE_INDEXING_RUNNING_KEY, IndexingState.RUNNING, CACHE_INDEXING_RUNNING_TTL)
}
}
private async indexFiles(indexSuffix: string, paths: FileParseContext[]): Promise<void> {
- const indexName = this.filesIndexer.getIndexName(indexSuffix)
- if (!(await this.filesIndexer.createIndex(indexName))) {
+ const indexName = this.filesContentStore.getIndexName(indexSuffix)
+ if (!(await this.filesContentStore.createIndex(indexName))) {
return
}
const context: FileIndexContext = {
indexSuffix: indexSuffix,
pathPrefix: '',
regexBasePath: undefined,
- db: await this.filesIndexer.getRecordStats(indexName),
+ db: await this.filesContentStore.getRecordStats(indexName),
fs: new Set()
}
let indexedRecords = 0
let errorRecords = 0
for (const p of paths) {
- context.regexBasePath = new RegExp(`^/?${p.realPath}/?`)
+ context.regexBasePath = new RegExp(`^/?${escapePath(p.realPath)}/?`)
context.pathPrefix = p.pathPrefix || ''
if (!p.isDir) {
// Handles the space root file or shared file case
const rootFileContent = await this.analyzeFile(p.realPath, context, true)
if (rootFileContent !== null) {
- this.filesIndexer.insertRecord(indexName, rootFileContent).catch((e: Error) => {
+ this.filesContentStore.insertRecord(indexName, rootFileContent).catch((e: Error) => {
errorRecords++
this.logger.error({ tag: this.indexFiles.name, msg: `${indexSuffix} | ${rootFileContent.name} : ${e}` })
})
@@ -120,7 +208,7 @@ export class FilesContentIndexer {
continue
}
for await (const fileContent of this.parseFiles(p.realPath, context)) {
- this.filesIndexer.insertRecord(indexName, fileContent).catch((e: Error) => {
+ this.filesContentStore.insertRecord(indexName, fileContent).catch((e: Error) => {
errorRecords++
this.logger.error({ tag: this.indexFiles.name, msg: `${indexSuffix} | ${fileContent.name} : ${e}` })
})
@@ -130,7 +218,7 @@ export class FilesContentIndexer {
if (context.db.size === 0 && indexedRecords === 0) {
// case when no data
- this.filesIndexer
+ this.filesContentStore
.dropIndex(indexName)
.catch((e: Error) => this.logger.error({ tag: this.indexFiles.name, msg: `${indexSuffix} - unable to drop index : ${e}` }))
this.logger.verbose({ tag: this.indexFiles.name, msg: `${indexSuffix} - no data, index not stored` })
@@ -138,7 +226,7 @@ export class FilesContentIndexer {
// clean up old records
const recordsToDelete: number[] = [...context.db.keys()].filter((key) => !context.fs.has(key))
if (recordsToDelete.length > 0) {
- this.filesIndexer
+ this.filesContentStore
.deleteRecords(indexName, recordsToDelete)
.catch((e: Error) => this.logger.error({ tag: this.indexFiles.name, msg: `${indexSuffix} - unable to delete records : ${e}` }))
}
diff --git a/backend/src/applications/files/services/files-event-manager.service.spec.ts b/backend/src/applications/files/services/files-event-manager.service.spec.ts
index bf58a4d3..5c50760a 100644
--- a/backend/src/applications/files/services/files-event-manager.service.spec.ts
+++ b/backend/src/applications/files/services/files-event-manager.service.spec.ts
@@ -5,7 +5,7 @@ import { ACTION } from '../../../common/constants'
import { FileEvent } from '../events/file-events'
import type { FileEventType } from '../interfaces/file-event.interface'
import { CACHE_QUOTA_TTL } from '../constants/cache'
-import { CACHE_INDEXING_TTL } from '../constants/indexing'
+import { CACHE_INDEXING_EVENT_TTL } from '../constants/indexing'
import { quotaCacheKeyFromSpace } from '../utils/quota'
import { indexingUpdateCacheKeysFromSpace } from '../utils/indexing'
import { configuration } from '../../../configuration/config.environment'
@@ -81,7 +81,7 @@ describe(FilesEventManager.name, () => {
expect(cacheSetMock).toHaveBeenCalledTimes(1 + indexingKeys.length)
expect(cacheSetMock).toHaveBeenCalledWith(quotaKey, true, CACHE_QUOTA_TTL)
for (const key of indexingKeys) {
- expect(cacheSetMock).toHaveBeenCalledWith(key, true, CACHE_INDEXING_TTL)
+ expect(cacheSetMock).toHaveBeenCalledWith(key, true, CACHE_INDEXING_EVENT_TTL)
}
})
diff --git a/backend/src/applications/files/services/files-event-manager.service.ts b/backend/src/applications/files/services/files-event-manager.service.ts
index 6ca7734a..5a5e518b 100644
--- a/backend/src/applications/files/services/files-event-manager.service.ts
+++ b/backend/src/applications/files/services/files-event-manager.service.ts
@@ -6,7 +6,7 @@ import type { FileEventType } from '../interfaces/file-event.interface'
import { CACHE_QUOTA_TTL } from '../constants/cache'
import { quotaCacheKeyFromSpace } from '../utils/quota'
import { getExtensionWithoutDot } from '../utils/files'
-import { CACHE_INDEXING_TTL, INDEXABLE_EXTENSIONS } from '../constants/indexing'
+import { CACHE_INDEXING_EVENT_TTL, INDEXABLE_EXTENSIONS } from '../constants/indexing'
import { indexingUpdateCacheKeysFromSpace } from '../utils/indexing'
import { configuration } from '../../../configuration/config.environment'
@@ -112,7 +112,7 @@ export class FilesEventManager implements OnModuleDestroy {
private async storeEventsInCache() {
const [failedQuotaKeys, failedIndexingKeys] = await Promise.all([
this.cacheKeysWithTTL(this.quotaEvents, CACHE_QUOTA_TTL, 'quota'),
- this.cacheKeysWithTTL(this.indexingEvents, CACHE_INDEXING_TTL, 'indexing')
+ this.cacheKeysWithTTL(this.indexingEvents, CACHE_INDEXING_EVENT_TTL, 'indexing')
])
this.quotaEvents = failedQuotaKeys
this.indexingEvents = failedIndexingKeys
diff --git a/backend/src/applications/files/services/files-scheduler.service.ts b/backend/src/applications/files/services/files-scheduler.service.ts
index 85b0d27e..88d8b404 100644
--- a/backend/src/applications/files/services/files-scheduler.service.ts
+++ b/backend/src/applications/files/services/files-scheduler.service.ts
@@ -24,10 +24,9 @@ import { FilesQuotaManager } from './files-quota-manager.service'
@Injectable()
export class FilesScheduler {
private readonly logger = new Logger(FilesScheduler.name)
- private isIndexContentRunning = false
- private isIndexContentEntriesRunning = false
private isQuotaUpdateIsRunning = false
private isQuotaUpdateEntriesIsRunning = false
+ private pendingFullSync = false
constructor(
@Inject(DB_TOKEN_PROVIDER) private readonly db: DBSchema,
@@ -39,6 +38,7 @@ export class FilesScheduler {
@Timeout(10_000)
async onStartup(): Promise<void> {
try {
+ await this.filesContentIndexer.resetRunningState()
await this.cleanupInterruptedTasks()
await this.clearRecentFiles()
await this.updateQuotas()
@@ -67,14 +67,14 @@ export class FilesScheduler {
} finally {
this.isQuotaUpdateEntriesIsRunning = false
}
- if (!configuration.applications.files.contentIndexing.enabled || this.isIndexContentRunning || this.isIndexContentEntriesRunning) return
- this.isIndexContentEntriesRunning = true
+ if (!configuration.applications.files.contentIndexing.enabled || (await this.filesContentIndexer.isRunning())) return
try {
await this.filesContentIndexer.updateIndexEntries()
} catch (e) {
this.logger.error({ tag: this.updateStorageAndIndexing.name, msg: `update indexing error: ${e}` })
- } finally {
- this.isIndexContentEntriesRunning = false
+ }
+ if (this.pendingFullSync) {
+ await this.indexContentFiles()
}
}
@@ -164,18 +164,15 @@ export class FilesScheduler {
async indexContentFiles(): Promise<void> {
// Conditional loading of file content indexing
if (!configuration.applications.files.contentIndexing.enabled) return
- if (this.isIndexContentRunning || this.isIndexContentEntriesRunning) {
- this.logger.warn({ tag: this.indexContentFiles.name, msg: `SKIP (already running)` })
+ if (await this.filesContentIndexer.isRunning()) {
+ this.pendingFullSync = true
+ this.logger.warn({ tag: this.indexContentFiles.name, msg: `SKIP (already running) - deferred` })
return
}
- this.isIndexContentRunning = true
+ this.pendingFullSync = false
this.logger.log({ tag: this.indexContentFiles.name, msg: `START` })
- try {
- await this.filesContentIndexer.parseAndIndexAllFiles()
- this.logger.log({ tag: this.indexContentFiles.name, msg: `END` })
- } finally {
- this.isIndexContentRunning = false
- }
+ await this.filesContentIndexer.parseAndIndexAllFiles()
+ this.logger.log({ tag: this.indexContentFiles.name, msg: `END` })
}
@Cron(CronExpression.EVERY_DAY_AT_4AM)
diff --git a/backend/src/applications/files/utils/doc-textify/utils/ocr.ts b/backend/src/applications/files/utils/doc-textify/utils/ocr.ts
index bc204bb3..24381afc 100644
--- a/backend/src/applications/files/utils/doc-textify/utils/ocr.ts
+++ b/backend/src/applications/files/utils/doc-textify/utils/ocr.ts
@@ -43,7 +43,9 @@ export class OCRManager {
this.workerInitializationPromise = this.createWorkerFromConfiguration()
.then((worker) => {
this.worker = worker
- if (this.worker !== null) this.logger.verbose({ tag: this.constructor.name, msg: 'Started' })
+ if (this.worker !== null) {
+ this.logger.verbose({ tag: this.constructor.name, msg: 'Started' })
+ }
return worker
})
.finally(() => {
diff --git a/backend/src/applications/files/utils/indexing.ts b/backend/src/applications/files/utils/indexing.ts
index f8a10a08..d74825c2 100644
--- a/backend/src/applications/files/utils/indexing.ts
+++ b/backend/src/applications/files/utils/indexing.ts
@@ -1,5 +1,5 @@
import { FILE_REPOSITORY } from '../constants/operations'
-import { CACHE_INDEXING_UPDATE_PREFIX } from '../constants/indexing'
+import { CACHE_INDEXING_EVENT_PREFIX } from '../constants/indexing'
import { SpaceEnv } from '../../spaces/models/space-env.model'
import { SpaceToFileRepository } from '../events/files-events.utils'
@@ -11,14 +11,14 @@ export function indexingUpdateCacheKeysFromSpace(userId: number, space: SpaceEnv
const cacheKeys: string[] = []
if (space.inSharesRepository && !space.root.externalPath) {
// shares that are linked to a space must also be indexed
- cacheKeys.push(`${CACHE_INDEXING_UPDATE_PREFIX}-${genIndexingKey(space.id, FILE_REPOSITORY.SHARE, '-')}`)
+ cacheKeys.push(`${CACHE_INDEXING_EVENT_PREFIX}-${genIndexingKey(space.id, FILE_REPOSITORY.SHARE, '-')}`)
} else if (space.inFilesRepository && space.root?.owner?.login) {
// space where the user’s root file is anchored
- cacheKeys.push(`${CACHE_INDEXING_UPDATE_PREFIX}-${genIndexingKey(space.id, FILE_REPOSITORY.SPACE, '-')}`)
+ cacheKeys.push(`${CACHE_INDEXING_EVENT_PREFIX}-${genIndexingKey(space.id, FILE_REPOSITORY.SPACE, '-')}`)
}
const repository: { id: number; type: FILE_REPOSITORY } = SpaceToFileRepository(userId, space)
if (repository !== null) {
- cacheKeys.push(`${CACHE_INDEXING_UPDATE_PREFIX}-${genIndexingKey(repository.id, repository.type, '-')}`)
+ cacheKeys.push(`${CACHE_INDEXING_EVENT_PREFIX}-${genIndexingKey(repository.id, repository.type, '-')}`)
}
return cacheKeys
}
diff --git a/frontend/src/app/applications/admin/admin.constants.ts b/frontend/src/app/applications/admin/admin.constants.ts
index 9002963e..80bb1663 100644
--- a/frontend/src/app/applications/admin/admin.constants.ts
+++ b/frontend/src/app/applications/admin/admin.constants.ts
@@ -1,4 +1,4 @@
-import { faGear, faLayerGroup, faUserGear, faUsersGear } from '@fortawesome/free-solid-svg-icons'
+import { faGear, faLayerGroup, faScrewdriverWrench, faUserGear, faUsersGear } from '@fortawesome/free-solid-svg-icons'
import { AppMenu } from '../../layout/layout.interfaces'
export const ADMIN_PATH = {
@@ -7,7 +7,8 @@ export const ADMIN_PATH = {
GUESTS: 'guests',
GROUPS: 'groups',
PGROUPS: 'personal_groups',
- SPACES: 'spaces'
+ SPACES: 'spaces',
+ TOOLS: 'tools'
} as const
export const ADMIN_TITLE = {
@@ -16,14 +17,16 @@ export const ADMIN_TITLE = {
GROUPS: 'Groups',
GUESTS: 'Guests',
PGROUPS: 'Personal groups',
- SPACES: 'Spaces'
+ SPACES: 'Spaces',
+ TOOLS: 'Tools'
} as const
export const ADMIN_ICON = {
BASE: faGear,
USERS: faUserGear,
GROUPS: faUsersGear,
- SPACES: faLayerGroup
+ SPACES: faLayerGroup,
+ TOOLS: faScrewdriverWrench
} as const
export const ADMIN_MENU: AppMenu = {
@@ -49,6 +52,11 @@ export const ADMIN_MENU: AppMenu = {
title: ADMIN_TITLE.SPACES,
icon: ADMIN_ICON.SPACES,
link: `${ADMIN_PATH.BASE}/${ADMIN_PATH.SPACES}`
+ },
+ {
+ title: ADMIN_TITLE.TOOLS,
+ icon: ADMIN_ICON.TOOLS,
+ link: `${ADMIN_PATH.BASE}/${ADMIN_PATH.TOOLS}`
}
]
} as const
diff --git a/frontend/src/app/applications/admin/admin.routes.ts b/frontend/src/app/applications/admin/admin.routes.ts
index 45236462..e952fa74 100644
--- a/frontend/src/app/applications/admin/admin.routes.ts
+++ b/frontend/src/app/applications/admin/admin.routes.ts
@@ -53,6 +53,10 @@ export const adminRoutes: Routes = [
}
]
},
+ {
+ path: ADMIN_PATH.TOOLS,
+ loadComponent: () => import('./components/admin-tools.component').then((c) => c.AdminToolsComponent)
+ },
{ path: '**', redirectTo: ADMIN_PATH.USERS }
]
}
diff --git a/frontend/src/app/applications/admin/admin.service.ts b/frontend/src/app/applications/admin/admin.service.ts
index 3d121c09..6d3830f5 100644
--- a/frontend/src/app/applications/admin/admin.service.ts
+++ b/frontend/src/app/applications/admin/admin.service.ts
@@ -38,6 +38,12 @@ import { MemberModel } from '../users/models/member.model'
import { USER_PATH } from '../users/user.constants'
import { AdminGroupModel } from './models/admin-group.model'
import { AdminUserModel } from './models/admin-user.model'
+import {
+ API_FILES_INDEXING,
+ API_FILES_INDEXING_START,
+ API_FILES_INDEXING_STOP
+} from '@sync-in-server/backend/src/applications/files/constants/routes'
+import type { IndexingStatus } from '@sync-in-server/backend/src/applications/files/interfaces/indexing.interface'
@Injectable({
providedIn: 'root'
@@ -144,4 +150,20 @@ export class AdminService {
listSpaces(): Observable<SpaceModel[]> {
return this.http.get<SpaceProps[]>(API_ADMIN_SPACES_LIST).pipe(map((sps: SpaceProps[]) => sps.map((s: SpaceProps) => new SpaceModel(s))))
}
+
+ indexingStatus(): Observable<IndexingStatus> {
+ return this.http.get<IndexingStatus>(API_FILES_INDEXING)
+ }
+
+ startIndexing(): Observable<boolean> {
+ return this.http.post<boolean>(API_FILES_INDEXING_START, null)
+ }
+
+ stopIndexing(): Observable<boolean> {
+ return this.http.post<boolean>(API_FILES_INDEXING_STOP, null)
+ }
+
+ dropIndexes(): Observable<void> {
+ return this.http.delete<void>(API_FILES_INDEXING)
+ }
}
diff --git a/frontend/src/app/applications/admin/components/admin-tools.component.html b/frontend/src/app/applications/admin/components/admin-tools.component.html
new file mode 100644
index 00000000..fb341a31
--- /dev/null
+++ b/frontend/src/app/applications/admin/components/admin-tools.component.html
@@ -0,0 +1,109 @@
+<div class="profile-page" appAutoResize [resizeOffset]="40">
+ <div class="container-fluid p-2">
+ <div class="row g-3">
+ <div class="col-12 col-lg-6">
+ <div class="card dialog-tab-card">
+ <div class="card-body">
+ <div class="text-muted text-uppercase fs-sm text-bold mb-2" l10nTranslate>Full-text indexing</div>
+ <div class="row g-0">
+ <div class="col-12">
+ <div class="card dialog-check-card">
+ <div class="card-body p-2">
+ <div class="row g-2 align-items-center py-2 border-bottom border-secondary-subtle">
+ <label for="" class="form-label col-7 col-sm-6 mb-0" l10nTranslate>State</label>
+ <div class="col-5 col-sm-6 text-end">
+ @switch (indexingStatus.state) {
+ @case (IndexingState.RUNNING) {
+ <span class="badge bg-success" l10nTranslate>Running</span>
+ }
+ @case (IndexingState.STOPPING) {
+ <span class="badge bg-warning" l10nTranslate>Stopping</span>
+ }
+ @default {
+ <span class="badge bg-secondary" l10nTranslate>Idle</span>
+ }
+ }
+ </div>
+ </div>
+ <div class="row g-2 align-items-center py-2 border-bottom border-secondary-subtle">
+ <label for="" class="form-label col-7 col-sm-6 mb-0" l10nTranslate>Indexes</label>
+ <div class="col-5 col-sm-6 text-end">
+ <span class="badge bg-primary">{{ indexingStatus.indexesCount }}</span>
+ </div>
+ </div>
+ <div class="row g-2 align-items-center py-2 border-bottom border-secondary-subtle mb-2">
+ <label for="" class="form-label col-7 col-sm-6 mb-0" l10nTranslate>Last partial run</label>
+ <div class="col-5 col-sm-6 text-end">
+ @if (indexingStatus.lastPartialRunAt) {
+ <span class="badge bg-purple text-muted">{{ indexingStatus.lastPartialRunAt | amDateFormat }}</span>
+ } @else {
+ <span class="badge bg-purple text-muted" l10nTranslate>Never</span>
+ }
+ </div>
+ </div>
+ <div class="row g-2 align-items-center py-2 border-bottom border-secondary-subtle mb-2">
+ <label for="" class="form-label col-7 col-sm-6 mb-0" l10nTranslate>Last full run</label>
+ <div class="col-5 col-sm-6 text-end">
+ @if (indexingStatus.lastFullRunAt) {
+ <span class="badge bg-purple text-muted">{{ indexingStatus.lastFullRunAt | amDateFormat }}</span>
+ } @else {
+ <span class="badge bg-danger text-muted" l10nTranslate>Never</span>
+ }
+ </div>
+ </div>
+ <label for="" class="form-label me-auto mb-0 text-nowrap" l10nTranslate>Actions</label>
+ <div class="d-flex align-items-center">
+ <div class="text-muted no-select fs-sm my-3 px-1 me-auto" l10nTranslate>
+ Start or stop indexing.
+ </div>
+ @if (indexingStatus.state === IndexingState.RUNNING) {
+ <button
+ (click)="stopIndexing()"
+ class="btn btn-warning btn-sm text-nowrap"
+ type="button">
+ <fa-icon [icon]="icons.faStop"></fa-icon>
+ <span class="ms-1" l10nTranslate>Stop</span>
+ </button>
+ } @else {
+ <button
+ (click)="startIndexing()"
+ [disabled]="indexingStatus.state === IndexingState.STOPPING"
+ class="btn btn-success btn-sm text-nowrap"
+ type="button">
+ <fa-icon [icon]="icons.faPlay"></fa-icon>
+ <span class="ms-1" l10nTranslate>Start</span>
+ </button>
+ }
+ </div>
+ <div class="d-flex align-items-center">
+ <div class="text-muted no-select fs-sm my-3 px-1 me-auto" l10nTranslate>
+ Delete all indexes.
+ </div>
+ @if (confirmResetIndexing) {
+ <button
+ (click)="confirmResetIndexing = false"
+ [disabled]="indexingStatus.state === IndexingState.RUNNING"
+ class="btn btn-secondary btn-sm text-nowrap me-2"
+ type="button">
+ <span l10nTranslate>Cancel</span>
+ </button>
+ }
+ <button
+ (click)="dropIndexes()"
+ class="btn {{confirmResetIndexing ? 'btn-danger' : 'btn-secondary'}} btn-sm text-nowrap"
+ type="button"
+ [disabled]="indexingStatus.state !== IndexingState.IDLE || indexingStatus.indexesCount === 0">
+ <fa-icon [icon]="icons.faTrash"></fa-icon>
+ <span class="ms-1" l10nTranslate>Remove</span>
+ </button>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+</div>
diff --git a/frontend/src/app/applications/admin/components/admin-tools.component.ts b/frontend/src/app/applications/admin/components/admin-tools.component.ts
new file mode 100644
index 00000000..eecdd9a6
--- /dev/null
+++ b/frontend/src/app/applications/admin/components/admin-tools.component.ts
@@ -0,0 +1,66 @@
+import { Component, DestroyRef, inject } from '@angular/core'
+import { takeUntilDestroyed } from '@angular/core/rxjs-interop'
+import { FaIconComponent } from '@fortawesome/angular-fontawesome'
+import { faPlay, faStop, faTrash } from '@fortawesome/free-solid-svg-icons'
+import { L10nTranslateDirective } from 'angular-l10n'
+import { AutoResizeDirective } from '../../../common/directives/auto-resize.directive'
+import { ADMIN_ICON, ADMIN_PATH, ADMIN_TITLE } from '../admin.constants'
+import { LayoutService } from '../../../layout/layout.service'
+import { AdminService } from '../admin.service'
+import { switchMap, timer } from 'rxjs'
+import { IndexingState, IndexingStatus } from '@sync-in-server/backend/src/applications/files/interfaces/indexing.interface'
+import { TimeDateFormatPipe } from '../../../common/pipes/time-date-format.pipe'
+
+@Component({
+ selector: 'app-admin-tools',
+ imports: [AutoResizeDirective, L10nTranslateDirective, FaIconComponent, TimeDateFormatPipe],
+ templateUrl: 'admin-tools.component.html'
+})
+export class AdminToolsComponent {
+ protected readonly icons = { faTrash, faPlay, faStop }
+ protected readonly IndexingState = IndexingState
+ protected confirmResetIndexing = false
+ protected indexingStatus: IndexingStatus = { indexesCount: 0, state: this.IndexingState.IDLE, lastFullRunAt: null, lastPartialRunAt: null }
+ private readonly adminService = inject(AdminService)
+ private readonly layout = inject(LayoutService)
+ private readonly destroyRef = inject(DestroyRef)
+
+ constructor() {
+ timer(0, 6_000)
+ .pipe(
+ switchMap(() => this.adminService.indexingStatus()),
+ takeUntilDestroyed(this.destroyRef)
+ )
+ .subscribe((r: IndexingStatus) => (this.indexingStatus = { ...r }))
+ this.layout.setBreadcrumbIcon(ADMIN_ICON.TOOLS)
+ this.layout.setBreadcrumbNav({
+ url: `/${ADMIN_PATH.BASE}/${ADMIN_PATH.TOOLS}/${ADMIN_TITLE.TOOLS}`,
+ splicing: 2,
+ translating: true,
+ sameLink: true
+ })
+ }
+
+ startIndexing() {
+ this.adminService.startIndexing().subscribe((started) => {
+ if (started) this.indexingStatus.state = IndexingState.RUNNING
+ })
+ }
+
+ stopIndexing() {
+ this.adminService.stopIndexing().subscribe((stopped) => {
+ if (stopped) this.indexingStatus.state = IndexingState.STOPPING
+ })
+ }
+
+ dropIndexes() {
+ if (!this.confirmResetIndexing) {
+ this.confirmResetIndexing = true
+ return
+ }
+ this.adminService.dropIndexes().subscribe(() => {
+ this.indexingStatus.indexesCount = 0
+ this.confirmResetIndexing = false
+ })
+ }
+}
diff --git a/frontend/src/i18n/de.json b/frontend/src/i18n/de.json
index 3825bd02..0a272d34 100644
--- a/frontend/src/i18n/de.json
+++ b/frontend/src/i18n/de.json
@@ -100,6 +100,7 @@
"See members": "Mitglieder anzeigen",
"Administrator": "Administrator",
"Administration": "Administration",
+ "Tools": "Werkzeuge",
"User": "Benutzer",
"user": "benutzer",
"Users": "Benutzer",
@@ -638,6 +639,20 @@
"Ask Me": "Mich fragen",
"Used when both editors support the file type.": "Wird verwendet, wenn beide Editoren den Dateityp unterstützen.",
"Enable content indexation for personal files.": "Inhaltsindexierung für persönliche Dateien aktivieren.",
+ "Actions": "Aktionen",
+ "Delete all indexes.": "Alle Indizes löschen.",
+ "Full-text indexing": "Volltextindizierung",
+ "Last full run": "Letzter vollständiger Durchlauf",
+ "Last partial run": "Letzter teilweiser Durchlauf",
+ "Never": "Nie",
+ "Start or stop indexing.": "Indexierung starten oder stoppen.",
+ "Start": "Starten",
+ "State": "Status",
+ "Stop": "Stoppen",
+ "Indexes": "Indizes",
+ "Running": "Läuft",
+ "Stopping": "Wird gestoppt",
+ "Idle": "Leerlauf",
"Preferences": "Einstellungen",
"of": "von",
"Sidebar auto-hide enabled": "Automatisches Ausblenden der Seitenleiste aktiviert",
diff --git a/frontend/src/i18n/en.json b/frontend/src/i18n/en.json
index ab10b02d..cd31cafd 100644
--- a/frontend/src/i18n/en.json
+++ b/frontend/src/i18n/en.json
@@ -1,4 +1,13 @@
{
+ "Actions": "Actions",
+ "Cancel": "Cancel",
+ "Delete all indexes.": "Delete all indexes.",
+ "Full-text indexing": "Full-text indexing",
+ "Idle": "Idle",
+ "Indexes": "Indexes",
+ "Last full run": "Last full run",
+ "Last partial run": "Last partial run",
+ "Never": "Never",
"no_task": "No task",
"one_task": "{{ nb }} task completed",
"nb_tasks": "{{ nb }} tasks completed",
@@ -15,9 +24,16 @@
"delete_one_file": "Do you want to permanently delete <b>{{arg}}</b> ?",
"trash_multiple_files": "Would you like to move <b>{{arg}} files</b> to trash ?",
"delete_multiple_files": "Do you want to permanently delete these <b>{{arg}} files</b> ?",
+ "Remove": "Remove",
+ "Running": "Running",
"scheduler_unit_hour": "hours",
"scheduler_unit_minute": "minutes",
"scheduler_unit_day": "days",
+ "Start": "Start",
+ "Start or stop indexing.": "Start or stop indexing.",
+ "State": "State",
+ "Stop": "Stop",
+ "Stopping": "Stopping",
"no_selection": "no item selected",
"one_selection": "{{ nb }} item selected",
"nb_selections": "{{ nb }} items selected"
diff --git a/frontend/src/i18n/es.json b/frontend/src/i18n/es.json
index 295b97cc..bd79ef23 100644
--- a/frontend/src/i18n/es.json
+++ b/frontend/src/i18n/es.json
@@ -100,6 +100,7 @@
"See members": "Ver miembros",
"Administrator": "Administrador",
"Administration": "Administración",
+ "Tools": "Herramientas",
"User": "Usuario",
"user": "usuario",
"Users": "Usuarios",
@@ -638,6 +639,20 @@
"Ask Me": "Preguntarme",
"Used when both editors support the file type.": "Se usa cuando ambos editores admiten el tipo de archivo.",
"Enable content indexation for personal files.": "Habilitar la indexación de contenido para archivos personales.",
+ "Actions": "Acciones",
+ "Delete all indexes.": "Eliminar todos los índices.",
+ "Full-text indexing": "Indexación de texto completo",
+ "Last full run": "Última ejecución completa",
+ "Last partial run": "Última ejecución parcial",
+ "Never": "Nunca",
+ "Start or stop indexing.": "Iniciar o detener la indexación.",
+ "Start": "Iniciar",
+ "State": "Estado",
+ "Stop": "Detener",
+ "Indexes": "Índices",
+ "Running": "En ejecución",
+ "Stopping": "Deteniendo",
+ "Idle": "Inactivo",
"Preferences": "Preferencias",
"of": "de",
"Sidebar auto-hide enabled": "Ocultación automática de la barra lateral activada",
diff --git a/frontend/src/i18n/fr.json b/frontend/src/i18n/fr.json
index 6bd915a9..87635e65 100644
--- a/frontend/src/i18n/fr.json
+++ b/frontend/src/i18n/fr.json
@@ -100,6 +100,7 @@
"See members": "Voir les membres",
"Administrator": "Administrateur",
"Administration": "Administration",
+ "Tools": "Outils",
"User": "Utilisateur",
"user": "utilisateur",
"Users": "Utilisateurs",
@@ -638,6 +639,20 @@
"Ask Me": "Me demander",
"Used when both editors support the file type.": "Utilisé lorsque les deux éditeurs prennent en charge le type de fichier.",
"Enable content indexation for personal files.": "Activer l'indexation du contenu pour les fichiers personnels.",
+ "Actions": "Actions",
+ "Delete all indexes.": "Supprimer tous les indexes.",
+ "Full-text indexing": "Indexation full-text",
+ "Last full run": "Dernière exécution complète",
+ "Last partial run": "Dernière exécution partielle",
+ "Never": "Jamais",
+ "Start or stop indexing.": "Démarrer ou arrêter l'indexation.",
+ "Start": "Démarrer",
+ "State": "État",
+ "Stop": "Arrêter",
+ "Indexes": "Indexes",
+ "Running": "En cours",
+ "Stopping": "Arrêt en cours",
+ "Idle": "Inactif",
"Preferences": "Préférences",
"of": "de",
"Sidebar auto-hide enabled": "Masquage automatique de la barre latérale activé",
diff --git a/frontend/src/i18n/hi.json b/frontend/src/i18n/hi.json
index 659b2ae5..defc271e 100644
--- a/frontend/src/i18n/hi.json
+++ b/frontend/src/i18n/hi.json
@@ -100,6 +100,7 @@
"See members": "सदस्य देखें",
"Administrator": "प्रशासक",
"Administration": "प्रशासन",
+ "Tools": "उपकरण",
"User": "उपयोगकर्ता",
"user": "उपयोगकर्ता",
"Users": "उपयोगकर्ता",
@@ -638,6 +639,20 @@
"Ask Me": "मुझसे पूछें",
"Used when both editors support the file type.": "जब दोनों संपादक फ़ाइल प्रकार का समर्थन करते हैं तो उपयोग किया जाता है।",
"Enable content indexation for personal files.": "व्यक्तिगत फ़ाइलों के लिए सामग्री अनुक्रमण सक्षम करें।",
+ "Actions": "क्रियाएँ",
+ "Delete all indexes.": "सभी इंडेक्स हटाएँ।",
+ "Full-text indexing": "पूर्ण-पाठ अनुक्रमणिका",
+ "Last full run": "अंतिम पूर्ण रन",
+ "Last partial run": "अंतिम आंशिक रन",
+ "Never": "कभी नहीं",
+ "Start or stop indexing.": "इंडेक्सिंग शुरू या बंद करें।",
+ "Start": "शुरू करें",
+ "State": "स्थिति",
+ "Stop": "रोकें",
+ "Indexes": "इंडेक्स",
+ "Running": "चल रहा है",
+ "Stopping": "रोका जा रहा है",
+ "Idle": "निष्क्रिय",
"Preferences": "वरीयताएँ",
"of": "का",
"Sidebar auto-hide enabled": "साइडबार स्वतः छिपाना सक्षम",
diff --git a/frontend/src/i18n/it.json b/frontend/src/i18n/it.json
index be1a5de8..7e51e264 100644
--- a/frontend/src/i18n/it.json
+++ b/frontend/src/i18n/it.json
@@ -100,6 +100,7 @@
"See members": "Vedi membri",
"Administrator": "Amministratore",
"Administration": "Amministrazione",
+ "Tools": "Strumenti",
"User": "Utente",
"user": "utente",
"Users": "Utenti",
@@ -638,6 +639,20 @@
"Ask Me": "Chiedimelo",
"Used when both editors support the file type.": "Usato quando entrambi gli editor supportano il tipo di file.",
"Enable content indexation for personal files.": "Abilita l'indicizzazione dei contenuti per i file personali.",
+ "Actions": "Azioni",
+ "Delete all indexes.": "Elimina tutti gli indici.",
+ "Full-text indexing": "Indicizzazione full-text",
+ "Last full run": "Ultima esecuzione completa",
+ "Last partial run": "Ultima esecuzione parziale",
+ "Never": "Mai",
+ "Start or stop indexing.": "Avvia o arresta l'indicizzazione.",
+ "Start": "Avvia",
+ "State": "Stato",
+ "Stop": "Arresta",
+ "Indexes": "Indici",
+ "Running": "In esecuzione",
+ "Stopping": "In arresto",
+ "Idle": "Inattivo",
"Preferences": "Preferenze",
"of": "di",
"Sidebar auto-hide enabled": "Nascondimento automatico della barra laterale attivato",
diff --git a/frontend/src/i18n/ja.json b/frontend/src/i18n/ja.json
index 7f94fead..b85403e2 100644
--- a/frontend/src/i18n/ja.json
+++ b/frontend/src/i18n/ja.json
@@ -100,6 +100,7 @@
"See members": "メンバーを表示",
"Administrator": "管理者",
"Administration": "管理",
+ "Tools": "ツール",
"User": "ユーザー",
"user": "ユーザー",
"Users": "ユーザー",
@@ -638,6 +639,20 @@
"Ask Me": "毎回確認",
"Used when both editors support the file type.": "両方のエディタがファイルタイプをサポートしている場合に使用されます。",
"Enable content indexation for personal files.": "個人ファイルのコンテンツインデックス作成を有効にする。",
+ "Actions": "アクション",
+ "Delete all indexes.": "すべてのインデックスを削除します。",
+ "Full-text indexing": "全文インデックス",
+ "Last full run": "最後の完全実行",
+ "Last partial run": "最後の部分実行",
+ "Never": "なし",
+ "Start or stop indexing.": "インデックス作成を開始または停止します。",
+ "Start": "開始",
+ "State": "状態",
+ "Stop": "停止",
+ "Indexes": "インデックス",
+ "Running": "実行中",
+ "Stopping": "停止中",
+ "Idle": "待機中",
"Preferences": "環境設定",
"of": "の",
"Sidebar auto-hide enabled": "サイドバー自動非表示が有効",
diff --git a/frontend/src/i18n/ko.json b/frontend/src/i18n/ko.json
index 73aeeff0..1c464505 100644
--- a/frontend/src/i18n/ko.json
+++ b/frontend/src/i18n/ko.json
@@ -100,6 +100,7 @@
"See members": "멤버 보기",
"Administrator": "관리자",
"Administration": "관리",
+ "Tools": "도구",
"User": "사용자",
"user": "사용자",
"Users": "사용자",
@@ -638,6 +639,20 @@
"Ask Me": "매번 물어보기",
"Used when both editors support the file type.": "두 편집기 모두 파일 유형을 지원할 때 사용됩니다.",
"Enable content indexation for personal files.": "개인 파일에 대한 콘텐츠 인덱싱을 활성화합니다.",
+ "Actions": "작업",
+ "Delete all indexes.": "모든 인덱스를 삭제합니다.",
+ "Full-text indexing": "전문 색인",
+ "Last full run": "마지막 전체 실행",
+ "Last partial run": "마지막 부분 실행",
+ "Never": "없음",
+ "Start or stop indexing.": "인덱싱을 시작하거나 중지합니다.",
+ "Start": "시작",
+ "State": "상태",
+ "Stop": "중지",
+ "Indexes": "인덱스",
+ "Running": "실행 중",
+ "Stopping": "중지 중",
+ "Idle": "유휴",
"Preferences": "환경 설정",
"of": "의",
"Sidebar auto-hide enabled": "사이드바 자동 숨김 활성화",
diff --git a/frontend/src/i18n/nl.json b/frontend/src/i18n/nl.json
index 1997c856..35fbab32 100644
--- a/frontend/src/i18n/nl.json
+++ b/frontend/src/i18n/nl.json
@@ -100,6 +100,7 @@
"See members": "Leden bekijken",
"Administrator": "Beheerder",
"Administration": "Beheer",
+ "Tools": "Hulpmiddelen",
"User": "Gebruiker",
"user": "gebruiker",
"Users": "Gebruikers",
@@ -638,6 +639,20 @@
"Ask Me": "Mij vragen",
"Used when both editors support the file type.": "Wordt gebruikt wanneer beide editors het bestandstype ondersteunen.",
"Enable content indexation for personal files.": "Inhoudsindexering inschakelen voor persoonlijke bestanden.",
+ "Actions": "Acties",
+ "Delete all indexes.": "Verwijder alle indexen.",
+ "Full-text indexing": "Volledige tekst indexering",
+ "Last full run": "Laatste volledige uitvoering",
+ "Last partial run": "Laatste gedeeltelijke uitvoering",
+ "Never": "Nooit",
+ "Start or stop indexing.": "Indexering starten of stoppen.",
+ "Start": "Start",
+ "State": "Status",
+ "Stop": "Stop",
+ "Indexes": "Indexen",
+ "Running": "Actief",
+ "Stopping": "Bezig met stoppen",
+ "Idle": "Inactief",
"Preferences": "Voorkeuren",
"of": "van",
"Sidebar auto-hide enabled": "Zijbalk automatisch verbergen ingeschakeld",
diff --git a/frontend/src/i18n/pl.json b/frontend/src/i18n/pl.json
index 3d743410..5daadf61 100644
--- a/frontend/src/i18n/pl.json
+++ b/frontend/src/i18n/pl.json
@@ -100,6 +100,7 @@
"See members": "Zobacz członków",
"Administrator": "Administrator",
"Administration": "Administracja",
+ "Tools": "Narzędzia",
"User": "Użytkownik",
"user": "użytkownik",
"Users": "Użytkownicy",
@@ -638,6 +639,20 @@
"Ask Me": "Pytaj mnie",
"Used when both editors support the file type.": "Używane, gdy oba edytory obsługują typ pliku.",
"Enable content indexation for personal files.": "Włącz indeksowanie treści dla plików osobistych.",
+ "Actions": "Akcje",
+ "Delete all indexes.": "Usuń wszystkie indeksy.",
+ "Full-text indexing": "Indeksowanie pełnotekstowe",
+ "Last full run": "Ostatnie pełne uruchomienie",
+ "Last partial run": "Ostatnie częściowe uruchomienie",
+ "Never": "Nigdy",
+ "Start or stop indexing.": "Rozpocznij lub zatrzymaj indeksowanie.",
+ "Start": "Start",
+ "State": "Stan",
+ "Stop": "Stop",
+ "Indexes": "Indeksy",
+ "Running": "W trakcie",
+ "Stopping": "Zatrzymywanie",
+ "Idle": "Bezczynny",
"Preferences": "Preferencje",
"of": "z",
"Sidebar auto-hide enabled": "Włączono automatyczne ukrywanie panelu bocznego",
diff --git a/frontend/src/i18n/pt-BR.json b/frontend/src/i18n/pt-BR.json
index 7c71e8ad..cdd0cc13 100644
--- a/frontend/src/i18n/pt-BR.json
+++ b/frontend/src/i18n/pt-BR.json
@@ -100,6 +100,7 @@
"See members": "Ver membros",
"Administrator": "Administrador",
"Administration": "Administração",
+ "Tools": "Ferramentas",
"User": "Usuário",
"user": "usuário",
"Users": "Usuários",
@@ -638,6 +639,20 @@
"Ask Me": "Perguntar sempre",
"Used when both editors support the file type.": "Usado quando ambos os editores suportam o tipo de arquivo.",
"Enable content indexation for personal files.": "Ativar indexação de conteúdo para arquivos pessoais.",
+ "Actions": "Ações",
+ "Delete all indexes.": "Excluir todos os índices.",
+ "Full-text indexing": "Indexação de texto completo",
+ "Last full run": "Última execução completa",
+ "Last partial run": "Última execução parcial",
+ "Never": "Nunca",
+ "Start or stop indexing.": "Iniciar ou parar a indexação.",
+ "Start": "Iniciar",
+ "State": "Estado",
+ "Stop": "Parar",
+ "Indexes": "Índices",
+ "Running": "Em execução",
+ "Stopping": "Parando",
+ "Idle": "Inativo",
"Preferences": "Preferências",
"of": "de",
"Sidebar auto-hide enabled": "Ocultação automática da barra lateral ativada",
diff --git a/frontend/src/i18n/pt.json b/frontend/src/i18n/pt.json
index 48537033..0a0f7431 100644
--- a/frontend/src/i18n/pt.json
+++ b/frontend/src/i18n/pt.json
@@ -100,6 +100,7 @@
"See members": "Ver membros",
"Administrator": "Administrador",
"Administration": "Administração",
+ "Tools": "Ferramentas",
"User": "Usuário",
"user": "usuário",
"Users": "Usuários",
@@ -638,6 +639,20 @@
"Ask Me": "Perguntar sempre",
"Used when both editors support the file type.": "Usado quando ambos os editores suportam o tipo de arquivo.",
"Enable content indexation for personal files.": "Ativar indexação de conteúdo para ficheiros pessoais.",
+ "Actions": "Ações",
+ "Delete all indexes.": "Eliminar todos os índices.",
+ "Full-text indexing": "Indexação de texto completo",
+ "Last full run": "Última execução completa",
+ "Last partial run": "Última execução parcial",
+ "Never": "Nunca",
+ "Start or stop indexing.": "Iniciar ou parar a indexação.",
+ "Start": "Iniciar",
+ "State": "Estado",
+ "Stop": "Parar",
+ "Indexes": "Índices",
+ "Running": "Em execução",
+ "Stopping": "A parar",
+ "Idle": "Inativo",
"Preferences": "Preferências",
"of": "de",
"Sidebar auto-hide enabled": "Ocultação automática da barra lateral ativada",
diff --git a/frontend/src/i18n/ru.json b/frontend/src/i18n/ru.json
index d073e1df..280d2ee2 100644
--- a/frontend/src/i18n/ru.json
+++ b/frontend/src/i18n/ru.json
@@ -100,6 +100,7 @@
"See members": "Просмотреть участников",
"Administrator": "Администратор",
"Administration": "Администрирование",
+ "Tools": "Инструменты",
"User": "Пользователь",
"user": "пользователь",
"Users": "Пользователи",
@@ -638,6 +639,20 @@
"Ask Me": "Спрашивать каждый раз",
"Used when both editors support the file type.": "Используется, когда оба редактора поддерживают тип файла.",
"Enable content indexation for personal files.": "Включить индексацию содержимого для личных файлов.",
+ "Actions": "Действия",
+ "Delete all indexes.": "Удалить все индексы.",
+ "Full-text indexing": "Полнотекстовая индексация",
+ "Last full run": "Последний полный запуск",
+ "Last partial run": "Последний частичный запуск",
+ "Never": "Никогда",
+ "Start or stop indexing.": "Запустить или остановить индексацию.",
+ "Start": "Запустить",
+ "State": "Состояние",
+ "Stop": "Остановить",
+ "Indexes": "Индексы",
+ "Running": "Выполняется",
+ "Stopping": "Останавливается",
+ "Idle": "Ожидание",
"Preferences": "Настройки",
"of": "из",
"Sidebar auto-hide enabled": "Автоскрытие боковой панели включено",
diff --git a/frontend/src/i18n/tr.json b/frontend/src/i18n/tr.json
index 24dfa409..4d480dfa 100644
--- a/frontend/src/i18n/tr.json
+++ b/frontend/src/i18n/tr.json
@@ -100,6 +100,7 @@
"See members": "Üyeleri görüntüle",
"Administrator": "Yönetici",
"Administration": "Yönetim",
+ "Tools": "Araçlar",
"User": "Kullanıcı",
"user": "kullanıcı",
"Users": "Kullanıcılar",
@@ -638,6 +639,20 @@
"Ask Me": "Bana sor",
"Used when both editors support the file type.": "Her iki editör de dosya türünü desteklediğinde kullanılır.",
"Enable content indexation for personal files.": "Kişisel dosyalar için içerik indekslemeyi etkinleştir.",
+ "Actions": "İşlemler",
+ "Delete all indexes.": "Tüm dizinleri silin.",
+ "Full-text indexing": "Tam metin indeksleme",
+ "Last full run": "Son tam çalıştırma",
+ "Last partial run": "Son kısmi çalıştırma",
+ "Never": "Hiçbir zaman",
+ "Start or stop indexing.": "Dizinlemeyi başlatın veya durdurun.",
+ "Start": "Başlat",
+ "State": "Durum",
+ "Stop": "Durdur",
+ "Indexes": "Dizinler",
+ "Running": "Çalışıyor",
+ "Stopping": "Durduruluyor",
+ "Idle": "Boşta",
"Preferences": "Tercihler",
"of": "/",
"Sidebar auto-hide enabled": "Kenar çubuğu otomatik gizleme etkin",
diff --git a/frontend/src/i18n/zh.json b/frontend/src/i18n/zh.json
index 1610ca63..c4df56f9 100644
--- a/frontend/src/i18n/zh.json
+++ b/frontend/src/i18n/zh.json
@@ -100,6 +100,7 @@
"See members": "查看成员",
"Administrator": "管理员",
"Administration": "管理",
+ "Tools": "管理工具",
"User": "用户",
"user": "用户",
"Users": "用户",
@@ -638,6 +639,20 @@
"Ask Me": "询问我",
"Used when both editors support the file type.": "当两个编辑器都支持该文件类型时使用。",
"Enable content indexation for personal files.": "启用个人文件内容索引。",
+ "Actions": "操作",
+ "Delete all indexes.": "删除所有索引。",
+ "Full-text indexing": "全文索引",
+ "Last full run": "上次完整运行",
+ "Last partial run": "上次部分运行",
+ "Never": "从未",
+ "Start or stop indexing.": "启动或停止索引。",
+ "Start": "启动",
+ "State": "状态",
+ "Stop": "停止",
+ "Indexes": "索引",
+ "Running": "运行中",
+ "Stopping": "停止中",
+ "Idle": "空闲",
"Preferences": "偏好设置",
"of": "的",
"Sidebar auto-hide enabled": "侧边栏自动隐藏已启用",