Skip to content

Commit 55a2d67

Browse files
authored
[7.x] [Canvas] Adds refresh and autoplay options to view menu (#64375) (#64972)
1 parent 476afc4 commit 55a2d67

File tree

17 files changed

+289
-232
lines changed

17 files changed

+289
-232
lines changed

x-pack/legacy/plugins/canvas/i18n/components.ts

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,12 +1005,6 @@ export const ComponentStrings = {
10051005
defaultMessage: 'Refresh elements',
10061006
}),
10071007
},
1008-
WorkpadHeaderControlSettings: {
1009-
getButtonLabel: () =>
1010-
i18n.translate('xpack.canvas.workpadHeaderControlSettings.buttonLabel', {
1011-
defaultMessage: 'Options',
1012-
}),
1013-
},
10141008
WorkpadHeaderCustomInterval: {
10151009
getButtonLabel: () =>
10161010
i18n.translate('xpack.canvas.workpadHeaderCustomInterval.confirmButtonLabel', {
@@ -1319,6 +1313,18 @@ export const ComponentStrings = {
13191313
}),
13201314
},
13211315
WorkpadHeaderViewMenu: {
1316+
getAutoplayOffMenuItemLabel: () =>
1317+
i18n.translate('xpack.canvas.workpadHeaderViewMenu.autoplayOffMenuItemLabel', {
1318+
defaultMessage: 'Turn autoplay off',
1319+
}),
1320+
getAutoplayOnMenuItemLabel: () =>
1321+
i18n.translate('xpack.canvas.workpadHeaderViewMenu.autoplayOnMenuItemLabel', {
1322+
defaultMessage: 'Turn autoplay on',
1323+
}),
1324+
getAutoplaySettingsMenuItemLabel: () =>
1325+
i18n.translate('xpack.canvas.workpadHeaderViewMenu.autoplaySettingsMenuItemLabel', {
1326+
defaultMessage: 'Autoplay settings',
1327+
}),
13221328
getFullscreenMenuItemLabel: () =>
13231329
i18n.translate('xpack.canvas.workpadHeaderViewMenu.fullscreenMenuLabel', {
13241330
defaultMessage: 'Enter fullscreen mode',
@@ -1331,6 +1337,10 @@ export const ComponentStrings = {
13311337
i18n.translate('xpack.canvas.workpadHeaderViewMenu.refreshMenuItemLabel', {
13321338
defaultMessage: 'Refresh data',
13331339
}),
1340+
getRefreshSettingsMenuItemLabel: () =>
1341+
i18n.translate('xpack.canvas.workpadHeaderViewMenu.refreshSettingsMenuItemLabel', {
1342+
defaultMessage: 'Auto refresh settings',
1343+
}),
13341344
getShowEditModeLabel: () =>
13351345
i18n.translate('xpack.canvas.workpadHeaderViewMenu.showEditModeLabel', {
13361346
defaultMessage: 'Show editing controls',

x-pack/legacy/plugins/canvas/public/components/workpad_header/control_settings/control_settings.scss

Lines changed: 0 additions & 7 deletions
This file was deleted.

x-pack/legacy/plugins/canvas/public/components/workpad_header/control_settings/control_settings.tsx

Lines changed: 0 additions & 84 deletions
This file was deleted.

x-pack/legacy/plugins/canvas/public/components/workpad_header/control_settings/index.ts

Lines changed: 0 additions & 35 deletions
This file was deleted.

x-pack/legacy/plugins/canvas/public/components/workpad_header/refresh_control/refresh_control.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export const RefreshControl = ({ doRefresh, inFlight }: Props) => (
3232
iconType="refresh"
3333
aria-label={strings.getRefreshAriaLabel()}
3434
onClick={doRefresh}
35+
data-test-subj="canvas-refresh-control"
3536
/>
3637
</EuiToolTip>
3738
);

x-pack/legacy/plugins/canvas/public/components/workpad_header/view_menu/__examples__/__snapshots__/view_menu.stories.storyshot

Lines changed: 66 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

x-pack/legacy/plugins/canvas/public/components/workpad_header/view_menu/__examples__/view_menu.stories.tsx

Lines changed: 42 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,58 @@ import { action } from '@storybook/addon-actions';
88
import React from 'react';
99
import { ViewMenu } from '../view_menu';
1010

11+
const handlers = {
12+
setZoomScale: action('setZoomScale'),
13+
zoomIn: action('zoomIn'),
14+
zoomOut: action('zoomOut'),
15+
toggleWriteable: action('toggleWriteable'),
16+
resetZoom: action('resetZoom'),
17+
enterFullscreen: action('enterFullscreen'),
18+
doRefresh: action('doRefresh'),
19+
fitToWindow: action('fitToWindow'),
20+
setRefreshInterval: action('setRefreshInterval'),
21+
setAutoplayInterval: action('setAutoplayInterval'),
22+
enableAutoplay: action('enableAutoplay'),
23+
};
24+
1125
storiesOf('components/WorkpadHeader/ViewMenu', module)
1226
.add('edit mode', () => (
1327
<ViewMenu
1428
isWriteable={true}
1529
zoomScale={1}
16-
setZoomScale={action('setZoomScale')}
17-
zoomIn={action('zoomIn')}
18-
zoomOut={action('zoomOut')}
19-
toggleWriteable={action('toggleWriteable')}
20-
resetZoom={action('resetZoom')}
21-
enterFullscreen={action('enterFullscreen')}
22-
doRefresh={action('doRefresh')}
23-
fitToWindow={action('fitToWindow')}
30+
refreshInterval={0}
31+
autoplayInterval={0}
32+
autoplayEnabled={false}
33+
{...handlers}
2434
/>
2535
))
2636
.add('read only mode', () => (
2737
<ViewMenu
2838
isWriteable={false}
2939
zoomScale={1}
30-
setZoomScale={action('setZoomScale')}
31-
zoomIn={action('zoomIn')}
32-
zoomOut={action('zoomOut')}
33-
toggleWriteable={action('toggleWriteable')}
34-
resetZoom={action('resetZoom')}
35-
enterFullscreen={action('enterFullscreen')}
36-
doRefresh={action('doRefresh')}
37-
fitToWindow={action('fitToWindow')}
40+
refreshInterval={0}
41+
autoplayInterval={0}
42+
autoplayEnabled={false}
43+
{...handlers}
44+
/>
45+
))
46+
.add('with refresh enabled', () => (
47+
<ViewMenu
48+
isWriteable={false}
49+
zoomScale={1}
50+
refreshInterval={1000}
51+
autoplayInterval={0}
52+
autoplayEnabled={false}
53+
{...handlers}
54+
/>
55+
))
56+
.add('with autoplay enabled', () => (
57+
<ViewMenu
58+
isWriteable={false}
59+
zoomScale={1}
60+
refreshInterval={0}
61+
autoplayInterval={5000}
62+
autoplayEnabled={true}
63+
{...handlers}
3864
/>
3965
));

0 commit comments

Comments
 (0)