mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
Add Snapshot and Restore locator. (#109886)
This commit is contained in:
parent
88640a7a10
commit
b300a1d7d1
3 changed files with 58 additions and 4 deletions
|
@ -7,7 +7,7 @@
|
|||
"name": "Stack Management",
|
||||
"githubTeam": "kibana-stack-management"
|
||||
},
|
||||
"requiredPlugins": ["licensing", "management", "features"],
|
||||
"requiredPlugins": ["licensing", "management", "features", "share"],
|
||||
"optionalPlugins": ["usageCollection", "security", "cloud", "home"],
|
||||
"configPath": ["xpack", "snapshot_restore"],
|
||||
"requiredBundles": ["esUiShared", "kibanaReact", "home"]
|
||||
|
|
45
x-pack/plugins/snapshot_restore/public/locator.ts
Normal file
45
x-pack/plugins/snapshot_restore/public/locator.ts
Normal file
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
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: SnapshotRestoreLocatorDefinitionDependencies) {}
|
||||
|
||||
public readonly id = SNAPSHOT_RESTORE_LOCATOR_ID;
|
||||
|
||||
public readonly getLocation = async (params: SnapshotRestoreLocatorParams) => {
|
||||
const location = await this.deps.managementAppLocator.getLocation({
|
||||
sectionId: 'data',
|
||||
appId: PLUGIN.id,
|
||||
});
|
||||
|
||||
switch (params.page) {
|
||||
case 'snapshots': {
|
||||
return {
|
||||
...location,
|
||||
path: location.path + linkToSnapshots(),
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
|
@ -7,13 +7,14 @@
|
|||
|
||||
import { i18n } from '@kbn/i18n';
|
||||
import { CoreSetup, PluginInitializerContext } from 'src/core/public';
|
||||
|
||||
import { UsageCollectionSetup } from '../../../../src/plugins/usage_collection/public';
|
||||
import { ManagementSetup } from '../../../../src/plugins/management/public';
|
||||
import { UsageCollectionSetup } from 'src/plugins/usage_collection/public';
|
||||
import { ManagementSetup } from 'src/plugins/management/public';
|
||||
import { SharePluginSetup } from 'src/plugins/share/public';
|
||||
import {
|
||||
FeatureCatalogueCategory,
|
||||
HomePublicPluginSetup,
|
||||
} from '../../../../src/plugins/home/public';
|
||||
|
||||
import { PLUGIN } from '../common/constants';
|
||||
|
||||
import { ClientConfigType } from './types';
|
||||
|
@ -22,10 +23,12 @@ import { httpService, setUiMetricService } from './application/services/http';
|
|||
import { textService } from './application/services/text';
|
||||
import { UiMetricService } from './application/services';
|
||||
import { UIM_APP_NAME } from './application/constants';
|
||||
import { SnapshotRestoreLocatorDefinition } from './locator';
|
||||
|
||||
interface PluginsDependencies {
|
||||
usageCollection: UsageCollectionSetup;
|
||||
management: ManagementSetup;
|
||||
share: SharePluginSetup;
|
||||
home?: HomePublicPluginSetup;
|
||||
}
|
||||
|
||||
|
@ -79,6 +82,12 @@ export class SnapshotRestoreUIPlugin {
|
|||
order: 630,
|
||||
});
|
||||
}
|
||||
|
||||
plugins.share.url.locators.create(
|
||||
new SnapshotRestoreLocatorDefinition({
|
||||
managementAppLocator: plugins.management.locator,
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
public start() {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue