Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[App Search] Refactor empty engine polling to EngineLogic #103041

Merged
merged 9 commits into from
Jun 24, 2021
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import { Documents } from '.';
describe('Documents', () => {
const values = {
isMetaEngine: false,
engine: { document_count: 1 },
myRole: { canManageEngineDocuments: true },
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { DOCUMENTS_TITLE } from './constants';
import { SearchExperience } from './search_experience';

export const Documents: React.FC = () => {
const { isMetaEngine, engine } = useValues(EngineLogic);
const { isMetaEngine, isEngineEmpty } = useValues(EngineLogic);
const { myRole } = useValues(AppLogic);

return (
Expand All @@ -32,7 +32,7 @@ export const Documents: React.FC = () => {
rightSideItems:
myRole.canManageEngineDocuments && !isMetaEngine ? [<DocumentCreationButton />] : [],
}}
isEmptyState={!engine.document_count}
isEmptyState={isEngineEmpty}
emptyState={<EmptyState />}
>
{isMetaEngine && (
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* 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 { i18n } from '@kbn/i18n';

export const POLLING_DURATION = 5000;

export const POLLING_ERROR_TITLE = i18n.translate(
'xpack.enterpriseSearch.appSearch.engine.pollingErrorMessage',
{ defaultMessage: 'Could not fetch engine data' }
);

export const POLLING_ERROR_TEXT = i18n.translate(
'xpack.enterpriseSearch.appSearch.engine.pollingErrorDescription',
{ defaultMessage: 'Please check your connection or manually reload the page.' }
);
Loading