Skip to content

Commit

Permalink
changes based on review
Browse files Browse the repository at this point in the history
  • Loading branch information
jgowdyelastic committed Feb 11, 2020
1 parent eed8c87 commit 8464f2a
Show file tree
Hide file tree
Showing 12 changed files with 11 additions and 82 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ describe('Navigation Menu: <TopNav />', () => {
</MemoryRouter>
);
expect(wrapper.find(TopNav)).toHaveLength(1);
// disabled broken test
// expect(wrapper.find('EuiSuperDatePicker')).toHaveLength(1);
expect(refreshListener).toBeCalledTimes(0);

refreshSubscription.unsubscribe();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { useMlKibana } from '../../contexts/kibana';

const createJobLink = '#/jobs/new_job/step/index_or_search';
const feedbackLink = 'https://www.elastic.co/community/';
const transformsLink = '/app/kibana#/management/elasticsearch/transform';
const whatIsMachineLearningLink = 'https://www.elastic.co/what-is/elasticsearch-machine-learning';

interface Props {
Expand Down Expand Up @@ -44,6 +43,7 @@ export const OverviewSideBar: FC<Props> = ({ createAnomalyDetectionJobDisabled }

const { ELASTIC_WEBSITE_URL, DOC_LINK_VERSION } = docLinks;
const docsLink = `${ELASTIC_WEBSITE_URL}guide/en/kibana/${DOC_LINK_VERSION}/xpack-ml.html`;
const transformsLink = `${basePath.get()}/app/kibana#/management/elasticsearch/transform`;

return (
<EuiFlexItem grow={1}>
Expand Down Expand Up @@ -72,7 +72,7 @@ export const OverviewSideBar: FC<Props> = ({ createAnomalyDetectionJobDisabled }
),
createJob: getCreateJobLink(createAnomalyDetectionJobDisabled),
transforms: (
<EuiLink href={`${basePath.get()}${transformsLink}`} target="blank">
<EuiLink href={transformsLink} target="blank">
<FormattedMessage
id="xpack.ml.overview.gettingStartedSectionTransforms"
defaultMessage="Elasticsearch's transforms"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@

import { Annotation } from '../../../../common/types/annotations';
import { http, http$ } from '../http_service';
import { getBasePath } from '../../util/dependency_cache';

function basePath() {
return getBasePath().prepend('/api/ml');
}
import { basePath } from './index';

export const annotations = {
getAnnotations(obj: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@

import { http } from '../http_service';

import { getBasePath } from '../../util/dependency_cache';

function basePath() {
return getBasePath().prepend('/api/ml');
}
import { basePath } from './index';

export const dataFrameAnalytics = {
getDataFrameAnalytics(analyticsId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@

import { http } from '../http_service';

import { getBasePath } from '../../util/dependency_cache';

function basePath() {
return getBasePath().prepend('/api/ml');
}
import { basePath } from './index';

export const fileDatavisualizer = {
analyzeFile(obj, params = {}) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@

import { http } from '../http_service';

import { getBasePath } from '../../util/dependency_cache';

function basePath() {
return getBasePath().prepend('/api/ml');
}
import { basePath } from './index';

export const filters = {
filters(obj) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ import {
} from '../../../../common/types/categories';
import { CATEGORY_EXAMPLES_VALIDATION_STATUS } from '../../../../common/constants/new_job';

declare const basePath: () => string;

// TODO This is not a complete representation of all methods of `ml.*`.
// It just satisfies needs for other parts of the code area which use
// TypeScript and rely on the methods typed in here.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { jobs } from './jobs';
import { fileDatavisualizer } from './datavisualizer';
import { getBasePath } from '../../util/dependency_cache';

function basePath() {
export function basePath() {
return getBasePath().prepend('/api/ml');
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@

import { http } from '../http_service';

import { getBasePath } from '../../util/dependency_cache';

function basePath() {
return getBasePath().prepend('/api/ml');
}
import { basePath } from './index';

export const jobs = {
jobsSummary(jobIds) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@

import { http, http$ } from '../http_service';

import { getBasePath } from '../../util/dependency_cache';

function basePath() {
return getBasePath().prepend('/api/ml');
}
import { basePath } from './index';

export const results = {
getAnomaliesTableData(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@
*/

import React from 'react';
// import { I18nProvider } from '@kbn/i18n/react';
// import { mount, shallow } from 'enzyme';
import { shallowWithIntl } from 'test_utils/enzyme_helpers';
import { ml } from '../../../services/ml_api_service';
// import { KibanaContextProvider } from '../../../../../../../../../src/plugins/kibana_react/public';

import { CalendarsList } from './calendars_list';

Expand Down Expand Up @@ -115,28 +112,6 @@ const props = {
},
};

// const services = {
// data: {
// query: {
// timefilter: {
// timefilter: {
// disableTimeRangeSelector: jest.fn(),
// disableAutoRefreshSelector: jest.fn(),
// },
// },
// },
// },
// notifications: {
// toasts: {
// addDanger: () => {},
// },
// },
// docLinks: {
// ELASTIC_WEBSITE_URL: 'https://www.elastic.co/',
// DOC_LINK_VERSION: 'jest-metadata-mock-branch',
// },
// };

describe('CalendarsList', () => {
test('loads calendars on mount', () => {
ml.calendars = jest.fn(() => []);
Expand All @@ -151,25 +126,4 @@ describe('CalendarsList', () => {
wrapper.update();
expect(wrapper).toMatchSnapshot();
});

// disabled broken tests

// test('Sets selected calendars list on checkbox change', () => {
// const wrapper = mount(
// <I18nProvider>
// <KibanaContextProvider services={services}>
// <CalendarsList {...props} />
// </KibanaContextProvider>
// </I18nProvider>
// );

// const instance = wrapper.instance();
// const spy = jest.spyOn(instance, 'setSelectedCalendarList');
// instance.setState(testingState);
// wrapper.update();

// const checkbox = wrapper.find('input[type="checkbox"]').first();
// checkbox.simulate('change');
// expect(spy).toHaveBeenCalled();
// });
});
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,6 @@ TimeBuckets.prototype.getScaledDateFormat = function() {
TimeBuckets.prototype.getScaledDateFormatter = function() {
const fieldFormats = getFieldFormats();
const uiSettings = getUiSettings();
// const getConfig = (...args) => uiSettings.get(...args);
const DateFieldFormat = fieldFormats.getType(FIELD_FORMAT_IDS.DATE);
return new DateFieldFormat(
{
Expand Down

0 comments on commit 8464f2a

Please sign in to comment.