chore: remove the option to trigger transition from the UI (#2489)
This commit is contained in:
@@ -13,8 +13,6 @@ import {
|
||||
MfaServiceInterface,
|
||||
GenerateUuid,
|
||||
CreateDecryptedBackupFile,
|
||||
GetTransitionStatus,
|
||||
StartTransition,
|
||||
} from '@standardnotes/services'
|
||||
import { VaultLockServiceInterface } from './../VaultLock/VaultLockServiceInterface'
|
||||
import { HistoryServiceInterface } from './../History/HistoryServiceInterface'
|
||||
@@ -78,8 +76,6 @@ export interface ApplicationInterface {
|
||||
get generateUuid(): GenerateUuid
|
||||
get getHost(): GetHost
|
||||
get setHost(): SetHost
|
||||
get getTransitionStatus(): GetTransitionStatus
|
||||
get startTransition(): StartTransition
|
||||
|
||||
// Services
|
||||
get alerts(): AlertService
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
export enum InternalFeature {
|
||||
Vaults = 'vaults',
|
||||
HomeServer = 'home-server',
|
||||
Transition = 'transition',
|
||||
}
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
import { HttpServiceInterface } from '@standardnotes/api'
|
||||
|
||||
import { GetTransitionStatus } from './GetTransitionStatus'
|
||||
|
||||
describe('GetTransitionStatus', () => {
|
||||
let httpService: HttpServiceInterface
|
||||
|
||||
const createUseCase = () => new GetTransitionStatus(httpService)
|
||||
|
||||
beforeEach(() => {
|
||||
httpService = {
|
||||
get: jest.fn(),
|
||||
} as unknown as HttpServiceInterface
|
||||
})
|
||||
|
||||
it('should get transition status', async () => {
|
||||
const useCase = createUseCase()
|
||||
;(httpService.get as jest.Mock).mockResolvedValueOnce({ status: 200, data: { status: 'TO-DO' } })
|
||||
|
||||
const result = await useCase.execute()
|
||||
|
||||
expect(result.isFailed()).toBe(false)
|
||||
expect(result.getValue()).toBe('TO-DO')
|
||||
})
|
||||
|
||||
it('should fail to get transition status', async () => {
|
||||
const useCase = createUseCase()
|
||||
;(httpService.get as jest.Mock).mockResolvedValueOnce({ status: 400 })
|
||||
|
||||
const result = await useCase.execute()
|
||||
|
||||
expect(result.isFailed()).toBe(true)
|
||||
})
|
||||
})
|
||||
@@ -1,17 +0,0 @@
|
||||
import { Result, UseCaseInterface } from '@standardnotes/domain-core'
|
||||
import { HttpServiceInterface } from '@standardnotes/api'
|
||||
import { HttpStatusCode } from '@standardnotes/responses'
|
||||
|
||||
export class GetTransitionStatus implements UseCaseInterface<'TO-DO' | 'STARTED' | 'FINISHED' | 'FAILED'> {
|
||||
constructor(private httpService: HttpServiceInterface) {}
|
||||
|
||||
async execute(): Promise<Result<'TO-DO' | 'STARTED' | 'FINISHED' | 'FAILED'>> {
|
||||
const response = await this.httpService.get('/v1/users/transition-status')
|
||||
|
||||
if (response.status !== HttpStatusCode.Success) {
|
||||
return Result.fail('Failed to get transition status')
|
||||
}
|
||||
|
||||
return Result.ok((response.data as { status: 'TO-DO' | 'STARTED' | 'FINISHED' | 'FAILED' }).status)
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
import { HttpServiceInterface } from '@standardnotes/api'
|
||||
|
||||
import { StartTransition } from './StartTransition'
|
||||
|
||||
describe('StartTransition', () => {
|
||||
let httpService: HttpServiceInterface
|
||||
|
||||
const createUseCase = () => new StartTransition(httpService)
|
||||
|
||||
beforeEach(() => {
|
||||
httpService = {
|
||||
post: jest.fn(),
|
||||
} as unknown as HttpServiceInterface
|
||||
})
|
||||
|
||||
it('should start transition', async () => {
|
||||
const useCase = createUseCase()
|
||||
;(httpService.post as jest.Mock).mockResolvedValueOnce({ status: 200 })
|
||||
|
||||
const result = await useCase.execute()
|
||||
|
||||
expect(result.isFailed()).toBe(false)
|
||||
})
|
||||
|
||||
it('should fail to start transition', async () => {
|
||||
const useCase = createUseCase()
|
||||
;(httpService.post as jest.Mock).mockResolvedValueOnce({ status: 400 })
|
||||
|
||||
const result = await useCase.execute()
|
||||
|
||||
expect(result.isFailed()).toBe(true)
|
||||
})
|
||||
})
|
||||
@@ -1,17 +0,0 @@
|
||||
import { HttpServiceInterface } from '@standardnotes/api'
|
||||
import { Result, UseCaseInterface } from '@standardnotes/domain-core'
|
||||
import { HttpStatusCode } from '@standardnotes/responses'
|
||||
|
||||
export class StartTransition implements UseCaseInterface<void> {
|
||||
constructor(private httpService: HttpServiceInterface) {}
|
||||
|
||||
async execute(): Promise<Result<void>> {
|
||||
const response = await this.httpService.post('/v1/items/transition')
|
||||
|
||||
if (response.status !== HttpStatusCode.Success) {
|
||||
return Result.fail('Failed to start transition')
|
||||
}
|
||||
|
||||
return Result.ok()
|
||||
}
|
||||
}
|
||||
@@ -187,8 +187,6 @@ export * from './Sync/SyncOptions'
|
||||
export * from './Sync/SyncQueueStrategy'
|
||||
export * from './Sync/SyncServiceInterface'
|
||||
export * from './Sync/SyncSource'
|
||||
export * from './UseCase/Transition/GetTransitionStatus/GetTransitionStatus'
|
||||
export * from './UseCase/Transition/StartTransition/StartTransition'
|
||||
export * from './UseCase/ChangeAndSaveItem'
|
||||
export * from './UseCase/DiscardItemsLocally'
|
||||
export * from './UseCase/GenerateUuid'
|
||||
|
||||
Reference in New Issue
Block a user