Skip to content

Commit

Permalink
Fixed view_menu
Browse files Browse the repository at this point in the history
  • Loading branch information
cqliu1 committed Apr 29, 2020
1 parent 1cfc3fa commit 67a4525
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const RefreshControl = ({ doRefresh, inFlight }: Props) => (
iconType="refresh"
aria-label={strings.getRefreshAriaLabel()}
onClick={doRefresh}
{...{ 'data-test-subj': 'canvas-refresh-control' }}
data-test-subj="canvas-refresh-control"
/>
</EuiToolTip>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,20 @@ 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
Expand All @@ -16,17 +30,7 @@ storiesOf('components/WorkpadHeader/ViewMenu', module)
refreshInterval={0}
autoplayInterval={0}
autoplayEnabled={false}
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')}
{...handlers}
/>
))
.add('read only mode', () => (
Expand All @@ -36,17 +40,7 @@ storiesOf('components/WorkpadHeader/ViewMenu', module)
refreshInterval={0}
autoplayInterval={0}
autoplayEnabled={false}
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')}
{...handlers}
/>
))
.add('with refresh enabled', () => (
Expand All @@ -56,17 +50,7 @@ storiesOf('components/WorkpadHeader/ViewMenu', module)
refreshInterval={1000}
autoplayInterval={0}
autoplayEnabled={false}
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')}
{...handlers}
/>
))
.add('with autoplay enabled', () => (
Expand All @@ -76,16 +60,6 @@ storiesOf('components/WorkpadHeader/ViewMenu', module)
refreshInterval={0}
autoplayInterval={5000}
autoplayEnabled={true}
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')}
{...handlers}
/>
));
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ export const AutoRefreshControls = ({ refreshInterval, setRefresh, disableInterv
<EuiSpacer size="s" />
<EuiText size="s">
<ListGroup aria-labelledby={intervalTitleId} className="canvasControlSettings__list">
<RefreshItem
duration={30000}
label={getSecondsText(30)}
descriptionId={intervalTitleId}
/>
<RefreshItem
duration={60000}
label={getMinutesText(1)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ export const ViewMenu: FunctionComponent<Props> = ({

const getPanelTree = (closePopover: ClosePopoverFn) => ({
id: 0,
title: strings.getViewMenuLabel(),
items: [
{
name: strings.getRefreshMenuItemLabel(),
Expand Down

0 comments on commit 67a4525

Please sign in to comment.