Skip to content

Commit

Permalink
Merge branch 'master' into task/basic-endpoint-list
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine authored Feb 13, 2020
2 parents 594d036 + ad600c8 commit bf678f3
Show file tree
Hide file tree
Showing 122 changed files with 3,561 additions and 325 deletions.
2 changes: 0 additions & 2 deletions src/legacy/core_plugins/kibana/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import { migrations } from './migrations';
import { importApi } from './server/routes/api/import';
import { exportApi } from './server/routes/api/export';
import { managementApi } from './server/routes/api/management';
import * as systemApi from './server/lib/system_api';
import mappings from './mappings.json';
import { getUiSettingDefaults } from './ui_setting_defaults';
import { registerCspCollector } from './server/lib/csp_usage_collector';
Expand Down Expand Up @@ -323,7 +322,6 @@ export default function(kibana) {
exportApi(server);
managementApi(server);
registerCspCollector(usageCollection, server);
server.expose('systemApi', systemApi);
server.injectUiAppVars('kibana', () => injectVars(server));
},
});
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ export class SampleDataViewDataButton extends React.Component {
closePopover={this.closePopover}
panelPaddingSize="none"
anchorPosition="downCenter"
data-test-subj={`launchSampleDataSet${this.props.id}`}
>
<EuiContextMenu initialPanelId={0} panels={panels} />
</EuiPopover>
Expand Down
41 changes: 0 additions & 41 deletions src/legacy/core_plugins/kibana/server/lib/__tests__/system_api.js

This file was deleted.

31 changes: 0 additions & 31 deletions src/legacy/core_plugins/kibana/server/lib/system_api.js

This file was deleted.

15 changes: 12 additions & 3 deletions src/legacy/ui/public/system_api/__tests__/system_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,25 @@ describe('system_api', () => {
};
const newHeaders = addSystemApiHeader(headers);

expect(newHeaders).to.have.property('kbn-system-api');
expect(newHeaders['kbn-system-api']).to.be(true);
expect(newHeaders).to.have.property('kbn-system-request');
expect(newHeaders['kbn-system-request']).to.be(true);

expect(newHeaders).to.have.property('kbn-version');
expect(newHeaders['kbn-version']).to.be('4.6.0');
});
});

