Skip to content

Commit

Permalink
max size for dashboard widget configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
Kateryna Honchar committed Aug 8, 2022
1 parent 886591c commit 5e66c46
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 3 deletions.
Expand Up @@ -228,7 +228,6 @@ public Search<C> load() {
}
}
if (storage != null) {

storage.setSearch(search);
}
return search;
Expand Down Expand Up @@ -340,9 +339,18 @@ protected boolean isPagingVisible() {
itemTable.setCurrentPage(pageStorage);
}
}
if (isDashboard()) {
Integer maxSize = getViewPagingMaxSize();
itemTable.setItemsPerPage(maxSize != null ? maxSize.intValue() : UserProfileStorage.DEFAULT_DASHBOARD_PAGING_SIZE);
}
return itemTable;
}

private Integer getViewPagingMaxSize() {
CompiledObjectCollectionView view = getObjectCollectionView();
return view != null && view.getPaging() != null ? view.getPaging().getMaxSize() : null;
}

protected void customProcessNewRowItem(org.apache.wicket.markup.repeater.Item<PO> item, IModel<PO> model) {
}

Expand Down Expand Up @@ -934,7 +942,6 @@ protected List<Component> createToolbarButtonsList(String idButton) {
//TODO TODO TODO what about other buttons? e.g. request access?
private List<Component> createNavigationButtons(String idButton) {
List<Component> buttonsList = new ArrayList<>();

buttonsList.add(createViewAllButton(idButton));
return buttonsList;
}
Expand All @@ -946,9 +953,11 @@ private AjaxIconButton createViewAllButton(String buttonId) {

@Override
public void onClick(AjaxRequestTarget target) {
//TODO redirect
PageBase page = ContainerableListPanel.this.getPageBase();

}
};
viewAll.add(new VisibleBehaviour(() -> isDashboard()));
viewAll.add(AttributeAppender.append("class", "btn btn-default btn-sm"));
viewAll.showTitleAsLabel(true);
return viewAll;
Expand All @@ -962,6 +971,8 @@ protected String getStorageKey() {
} else if (isCollectionViewPanelForWidget()) {
String widgetName = getWidgetNameOfCollection();
return WebComponentUtil.getObjectListPageStorageKey(widgetName);
} else if (isDashboard()) {
return WebComponentUtil.getObjectListPageStorageKey(config.getIdentifier());
}

return WebComponentUtil.getObjectListPageStorageKey(getDefaultType().getSimpleName());
Expand Down
Expand Up @@ -23,6 +23,7 @@ public class UserProfileStorage implements Serializable, DebugDumpable {

private static final long serialVersionUID = 1L;
public static final int DEFAULT_PAGING_SIZE = 20;
public static final int DEFAULT_DASHBOARD_PAGING_SIZE = 10;

/*
* Enum containing IDs of all tables. where paging size can be adjusted
Expand Down
Expand Up @@ -183,6 +183,11 @@
<cssClass>fa fa-history</cssClass>
</icon>
</display>
<listView>
<paging>
<maxSize>10</maxSize>
</paging>
</listView>
<panelType>history</panelType>
<preview>true</preview>
</widget>
Expand All @@ -200,6 +205,11 @@
<cssClass>fe fe-assignment</cssClass>
</icon>
</display>
<listView>
<paging>
<maxSize>10</maxSize>
</paging>
</listView>
<panelType>myAccesses</panelType>
<preview>true</preview>
</widget>
Expand All @@ -217,6 +227,11 @@
<cssClass>fe fe-case</cssClass>
</icon>
</display>
<listView>
<paging>
<maxSize>10</maxSize>
</paging>
</listView>
<panelType>focusCases</panelType>
<preview>true</preview>
</widget>
Expand All @@ -234,6 +249,11 @@
<cssClass>fa fa-inbox</cssClass>
</icon>
</display>
<listView>
<paging>
<maxSize>10</maxSize>
</paging>
</listView>
<panelType>myWorkItems</panelType>
<preview>true</preview>
</widget>
Expand Down

0 comments on commit 5e66c46

Please sign in to comment.