Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into bug/form-lib-addf…
Browse files Browse the repository at this point in the history
…ield-on-component-mount
  • Loading branch information
sebelga committed Aug 26, 2020
2 parents 55593c1 + ddf99b6 commit d04098b
Show file tree
Hide file tree
Showing 164 changed files with 3,181 additions and 549 deletions.
22 changes: 20 additions & 2 deletions src/dev/build/lib/fs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,16 @@ export async function compressTar({

archive.pipe(output);

return archive.directory(source, name).finalize();
let fileCount = 0;
archive.on('entry', (entry) => {
if (entry.stats?.isFile()) {
fileCount += 1;
}
});

await archive.directory(source, name).finalize();

return fileCount;
}

interface CompressZipOptions {
Expand All @@ -294,5 +303,14 @@ export async function compressZip({

archive.pipe(output);

return archive.directory(source, name).finalize();
let fileCount = 0;
archive.on('entry', (entry) => {
if (entry.stats?.isFile()) {
fileCount += 1;
}
});

await archive.directory(source, name).finalize();

return fileCount;
}
71 changes: 36 additions & 35 deletions src/dev/build/tasks/create_archives_task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import Path from 'path';
import Fs from 'fs';
import { promisify } from 'util';

import { CiStatsReporter } from '@kbn/dev-utils';
import { CiStatsReporter, CiStatsMetrics } from '@kbn/dev-utils';

import { mkdirp, compressTar, compressZip, Task } from '../lib';

Expand All @@ -47,36 +47,34 @@ export const CreateArchives: Task = {
archives.push({
format: 'zip',
path: destination,
});

await compressZip({
source,
destination,
archiverOptions: {
zlib: {
level: 9,
fileCount: await compressZip({
source,
destination,
archiverOptions: {
zlib: {
level: 9,
},
},
},
createRootDirectory: true,
createRootDirectory: true,
}),
});
break;

case '.gz':
archives.push({
format: 'tar',
path: destination,
});

await compressTar({
source,
destination,
archiverOptions: {
gzip: true,
gzipOptions: {
level: 9,
fileCount: await compressTar({
source,
destination,
archiverOptions: {
gzip: true,
gzipOptions: {
level: 9,
},
},
},
createRootDirectory: true,
createRootDirectory: true,
}),
});
break;

Expand All @@ -85,19 +83,22 @@ export const CreateArchives: Task = {
}
}

const reporter = CiStatsReporter.fromEnv(log);
if (reporter.isEnabled()) {
await reporter.metrics(
await Promise.all(
archives.map(async ({ format, path }) => {
return {
group: `${build.isOss() ? 'oss ' : ''}distributable size`,
id: format,
value: (await asyncStat(path)).size,
};
})
)
);
const metrics: CiStatsMetrics = [];
for (const { format, path, fileCount } of archives) {
metrics.push({
group: `${build.isOss() ? 'oss ' : ''}distributable size`,
id: format,
value: (await asyncStat(path)).size,
});

metrics.push({
group: `${build.isOss() ? 'oss ' : ''}distributable file count`,
id: 'total',
value: fileCount,
});
}
log.debug('archive metrics:', metrics);

await CiStatsReporter.fromEnv(log).metrics(metrics);
},
};
83 changes: 1 addition & 82 deletions src/legacy/core_plugins/kibana/server/ui_setting_defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,88 +17,7 @@
* under the License.
*/

import { i18n } from '@kbn/i18n';

export function getUiSettingDefaults() {
// wrapped in provider so that a new instance is given to each app/test
return {
'visualization:tileMap:maxPrecision': {
name: i18n.translate('kbn.advancedSettings.visualization.tileMap.maxPrecisionTitle', {
defaultMessage: 'Maximum tile map precision',
}),
value: 7,
description: i18n.translate('kbn.advancedSettings.visualization.tileMap.maxPrecisionText', {
defaultMessage:
'The maximum geoHash precision displayed on tile maps: 7 is high, 10 is very high, 12 is the max. {cellDimensionsLink}',
description:
'Part of composite text: kbn.advancedSettings.visualization.tileMap.maxPrecisionText + ' +
'kbn.advancedSettings.visualization.tileMap.maxPrecision.cellDimensionsLinkText',
values: {
cellDimensionsLink:
`<a href="http://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-geohashgrid-aggregation.html#_cell_dimensions_at_the_equator"
target="_blank" rel="noopener">` +
i18n.translate(
'kbn.advancedSettings.visualization.tileMap.maxPrecision.cellDimensionsLinkText',
{
defaultMessage: 'Explanation of cell dimensions',
}
) +
'</a>',
},
}),
category: ['visualization'],
},
'visualization:tileMap:WMSdefaults': {
name: i18n.translate('kbn.advancedSettings.visualization.tileMap.wmsDefaultsTitle', {
defaultMessage: 'Default WMS properties',
}),
value: JSON.stringify(
{
enabled: false,
url: undefined,
options: {
version: undefined,
layers: undefined,
format: 'image/png',
transparent: true,
attribution: undefined,
styles: undefined,
},
},
null,
2
),
type: 'json',
description: i18n.translate('kbn.advancedSettings.visualization.tileMap.wmsDefaultsText', {
defaultMessage:
'Default {propertiesLink} for the WMS map server support in the coordinate map',
description:
'Part of composite text: kbn.advancedSettings.visualization.tileMap.wmsDefaultsText + ' +
'kbn.advancedSettings.visualization.tileMap.wmsDefaults.propertiesLinkText',
values: {
propertiesLink:
'<a href="http://leafletjs.com/reference.html#tilelayer-wms" target="_blank" rel="noopener noreferrer">' +
i18n.translate(
'kbn.advancedSettings.visualization.tileMap.wmsDefaults.propertiesLinkText',
{
defaultMessage: 'properties',
}
) +
'</a>',
},
}),
category: ['visualization'],
},
'visualization:regionmap:showWarnings': {
name: i18n.translate('kbn.advancedSettings.visualization.showRegionMapWarningsTitle', {
defaultMessage: 'Show region map warning',
}),
value: true,
description: i18n.translate('kbn.advancedSettings.visualization.showRegionMapWarningsText', {
defaultMessage:
'Whether the region map shows a warning when terms cannot be joined to a shape on the map.',
}),
category: ['visualization'],
},
};
return {};
}
7 changes: 5 additions & 2 deletions src/plugins/maps_legacy/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@
*/

import { Plugin, PluginConfigDescriptor } from 'kibana/server';
import { PluginInitializerContext } from 'src/core/server';
import { CoreSetup, PluginInitializerContext } from 'src/core/server';
import { Observable } from 'rxjs';
import { configSchema, ConfigSchema } from '../config';
import { getUiSettings } from './ui_settings';

export const config: PluginConfigDescriptor<ConfigSchema> = {
exposeToBrowser: {
Expand Down Expand Up @@ -49,7 +50,9 @@ export class MapsLegacyPlugin implements Plugin<MapsLegacyPluginSetup> {
this._initializerContext = initializerContext;
}

public setup() {
public setup(core: CoreSetup) {
core.uiSettings.register(getUiSettings());

// @ts-ignore
const config$ = this._initializerContext.config.create();
return {
Expand Down
113 changes: 113 additions & 0 deletions src/plugins/maps_legacy/server/ui_settings.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import { i18n } from '@kbn/i18n';
import { UiSettingsParams } from 'kibana/server';
import { schema } from '@kbn/config-schema';

export function getUiSettings(): Record<string, UiSettingsParams<unknown>> {
return {
'visualization:tileMap:maxPrecision': {
name: i18n.translate('maps_legacy.advancedSettings.visualization.tileMap.maxPrecisionTitle', {
defaultMessage: 'Maximum tile map precision',
}),
value: 7,
description: i18n.translate(
'maps_legacy.advancedSettings.visualization.tileMap.maxPrecisionText',
{
defaultMessage:
'The maximum geoHash precision displayed on tile maps: 7 is high, 10 is very high, 12 is the max. {cellDimensionsLink}',
description:
'Part of composite text: maps_legacy.advancedSettings.visualization.tileMap.maxPrecisionText + ' +
'maps_legacy.advancedSettings.visualization.tileMap.maxPrecision.cellDimensionsLinkText',
values: {
cellDimensionsLink:
`<a href="http://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-geohashgrid-aggregation.html#_cell_dimensions_at_the_equator"
target="_blank" rel="noopener">` +
i18n.translate(
'maps_legacy.advancedSettings.visualization.tileMap.maxPrecision.cellDimensionsLinkText',
{
defaultMessage: 'Explanation of cell dimensions',
}
) +
'</a>',
},
}
),
schema: schema.number(),
category: ['visualization'],
},
'visualization:tileMap:WMSdefaults': {
name: i18n.translate('maps_legacy.advancedSettings.visualization.tileMap.wmsDefaultsTitle', {
defaultMessage: 'Default WMS properties',
}),
value: JSON.stringify(
{
enabled: false,
url: '',
options: {
version: '',
layers: '',
format: 'image/png',
transparent: true,
attribution: '',
styles: '',
},
},
null,
2
),
type: 'json',
description: i18n.translate(
'maps_legacy.advancedSettings.visualization.tileMap.wmsDefaultsText',
{
defaultMessage:
'Default {propertiesLink} for the WMS map server support in the coordinate map',
description:
'Part of composite text: maps_legacy.advancedSettings.visualization.tileMap.wmsDefaultsText + ' +
'maps_legacy.advancedSettings.visualization.tileMap.wmsDefaults.propertiesLinkText',
values: {
propertiesLink:
'<a href="http://leafletjs.com/reference.html#tilelayer-wms" target="_blank" rel="noopener noreferrer">' +
i18n.translate(
'maps_legacy.advancedSettings.visualization.tileMap.wmsDefaults.propertiesLinkText',
{
defaultMessage: 'properties',
}
) +
'</a>',
},
}
),
schema: schema.object({
enabled: schema.boolean(),
url: schema.string(),
options: schema.object({
version: schema.string(),
layers: schema.string(),
format: schema.string(),
transparent: schema.boolean(),
attribution: schema.string(),
styles: schema.string(),
}),
}),
category: ['visualization'],
},
};
}
7 changes: 6 additions & 1 deletion src/plugins/region_map/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
*/

import { PluginConfigDescriptor } from 'kibana/server';
import { CoreSetup } from 'src/core/server';
import { configSchema, ConfigSchema } from '../config';
import { getUiSettings } from './ui_settings';

export const config: PluginConfigDescriptor<ConfigSchema> = {
exposeToBrowser: {
Expand All @@ -29,6 +31,9 @@ export const config: PluginConfigDescriptor<ConfigSchema> = {
};

export const plugin = () => ({
setup() {},
setup(core: CoreSetup) {
core.uiSettings.register(getUiSettings());
},

start() {},
});
Loading

0 comments on commit d04098b

Please sign in to comment.