Skip to content

Commit

Permalink
Merge branch 'master' of github.com:elastic/kibana into Move_Show_Hid…
Browse files Browse the repository at this point in the history
…e_Indices_Outside_List
  • Loading branch information
John Dorlus committed Feb 18, 2020
2 parents 6b742de + 6436862 commit 3bdddc2
Show file tree
Hide file tree
Showing 1,327 changed files with 15,944 additions and 7,830 deletions.
27 changes: 25 additions & 2 deletions .ci/end2end.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pipeline {
durabilityHint('PERFORMANCE_OPTIMIZED')
}
triggers {
issueCommentTrigger('(?i).*jenkins\\W+run\\W+(?:the\\W+)?e2e(?:\\W+please)?.*')
issueCommentTrigger('(?i)(retest|.*jenkins\\W+run\\W+(?:the\\W+)?e2e?.*)')
}
parameters {
booleanParam(name: 'FORCE', defaultValue: false, description: 'Whether to force the run.')
Expand Down Expand Up @@ -60,8 +60,14 @@ pipeline {
}
}
steps {
notifyStatus('Starting services', 'PENDING')
dir("${APM_ITS}"){
sh './scripts/compose.py start master --no-kibana --no-xpack-secure'
sh './scripts/compose.py start master --no-kibana'
}
}
post {
unsuccessful {
notifyStatus('Environmental issue', 'FAILURE')
}
}
}
Expand All @@ -77,10 +83,16 @@ pipeline {
JENKINS_NODE_COOKIE = 'dontKillMe'
}
steps {
notifyStatus('Preparing kibana', 'PENDING')
dir("${BASE_DIR}"){
sh script: "${CYPRESS_DIR}/ci/prepare-kibana.sh"
}
}
post {
unsuccessful {
notifyStatus('Kibana warm up failed', 'FAILURE')
}
}
}
stage('Smoke Tests'){
options { skipDefaultCheckout() }
Expand All @@ -91,6 +103,7 @@ pipeline {
}
}
steps{
notifyStatus('Running smoke tests', 'PENDING')
dir("${BASE_DIR}"){
sh '''
jobs -l
Expand All @@ -112,6 +125,12 @@ pipeline {
archiveArtifacts(allowEmptyArchive: false, artifacts: 'apm-its.log')
}
}
unsuccessful {
notifyStatus('Test failures', 'FAILURE')
}
success {
notifyStatus('Tests passed', 'SUCCESS')
}
}
}
}
Expand All @@ -123,3 +142,7 @@ pipeline {
}
}
}

def notifyStatus(String description, String status) {
withGithubNotify.notify('end2end-for-apm-ui', description, status, getBlueoceanDisplayURL())
}
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,15 @@
# Kibana Alerting Services
/x-pack/legacy/plugins/alerting/ @elastic/kibana-alerting-services
/x-pack/legacy/plugins/actions/ @elastic/kibana-alerting-services
/x-pack/plugins/alerting/ @elastic/kibana-alerting-services
/x-pack/plugins/actions/ @elastic/kibana-alerting-services
/x-pack/plugins/event_log/ @elastic/kibana-alerting-services
/x-pack/plugins/task_manager/ @elastic/kibana-alerting-services
/x-pack/test/alerting_api_integration/ @elastic/kibana-alerting-services
/x-pack/test/plugin_api_integration/plugins/task_manager/ @elastic/kibana-alerting-services
/x-pack/test/plugin_api_integration/test_suites/task_manager/ @elastic/kibana-alerting-services
/x-pack/legacy/plugins/triggers_actions_ui/ @elastic/kibana-alerting-services
/x-pack/plugins/triggers_actions_ui/ @elastic/kibana-alerting-services
/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/ @elastic/kibana-alerting-services
/x-pack/test/functional_with_es_ssl/fixtures/plugins/alerts/ @elastic/kibana-alerting-services

Expand Down
8 changes: 4 additions & 4 deletions docs/api/dashboard/import-dashboard.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ experimental[] Import dashboards and corresponding saved objects.

`force`::
(Optional, boolean) Overwrite any existing objects on ID conflict.

`exclude`::
(Optional, array) Saved object types that you want to exclude from the import.

Expand All @@ -28,14 +28,14 @@ Use the complete response body from the <<dashboard-api-export, Export dashboard
[[dashboard-api-import-response-body]]
==== Response body

`objects`::
(array) A top level property that includes the saved objects.
`objects`::
(array) A top level property that includes the saved objects.

[[dashboard-api-import-codes]]
==== Response code

`200`::
Indicates a successful call, even if there are errors importing individual saved objects. If there ar errors, the error information is returned in the response body on an object-by-object basis.
Indicates a successful call, even if there are errors importing individual saved objects. If there are errors, the error information is returned in the response body on an object-by-object basis.

[[dashboard-api-import-example]]
==== Example
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
"@kbn/ui-framework": "1.0.0",
"@kbn/ui-shared-deps": "1.0.0",
"JSONStream": "1.3.5",
"abort-controller": "^3.0.0",
"abortcontroller-polyfill": "^1.4.0",
"angular": "^1.7.9",
"angular-aria": "^1.7.9",
"angular-elastic": "^2.5.1",
Expand Down
1 change: 1 addition & 0 deletions packages/kbn-optimizer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"node-sass": "^4.13.0",
"postcss-loader": "^3.0.0",
"raw-loader": "^3.1.0",
"resolve-url-loader": "^3.1.1",
"rxjs": "^6.5.3",
"sass-loader": "^8.0.2",
"style-loader": "^1.1.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const MOCK_REPO_DIR = Path.resolve(TMP_DIR, 'mock_repo');

expect.addSnapshotSerializer(createAbsolutePathSerializer(MOCK_REPO_DIR));

beforeEach(async () => {
beforeAll(async () => {
await del(TMP_DIR);
await cpy('**/*', MOCK_REPO_DIR, {
cwd: MOCK_REPO_SRC,
Expand All @@ -42,7 +42,7 @@ beforeEach(async () => {
});
});

afterEach(async () => {
afterAll(async () => {
await del(TMP_DIR);
});

Expand Down Expand Up @@ -153,3 +153,32 @@ it('builds expected bundles, saves bundle counts to metadata', async () => {
]
`);
});

it('uses cache on second run and exist cleanly', async () => {
const config = OptimizerConfig.create({
repoRoot: MOCK_REPO_DIR,
pluginScanDirs: [Path.resolve(MOCK_REPO_DIR, 'plugins')],
maxWorkerCount: 1,
});

const msgs = await runOptimizer(config)
.pipe(
tap(state => {
if (state.event?.type === 'worker stdio') {
// eslint-disable-next-line no-console
console.log('worker', state.event.stream, state.event.chunk.toString('utf8'));
}
}),
toArray()
)
.toPromise();

expect(msgs.map(m => m.state.phase)).toMatchInlineSnapshot(`
Array [
"initializing",
"initializing",
"initializing",
"initialized",
]
`);
});
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ export function handleOptimizerCompletion(config: OptimizerConfig) {
return;
}

if (prevState?.phase === 'initialized' && prevState.onlineBundles.length === 0) {
// all bundles cached
return;
}

if (prevState?.phase === 'issue') {
throw createFailError('webpack issue');
}
Expand Down
21 changes: 21 additions & 0 deletions packages/kbn-optimizer/src/worker/webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,27 @@ export function getWebpackConfig(bundle: Bundle, worker: WorkerConfig) {
},
},
},
{
loader: 'resolve-url-loader',
options: {
join: (_: string, __: any) => (uri: string, base?: string) => {
if (!base) {
return null;
}

// manually force ui/* urls in legacy styles to resolve to ui/legacy/public
if (uri.startsWith('ui/') && base.split(Path.sep).includes('legacy')) {
return Path.resolve(
worker.repoRoot,
'src/legacy/ui/public',
uri.replace('ui/', '')
);
}

return null;
},
},
},
{
loader: 'sass-loader',
options: {
Expand Down
31 changes: 19 additions & 12 deletions packages/kbn-pm/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43046,21 +43046,28 @@ module.exports = require("tty");
const os = __webpack_require__(11);
const hasFlag = __webpack_require__(12);

const env = process.env;
const {env} = process;

let forceColor;
if (hasFlag('no-color') ||
hasFlag('no-colors') ||
hasFlag('color=false')) {
forceColor = false;
hasFlag('color=false') ||
hasFlag('color=never')) {
forceColor = 0;
} else if (hasFlag('color') ||
hasFlag('colors') ||
hasFlag('color=true') ||
hasFlag('color=always')) {
forceColor = true;
forceColor = 1;
}
if ('FORCE_COLOR' in env) {
forceColor = env.FORCE_COLOR.length === 0 || parseInt(env.FORCE_COLOR, 10) !== 0;
if (env.FORCE_COLOR === true || env.FORCE_COLOR === 'true') {
forceColor = 1;
} else if (env.FORCE_COLOR === false || env.FORCE_COLOR === 'false') {
forceColor = 0;
} else {
forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
}
}

function translateLevel(level) {
Expand All @@ -43077,7 +43084,7 @@ function translateLevel(level) {
}

function supportsColor(stream) {
if (forceColor === false) {
if (forceColor === 0) {
return 0;
}

Expand All @@ -43091,11 +43098,15 @@ function supportsColor(stream) {
return 2;
}

if (stream && !stream.isTTY && forceColor !== true) {
if (stream && !stream.isTTY && forceColor === undefined) {
return 0;
}

const min = forceColor ? 1 : 0;
const min = forceColor || 0;

if (env.TERM === 'dumb') {
return min;
}

if (process.platform === 'win32') {
// Node.js 7.5.0 is the first version of Node.js to include a patch to
Expand Down Expand Up @@ -43156,10 +43167,6 @@ function supportsColor(stream) {
return 1;
}

if (env.TERM === 'dumb') {
return min;
}

return min;
}

Expand Down
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 @@ -10,7 +10,7 @@
},
"devDependencies": {
"@elastic/charts": "^17.0.2",
"abort-controller": "^3.0.0",
"abortcontroller-polyfill": "^1.4.0",
"@elastic/eui": "19.0.0",
"@kbn/dev-utils": "1.0.0",
"@kbn/i18n": "1.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/kbn-ui-shared-deps/polyfills.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ require('core-js/stable');
require('regenerator-runtime/runtime');
require('custom-event-polyfill');
require('whatwg-fetch');
require('abort-controller/polyfill');
require('abortcontroller-polyfill/dist/polyfill-patch-fetch');
require('./vendor/childnode_remove_polyfill');
require('symbol-observable');
4 changes: 4 additions & 0 deletions packages/kbn-utility-types/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,12 @@ type B = UnwrapPromise<A>; // string

- `Ensure<T, X>` &mdash; Makes sure `T` is of type `X`.
- `ObservableLike<T>` &mdash; Minimal interface for an object resembling an `Observable`.
- `PublicContract<T>` &mdash; Returns an object with public keys only.
- `PublicKeys<T>` &mdash; Returns public keys of an object.
- `RecursiveReadonly<T>` &mdash; Like `Readonly<T>`, but freezes object recursively.
- `ShallowPromise<T>` &mdash; Same as `Promise` type, but it flat maps the wrapped type.
- `UnionToIntersection<T>` &mdash; Converts a union of types into an intersection.
- `UnwrapObservable<T>` &mdash; Returns wrapped type of an observable.
- `UnwrapPromise<T>` &mdash; Returns wrapped type of a promise.
- `UnwrapPromiseOrReturn<T>` &mdash; Returns wrapped type of a promise or the type itself, if it isn't a promise.
- `Values<T>` &mdash; Returns object or array value types.
28 changes: 28 additions & 0 deletions packages/kbn-utility-types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,31 @@ export type RecursiveReadonly<T> = T extends (...args: any) => any
: T extends object
? Readonly<{ [K in keyof T]: RecursiveReadonly<T[K]> }>
: T;

/**
* Returns types or array or object values.
*/
export type Values<T> = T extends any[] ? T[number] : T extends object ? T[keyof T] : never;

/**
* Utility type for converting a union of types into an intersection.
*
* This is a bit of "black magic" that will interpret a Union type as an Intersection
* type. This is necessary in the case of distinguishing one collection from
* another.
*/
export type UnionToIntersection<U> = (U extends any
? (k: U) => void
: never) extends (k: infer I) => void
? I
: never;

/**
* Returns public keys of an object.
*/
export type PublicKeys<T> = keyof T;

/**
* Returns an object with public keys only.
*/
export type PublicContract<T> = Pick<T, PublicKeys<T>>;
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,17 @@
* under the License.
*/

import Hapi from 'hapi';
import { expectType } from 'tsd';
import { PublicContract } from '../index';

export const createLogLegacyImportRoute = () => ({
path: '/api/saved_objects/_log_legacy_import',
method: 'POST',
options: {
handler(request: Hapi.Request) {
request.server.log(
['warning'],
'Importing saved objects from a .json file has been deprecated'
);
return { success: true };
},
},
class Test {
public str: string = '';
// @ts-ignore
private num: number = 0;
}

type CONTRACT = PublicContract<Test>;

expectType<CONTRACT>({
str: 'foo',
});
Loading

0 comments on commit 3bdddc2

Please sign in to comment.