Skip to content

Commit

Permalink
Convert source config view to new page template
Browse files Browse the repository at this point in the history
  • Loading branch information
cee-chen committed Jun 17, 2021
1 parent 0fc182b commit cfe6d65
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import { shallow } from 'enzyme';

import { EuiConfirmModal } from '@elastic/eui';

import { Loading } from '../../../../shared/loading';
import { SaveConfig } from '../../content_sources/components/add_source/save_config';

import { SourceConfig } from './source_config';
Expand All @@ -41,16 +40,6 @@ describe('SourceConfig', () => {
expect(wrapper.find(EuiConfirmModal)).toHaveLength(1);
});

it('returns loading when loading', () => {
setMockValues({
sourceConfigData,
dataLoading: true,
});
const wrapper = shallow(<SourceConfig sourceIndex={1} />);

expect(wrapper.find(Loading)).toHaveLength(1);
});

it('handles delete click', () => {
const wrapper = shallow(<SourceConfig sourceIndex={1} />);
const saveConfig = wrapper.find(SaveConfig);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import { useActions, useValues } from 'kea';
import { EuiConfirmModal } from '@elastic/eui';
import { i18n } from '@kbn/i18n';

import { Loading } from '../../../../shared/loading';
import { REMOVE_BUTTON, CANCEL_BUTTON } from '../../../constants';
import { WorkplaceSearchPageTemplate } from '../../../components/layout';
import { NAV, REMOVE_BUTTON, CANCEL_BUTTON } from '../../../constants';
import { SourceDataItem } from '../../../types';
import { AddSourceHeader } from '../../content_sources/components/add_source/add_source_header';
import { AddSourceLogic } from '../../content_sources/components/add_source/add_source_logic';
Expand All @@ -39,16 +39,17 @@ export const SourceConfig: React.FC<SourceConfigProps> = ({ sourceIndex }) => {
getSourceConfigData(serviceType);
}, []);

if (dataLoading) return <Loading />;

const hideConfirmModal = () => setConfirmModalVisibility(false);
const showConfirmModal = () => setConfirmModalVisibility(true);
const saveUpdatedConfig = () => saveSourceConfig(true);

const header = <AddSourceHeader name={name} serviceType={serviceType} categories={categories} />;

return (
<>
<WorkplaceSearchPageTemplate
pageChrome={[NAV.SETTINGS, NAV.SETTINGS_SOURCE_PRIORITIZATION, name]}
isLoading={dataLoading}
>
<SaveConfig
name={name}
configuration={configuration}
Expand Down Expand Up @@ -77,6 +78,6 @@ export const SourceConfig: React.FC<SourceConfigProps> = ({ sourceIndex }) => {
)}
</EuiConfirmModal>
)}
</>
</WorkplaceSearchPageTemplate>
);
};

0 comments on commit cfe6d65

Please sign in to comment.