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

[Canvas] Adds refresh and autoplay options to view menu #64375

Merged
merged 8 commits into from
Apr 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions x-pack/legacy/plugins/canvas/i18n/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1079,12 +1079,6 @@ export const ComponentStrings = {
defaultMessage: 'Refresh elements',
}),
},
WorkpadHeaderControlSettings: {
getButtonLabel: () =>
i18n.translate('xpack.canvas.workpadHeaderControlSettings.buttonLabel', {
defaultMessage: 'Options',
}),
},
WorkpadHeaderCustomInterval: {
getButtonLabel: () =>
i18n.translate('xpack.canvas.workpadHeaderCustomInterval.confirmButtonLabel', {
Expand Down Expand Up @@ -1305,6 +1299,18 @@ export const ComponentStrings = {
}),
},
WorkpadHeaderViewMenu: {
getAutoplayOffMenuItemLabel: () =>
i18n.translate('xpack.canvas.workpadHeaderViewMenu.autoplayOffMenuItemLabel', {
defaultMessage: 'Turn autoplay off',
}),
getAutoplayOnMenuItemLabel: () =>
i18n.translate('xpack.canvas.workpadHeaderViewMenu.autoplayOnMenuItemLabel', {
defaultMessage: 'Turn autoplay on',
}),
getAutoplaySettingsMenuItemLabel: () =>
i18n.translate('xpack.canvas.workpadHeaderViewMenu.autoplaySettingsMenuItemLabel', {
defaultMessage: 'Autoplay settings',
}),
getFullscreenMenuItemLabel: () =>
i18n.translate('xpack.canvas.workpadHeaderViewMenu.fullscreenMenuLabel', {
defaultMessage: 'Enter fullscreen mode',
Expand All @@ -1317,6 +1323,10 @@ export const ComponentStrings = {
i18n.translate('xpack.canvas.workpadHeaderViewMenu.refreshMenuItemLabel', {
defaultMessage: 'Refresh data',
}),
getRefreshSettingsMenuItemLabel: () =>
i18n.translate('xpack.canvas.workpadHeaderViewMenu.refreshSettingsMenuItemLabel', {
defaultMessage: 'Auto refresh settings',
}),
getShowEditModeLabel: () =>
i18n.translate('xpack.canvas.workpadHeaderViewMenu.showEditModeLabel', {
defaultMessage: 'Show editing controls',
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export const RefreshControl = ({ doRefresh, inFlight }: Props) => (
iconType="refresh"
aria-label={strings.getRefreshAriaLabel()}
onClick={doRefresh}
data-test-subj="canvas-refresh-control"
/>
</EuiToolTip>
);
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,58 @@ import { action } from '@storybook/addon-actions';
import React from 'react';
import { ViewMenu } from '../view_menu';

const handlers = {
setZoomScale: action('setZoomScale'),
zoomIn: action('zoomIn'),
zoomOut: action('zoomOut'),
toggleWriteable: action('toggleWriteable'),
resetZoom: action('resetZoom'),
enterFullscreen: action('enterFullscreen'),
doRefresh: action('doRefresh'),
fitToWindow: action('fitToWindow'),
setRefreshInterval: action('setRefreshInterval'),
setAutoplayInterval: action('setAutoplayInterval'),
enableAutoplay: action('enableAutoplay'),
};

storiesOf('components/WorkpadHeader/ViewMenu', module)
.add('edit mode', () => (
<ViewMenu
isWriteable={true}
zoomScale={1}
setZoomScale={action('setZoomScale')}
zoomIn={action('zoomIn')}
zoomOut={action('zoomOut')}
toggleWriteable={action('toggleWriteable')}
resetZoom={action('resetZoom')}
enterFullscreen={action('enterFullscreen')}
doRefresh={action('doRefresh')}
fitToWindow={action('fitToWindow')}
refreshInterval={0}
autoplayInterval={0}
autoplayEnabled={false}
{...handlers}
/>
))
.add('read only mode', () => (
<ViewMenu
isWriteable={false}
zoomScale={1}
setZoomScale={action('setZoomScale')}
zoomIn={action('zoomIn')}
zoomOut={action('zoomOut')}
toggleWriteable={action('toggleWriteable')}
resetZoom={action('resetZoom')}
enterFullscreen={action('enterFullscreen')}
doRefresh={action('doRefresh')}
fitToWindow={action('fitToWindow')}
refreshInterval={0}
autoplayInterval={0}
autoplayEnabled={false}
{...handlers}
/>
))
.add('with refresh enabled', () => (
<ViewMenu
isWriteable={false}
zoomScale={1}
refreshInterval={1000}
autoplayInterval={0}
autoplayEnabled={false}
{...handlers}
/>
))
.add('with autoplay enabled', () => (
<ViewMenu
isWriteable={false}
zoomScale={1}
refreshInterval={0}
autoplayInterval={5000}
autoplayEnabled={true}
{...handlers}
/>
));
Loading