mirror of
https://github.com/grafana/grafana.git
synced 2025-02-14 01:23:32 -06:00
public dashboards:fix time regression (#51998)
This PR fixes a regression bug for public dashboards and adds a test to ensure the regression does not resurface.
This commit is contained in:
parent
5aacc7cc2a
commit
fcfde8abd8
@ -96,10 +96,28 @@ describe('SharePublic', () => {
|
||||
await screen.findByText('Welcome to Grafana public dashboards alpha!');
|
||||
});
|
||||
|
||||
// test when checkboxes show up
|
||||
// test checkboxes hidden
|
||||
// test url hidden
|
||||
// test url shows up
|
||||
//
|
||||
it('renders default time in inputs', async () => {
|
||||
config.featureToggles.publicDashboards = true;
|
||||
const mockDashboard = new DashboardModel({
|
||||
uid: 'mockDashboardUid',
|
||||
});
|
||||
const mockPanel = new PanelModel({
|
||||
id: 'mockPanelId',
|
||||
});
|
||||
|
||||
expect(mockDashboard.time).toEqual({ from: 'now-6h', to: 'now' });
|
||||
//@ts-ignore
|
||||
mockDashboard.originalTime = { from: 'test-from', to: 'test-to' };
|
||||
|
||||
render(<ShareModal panel={mockPanel} dashboard={mockDashboard} onDismiss={() => {}} />);
|
||||
|
||||
await waitFor(() => screen.getByText('Link'));
|
||||
fireEvent.click(screen.getByText('Public Dashboard'));
|
||||
|
||||
await screen.findByText('Welcome to Grafana public dashboards alpha!');
|
||||
expect(screen.getByDisplayValue('test-from')).toBeInTheDocument();
|
||||
expect(screen.getByDisplayValue('test-to')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
// test checking if current version of dashboard in state is persisted to db
|
||||
});
|
||||
|
@ -164,14 +164,14 @@ export const SharePublicDashboard = (props: Props) => {
|
||||
<br />
|
||||
<div style={{ padding: '5px' }}>
|
||||
<Input
|
||||
value={props.dashboard.time.from}
|
||||
value={props.dashboard.getDefaultTime().from}
|
||||
disabled={true}
|
||||
addonBefore={
|
||||
<span style={{ width: '50px', display: 'flex', alignItems: 'center', padding: '5px' }}>From:</span>
|
||||
}
|
||||
/>
|
||||
<Input
|
||||
value={props.dashboard.time.to}
|
||||
value={props.dashboard.getDefaultTime().to}
|
||||
disabled={true}
|
||||
addonBefore={
|
||||
<span style={{ width: '50px', display: 'flex', alignItems: 'center', padding: '5px' }}>To:</span>
|
||||
|
Loading…
Reference in New Issue
Block a user