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

[Streams] Schema Editor refresh button #208093

Merged
merged 7 commits into from
Jan 31, 2025
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import React, { useEffect } from 'react';
import { EuiFlexGroup, EuiFlexItem, EuiProgress, EuiPortal } from '@elastic/eui';
import React, { useCallback, useEffect } from 'react';
import { EuiFlexGroup, EuiFlexItem, EuiProgress, EuiPortal, EuiButton } from '@elastic/eui';
import { css } from '@emotion/css';
import { i18n } from '@kbn/i18n';
import { WiredStreamGetResponse } from '@kbn/streams-schema';
import { useEditingState } from './hooks/use_editing_state';
import { SchemaEditorFlyout } from './flyout';
Expand Down Expand Up @@ -90,6 +91,11 @@ const Content = ({
reset();
}, [definition.stream.name, reset]);

const refreshData = useCallback(() => {
refreshDefinition();
refreshUnmappedFields();
}, [refreshDefinition, refreshUnmappedFields]);

return (
<EuiFlexItem>
<EuiFlexGroup direction="column">
Expand All @@ -116,6 +122,17 @@ const Content = ({
onChangeFilterGroup={queryAndFiltersState.changeFilterGroups}
/>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiButton
data-test-subj="streamsAppContentRefreshButton"
iconType="refresh"
onClick={refreshData}
>
{i18n.translate('xpack.streams.schemaEditor.refreshDataButtonLabel', {
defaultMessage: 'Refresh',
})}
</EuiButton>
</EuiFlexItem>
</EuiFlexGroup>
</EuiFlexItem>
<EuiFlexItem
Expand Down