describe('#isSystemApiRequest', () => {
it('returns true for a system API HTTP request', () => {
it('returns true for a system HTTP request', () => {
const mockRequest = {
headers: {
'kbn-system-request': true,
},
};
expect(isSystemApiRequest(mockRequest)).to.be(true);
});

it('returns true for a legacy system API HTTP request', () => {
const mockRequest = {
headers: {
'kbn-system-api': true,
Expand Down
9 changes: 6 additions & 3 deletions src/plugins/kibana_legacy/public/utils/system_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@

import { IRequestConfig } from 'angular';

const SYSTEM_API_HEADER_NAME = 'kbn-system-api';
const SYSTEM_REQUEST_HEADER_NAME = 'kbn-system-request';
const LEGACY_SYSTEM_API_HEADER_NAME = 'kbn-system-api';

/**
* Adds a custom header designating request as system API
Expand All @@ -28,7 +29,7 @@ const SYSTEM_API_HEADER_NAME = 'kbn-system-api';
*/
export function addSystemApiHeader(originalHeaders: Record<string, string>) {
const systemApiHeaders = {
[SYSTEM_API_HEADER_NAME]: true,
[SYSTEM_REQUEST_HEADER_NAME]: true,
};
return {
...originalHeaders,
Expand All @@ -44,5 +45,7 @@ export function addSystemApiHeader(originalHeaders: Record<string, string>) {
*/
export function isSystemApiRequest(request: IRequestConfig) {
const { headers } = request;
return headers && !!headers[SYSTEM_API_HEADER_NAME];
return (
headers && (!!headers[SYSTEM_REQUEST_HEADER_NAME] || !!headers[LEGACY_SYSTEM_API_HEADER_NAME])
);
}
8 changes: 4 additions & 4 deletions test/functional/apps/home/_sample_data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export default function({ getService, getPageObjects }: FtrProviderContext) {
});

it('should launch sample flights data set dashboard', async () => {
await PageObjects.home.launchSampleDataSet('flights');
await PageObjects.home.launchSampleDashboard('flights');
await PageObjects.header.waitUntilLoadingHasFinished();
await renderable.waitForRender();
const todayYearMonthDay = moment().format('MMM D, YYYY');
Expand All @@ -96,7 +96,7 @@ export default function({ getService, getPageObjects }: FtrProviderContext) {
});

it('should render visualizations', async () => {
await PageObjects.home.launchSampleDataSet('flights');
await PageObjects.home.launchSampleDashboard('flights');
await PageObjects.header.waitUntilLoadingHasFinished();
await renderable.waitForRender();
log.debug('Checking pie charts rendered');
Expand All @@ -115,7 +115,7 @@ export default function({ getService, getPageObjects }: FtrProviderContext) {
});

it('should launch sample logs data set dashboard', async () => {
await PageObjects.home.launchSampleDataSet('logs');
await PageObjects.home.launchSampleDashboard('logs');
await PageObjects.header.waitUntilLoadingHasFinished();
await renderable.waitForRender();
const todayYearMonthDay = moment().format('MMM D, YYYY');
Expand All @@ -127,7 +127,7 @@ export default function({ getService, getPageObjects }: FtrProviderContext) {
});

it('should launch sample ecommerce data set dashboard', async () => {
await PageObjects.home.launchSampleDataSet('ecommerce');
await PageObjects.home.launchSampleDashboard('ecommerce');
await PageObjects.header.waitUntilLoadingHasFinished();
await renderable.waitForRender();
const todayYearMonthDay = moment().format('MMM D, YYYY');
Expand Down
13 changes: 12 additions & 1 deletion test/functional/page_objects/home_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@

import { FtrProviderContext } from '../ftr_provider_context';

export function HomePageProvider({ getService }: FtrProviderContext) {
export function HomePageProvider({ getService, getPageObjects }: FtrProviderContext) {
const testSubjects = getService('testSubjects');
const retry = getService('retry');
const find = getService('find');
const PageObjects = getPageObjects(['common']);
let isOss = true;

class HomePage {
async clickSynopsis(title: string) {
Expand Down Expand Up @@ -63,6 +66,14 @@ export function HomePageProvider({ getService }: FtrProviderContext) {
});
}

async launchSampleDashboard(id: string) {
await this.launchSampleDataSet(id);
isOss = await PageObjects.common.isOss();
if (!isOss) {
await find.clickByLinkText('Dashboard');
}
}

async launchSampleDataSet(id: string) {
await this.addSampleDataSet(id);
await testSubjects.click(`launchSampleDataSet${id}`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ import { schema } from '@kbn/config-schema';

const analyzerSchema = {
tokenizer: schema.string(),
filter: schema.arrayOf(
schema.object({
type: schema.string(),
stopwords: schema.arrayOf(schema.maybe(schema.string())),
})
filter: schema.maybe(
schema.arrayOf(
schema.object({
type: schema.string(),
stopwords: schema.arrayOf(schema.maybe(schema.string())),
})
)
),
};

Expand Down
3 changes: 0 additions & 3 deletions x-pack/legacy/plugins/security/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,6 @@ export const security = kibana =>
const xpackInfo = server.plugins.xpack_main.info;
securityPlugin.__legacyCompat.registerLegacyAPI({
auditLogger: new AuditLogger(server, 'security', config, xpackInfo),
isSystemAPIRequest: server.plugins.kibana.systemApi.isSystemApiRequest.bind(
server.plugins.kibana.systemApi
),
});

// Legacy xPack Info endpoint returns whatever we return in a callback for `registerLicenseCheckResultsGenerator`
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit bf678f3

Please sign in to comment.