import type { SerializableRecord } from '@kbn/utility-types' ; import { ManagementAppLocator } from 'src/plugins/management/common' ; import { LocatorDefinition } from '../../../../src/plugins/share/public/' ; import { linkToSnapshots } from './application/services/navigation' ; import { PLUGIN } from '../common/constants' ; export const SNAPSHOT_RESTORE_LOCATOR_ID = 'SNAPSHOT_RESTORE_LOCATOR' ; export interface SnapshotRestoreLocatorParams extends SerializableRecord { page : 'snapshots' ; } export interface SnapshotRestoreLocatorDefinitionDependencies { managementAppLocator : ManagementAppLocator ; } export class SnapshotRestoreLocatorDefinition implements LocatorDefinition < SnapshotRestoreLocatorParams > { constructor ( protected readonly deps ) { } public readonly id = SNAPSHOT_RESTORE_LOCATOR_ID ; public readonly getLocation = async ( params ) => { const location = await this . deps . managementAppLocator . getLocation ( { sectionId : 'data' , appId : PLUGIN . id , } ) ; switch ( params . page ) { case 'snapshots' : { return { ... location , path : location . path + linkToSnapshots ( ) , } ; } } } ; }