-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Workplace Search] Enables external SharePoint Online and custom Shar…
…ePoint Server connectors (#126172) This adds the ability to add and manage an External SharePoint Online connector and a Custom SharePoint Server connector via Kibana. Co-authored-by: Byron Hulcher <byron.hulcher@elastic.co>
- Loading branch information
Showing
45 changed files
with
1,980 additions
and
539 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...ns/workplace_search/components/shared/assets/source_icons/sharepoint_server.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
...prise_search/public/applications/workplace_search/utils/has_multiple_connector_options.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { SourceDataItem } from '../types'; | ||
|
||
export const hasMultipleConnectorOptions = ({ | ||
internalConnectorAvailable, | ||
externalConnectorAvailable, | ||
customConnectorAvailable, | ||
}: SourceDataItem) => | ||
[externalConnectorAvailable, internalConnectorAvailable, customConnectorAvailable].filter( | ||
(available) => !!available | ||
).length > 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
...ck/plugins/enterprise_search/public/applications/workplace_search/utils/is_not_nullish.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
export function isNotNullish<T>(value: T | null | undefined): value is T { | ||
return value !== null && value !== undefined; | ||
} |
69 changes: 69 additions & 0 deletions
69
...s/workplace_search/views/content_sources/components/add_source/add_custom_source.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import '../../../../../__mocks__/shallow_useeffect.mock'; | ||
import { setMockValues } from '../../../../../__mocks__/kea_logic'; | ||
import { sourceConfigData } from '../../../../__mocks__/content_sources.mock'; | ||
|
||
import React from 'react'; | ||
|
||
import { shallow } from 'enzyme'; | ||
|
||
import { | ||
WorkplaceSearchPageTemplate, | ||
PersonalDashboardLayout, | ||
} from '../../../../components/layout'; | ||
import { staticSourceData } from '../../source_data'; | ||
|
||
import { AddCustomSource } from './add_custom_source'; | ||
import { AddCustomSourceSteps } from './add_custom_source_logic'; | ||
import { ConfigureCustom } from './configure_custom'; | ||
import { SaveCustom } from './save_custom'; | ||
|
||
describe('AddCustomSource', () => { | ||
const props = { | ||
sourceData: staticSourceData[0], | ||
initialValues: undefined, | ||
}; | ||
|
||
const values = { | ||
sourceConfigData, | ||
isOrganization: true, | ||
}; | ||
|
||
beforeEach(() => { | ||
setMockValues({ ...values }); | ||
}); | ||
|
||
it('renders', () => { | ||
const wrapper = shallow(<AddCustomSource {...props} />); | ||
|
||
expect(wrapper.find(WorkplaceSearchPageTemplate)).toHaveLength(1); | ||
}); | ||
|
||
it('should show correct layout for personal dashboard', () => { | ||
setMockValues({ isOrganization: false }); | ||
const wrapper = shallow(<AddCustomSource {...props} />); | ||
|
||
expect(wrapper.find(WorkplaceSearchPageTemplate)).toHaveLength(0); | ||
expect(wrapper.find(PersonalDashboardLayout)).toHaveLength(1); | ||
}); | ||
|
||
it('should show Configure Custom for custom configuration step', () => { | ||
setMockValues({ currentStep: AddCustomSourceSteps.ConfigureCustomStep }); | ||
const wrapper = shallow(<AddCustomSource {...props} />); | ||
|
||
expect(wrapper.find(ConfigureCustom)).toHaveLength(1); | ||
}); | ||
|
||
it('should show Save Custom for save custom step', () => { | ||
setMockValues({ currentStep: AddCustomSourceSteps.SaveCustomStep }); | ||
const wrapper = shallow(<AddCustomSource {...props} />); | ||
|
||
expect(wrapper.find(SaveCustom)).toHaveLength(1); | ||
}); | ||
}); |
44 changes: 44 additions & 0 deletions
44
...ations/workplace_search/views/content_sources/components/add_source/add_custom_source.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import React from 'react'; | ||
|
||
import { useValues } from 'kea'; | ||
|
||
import { AppLogic } from '../../../../app_logic'; | ||
import { | ||
WorkplaceSearchPageTemplate, | ||
PersonalDashboardLayout, | ||
} from '../../../../components/layout'; | ||
import { NAV } from '../../../../constants'; | ||
|
||
import { SourceDataItem } from '../../../../types'; | ||
|
||
import { AddCustomSourceLogic, AddCustomSourceSteps } from './add_custom_source_logic'; | ||
import { ConfigureCustom } from './configure_custom'; | ||
import { SaveCustom } from './save_custom'; | ||
|
||
import './add_source.scss'; | ||
|
||
interface Props { | ||
sourceData: SourceDataItem; | ||
initialValue?: string; | ||
} | ||
export const AddCustomSource: React.FC<Props> = ({ sourceData, initialValue = '' }) => { | ||
const addCustomSourceLogic = AddCustomSourceLogic({ sourceData, initialValue }); | ||
const { currentStep } = useValues(addCustomSourceLogic); | ||
const { isOrganization } = useValues(AppLogic); | ||
|
||
const Layout = isOrganization ? WorkplaceSearchPageTemplate : PersonalDashboardLayout; | ||
|
||
return ( | ||
<Layout pageChrome={[NAV.SOURCES, NAV.ADD_SOURCE, sourceData.name || '...']}> | ||
{currentStep === AddCustomSourceSteps.ConfigureCustomStep && <ConfigureCustom />} | ||
{currentStep === AddCustomSourceSteps.SaveCustomStep && <SaveCustom />} | ||
</Layout> | ||
); | ||
}; |
Oops, something went wrong.