From 05fc04c8066f466803e27e98cd27df5def0f07c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Hornych?= Date: Sun, 22 Sep 2024 22:12:13 +0200 Subject: [PATCH] feat(#117): jfr, tasks, backups refactor and fixes --- package.json | 2 +- .../BackupViewerModuleRegistrar.ts | 14 + .../components/BackupCatalogDialog.vue | 141 +++++++++ .../backup-viewer/components/BackupViewer.vue | 286 ++++++++++++++++++ .../components/RestoreCatalogDialog.vue | 119 ++++++++ .../model/BackupViewerDefinition.ts | 17 ++ .../model/BackupViewerTabParams.ts} | 8 +- .../model/BackupViewerTabParamsDto.ts} | 2 +- .../service/BackupViewerService.ts | 104 +++++++ .../service/BackupViewerTabFactory.ts | 36 +++ src/modules/backups/BackupsModuleRegistrar.ts | 14 - .../backups/components/BackupCatalog.vue | 86 ------ src/modules/backups/components/Backups.vue | 262 ---------------- .../backups/components/RestoreCatalog.vue | 62 ---- .../backups/model/BackupsDefinition.ts | 17 -- src/modules/backups/service/BackupsService.ts | 87 ------ .../backups/service/BackupsTabFactory.ts | 36 --- .../base/component/VExecuteQueryButton.vue | 10 +- src/modules/base/component/VFormDialog.vue | 9 +- .../base/component/VTabMainActionButton.vue | 29 ++ src/modules/base/component/VTabToolbar.vue | 2 +- .../connection/driver/EvitaDBDriver.ts | 41 +-- .../driver/grpc/EvitaDBDriverGrpc.ts | 244 +++++++-------- .../driver/grpc/service/BackupConverter.ts | 19 +- .../grpc/service/CatalogSchemaConverter.ts | 5 +- .../driver/grpc/service/EntityConverter.ts | 2 +- .../grpc/service/EvitaValueConverter.ts | 2 +- .../grpc/service/ServerStatusConverter.ts | 4 +- ...tateConverter.ts => TaskStateConverter.ts} | 35 +-- ...obsConverter.ts => TaskStatusConverter.ts} | 16 +- .../explorer/component/CatalogItem.vue | 6 +- .../explorer/component/ConnectionItem.vue | 16 +- .../explorer/model/ConnectionActionType.ts | 2 +- .../{data => }/CatalogVersionAtResponse.ts | 4 +- .../model/{data => data-type}/Currency.ts | 0 src/modules/connection/model/data/Price.ts | 3 +- .../model/data/TaskSimplifiedState.ts | 6 - .../connection/model/{data => file}/File.ts | 0 .../model/{data => file}/FilesToFetch.ts | 4 +- .../model/{data => jfr}/EventType.ts | 2 +- .../connection/model/schema/EntitySchema.ts | 3 +- .../model/{data => status}/ApiEndpoint.ts | 0 .../model/{data => status}/ApiReadiness.ts | 0 .../model/{data => status}/ApiServerStatus.ts | 0 .../model/{data => status}/ServerStatus.ts | 0 .../connection/model/task/TaskState.ts | 6 + .../model/{data => task}/TaskStatus.ts | 33 +- .../model/{data => task}/TaskStatuses.ts | 6 +- .../entity-property-value/EntityPrice.ts | 2 +- .../entity-property-value/NativeValue.ts | 2 +- .../global/components/TabWindowBody.vue | 55 ---- .../console/component/GraphQLConsole.vue | 10 +- src/modules/i18n/en.json | 139 +++++++-- .../jfr-recording/JfrModuleRegistrar.ts | 15 - .../jfr-recording/components/JfrEndRecord.vue | 23 -- .../components/JfrStartRecord.vue | 85 ------ .../components/JfrVisualizer.vue | 135 --------- .../model/JfrVisualizerDefinition.ts | 11 - .../jfr-recording/service/JfrService.ts | 46 --- .../jfr-recording/service/JfrTabFactory.ts | 37 --- .../jfr-viewer/JfrViewerModuleRegistrar.ts | 12 + .../components/EndJfrRecordingDialog.vue | 67 ++++ .../jfr-viewer/components/JfrViewer.vue | 206 +++++++++++++ .../components/StartJfrRecordingDialog.vue | 118 ++++++++ .../jfr-viewer/model/JfrViewerDefinition.ts | 18 ++ .../model/JfrViewerTabParams.ts} | 8 +- .../model/JfrViewerTabParamsDto.ts} | 4 +- .../jfr-viewer/service/JfrViewerService.ts | 48 +++ .../jfr-viewer/service/JfrViewerTabFactory.ts | 38 +++ src/modules/jobs/JobModuleRegistrar.ts | 12 - src/modules/jobs/components/JobVisualizer.vue | 209 ------------- src/modules/jobs/components/JobsControl.vue | 30 -- src/modules/jobs/model/JobDefinition.ts | 11 - src/modules/jobs/services/JobService.ts | 31 -- src/modules/jobs/services/JobTabFactory.ts | 36 --- src/modules/modules.ts | 12 +- .../server-status/component/ServerStatus.vue | 8 +- .../service/ServerStatusService.ts | 6 +- .../task-viewer/TaskViewerModuleRegistrar.ts | 13 + .../task-viewer/components/TaskViewer.vue | 38 +++ .../components/TasksVisualizer.vue | 275 +++++++++++++++++ .../task-viewer/model/TaskViewerDefinition.ts | 18 ++ .../model/TaskViewerTabParams.ts} | 7 +- .../model/TaskViewerTabParamsDto.ts} | 4 +- .../task-viewer/services/TaskViewerService.ts | 35 +++ .../services/TaskViewerTabFactory.ts | 37 +++ .../workspace/WorkspaceModuleRegistrar.ts | 16 +- .../workspace/service/WorkspaceService.ts | 6 +- src/modules/workspace/tab/model/TabType.ts | 1 + .../tab/service/SharedTabResolver.ts | 8 +- src/vue-plugins/vuetify.ts | 4 + yarn.lock | 8 +- 92 files changed, 2079 insertions(+), 1627 deletions(-) create mode 100644 src/modules/backup-viewer/BackupViewerModuleRegistrar.ts create mode 100644 src/modules/backup-viewer/components/BackupCatalogDialog.vue create mode 100644 src/modules/backup-viewer/components/BackupViewer.vue create mode 100644 src/modules/backup-viewer/components/RestoreCatalogDialog.vue create mode 100644 src/modules/backup-viewer/model/BackupViewerDefinition.ts rename src/modules/{backups/model/BackupsTabParams.ts => backup-viewer/model/BackupViewerTabParams.ts} (74%) rename src/modules/{backups/model/BackupsTabParamsDto.ts => backup-viewer/model/BackupViewerTabParamsDto.ts} (81%) create mode 100644 src/modules/backup-viewer/service/BackupViewerService.ts create mode 100644 src/modules/backup-viewer/service/BackupViewerTabFactory.ts delete mode 100644 src/modules/backups/BackupsModuleRegistrar.ts delete mode 100644 src/modules/backups/components/BackupCatalog.vue delete mode 100644 src/modules/backups/components/Backups.vue delete mode 100644 src/modules/backups/components/RestoreCatalog.vue delete mode 100644 src/modules/backups/model/BackupsDefinition.ts delete mode 100644 src/modules/backups/service/BackupsService.ts delete mode 100644 src/modules/backups/service/BackupsTabFactory.ts create mode 100644 src/modules/base/component/VTabMainActionButton.vue rename src/modules/connection/driver/grpc/service/{TaskSimplifiedStateConverter.ts => TaskStateConverter.ts} (53%) rename src/modules/connection/driver/grpc/service/{JobsConverter.ts => TaskStatusConverter.ts} (85%) rename src/modules/connection/model/{data => }/CatalogVersionAtResponse.ts (74%) rename src/modules/connection/model/{data => data-type}/Currency.ts (100%) delete mode 100644 src/modules/connection/model/data/TaskSimplifiedState.ts rename src/modules/connection/model/{data => file}/File.ts (100%) rename src/modules/connection/model/{data => file}/FilesToFetch.ts (92%) rename src/modules/connection/model/{data => jfr}/EventType.ts (92%) rename src/modules/connection/model/{data => status}/ApiEndpoint.ts (100%) rename src/modules/connection/model/{data => status}/ApiReadiness.ts (100%) rename src/modules/connection/model/{data => status}/ApiServerStatus.ts (100%) rename src/modules/connection/model/{data => status}/ServerStatus.ts (100%) create mode 100644 src/modules/connection/model/task/TaskState.ts rename src/modules/connection/model/{data => task}/TaskStatus.ts (50%) rename src/modules/connection/model/{data => task}/TaskStatuses.ts (79%) delete mode 100644 src/modules/global/components/TabWindowBody.vue delete mode 100644 src/modules/jfr-recording/JfrModuleRegistrar.ts delete mode 100644 src/modules/jfr-recording/components/JfrEndRecord.vue delete mode 100644 src/modules/jfr-recording/components/JfrStartRecord.vue delete mode 100644 src/modules/jfr-recording/components/JfrVisualizer.vue delete mode 100644 src/modules/jfr-recording/model/JfrVisualizerDefinition.ts delete mode 100644 src/modules/jfr-recording/service/JfrService.ts delete mode 100644 src/modules/jfr-recording/service/JfrTabFactory.ts create mode 100644 src/modules/jfr-viewer/JfrViewerModuleRegistrar.ts create mode 100644 src/modules/jfr-viewer/components/EndJfrRecordingDialog.vue create mode 100644 src/modules/jfr-viewer/components/JfrViewer.vue create mode 100644 src/modules/jfr-viewer/components/StartJfrRecordingDialog.vue create mode 100644 src/modules/jfr-viewer/model/JfrViewerDefinition.ts rename src/modules/{jfr-recording/model/JfrVisualizerTabParams.ts => jfr-viewer/model/JfrViewerTabParams.ts} (62%) rename src/modules/{jobs/model/JobTabParamsDto.ts => jfr-viewer/model/JfrViewerTabParamsDto.ts} (74%) create mode 100644 src/modules/jfr-viewer/service/JfrViewerService.ts create mode 100644 src/modules/jfr-viewer/service/JfrViewerTabFactory.ts delete mode 100644 src/modules/jobs/JobModuleRegistrar.ts delete mode 100644 src/modules/jobs/components/JobVisualizer.vue delete mode 100644 src/modules/jobs/components/JobsControl.vue delete mode 100644 src/modules/jobs/model/JobDefinition.ts delete mode 100644 src/modules/jobs/services/JobService.ts delete mode 100644 src/modules/jobs/services/JobTabFactory.ts create mode 100644 src/modules/task-viewer/TaskViewerModuleRegistrar.ts create mode 100644 src/modules/task-viewer/components/TaskViewer.vue create mode 100644 src/modules/task-viewer/components/TasksVisualizer.vue create mode 100644 src/modules/task-viewer/model/TaskViewerDefinition.ts rename src/modules/{jobs/model/JobTabParams.ts => task-viewer/model/TaskViewerTabParams.ts} (69%) rename src/modules/{jfr-recording/model/JfrVisualizerTabParamsDto.ts => task-viewer/model/TaskViewerTabParamsDto.ts} (73%) create mode 100644 src/modules/task-viewer/services/TaskViewerService.ts create mode 100644 src/modules/task-viewer/services/TaskViewerTabFactory.ts diff --git a/package.json b/package.json index 4ff15889..3f19af15 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "vue-router": "^4.0.0", "vue-toastification": "^2.0.0-rc.5", "vue3-apexcharts": "^1.4.4", - "vuetify": "^3.1.0", + "vuetify": "^3.6.0", "webfontloader": "^1.0.0", "xml-formatter": "^3.5.0", "xxhashjs": "^0.2.2" diff --git a/src/modules/backup-viewer/BackupViewerModuleRegistrar.ts b/src/modules/backup-viewer/BackupViewerModuleRegistrar.ts new file mode 100644 index 00000000..027cbae7 --- /dev/null +++ b/src/modules/backup-viewer/BackupViewerModuleRegistrar.ts @@ -0,0 +1,14 @@ +import { ModuleContextBuilder } from "@/ModuleContextBuilder"; +import { ModuleRegistrar } from "@/ModuleRegistrar"; +import { BackupViewerService, backupViewerServiceInjectionKey } from "./service/BackupViewerService"; +import { ConnectionService, connectionServiceInjectionKey } from '@/modules/connection/service/ConnectionService' + +//TODO: docs +export class BackupViewerModuleRegistrar implements ModuleRegistrar { + + register(builder: ModuleContextBuilder): void { + const connectionService: ConnectionService = builder.inject(connectionServiceInjectionKey) + const backupViewerService: BackupViewerService = new BackupViewerService(connectionService) + builder.provide(backupViewerServiceInjectionKey, backupViewerService) + } +} diff --git a/src/modules/backup-viewer/components/BackupCatalogDialog.vue b/src/modules/backup-viewer/components/BackupCatalogDialog.vue new file mode 100644 index 00000000..4a081dfc --- /dev/null +++ b/src/modules/backup-viewer/components/BackupCatalogDialog.vue @@ -0,0 +1,141 @@ + + + + + diff --git a/src/modules/backup-viewer/components/BackupViewer.vue b/src/modules/backup-viewer/components/BackupViewer.vue new file mode 100644 index 00000000..6adeaf50 --- /dev/null +++ b/src/modules/backup-viewer/components/BackupViewer.vue @@ -0,0 +1,286 @@ + + + + + diff --git a/src/modules/backup-viewer/components/RestoreCatalogDialog.vue b/src/modules/backup-viewer/components/RestoreCatalogDialog.vue new file mode 100644 index 00000000..557f4558 --- /dev/null +++ b/src/modules/backup-viewer/components/RestoreCatalogDialog.vue @@ -0,0 +1,119 @@ + + + + + diff --git a/src/modules/backup-viewer/model/BackupViewerDefinition.ts b/src/modules/backup-viewer/model/BackupViewerDefinition.ts new file mode 100644 index 00000000..2c287598 --- /dev/null +++ b/src/modules/backup-viewer/model/BackupViewerDefinition.ts @@ -0,0 +1,17 @@ +import { TabDefinition } from "@/modules/workspace/tab/model/TabDefinition"; +import { VoidTabData } from "@/modules/workspace/tab/model/void/VoidTabData"; +import { DefineComponent, markRaw } from "vue"; +import { BackupViewerTabParams } from '@/modules/backup-viewer/model/BackupViewerTabParams' +import BackupViewer from '@/modules/backup-viewer/components/BackupViewer.vue' + +export class BackupViewerDefinition extends TabDefinition { + constructor(title: string, params: BackupViewerTabParams) { + super(undefined, + title, + 'mdi-cloud-download-outline', + markRaw(BackupViewer as DefineComponent), + params, + new VoidTabData() + ) + } +} diff --git a/src/modules/backups/model/BackupsTabParams.ts b/src/modules/backup-viewer/model/BackupViewerTabParams.ts similarity index 74% rename from src/modules/backups/model/BackupsTabParams.ts rename to src/modules/backup-viewer/model/BackupViewerTabParams.ts index 52144d7f..22a97644 100644 --- a/src/modules/backups/model/BackupsTabParams.ts +++ b/src/modules/backup-viewer/model/BackupViewerTabParams.ts @@ -1,9 +1,9 @@ import { TabParams } from "@/modules/workspace/tab/model/TabParams"; -import { BackupsTabParamsDto } from "./BackupsTabParamsDto"; +import { BackupViewerTabParamsDto } from "./BackupViewerTabParamsDto"; import { ExecutableTabRequest } from "@/modules/workspace/tab/model/ExecutableTabRequest"; import { Connection } from "@/modules/connection/model/Connection"; -export class BackupTabParams implements TabParams, ExecutableTabRequest { +export class BackupViewerTabParams implements TabParams, ExecutableTabRequest { readonly executeOnOpen: boolean readonly connection: Connection readonly catalogName: string @@ -13,10 +13,10 @@ export class BackupTabParams implements TabParams, Executab this.executeOnOpen = executeOnOpen this.catalogName = catalogName } - toSerializable(): BackupsTabParamsDto { + toSerializable(): BackupViewerTabParamsDto { return { connection: this.connection, catalogName: this.catalogName } } -} \ No newline at end of file +} diff --git a/src/modules/backups/model/BackupsTabParamsDto.ts b/src/modules/backup-viewer/model/BackupViewerTabParamsDto.ts similarity index 81% rename from src/modules/backups/model/BackupsTabParamsDto.ts rename to src/modules/backup-viewer/model/BackupViewerTabParamsDto.ts index 63ab05dc..88e78201 100644 --- a/src/modules/backups/model/BackupsTabParamsDto.ts +++ b/src/modules/backup-viewer/model/BackupViewerTabParamsDto.ts @@ -2,7 +2,7 @@ import { Connection } from "@/modules/connection/model/Connection"; import { TabDataDto } from "@/modules/workspace/tab/model/TabDataDto"; import { TabParamsDto } from '@/modules/workspace/tab/model/TabParamsDto' -export interface BackupsTabParamsDto extends TabParamsDto { +export interface BackupViewerTabParamsDto extends TabParamsDto { readonly connection: Connection readonly catalogName: string } diff --git a/src/modules/backup-viewer/service/BackupViewerService.ts b/src/modules/backup-viewer/service/BackupViewerService.ts new file mode 100644 index 00000000..db098002 --- /dev/null +++ b/src/modules/backup-viewer/service/BackupViewerService.ts @@ -0,0 +1,104 @@ +import { Connection } from '@/modules/connection/model/Connection' +import { OffsetDateTime } from '@/modules/connection/model/data-type/OffsetDateTime' +import { Uuid } from '@/modules/connection/model/data-type/Uuid' +import { mandatoryInject } from '@/utils/reactivity' +import { InjectionKey } from 'vue' +import { + GrpcRestoreCatalogRequest, + GrpcRestoreCatalogResponse +} from '@/modules/connection/driver/grpc/gen/GrpcEvitaManagementAPI_pb' +import { ConnectionService } from '@/modules/connection/service/ConnectionService' +import { CatalogVersionAtResponse } from '@/modules/connection/model/CatalogVersionAtResponse' +import { TaskStatus } from '@/modules/connection/model/task/TaskStatus' +import { FilesToFetch } from '@/modules/connection/model/file/FilesToFetch' +import { ClassifierValidationErrorType } from '@/modules/connection/model/data-type/ClassifierValidationErrorType' +import { EvitaDBDriver } from '@/modules/connection/driver/EvitaDBDriver' +import { ClassifierType } from '@/modules/connection/model/data-type/ClassifierType' +import { UnexpectedError } from '@/modules/base/exception/UnexpectedError' + +export const backupViewerServiceInjectionKey: InjectionKey = Symbol('backupViewerService') + +export const backupTaskName: string = 'BackupTask' +export const restoreTaskName: string = 'RestoreTask' + +export class BackupViewerService { + private readonly connectionService: ConnectionService + + constructor(connectionService: ConnectionService) { + this.connectionService = connectionService + } + + async getMinimalBackupDate( + connection: Connection, + catalogName: string + ): Promise { + const driver = await this.connectionService.getDriver(connection) + return driver.getMinimalBackupDate(connection, catalogName) + } + + async backupCatalog( + connection: Connection, + catalogName: string, + includingWAL: boolean, + pastMoment: OffsetDateTime + ): Promise { + const driver = await this.connectionService.getDriver(connection) + return driver.createBackup( + connection, + catalogName, + includingWAL, + pastMoment + ) + } + + async getBackupFiles( + connection: Connection, + pageNumber: number, + pageSize: number + ): Promise { + const driver = await this.connectionService.getDriver(connection) + return await driver.getFilesToFetch(connection, backupTaskName, pageNumber, pageSize) + } + + async restoreCatalog( + connection: Connection, + fileId: Uuid, + catalogName: string + ): Promise { + const driver = await this.connectionService.getDriver(connection) + return await driver.restoreCatalog(connection, fileId, catalogName) + } + + async downloadBackup(connection: Connection, fileId: Uuid): Promise { + const driver = await this.connectionService.getDriver(connection) + return await driver.downloadFile(connection, fileId) + } + + async uploadBackup(connection: Connection, stream: AsyncIterable): Promise{ + const driver = await this.connectionService.getDriver(connection) + return await driver.uploadFile(connection, stream) + } + + async isCatalogNameValid(connection: Connection, catalogName: string): Promise { + const driver: EvitaDBDriver = await this.connectionService.getDriver(connection) + return driver.isClassifierValid(connection, ClassifierType.Catalog, catalogName) + } + + async isCatalogNameAvailable(connection: Connection, catalogName: string): Promise { + const driver: EvitaDBDriver = await this.connectionService.getDriver(connection) + try { + await driver.getCatalog(connection, catalogName) + } catch (e) { + // todo lho better exceptions + if (e instanceof UnexpectedError) { + // catalog not found + return true + } + } + return false + } +} + +export const useBackupViewerService = (): BackupViewerService => { + return mandatoryInject(backupViewerServiceInjectionKey) as BackupViewerService +} diff --git a/src/modules/backup-viewer/service/BackupViewerTabFactory.ts b/src/modules/backup-viewer/service/BackupViewerTabFactory.ts new file mode 100644 index 00000000..eb00a176 --- /dev/null +++ b/src/modules/backup-viewer/service/BackupViewerTabFactory.ts @@ -0,0 +1,36 @@ +import { Connection } from "@/modules/connection/model/Connection"; +import { ConnectionService } from "@/modules/connection/service/ConnectionService"; +import { mandatoryInject } from "@/utils/reactivity"; +import { InjectionKey } from "vue"; +import { BackupViewerDefinition } from "../model/BackupViewerDefinition"; +import { TabParamsDto } from "@/modules/workspace/tab/model/TabParamsDto"; +import { TabDataDto } from "@/modules/workspace/tab/model/TabDataDto"; +import { BackupViewerTabParamsDto } from "../model/BackupViewerTabParamsDto"; +import { BackupViewerTabParams } from '@/modules/backup-viewer/model/BackupViewerTabParams' + +export const backupsTabFactoryInjectionKey: InjectionKey = Symbol('BackupsTabFactory') + +export class BackupViewerTabFactory { + private readonly connectionService: ConnectionService + + constructor(connectionService: ConnectionService){ + this.connectionService = connectionService + } + + createNew(connection: Connection, catalogName: string, executeOnOpen: boolean = false):BackupViewerDefinition { + return new BackupViewerDefinition('Backups', this.createTabParams(connection, catalogName, executeOnOpen)) + } + + private createTabParams(connection: Connection, catalogName: string, executeOnOpen: boolean = false):BackupViewerTabParams { + return new BackupViewerTabParams(connection, catalogName, executeOnOpen) + } + + restoreFromJson(paramsJson: TabParamsDto, dataJson?: TabDataDto): BackupViewerDefinition { + const params: BackupViewerTabParamsDto = paramsJson as BackupViewerTabParams + return new BackupViewerDefinition('Backups', this.createTabParams(this.connectionService.getConnection(params.connection.id), params.catalogName)) + } +} + +export const useBackupsTabFactory = (): BackupViewerTabFactory => { + return mandatoryInject(backupsTabFactoryInjectionKey) as BackupViewerTabFactory +} diff --git a/src/modules/backups/BackupsModuleRegistrar.ts b/src/modules/backups/BackupsModuleRegistrar.ts deleted file mode 100644 index ade16d73..00000000 --- a/src/modules/backups/BackupsModuleRegistrar.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { ModuleContextBuilder } from "@/ModuleContextBuilder"; -import { ModuleRegistrar } from "@/ModuleRegistrar"; -import { EvitaDBDriverResolver, evitaDBDriverResolverInjectionKey } from "../connection/driver/EvitaDBDriverResolver"; -import { BackupsService, backupsServiceInjectionKey } from "./service/BackupsService"; - -//TODO: docs -export class BackupsModuleRegistrar implements ModuleRegistrar { - register(builder: ModuleContextBuilder): void { - const evitaDBDriverResolver: EvitaDBDriverResolver = builder.inject(evitaDBDriverResolverInjectionKey) - const backupService: BackupsService = new BackupsService(evitaDBDriverResolver) - builder.provide(backupsServiceInjectionKey, backupService) - } - -} \ No newline at end of file diff --git a/src/modules/backups/components/BackupCatalog.vue b/src/modules/backups/components/BackupCatalog.vue deleted file mode 100644 index d87b2029..00000000 --- a/src/modules/backups/components/BackupCatalog.vue +++ /dev/null @@ -1,86 +0,0 @@ - - - - - diff --git a/src/modules/backups/components/Backups.vue b/src/modules/backups/components/Backups.vue deleted file mode 100644 index 5de59cbb..00000000 --- a/src/modules/backups/components/Backups.vue +++ /dev/null @@ -1,262 +0,0 @@ - - - - - diff --git a/src/modules/backups/components/RestoreCatalog.vue b/src/modules/backups/components/RestoreCatalog.vue deleted file mode 100644 index 7eea26ae..00000000 --- a/src/modules/backups/components/RestoreCatalog.vue +++ /dev/null @@ -1,62 +0,0 @@ - - - - - diff --git a/src/modules/backups/model/BackupsDefinition.ts b/src/modules/backups/model/BackupsDefinition.ts deleted file mode 100644 index f461b3c6..00000000 --- a/src/modules/backups/model/BackupsDefinition.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { TabDefinition } from "@/modules/workspace/tab/model/TabDefinition"; -import { BackupTabParams } from "./BackupsTabParams"; -import { VoidTabData } from "@/modules/workspace/tab/model/void/VoidTabData"; -import { DefineComponent, markRaw } from "vue"; -import Backups from "../components/Backups.vue"; - -export class BackupsDefinition extends TabDefinition { - constructor(title: string, params: BackupTabParams) { - super(undefined, - title, - 'mdi-cloud-download-outline', - markRaw(Backups as DefineComponent), - params, - new VoidTabData() - ) - } -} diff --git a/src/modules/backups/service/BackupsService.ts b/src/modules/backups/service/BackupsService.ts deleted file mode 100644 index 4c9d648a..00000000 --- a/src/modules/backups/service/BackupsService.ts +++ /dev/null @@ -1,87 +0,0 @@ -import { EvitaDBDriverResolver } from '@/modules/connection/driver/EvitaDBDriverResolver' -import { Connection } from '@/modules/connection/model/Connection' -import { OffsetDateTime } from '@/modules/connection/model/data-type/OffsetDateTime' -import { Uuid } from '@/modules/connection/model/data-type/Uuid' -import { CatalogVersionAtResponse } from '@/modules/connection/model/data/CatalogVersionAtResponse' -import { FilesToFetch } from '@/modules/connection/model/data/FilesToFetch' -import { TaskStatus } from '@/modules/connection/model/data/TaskStatus' -import { mandatoryInject } from '@/utils/reactivity' -import { InjectionKey } from 'vue' -import { - GrpcRestoreCatalogRequest, - GrpcRestoreCatalogResponse -} from '@/modules/connection/driver/grpc/gen/GrpcEvitaManagementAPI_pb' - -export const backupsServiceInjectionKey: InjectionKey = - Symbol('backupsService') - -export class BackupsService { - private readonly evitaDBDriverResolver: EvitaDBDriverResolver - - constructor(evitaDBDriver: EvitaDBDriverResolver) { - this.evitaDBDriverResolver = evitaDBDriver - } - - async getMinimalBackupDate( - connection: Connection, - catalogName: string - ): Promise { - const driver = await this.evitaDBDriverResolver.resolveDriver( - connection - ) - return driver.getMinimalBackupDate(connection, catalogName) - } - - async backupCatalog( - connection: Connection, - catalogName: string, - includingWAL: boolean, - pastMoment: OffsetDateTime - ): Promise { - const driver = await this.evitaDBDriverResolver.resolveDriver( - connection - ) - return driver.createBackup( - connection, - catalogName, - includingWAL, - pastMoment - ) - } - - async getAllBackups( - connection: Connection, - pageNumber: number, - pageSize: number - ): Promise { - const driver = await this.evitaDBDriverResolver.resolveDriver( - connection - ) - return await driver.getBackups(connection, pageNumber, pageSize) - } - - async restoreCatalog( - connection: Connection, - catalogName: string, - fileId: Uuid - ) { - const driver = await this.evitaDBDriverResolver.resolveDriver( - connection - ) - return await driver.restoreCatalog(connection, catalogName, fileId) - } - - async downloadBackup(connection: Connection, fileId: Uuid){ - const driver = await this.evitaDBDriverResolver.resolveDriver(connection) - return await driver.downloadFile(connection, fileId) - } - - async uploadBackup(connection: Connection, stream: AsyncIterable):Promise{ - const driver = await this.evitaDBDriverResolver.resolveDriver(connection) - return await driver.uploadFile(connection, stream) - } -} - -export const useBackupsService = (): BackupsService => { - return mandatoryInject(backupsServiceInjectionKey) as BackupsService -} diff --git a/src/modules/backups/service/BackupsTabFactory.ts b/src/modules/backups/service/BackupsTabFactory.ts deleted file mode 100644 index d3e1f491..00000000 --- a/src/modules/backups/service/BackupsTabFactory.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { Connection } from "@/modules/connection/model/Connection"; -import { ConnectionService } from "@/modules/connection/service/ConnectionService"; -import { mandatoryInject } from "@/utils/reactivity"; -import { InjectionKey } from "vue"; -import { BackupsDefinition } from "../model/BackupsDefinition"; -import { BackupTabParams } from "../model/BackupsTabParams"; -import { TabParamsDto } from "@/modules/workspace/tab/model/TabParamsDto"; -import { TabDataDto } from "@/modules/workspace/tab/model/TabDataDto"; -import { BackupsTabParamsDto } from "../model/BackupsTabParamsDto"; - -export const backupsTabFactoryInjectionKey: InjectionKey = Symbol('BackupsTabFactory') - -export class BackupsTabFactory { - private readonly connectionService: ConnectionService - - constructor(connectionService: ConnectionService){ - this.connectionService = connectionService - } - - createNew(connection: Connection, catalogName: string, executeOnOpen: boolean = false):BackupsDefinition { - return new BackupsDefinition('Backups', this.createTabParams(connection, catalogName, executeOnOpen)) - } - - private createTabParams(connection: Connection, catalogName: string, executeOnOpen: boolean = false):BackupTabParams { - return new BackupTabParams(connection, catalogName, executeOnOpen) - } - - restoreFromJson(paramsJson: TabParamsDto, dataJson?: TabDataDto): BackupsDefinition { - const params: BackupsTabParamsDto = paramsJson as BackupTabParams - return new BackupsDefinition('Backups', this.createTabParams(this.connectionService.getConnection(params.connection.id), params.catalogName)) - } -} - -export const useBackupsTabFactory = (): BackupsTabFactory => { - return mandatoryInject(backupsTabFactoryInjectionKey) as BackupsTabFactory -} \ No newline at end of file diff --git a/src/modules/base/component/VExecuteQueryButton.vue b/src/modules/base/component/VExecuteQueryButton.vue index b9069648..4dfd99e9 100644 --- a/src/modules/base/component/VExecuteQueryButton.vue +++ b/src/modules/base/component/VExecuteQueryButton.vue @@ -1,6 +1,7 @@ diff --git a/src/modules/base/component/VTabToolbar.vue b/src/modules/base/component/VTabToolbar.vue index 939be21e..ae625807 100644 --- a/src/modules/base/component/VTabToolbar.vue +++ b/src/modules/base/component/VTabToolbar.vue @@ -67,7 +67,7 @@ const normalizedFlags = computed>(() => { -