Skip to content

Commit 3385ba5

Browse files
nikkikapadiaharshithadurai
authored andcommitted
feat(dashboards): Create table for landing page table view (#80945)
As part of creating table view for the dashboards landing page this PR creates the actual table with most of the fields that are present in the mockup (only column left to add is permissions/access column). Switching the toggle to list view will bring you to this page view. I've defaulted to 25 items per page (i'm not sure if there's a different amount we want to use). It's still under the feature flag `dashboards-table-view` which I only have access to atm. <img width="1512" alt="image" src="https://github.com/user-attachments/assets/89530817-cd94-4128-ad3a-fa1ea05851d6">
1 parent 9535988 commit 3385ba5

File tree

7 files changed

+548
-28
lines changed

7 files changed

+548
-28
lines changed

static/app/views/dashboards/manage/dashboardList.spec.tsx renamed to static/app/views/dashboards/manage/dashboardGrid.spec.tsx

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ import {
1313
within,
1414
} from 'sentry-test/reactTestingLibrary';
1515

16-
import DashboardList from 'sentry/views/dashboards/manage/dashboardList';
16+
import DashboardGrid from 'sentry/views/dashboards/manage/dashboardGrid';
1717
import {type DashboardListItem, DisplayType} from 'sentry/views/dashboards/types';
1818

19-
describe('Dashboards - DashboardList', function () {
19+
describe('Dashboards - DashboardGrid', function () {
2020
let dashboards: DashboardListItem[];
2121
let deleteMock: jest.Mock;
2222
let dashboardUpdateMock: jest.Mock;
@@ -100,9 +100,9 @@ describe('Dashboards - DashboardList', function () {
100100
dashboardUpdateMock = jest.fn();
101101
});
102102

103-
it('renders an empty list', function () {
103+
it('renders an empty list', async function () {
104104
render(
105-
<DashboardList
105+
<DashboardGrid
106106
onDashboardsChange={jest.fn()}
107107
organization={organization}
108108
dashboards={[]}
@@ -113,11 +113,14 @@ describe('Dashboards - DashboardList', function () {
113113
);
114114

115115
expect(screen.getByTestId('empty-state')).toBeInTheDocument();
116+
expect(
117+
await screen.findByText('Sorry, no Dashboards match your filters.')
118+
).toBeInTheDocument();
116119
});
117120

118121
it('renders dashboard list', function () {
119122
render(
120-
<DashboardList
123+
<DashboardGrid
121124
onDashboardsChange={jest.fn()}
122125
organization={organization}
123126
dashboards={dashboards}
@@ -133,7 +136,7 @@ describe('Dashboards - DashboardList', function () {
133136

134137
it('returns landing page url for dashboards', function () {
135138
render(
136-
<DashboardList
139+
<DashboardGrid
137140
onDashboardsChange={jest.fn()}
138141
organization={organization}
139142
dashboards={dashboards}
@@ -156,7 +159,7 @@ describe('Dashboards - DashboardList', function () {
156159

157160
it('persists global selection headers', function () {
158161
render(
159-
<DashboardList
162+
<DashboardGrid
160163
onDashboardsChange={jest.fn()}
161164
organization={organization}
162165
dashboards={dashboards}
@@ -175,7 +178,7 @@ describe('Dashboards - DashboardList', function () {
175178

176179
it('can delete dashboards', async function () {
177180
render(
178-
<DashboardList
181+
<DashboardGrid
179182
organization={organization}
180183
dashboards={dashboards}
181184
location={{...LocationFixture(), query: {}}}
@@ -213,7 +216,7 @@ describe('Dashboards - DashboardList', function () {
213216
}),
214217
];
215218
render(
216-
<DashboardList
219+
<DashboardGrid
217220
organization={organization}
218221
dashboards={singleDashboard}
219222
location={LocationFixture()}
@@ -232,7 +235,7 @@ describe('Dashboards - DashboardList', function () {
232235

233236
it('can duplicate dashboards', async function () {
234237
render(
235-
<DashboardList
238+
<DashboardGrid
236239
organization={organization}
237240
dashboards={dashboards}
238241
location={{...LocationFixture(), query: {}}}
@@ -259,7 +262,7 @@ describe('Dashboards - DashboardList', function () {
259262
});
260263

261264
render(
262-
<DashboardList
265+
<DashboardGrid
263266
organization={organization}
264267
dashboards={dashboards}
265268
location={{...LocationFixture(), query: {}}}

static/app/views/dashboards/manage/dashboardList.tsx renamed to static/app/views/dashboards/manage/dashboardGrid.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ type Props = {
4545
isLoading?: boolean;
4646
};
4747

48-
function DashboardList({
48+
function DashboardGrid({
4949
api,
5050
organization,
5151
location,
@@ -203,21 +203,25 @@ function DashboardList({
203203
: dashboards?.length ?? 0;
204204

205205
return (
206-
<DashboardGrid rows={rowCount} columns={columnCount}>
206+
<DashboardGridContainer
207+
rows={rowCount}
208+
columns={columnCount}
209+
data-test-id={'dashboard-grid'}
210+
>
207211
{renderMiniDashboards()}
208212
{isLoading &&
209213
rowCount * columnCount > numDashboards &&
210214
new Array(rowCount * columnCount - numDashboards)
211215
.fill(0)
212216
.map((_, index) => <Placeholder key={index} height="270px" />)}
213-
</DashboardGrid>
217+
</DashboardGridContainer>
214218
);
215219
}
216220

217221
return <Fragment>{renderDashboardGrid()}</Fragment>;
218222
}
219223

220-
const DashboardGrid = styled('div')<{columns: number; rows: number}>`
224+
const DashboardGridContainer = styled('div')<{columns: number; rows: number}>`
221225
display: grid;
222226
grid-template-columns: repeat(
223227
${props => props.columns},
@@ -231,4 +235,4 @@ const DropdownTrigger = styled(Button)`
231235
transform: translateX(${space(1)});
232236
`;
233237

234-
export default withApi(DashboardList);
238+
export default withApi(DashboardGrid);

0 commit comments

Comments
 (0)