Skip to content

Commit

Permalink
[Enterprise Search] Migrate shared components used in Workplace Searc…
Browse files Browse the repository at this point in the history
…h Groups (#76345)

* Add shared images and export file

* Migrate SourceIcon component

* Add util to format routes

We need a way to format routes using parametrized routes in Workplace Search. We used to the `react-router-named-routes` library, but it is 5 years old has has no typings. I extracted the function we needed into a util.

* Update recent_activity to use formatRoute

For the 7.9 Kibana MVP, we used a temporary function to generate this route. Aligning this component to use the helper other parts of the app will use after migration.

* Add types and constants

Various types and constants migrated for use in groups component

* Migrate SourceRow component

Also adds a mock for contentSources. For now the array only has one item needed for this test, but in future tests, more sources will be added to that array.

* Migrate SourcesTable component

* Migrate TablePaginationBar component

* Migrate UserIcon component

* Migrate UserRow component

* Refactor format_route

Uses Object.entries instead of for…in. This is more modern and allows for 100% test coverage.

Also removed `toString()` as `encodeURIComponent()` seems to automatically cast to string

* Remove unused import

* Use forEach instead of map

We’re not returning anything so map is not needed

* Minify images

* Remove formatRoute in favor of generatePath

Unike formatRoute, generatePath adds the trailing slash automatically

* Stop renaming methods

Co-authored-by: Elastic Machine <[email protected]>
  • Loading branch information
scottybollinger and elasticmachine authored Sep 2, 2020
1 parent 535eb40 commit 6f94bf7
Show file tree
Hide file tree
Showing 49 changed files with 901 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

export const contentSources = [
{
id: '123',
serviceType: 'custom',
searchable: true,
supportedByLicense: true,
status: 'foo',
statusMessage: 'bar',
name: 'source',
documentCount: '123',
isFederatedSource: false,
errorReason: 0,
allowsReauth: true,
boost: 1,
},
{
id: '123',
serviceType: 'jira',
searchable: true,
supportedByLicense: true,
status: 'synced',
statusMessage: 'all green',
name: 'Jira',
documentCount: '34234',
isFederatedSource: false,
errorReason: 0,
allowsReauth: true,
boost: 0.5,
},
];
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;
* you may not use this file except in compliance with the Elastic License.
*/

export const users = [
{
id: '1z1z',
name: 'John Does',
pictureUrl: 'http://google.cats',
color: '#ededed',
initials: 'JD',
email: '[email protected]',
groupIds: [],
},
];
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import box from './box.svg';
import confluence from './confluence.svg';
import crawler from './crawler.svg';
import custom from './custom.svg';
import drive from './drive.svg';
import dropbox from './dropbox.svg';
import github from './github.svg';
import gmail from './gmail.svg';
import google from './google.svg';
import googleDrive from './google_drive.svg';
import jira from './jira.svg';
import jiraServer from './jira_server.svg';
import loadingSmall from './loading_small.svg';
import office365 from './office365.svg';
import oneDrive from './one_drive.svg';
import outlook from './outlook.svg';
import people from './people.svg';
import salesforce from './salesforce.svg';
import serviceNow from './service_now.svg';
import sharePoint from './share_point.svg';
import slack from './slack.svg';
import zendesk from './zendesk.svg';

export const images = {
box,
confluence,
crawler,
custom,
drive,
dropbox,
github,
gmail,
googleDrive,
google,
jira,
jiraServer,
loadingSmall,
office365,
oneDrive,
outlook,
people,
salesforce,
serviceNow,
sharePoint,
slack,
zendesk,
} as { [key: string]: string };
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 6f94bf7

Please sign in to comment.