Skip to content

Commit

Permalink
Merge branch 'master' into ua/chore/move-out-of-legacy
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine authored Feb 24, 2020
2 parents 73c6267 + 256e4ab commit c8b2da1
Show file tree
Hide file tree
Showing 39 changed files with 5,644 additions and 4,978 deletions.
37 changes: 31 additions & 6 deletions packages/kbn-config-schema/src/types/array_type.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,29 @@ test('fails if mixed types of content in array', () => {
);
});

test('returns empty array if input is empty but type has default value', () => {
const type = schema.arrayOf(schema.string({ defaultValue: 'test' }));
test('fails if sparse content in array', () => {
const type = schema.arrayOf(schema.string());
expect(type.validate([])).toEqual([]);
expect(() => type.validate([undefined])).toThrowErrorMatchingInlineSnapshot(
`"[0]: sparse array are not allowed"`
);
});

test('returns empty array if input is empty even if type is required', () => {
const type = schema.arrayOf(schema.string());
test('fails if sparse content in array if optional', () => {
const type = schema.arrayOf(schema.maybe(schema.string()));
expect(type.validate([])).toEqual([]);
expect(() => type.validate([undefined])).toThrowErrorMatchingInlineSnapshot(
`"[0]: sparse array are not allowed"`
);
});

test('fails if sparse content in array if nullable', () => {
const type = schema.arrayOf(schema.nullable(schema.string()));
expect(type.validate([])).toEqual([]);
expect(type.validate([null])).toEqual([null]);
expect(() => type.validate([undefined])).toThrowErrorMatchingInlineSnapshot(
`"[0]: sparse array are not allowed"`
);
});

test('fails for null values if optional', () => {
Expand All @@ -102,9 +117,19 @@ test('fails for null values if optional', () => {
);
});

test('returns empty array if input is empty but type has default value', () => {
const type = schema.arrayOf(schema.string({ defaultValue: 'test' }));
expect(type.validate([])).toEqual([]);
});

test('returns empty array if input is empty even if type is required', () => {
const type = schema.arrayOf(schema.string());
expect(type.validate([])).toEqual([]);
});

test('handles default values for undefined values', () => {
const type = schema.arrayOf(schema.string({ defaultValue: 'foo' }));
expect(type.validate([undefined])).toEqual(['foo']);
const type = schema.arrayOf(schema.string(), { defaultValue: ['foo'] });
expect(type.validate(undefined)).toEqual(['foo']);
});

test('array within array', () => {
Expand Down
4 changes: 3 additions & 1 deletion packages/kbn-config-schema/src/types/array_type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class ArrayType<T> extends Type<T[]> {
let schema = internals
.array()
.items(type.getSchema().optional())
.sparse();
.sparse(false);

if (options.minSize !== undefined) {
schema = schema.min(options.minSize);
Expand All @@ -49,6 +49,8 @@ export class ArrayType<T> extends Type<T[]> {
case 'any.required':
case 'array.base':
return `expected value of type [array] but got [${typeDetect(value)}]`;
case 'array.sparse':
return `sparse array are not allowed`;
case 'array.parse':
return `could not parse array value from [${value}]`;
case 'array.min':
Expand Down
206 changes: 0 additions & 206 deletions packages/kbn-optimizer/src/optimizer/cache_keys.test.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ kibana_vars=(
xpack.code.security.enableGitCertCheck
xpack.code.security.gitHostWhitelist
xpack.code.security.gitProtocolWhitelist
xpack.encryptedSavedObjects.encryptionKey
xpack.graph.enabled
xpack.graph.canEditDrillDownUrls
xpack.graph.savePolicy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ export const DashboardConstants = {
CREATE_NEW_DASHBOARD_URL: '/dashboard',
ADD_EMBEDDABLE_ID: 'addEmbeddableId',
ADD_EMBEDDABLE_TYPE: 'addEmbeddableType',
DASHBOARDS_ID: 'dashboards',
DASHBOARD_ID: 'dashboard',
};

export function createDashboardEditUrl(id: string) {
Expand Down
15 changes: 11 additions & 4 deletions src/legacy/core_plugins/kibana/public/dashboard/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,14 @@ export class DashboardPlugin implements Plugin {
);
const { appMounted, appUnMounted, stop: stopUrlTracker } = createKbnUrlTracker({
baseUrl: core.http.basePath.prepend('/app/kibana'),
defaultSubUrl: '#/dashboards',
defaultSubUrl: `#${DashboardConstants.LANDING_PAGE_PATH}`,
shouldTrackUrlUpdate: pathname => {
const targetAppName = pathname.split('/')[1];
return (
targetAppName === DashboardConstants.DASHBOARDS_ID ||
targetAppName === DashboardConstants.DASHBOARD_ID
);
},
storageKey: 'lastUrl:dashboard',
navLinkUpdater$: this.appStateUpdater,
toastNotifications: core.notifications.toasts,
Expand Down Expand Up @@ -150,15 +157,15 @@ export class DashboardPlugin implements Plugin {
};
kibanaLegacy.registerLegacyApp({
...app,
id: 'dashboard',
id: DashboardConstants.DASHBOARD_ID,
// only register the updater in once app, otherwise all updates would happen twice
updater$: this.appStateUpdater.asObservable(),
navLinkId: 'kibana:dashboard',
});
kibanaLegacy.registerLegacyApp({ ...app, id: 'dashboards' });
kibanaLegacy.registerLegacyApp({ ...app, id: DashboardConstants.DASHBOARDS_ID });

home.featureCatalogue.register({
id: 'dashboard',
id: DashboardConstants.DASHBOARD_ID,
title: i18n.translate('kbn.dashboard.featureCatalogue.dashboardTitle', {
defaultMessage: 'Dashboard',
}),
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/advanced_settings/public/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
* under the License.
*/

@import './management_app/advanced_settings';
@import './management_app/index';
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@import './advanced_settings';

@import './components/index';
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,27 @@
* under the License.
*/

.mgtAdvancedSettings__field {
.mgtAdvancedSettings__field {
+ * {
margin-top: $euiSize;
}

&Wrapper {
width: 640px;

@include internetExplorerOnly() {
min-height: 1px;
}
padding-left: $euiSizeS;
margin-left: -$euiSizeS;
&--unsaved {
// Simulates a left side border without shifting content
box-shadow: -$euiSizeXS 0px $euiColorSecondary;
}

&Actions {
padding-top: $euiSizeM;
&--invalid {
// Simulates a left side border without shifting content
box-shadow: -$euiSizeXS 0px $euiColorDanger;
}
@include internetExplorerOnly() {
min-height: 1px;
}
&Row {
padding-left: $euiSizeS;
}

@include internetExplorerOnly {
Expand All @@ -40,3 +46,19 @@
}
}
}

.mgtAdvancedSettingsForm__unsavedCount {
@include euiBreakpoint('xs', 's') {
display: none;
}
}

.mgtAdvancedSettingsForm__unsavedCountMessage{
// Simulates a left side border without shifting content
box-shadow: -$euiSizeXS 0px $euiColorSecondary;
padding-left: $euiSizeS;
}

.mgtAdvancedSettingsForm__button {
width: 100%;
}
Loading

0 comments on commit c8b2da1

Please sign in to comment.