Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ES UI new platform cleanup #64332

Merged
merged 10 commits into from
Apr 28, 2020
1 change: 1 addition & 0 deletions docs/development/core/server/kibana-plugin-core-server.md
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ The plugin integrates with the core system via lifecycle events: `setup`<!-- -->
| [SavedObjectsClientWrapperFactory](./kibana-plugin-core-server.savedobjectsclientwrapperfactory.md) | Describes the factory used to create instances of Saved Objects Client Wrappers. |
| [SavedObjectsFieldMapping](./kibana-plugin-core-server.savedobjectsfieldmapping.md) | Describe a [saved object type mapping](./kibana-plugin-core-server.savedobjectstypemappingdefinition.md) field.<!-- -->Please refer to [elasticsearch documentation](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-types.html) For the mapping documentation |
| [SavedObjectsNamespaceType](./kibana-plugin-core-server.savedobjectsnamespacetype.md) | The namespace type dictates how a saved object can be interacted in relation to namespaces. Each type is mutually exclusive: \* single (default): this type of saved object is namespace-isolated, e.g., it exists in only one namespace. \* multiple: this type of saved object is shareable, e.g., it can exist in one or more namespaces. \* agnostic: this type of saved object is global.<!-- -->Note: do not write logic that uses this value directly; instead, use the appropriate accessors in the [type registry](./kibana-plugin-core-server.savedobjecttyperegistry.md)<!-- -->. |
| [SavedObjectUnsanitizedDoc](./kibana-plugin-core-server.savedobjectunsanitizeddoc.md) | We want to have two types, one that guarantees a "references" attribute will exist and one that allows it to be null. Since we're not migrating all the saved objects to have a "references" array, we need to support the scenarios where it may be missing (ex migrations). |
| [ScopeableRequest](./kibana-plugin-core-server.scopeablerequest.md) | A user credentials container. It accommodates the necessary auth credentials to impersonate the current user.<!-- -->See [KibanaRequest](./kibana-plugin-core-server.kibanarequest.md)<!-- -->. |
| [ServiceStatusLevel](./kibana-plugin-core-server.servicestatuslevel.md) | A convenience type that represents the union of each value in [ServiceStatusLevels](./kibana-plugin-core-server.servicestatuslevels.md)<!-- -->. |
| [SharedGlobalConfig](./kibana-plugin-core-server.sharedglobalconfig.md) | |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ export interface SavedObjectsCoreFieldMapping
| [enabled](./kibana-plugin-core-server.savedobjectscorefieldmapping.enabled.md) | <code>boolean</code> | |
| [fields](./kibana-plugin-core-server.savedobjectscorefieldmapping.fields.md) | <code>{</code><br/><code> [subfield: string]: {</code><br/><code> type: string;</code><br/><code> };</code><br/><code> }</code> | |
| [index](./kibana-plugin-core-server.savedobjectscorefieldmapping.index.md) | <code>boolean</code> | |
| [null\_value](./kibana-plugin-core-server.savedobjectscorefieldmapping.null_value.md) | <code>number &#124; boolean &#124; string</code> | |
| [type](./kibana-plugin-core-server.savedobjectscorefieldmapping.type.md) | <code>string</code> | |

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [SavedObjectsCoreFieldMapping](./kibana-plugin-core-server.savedobjectscorefieldmapping.md) &gt; [null\_value](./kibana-plugin-core-server.savedobjectscorefieldmapping.null_value.md)

## SavedObjectsCoreFieldMapping.null\_value property

<b>Signature:</b>

