-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Monitoring] Added deprecated tag to the advanced settings for xPack:…
…defaultAdminEmail (#70280) * Added deprecated tag to the advanced settings * Addressed code feedback * Code feedback * Code feedback * Fixed version Co-authored-by: Elastic Machine <[email protected]>
- Loading branch information
1 parent
d539af5
commit 58e64af
Showing
8 changed files
with
101 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { CoreStart, CoreSetup } from 'kibana/server'; | ||
|
||
import { SavedObjectsClient } from '../../../../src/core/server'; | ||
|
||
export class CoreServices { | ||
private static _coreSetup: CoreSetup; | ||
private static _coreStart: CoreStart; | ||
|
||
public static init(core: CoreSetup) { | ||
this._coreSetup = core; | ||
} | ||
|
||
public static get coreSetup(): CoreSetup { | ||
this.checkError(); | ||
return this._coreSetup; | ||
} | ||
|
||
public static async getCoreStart(): Promise<CoreStart> { | ||
if (this._coreStart) { | ||
return this._coreStart; | ||
} | ||
const [coreStart] = await this.coreSetup.getStartServices(); | ||
this._coreStart = coreStart; | ||
return coreStart; | ||
} | ||
|
||
public static async getUISetting(key: string) { | ||
const coreStart = await this.getCoreStart(); | ||
const { savedObjects, uiSettings } = coreStart; | ||
const savedObjectsClient = new SavedObjectsClient(savedObjects.createInternalRepository()); | ||
const theSettings = uiSettings.asScopedToClient(savedObjectsClient); | ||
return await theSettings.get(key); | ||
} | ||
|
||
private static checkError() { | ||
if (!this._coreSetup) { | ||
throw new Error( | ||
'CoreServices has not been initialized. Please run CoreServices.init(...) before use' | ||
); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters