Skip to content

Commit

Permalink
Merge branch 'master' into uriencode-password
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Oct 26, 2020
2 parents bab0698 + 38c6d1f commit 8688bd6
Show file tree
Hide file tree
Showing 121 changed files with 2,074 additions and 514 deletions.
3 changes: 2 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,9 @@ x-pack/plugins/telemetry_collection_xpack/schema/xpack_plugins.json @elastic/kib
**/*.scss @elastic/kibana-design
#CC# /packages/kbn-ui-framework/ @elastic/kibana-design

# Core design
# Core UI design
/src/plugins/dashboard/**/*.scss @elastic/kibana-core-ui-designers
/src/plugins/embeddable/**/*.scss @elastic/kibana-core-ui-designers
/x-pack/plugins/canvas/**/*.scss @elastic/kibana-core-ui-designers
/x-pack/plugins/spaces/**/*.scss @elastic/kibana-core-ui-designers
/x-pack/plugins/security/**/*.scss @elastic/kibana-core-ui-designers
Expand Down
5 changes: 5 additions & 0 deletions .telemetryrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,10 @@
"src/plugins/testbed/",
"src/plugins/kibana_utils/"
]
},
{
"output": "src/plugins/telemetry/schema/legacy_plugins.json",
"root": "src/legacy/server/",
"exclude": []
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ Constructs a new instance of the `IndexPatternsFetcher` class
<b>Signature:</b>

```typescript
constructor(callDataCluster: LegacyAPICaller);
constructor(elasticsearchClient: ElasticsearchClient, allowNoIndices?: boolean);
```

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| callDataCluster | <code>LegacyAPICaller</code> | |
| elasticsearchClient | <code>ElasticsearchClient</code> | |
| allowNoIndices | <code>boolean</code> | |

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ getFieldsForWildcard(options: {
pattern: string | string[];
metaFields?: string[];
fieldCapsOptions?: {
allowNoIndices: boolean;
allow_no_indices: boolean;
};
}): Promise<FieldDescriptor[]>;
```
Expand All @@ -22,7 +22,7 @@ getFieldsForWildcard(options: {

| Parameter | Type | Description |
| --- | --- | --- |
| options | <code>{</code><br/><code> pattern: string &#124; string[];</code><br/><code> metaFields?: string[];</code><br/><code> fieldCapsOptions?: {</code><br/><code> allowNoIndices: boolean;</code><br/><code> };</code><br/><code> }</code> | |
| options | <code>{</code><br/><code> pattern: string &#124; string[];</code><br/><code> metaFields?: string[];</code><br/><code> fieldCapsOptions?: {</code><br/><code> allow_no_indices: boolean;</code><br/><code> };</code><br/><code> }</code> | |

<b>Returns:</b>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export declare class IndexPatternsFetcher

| Constructor | Modifiers | Description |
| --- | --- | --- |
| [(constructor)(callDataCluster)](./kibana-plugin-plugins-data-server.indexpatternsfetcher._constructor_.md) | | Constructs a new instance of the <code>IndexPatternsFetcher</code> class |
| [(constructor)(elasticsearchClient, allowNoIndices)](./kibana-plugin-plugins-data-server.indexpatternsfetcher._constructor_.md) | | Constructs a new instance of the <code>IndexPatternsFetcher</code> class |

## Methods

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@
"@babel/register": "^7.10.5",
"@babel/types": "^7.11.0",
"@elastic/apm-rum": "^5.6.1",
"@elastic/charts": "23.2.1",
"@elastic/charts": "24.0.0",
"@elastic/ems-client": "7.10.0",
"@elastic/eslint-config-kibana": "0.15.0",
"@elastic/eslint-plugin-eui": "0.0.2",
Expand Down
21 changes: 12 additions & 9 deletions packages/kbn-plugin-generator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,14 @@ yarn kbn bootstrap

Generated plugins receive a handful of scripts that can be used during development. Those scripts are detailed in the [README.md](template/README.md) file in each newly generated plugin, and expose the scripts provided by the [Kibana plugin helpers](../kbn-plugin-helpers), but here is a quick reference in case you need it:

> ***NOTE:*** All of these scripts should be run from the generated plugin.
> ***NOTE:*** The following scripts should be run from the generated plugin.
- `yarn kbn bootstrap`

Install dependencies and crosslink Kibana and all projects/plugins.

> ***IMPORTANT:*** Use this script instead of `yarn` to install dependencies when switching branches, and re-run it whenever your dependencies change.
- `yarn start`

Start kibana and have it include this plugin. You can pass any arguments that you would normally send to `bin/kibana`

```
yarn start --elasticsearch.hosts http://localhost:9220
```
- `yarn build`

Build a distributable archive of your plugin.
Expand All @@ -75,4 +67,15 @@ Generated plugins receive a handful of scripts that can be used during developme

Run the server tests using mocha.


To start kibana run the following command from Kibana root.

- `yarn start`

Start kibana and it will automatically include this plugin. You can pass any arguments that you would normally send to `bin/kibana`

```
yarn start --elasticsearch.hosts http://localhost:9220
```

For more information about any of these commands run `yarn ${task} --help`. For a full list of tasks run `yarn run` or take a look in the `package.json` file.
2 changes: 1 addition & 1 deletion packages/kbn-ui-shared-deps/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"kbn:watch": "node scripts/build --dev --watch"
},
"dependencies": {
"@elastic/charts": "23.2.1",
"@elastic/charts": "24.0.0",
"@elastic/eui": "29.5.0",
"@elastic/numeral": "^2.5.0",
"@kbn/i18n": "1.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ kibana_vars=(
tilemap.url
timelion.enabled
vega.enableExternalUrls
xpack.actions.proxyUrl
xpack.apm.enabled
xpack.apm.serviceMapEnabled
xpack.apm.ui.enabled
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
* specific language governing permissions and limitations
* under the License.
*/
import { CollectorSet, CollectorOptions } from '../../plugins/usage_collection/server/collector';
import {
CollectorSet,
UsageCollectorOptions,
} from '../../plugins/usage_collection/server/collector';
import { loggerMock } from '../../core/server/logging/logger.mock';

const collectorSet = new CollectorSet({
Expand All @@ -28,7 +31,7 @@ interface Usage {
locale: string;
}

function createCollector(): CollectorOptions<Usage> {
function createCollector(): UsageCollectorOptions<Usage> {
return {
type: 'from_fn_collector',
isReady: () => true,
Expand All @@ -46,7 +49,7 @@ function createCollector(): CollectorOptions<Usage> {
}

export function defineCollectorFromVariable() {
const fromVarCollector: CollectorOptions<Usage> = {
const fromVarCollector: UsageCollectorOptions<Usage> = {
type: 'from_variable_collector',
isReady: () => true,
fetch(): Usage {
Expand Down
1 change: 1 addition & 0 deletions src/fixtures/telemetry_collectors/unmapped_collector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ interface Usage {
locale: string;
}

// @ts-expect-error Intentionally not specifying `schema`
export const myCollector = makeUsageCollector<Usage>({
type: 'unmapped_collector',
isReady: () => true,
Expand Down
5 changes: 0 additions & 5 deletions src/legacy/server/i18n/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,3 @@
*/

export const I18N_RC = '.i18nrc.json';

/**
* The type name used within the Monitoring index to publish localization stats.
*/
export const KIBANA_LOCALIZATION_STATS_TYPE = 'localization';
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import { i18nLoader } from '@kbn/i18n';
import { size } from 'lodash';
import { UsageCollectionSetup } from 'src/plugins/usage_collection/server';
import { getIntegrityHashes, Integrities } from './file_integrity';
import { KIBANA_LOCALIZATION_STATS_TYPE } from '../constants';

export interface UsageStats {
locale: string;
Expand Down Expand Up @@ -63,14 +62,20 @@ export function createCollectorFetch({
};
}

// TODO: Migrate out of the Legacy dir
export function registerLocalizationUsageCollector(
usageCollection: UsageCollectionSetup,
helpers: LocalizationUsageCollectorHelpers
) {
const collector = usageCollection.makeUsageCollector({
type: KIBANA_LOCALIZATION_STATS_TYPE,
const collector = usageCollection.makeUsageCollector<UsageStats>({
type: 'localization',
isReady: () => true,
fetch: createCollectorFetch(helpers),
schema: {
locale: { type: 'keyword' },
integrities: { DYNAMIC_KEY: { type: 'text' } },
labelsCount: { type: 'long' },
},
});

usageCollection.registerCollector(collector);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import classNames from 'classnames';

import 'brace/theme/textmate';
import 'brace/mode/markdown';
import 'brace/mode/json';

import {
EuiBadge,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

import { LegacyAPICaller } from 'kibana/server';
import { ElasticsearchClient } from 'kibana/server';

import { getFieldCapabilities, resolveTimePattern, createNoMatchingIndicesError } from './lib';

Expand All @@ -37,10 +37,12 @@ interface FieldSubType {
}

export class IndexPatternsFetcher {
private _callDataCluster: LegacyAPICaller;
private elasticsearchClient: ElasticsearchClient;
private allowNoIndices: boolean;

constructor(callDataCluster: LegacyAPICaller) {
this._callDataCluster = callDataCluster;
constructor(elasticsearchClient: ElasticsearchClient, allowNoIndices: boolean = false) {
this.elasticsearchClient = elasticsearchClient;
this.allowNoIndices = allowNoIndices;
}

/**
Expand All @@ -55,10 +57,12 @@ export class IndexPatternsFetcher {
async getFieldsForWildcard(options: {
pattern: string | string[];
metaFields?: string[];
fieldCapsOptions?: { allowNoIndices: boolean };
fieldCapsOptions?: { allow_no_indices: boolean };
}): Promise<FieldDescriptor[]> {
const { pattern, metaFields, fieldCapsOptions } = options;
return await getFieldCapabilities(this._callDataCluster, pattern, metaFields, fieldCapsOptions);
return await getFieldCapabilities(this.elasticsearchClient, pattern, metaFields, {
allow_no_indices: fieldCapsOptions ? fieldCapsOptions.allow_no_indices : this.allowNoIndices,
});
}

/**
Expand All @@ -78,11 +82,11 @@ export class IndexPatternsFetcher {
interval: string;
}) {
const { pattern, lookBack, metaFields } = options;
const { matches } = await resolveTimePattern(this._callDataCluster, pattern);
const { matches } = await resolveTimePattern(this.elasticsearchClient, pattern);
const indices = matches.slice(0, lookBack);
if (indices.length === 0) {
throw createNoMatchingIndicesError(pattern);
}
return await getFieldCapabilities(this._callDataCluster, indices, metaFields);
return await getFieldCapabilities(this.elasticsearchClient, indices, metaFields);
}
}
Loading

0 comments on commit 8688bd6

Please sign in to comment.