-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Add SearchBar UI. Query, filter, and dateRange work * Sync url with search bar, fix excluded filters on BE * fix welcome title * Use KibanaReactContext, fix indexPattern fetch * Mock data plugin, api and ui tests pass * Add view and functional tests * use observables to handle filter updates * address comments
- Loading branch information
1 parent
0500350
commit 541a9cf
Showing
29 changed files
with
526 additions
and
107 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
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
58 changes: 58 additions & 0 deletions
58
x-pack/plugins/endpoint/public/applications/endpoint/mocks.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,58 @@ | ||
/* | ||
* 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 { | ||
dataPluginMock, | ||
Start as DataPublicStartMock, | ||
} from '../../../../../../src/plugins/data/public/mocks'; | ||
|
||
type DataMock = Omit<DataPublicStartMock, 'indexPatterns' | 'query'> & { | ||
indexPatterns: Omit<DataPublicStartMock['indexPatterns'], 'getFieldsForWildcard'> & { | ||
getFieldsForWildcard: jest.Mock; | ||
}; | ||
// We can't Omit (override) 'query' here because FilterManager is a class not an interface. | ||
// Because of this, wherever FilterManager is used tsc expects some FilterManager private fields | ||
// like filters, updated$, fetch$ to be part of the type. Omit removes these private fields when used. | ||
query: DataPublicStartMock['query'] & { | ||
filterManager: { | ||
setFilters: jest.Mock; | ||
getUpdates$: jest.Mock; | ||
}; | ||
}; | ||
ui: DataPublicStartMock['ui'] & { | ||
SearchBar: jest.Mock; | ||
}; | ||
}; | ||
|
||
/** | ||
* Type for our app's depsStart (plugin start dependencies) | ||
*/ | ||
export interface DepsStartMock { | ||
data: DataMock; | ||
} | ||
|
||
/** | ||
* Returns a mock of our app's depsStart (plugin start dependencies) | ||
*/ | ||
export const depsStartMock: () => DepsStartMock = () => { | ||
const dataMock: DataMock = (dataPluginMock.createStartContract() as unknown) as DataMock; | ||
dataMock.indexPatterns.getFieldsForWildcard = jest.fn(); | ||
dataMock.query.filterManager.setFilters = jest.fn(); | ||
dataMock.query.filterManager.getUpdates$ = jest.fn(() => { | ||
return { | ||
subscribe: jest.fn(() => { | ||
return { | ||
unsubscribe: jest.fn(), | ||
}; | ||
}), | ||
}; | ||
}) as DataMock['query']['filterManager']['getUpdates$']; | ||
dataMock.ui.SearchBar = jest.fn(); | ||
|
||
return { | ||
data: dataMock, | ||
}; | ||
}; |
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
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
Oops, something went wrong.