@@ -81,12 +81,19 @@ function DashboardListExtraActions(props) {
81
81
}
82
82
83
83
function DashboardList ( { controller } ) {
84
+ let usedListColumns = listColumns ;
85
+ if ( controller . params . currentPage === "favorites" ) {
86
+ usedListColumns = [
87
+ ...usedListColumns ,
88
+ Columns . dateTime . sortable ( { title : "Starred At" , field : "starred_at" , width : "1%" } ) ,
89
+ ] ;
90
+ }
84
91
const {
85
92
areExtraActionsAvailable,
86
93
listColumns : tableColumns ,
87
94
Component : ExtraActionsComponent ,
88
95
selectedItems,
89
- } = useItemsListExtraActions ( controller , listColumns , DashboardListExtraActions ) ;
96
+ } = useItemsListExtraActions ( controller , usedListColumns , DashboardListExtraActions ) ;
90
97
91
98
return (
92
99
< div className = "page-dashboard-list" >
@@ -139,9 +146,9 @@ function DashboardList({ controller }) {
139
146
showPageSizeSelect
140
147
totalCount = { controller . totalItemsCount }
141
148
pageSize = { controller . itemsPerPage }
142
- onPageSizeChange = { itemsPerPage => controller . updatePagination ( { itemsPerPage } ) }
149
+ onPageSizeChange = { ( itemsPerPage ) => controller . updatePagination ( { itemsPerPage } ) }
143
150
page = { controller . page }
144
- onChange = { page => controller . updatePagination ( { page } ) }
151
+ onChange = { ( page ) => controller . updatePagination ( { page } ) }
145
152
/>
146
153
</ div >
147
154
</ React . Fragment >
@@ -170,33 +177,33 @@ const DashboardListPage = itemsList(
170
177
} [ currentPage ] ;
171
178
} ,
172
179
getItemProcessor ( ) {
173
- return item => new Dashboard ( item ) ;
180
+ return ( item ) => new Dashboard ( item ) ;
174
181
} ,
175
182
} ) ,
176
- ( ) => new UrlStateStorage ( { orderByField : "created_at" , orderByReverse : true } )
183
+ ( { ... props } ) => new UrlStateStorage ( { orderByField : props . orderByField ?? "created_at" , orderByReverse : true } )
177
184
) ;
178
185
179
186
routes . register (
180
187
"Dashboards.List" ,
181
188
routeWithUserSession ( {
182
189
path : "/dashboards" ,
183
190
title : "Dashboards" ,
184
- render : pageProps => < DashboardListPage { ...pageProps } currentPage = "all" /> ,
191
+ render : ( pageProps ) => < DashboardListPage { ...pageProps } currentPage = "all" /> ,
185
192
} )
186
193
) ;
187
194
routes . register (
188
195
"Dashboards.Favorites" ,
189
196
routeWithUserSession ( {
190
197
path : "/dashboards/favorites" ,
191
198
title : "Favorite Dashboards" ,
192
- render : pageProps => < DashboardListPage { ...pageProps } currentPage = "favorites" /> ,
199
+ render : ( pageProps ) => < DashboardListPage { ...pageProps } currentPage = "favorites" orderByField = "starred_at " /> ,
193
200
} )
194
201
) ;
195
202
routes . register (
196
203
"Dashboards.My" ,
197
204
routeWithUserSession ( {
198
205
path : "/dashboards/my" ,
199
206
title : "My Dashboards" ,
200
- render : pageProps => < DashboardListPage { ...pageProps } currentPage = "my" /> ,
207
+ render : ( pageProps ) => < DashboardListPage { ...pageProps } currentPage = "my" /> ,
201
208
} )
202
209
) ;
0 commit comments