```typescript
null_value?: number | boolean | string;
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-core-server](./kibana-plugin-core-server.md) &gt; [SavedObjectUnsanitizedDoc](./kibana-plugin-core-server.savedobjectunsanitizeddoc.md)

## SavedObjectUnsanitizedDoc type

We want to have two types, one that guarantees a "references" attribute will exist and one that allows it to be null. Since we're not migrating all the saved objects to have a "references" array, we need to support the scenarios where it may be missing (ex migrations).

<b>Signature:</b>

```typescript
export declare type SavedObjectUnsanitizedDoc = SavedObjectDoc & Partial<Referencable>;
```
1 change: 1 addition & 0 deletions src/core/server/saved_objects/mappings/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ export interface IndexMappingMeta {
*/
export interface SavedObjectsCoreFieldMapping {
type: string;
null_value?: number | boolean | string;
index?: boolean;
enabled?: boolean;
fields?: {
Expand Down
2 changes: 2 additions & 0 deletions src/core/server/server.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1840,6 +1840,8 @@ export interface SavedObjectsCoreFieldMapping {
// (undocumented)
index?: boolean;
// (undocumented)
null_value?: number | boolean | string;
// (undocumented)
type: string;
}

Expand Down
6 changes: 0 additions & 6 deletions x-pack/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,12 @@ import { dashboardMode } from './legacy/plugins/dashboard_mode';
import { beats } from './legacy/plugins/beats_management';
import { apm } from './legacy/plugins/apm';
import { maps } from './legacy/plugins/maps';
import { indexManagement } from './legacy/plugins/index_management';
import { spaces } from './legacy/plugins/spaces';
import { canvas } from './legacy/plugins/canvas';
import { infra } from './legacy/plugins/infra';
import { taskManager } from './legacy/plugins/task_manager';
import { rollup } from './legacy/plugins/rollup';
import { siem } from './legacy/plugins/siem';
import { remoteClusters } from './legacy/plugins/remote_clusters';
import { upgradeAssistant } from './legacy/plugins/upgrade_assistant';
import { uptime } from './legacy/plugins/uptime';
import { encryptedSavedObjects } from './legacy/plugins/encrypted_saved_objects';
import { actions } from './legacy/plugins/actions';
Expand All @@ -42,13 +39,10 @@ module.exports = function(kibana) {
apm(kibana),
maps(kibana),
canvas(kibana),
indexManagement(kibana),
infra(kibana),
taskManager(kibana),
rollup(kibana),
siem(kibana),
remoteClusters(kibana),
upgradeAssistant(kibana),
uptime(kibana),
encryptedSavedObjects(kibana),
actions(kibana),
Expand Down
13 changes: 0 additions & 13 deletions x-pack/legacy/plugins/index_management/index.ts

This file was deleted.

40 changes: 0 additions & 40 deletions x-pack/legacy/plugins/remote_clusters/index.ts

This file was deleted.

28 changes: 0 additions & 28 deletions x-pack/legacy/plugins/upgrade_assistant/index.ts

This file was deleted.

65 changes: 0 additions & 65 deletions x-pack/legacy/plugins/upgrade_assistant/mappings.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// Import the EUI global scope so we can use EUI constants
@import 'src/legacy/ui/public/styles/_styling_constants';

// Remote clusters plugin styles
// Remote clusters plugin hacks

// Prefix all styles with "remoteClusters" to avoid conflicts.
// Examples
Expand Down
2 changes: 2 additions & 0 deletions x-pack/plugins/remote_clusters/public/application/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import { App } from './app';
import { remoteClustersStore } from './store';
import { AppContextProvider } from './app_context';

import './_hacks.scss';

export const renderApp = (elem, I18nContext, appDependencies) => {
render(
<I18nContext>
Expand Down
15 changes: 12 additions & 3 deletions x-pack/plugins/upgrade_assistant/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import { registerClusterCheckupRoutes } from './routes/cluster_checkup';
import { registerDeprecationLoggingRoutes } from './routes/deprecation_logging';
import { registerReindexIndicesRoutes, createReindexWorker } from './routes/reindex_indices';
import { registerTelemetryRoutes } from './routes/telemetry';
import { telemetrySavedObjectType, reindexOperationSavedObjectType } from './saved_object_types';

import { RouteDependencies } from './types';

interface PluginsSetup {
Expand Down Expand Up @@ -57,11 +59,14 @@ export class UpgradeAssistantServerPlugin implements Plugin {
}

setup(
{ http, getStartServices, capabilities }: CoreSetup,
{ http, getStartServices, capabilities, savedObjects }: CoreSetup,
{ usageCollection, cloud, licensing }: PluginsSetup
) {
this.licensing = licensing;

savedObjects.registerType(reindexOperationSavedObjectType);
savedObjects.registerType(telemetrySavedObjectType);

const router = http.createRouter();

const dependencies: RouteDependencies = {
Expand All @@ -85,8 +90,12 @@ export class UpgradeAssistantServerPlugin implements Plugin {
registerTelemetryRoutes(dependencies);

if (usageCollection) {
getStartServices().then(([{ savedObjects, elasticsearch }]) => {
registerUpgradeAssistantUsageCollector({ elasticsearch, usageCollection, savedObjects });
getStartServices().then(([{ savedObjects: savedObjectsService, elasticsearch }]) => {
registerUpgradeAssistantUsageCollector({
elasticsearch,
usageCollection,
savedObjects: savedObjectsService,
});
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@
* you may not use this file except in compliance with the Elastic License.
*/

export const PLUGIN = {
ID: 'remoteClusters',
};
export { reindexOperationSavedObjectType } from './reindex_operation_saved_object_type';
export { telemetrySavedObjectType } from './telemetry_saved_object_type';
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* 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 { SavedObjectsType } from 'src/core/server';

import { REINDEX_OP_TYPE } from '../../common/types';

export const reindexOperationSavedObjectType: SavedObjectsType = {
name: REINDEX_OP_TYPE,
hidden: false,
namespaceType: 'agnostic',
mappings: {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new Saved Object types API disallows dynamic mapping, which the original type definitions depended upon, so I had to add a bunch of new mappings to get the tests passing.

Copy link
Contributor

@pgayvallet pgayvallet Apr 27, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If dynamic mappings in SO type are really a need, we can discuss about enabling it (actually it's only 'disabled' in the TS type, forcing the dynamic: true value does work, see (but please don't do):

// we don't want to allow `true` in the public `SavedObjectsTypeMappingDefinition` type, however
// this is needed for the config that is kinda a special type. To avoid adding additional internal types
// just for this, we hardcast to any here.
dynamic: true as any,

It's just that when we discussed about it, we did not find any valid argument to allow this value on the public API as a SO type mapping is meant to be exhaustive.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Pierre! I don't think we need it in this case. I also created #64547 so that we eventually remove these added mappings (if possible).

properties: {
reindexTaskId: {
type: 'keyword',
},
indexName: {
type: 'keyword',
},
newIndexName: {
type: 'keyword',
},
status: {
type: 'integer',
},
locked: {
type: 'date',
},
lastCompletedStep: {
type: 'integer',
},
errorMessage: {
type: 'keyword',
},
reindexTaskPercComplete: {
type: 'float',
},
runningReindexCount: {
type: 'integer',
},
reindexOptions: {
properties: {
openAndClose: {
type: 'boolean',
},
queueSettings: {
properties: {
queuedAt: {
type: 'long',
},
startedAt: {
type: 'long',
},
},
},
},
},
},
},
};
Loading