-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(dashboard): adding new property panel layout
- Loading branch information
Showing
19 changed files
with
515 additions
and
51 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
75 changes: 75 additions & 0 deletions
75
packages/dashboard/e2e/tests/propertyPanel/propertyPanel.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import { test } from '../test'; | ||
import { expect } from '@playwright/test'; | ||
|
||
test.describe('Property Panel Tests', () => { | ||
test.skip(); | ||
test('test if the property panel is visible in the new layout', async ({ | ||
dashboardWithPropertyPanel, | ||
}) => { | ||
const propPanel = dashboardWithPropertyPanel.page.locator( | ||
'div[class="property-panel-container"]' | ||
); | ||
await expect(propPanel).toBeVisible(); | ||
}); | ||
|
||
test('test if the property panel opens on clicking the header', async ({ | ||
dashboardWithPropertyPanel, | ||
}) => { | ||
const propPanel = dashboardWithPropertyPanel.page.locator( | ||
'div[class="property-panel-container"]' | ||
); | ||
await propPanel.click(); | ||
const boundingBox = await propPanel.boundingBox(); | ||
expect(boundingBox.height > 62).toBeTruthy(); | ||
}); | ||
|
||
test('test if the property panel opens when a widget is selected', async ({ | ||
dashboardWithPropertyPanel, | ||
}) => { | ||
await dashboardWithPropertyPanel.addAWidgetByType('line'); | ||
const propPanel = dashboardWithPropertyPanel.page.locator( | ||
'div[class="property-panel-container"]' | ||
); | ||
const boundingBox = await propPanel.boundingBox(); | ||
expect(boundingBox.height > 62).toBeTruthy(); | ||
}); | ||
|
||
test('test if the property panel stays open when a widget is deselected', async ({ | ||
dashboardWithPropertyPanel, | ||
page, | ||
}) => { | ||
await dashboardWithPropertyPanel.addAWidgetByType('line'); | ||
const boundingBox = await dashboardWithPropertyPanel.gridArea.boundingBox(); | ||
await page.mouse.dblclick(boundingBox.x + 10, boundingBox.y + 10); | ||
const propPanel = dashboardWithPropertyPanel.page.locator( | ||
'div[class="property-panel-container"]' | ||
); | ||
const propPanelBoundingBox = await propPanel.boundingBox(); | ||
expect(propPanelBoundingBox.height > 62).toBeTruthy(); | ||
}); | ||
|
||
test('test if the property panel resizes ', async ({ | ||
dashboardWithPropertyPanel, | ||
page, | ||
}) => { | ||
const propPanel = dashboardWithPropertyPanel.page.locator( | ||
'div[class="property-panel-container"]' | ||
); | ||
await propPanel.click(); | ||
const handle = propPanel.locator( | ||
'span[class="react-resizable-handle react-resizable-handle-n"]' | ||
); | ||
await expect(handle).toBeVisible(); | ||
const propPanelBeforeMoveBoundingBox = await propPanel.boundingBox(); | ||
const handleBoundingBox = await handle.boundingBox(); | ||
await handle.hover(); | ||
await page.mouse.down(); | ||
await page.mouse.move(handleBoundingBox.x, handleBoundingBox.y - 100); | ||
await page.mouse.up(); | ||
|
||
expect( | ||
(await propPanel.boundingBox()).height > | ||
propPanelBeforeMoveBoundingBox.height | ||
).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
packages/dashboard/src/components/dashboardLayout/constants.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export const CONFIG_PANEL_OPEN_WIDTH_PIXELS = 500; | ||
export const CONFIG_PANEL_COLLAPSED_WIDTH_PIXELS = 80; | ||
export const CONFIG_PANEL_BORDER_WIDTH = 2; | ||
export const PROPERTY_PANEL_DRAG_HANDLE_ICON_SIZE = 20; | ||
export const PROPERTY_PANEL_COLLAPSED_HEIGHT_PIXELS = 62; | ||
export const PROPERTY_PANEL_OPEN_DEFAULT_HEIGHT_PIXELS = 159; | ||
export const PROPERTY_PANEL_DEFAULT_HEIGHT_PIXELS = 299; |
17 changes: 17 additions & 0 deletions
17
packages/dashboard/src/components/dashboardLayout/dashboardLayout.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
.dashboard-layout-container { | ||
height: calc(100vh - 160px); | ||
display: flex; | ||
width: 100%; | ||
} | ||
|
||
.dashboard-layout-center-pane-container { | ||
overflow: scroll; | ||
width: 100%; | ||
position: relative; | ||
} | ||
|
||
.dashboard-layout-config-container { | ||
z-index: 2; | ||
margin-left: auto; | ||
height: 100%; | ||
} |
55 changes: 55 additions & 0 deletions
55
packages/dashboard/src/components/dashboardLayout/dashboardLayout.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import React, { ReactNode, useState } from 'react'; | ||
import PropertiesPanelIcon from '~/components/resizablePanes/assets/propertiesPane.svg'; | ||
import { CollapsiblePanel } from '~/components/internalDashboard/collapsiblePanel'; | ||
import { | ||
CONFIG_PANEL_COLLAPSED_WIDTH_PIXELS, | ||
CONFIG_PANEL_OPEN_WIDTH_PIXELS, | ||
} from '~/components/dashboardLayout/constants'; | ||
import './dashboardLayout.css'; | ||
import { PropertyPanel } from '~/components/dashboardLayout/propertyPanel/propertyPanel'; | ||
|
||
export const DashboardLayout = ({ | ||
centerPane, | ||
rightPane, | ||
leftPane, | ||
}: { | ||
centerPane: ReactNode; | ||
rightPane: ReactNode; | ||
leftPane: ReactNode; | ||
}) => { | ||
const [isConfigPanelCollapsed, setIsConfigPanelCollapsed] = useState(true); | ||
|
||
return ( | ||
<div | ||
className='dashboard-layout-container' // important | ||
> | ||
{/*main area*/} | ||
<div className='dashboard-layout-center-pane-container'>{centerPane}</div> | ||
|
||
{/*bottom drawer */} | ||
<PropertyPanel | ||
resourceExplorer={leftPane} | ||
isConfigPanelCollapsed={isConfigPanelCollapsed} | ||
/> | ||
|
||
{/*right config panel*/} | ||
<div className='dashboard-layout-config-container'> | ||
<CollapsiblePanel | ||
isPanelCollapsed={isConfigPanelCollapsed} | ||
panelWidth={ | ||
isConfigPanelCollapsed | ||
? CONFIG_PANEL_COLLAPSED_WIDTH_PIXELS | ||
: CONFIG_PANEL_OPEN_WIDTH_PIXELS | ||
} | ||
onCollapsedPanelClick={() => { | ||
setIsConfigPanelCollapsed(!isConfigPanelCollapsed); | ||
}} | ||
panelContent={rightPane} | ||
icon={PropertiesPanelIcon} | ||
side='right' | ||
headerText='Widget Configuration' | ||
/> | ||
</div> | ||
</div> | ||
); | ||
}; |
Oops, something went wrong.