mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 01:13:23 -04:00
parent
b52a4a24ce
commit
d10a8cee37
4 changed files with 10 additions and 10 deletions
|
@ -29,8 +29,8 @@ export type StringOptions = TypeOptions<string> & {
|
|||
|
||||
export class StringType extends Type<string> {
|
||||
constructor(options: StringOptions = {}) {
|
||||
// We want to allow empty strings, however calling `allow('')` casues
|
||||
// Joi to whitelist the value and skip any additional validation.
|
||||
// We want to allow empty strings, however calling `allow('')` causes
|
||||
// Joi to allow the value and skip any additional validation.
|
||||
// Instead, we reimplement the string validator manually except in the
|
||||
// hostname case where empty strings aren't allowed anyways.
|
||||
let schema =
|
||||
|
|
|
@ -1308,7 +1308,7 @@ This table shows where these uiExports have moved to in the New Platform. In mos
|
|||
| `hacks` | n/a | Just run the code in your plugin's `start` method. |
|
||||
| `home` | [`plugins.home.featureCatalogue.register`](./src/plugins/home/public/feature_catalogue) | Must add `home` as a dependency in your kibana.json. |
|
||||
| `indexManagement` | | Should be an API on the indexManagement plugin. |
|
||||
| `injectDefaultVars` | n/a | Plugins will only be able to "whitelist" config values for the frontend. See [#41990](https://github.com/elastic/kibana/issues/41990) |
|
||||
| `injectDefaultVars` | n/a | Plugins will only be able to allow config values for the frontend. See [#41990](https://github.com/elastic/kibana/issues/41990) |
|
||||
| `inspectorViews` | | Should be an API on the data (?) plugin. |
|
||||
| `interpreter` | | Should be an API on the interpreter plugin. |
|
||||
| `links` | n/a | Not necessary, just register your app via `core.application.register` |
|
||||
|
@ -1387,7 +1387,7 @@ class MyPlugin {
|
|||
}
|
||||
```
|
||||
|
||||
If your plugin also have a client-side part, you can also expose configuration properties to it using a whitelisting mechanism with the configuration `exposeToBrowser` property.
|
||||
If your plugin also have a client-side part, you can also expose configuration properties to it using the configuration `exposeToBrowser` allow-list property.
|
||||
|
||||
```typescript
|
||||
// my_plugin/server/index.ts
|
||||
|
|
|
@ -28,7 +28,7 @@ const createInternalClientMock = (): DeeplyMockedKeys<Client> => {
|
|||
node: 'http://localhost',
|
||||
}) as any;
|
||||
|
||||
const blackListedProps = [
|
||||
const omittedProps = [
|
||||
'_events',
|
||||
'_eventsCount',
|
||||
'_maxListeners',
|
||||
|
@ -39,9 +39,9 @@ const createInternalClientMock = (): DeeplyMockedKeys<Client> => {
|
|||
'helpers',
|
||||
];
|
||||
|
||||
const mockify = (obj: Record<string, any>, blacklist: string[] = []) => {
|
||||
const mockify = (obj: Record<string, any>, omitted: string[] = []) => {
|
||||
Object.keys(obj)
|
||||
.filter((key) => !blacklist.includes(key))
|
||||
.filter((key) => !omitted.includes(key))
|
||||
.forEach((key) => {
|
||||
const propType = typeof obj[key];
|
||||
if (propType === 'function') {
|
||||
|
@ -52,7 +52,7 @@ const createInternalClientMock = (): DeeplyMockedKeys<Client> => {
|
|||
});
|
||||
};
|
||||
|
||||
mockify(client, blackListedProps);
|
||||
mockify(client, omittedProps);
|
||||
|
||||
client.transport = {
|
||||
request: jest.fn(),
|
||||
|
|
|
@ -39,14 +39,14 @@ import { getRootProperties } from './get_root_properties';
|
|||
* @return {EsPropertyMappings}
|
||||
*/
|
||||
|
||||
const blacklist = ['migrationVersion', 'references'];
|
||||
const omittedRootProps = ['migrationVersion', 'references'];
|
||||
|
||||
export function getRootPropertiesObjects(mappings: IndexMapping) {
|
||||
const rootProperties = getRootProperties(mappings);
|
||||
return Object.entries(rootProperties).reduce((acc, [key, value]) => {
|
||||
// we consider the existence of the properties or type of object to designate that this is an object datatype
|
||||
if (
|
||||
!blacklist.includes(key) &&
|
||||
!omittedRootProps.includes(key) &&
|
||||
((value as SavedObjectsComplexFieldMapping).properties || value.type === 'object')
|
||||
) {
|
||||
acc[key] = value;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue