Skip to content

Commit

Permalink
adding links to other objects
Browse files Browse the repository at this point in the history
  • Loading branch information
skublik committed Apr 12, 2019
1 parent 74e65b2 commit eaf1854
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 12 deletions.
Expand Up @@ -61,12 +61,17 @@
import com.evolveum.midpoint.web.page.admin.reports.PageAuditLogViewer;
import com.evolveum.midpoint.web.page.admin.reports.dto.AuditEventRecordProvider;
import com.evolveum.midpoint.web.page.admin.reports.dto.AuditSearchDto;
import com.evolveum.midpoint.web.page.admin.resources.PageResource;
import com.evolveum.midpoint.web.page.admin.resources.PageResources;
import com.evolveum.midpoint.web.page.admin.roles.PageRole;
import com.evolveum.midpoint.web.page.admin.roles.PageRoles;
import com.evolveum.midpoint.web.page.admin.server.PageTaskEdit;
import com.evolveum.midpoint.web.page.admin.server.PageTasks;
import com.evolveum.midpoint.web.page.admin.services.PageService;
import com.evolveum.midpoint.web.page.admin.services.PageServices;
import com.evolveum.midpoint.web.page.admin.users.PageOrgTree;
import com.evolveum.midpoint.web.page.admin.users.PageOrgUnit;
import com.evolveum.midpoint.web.page.admin.users.PageUser;
import com.evolveum.midpoint.web.page.admin.users.PageUsers;
import com.evolveum.midpoint.web.util.OnePageParameterEncoder;
import com.evolveum.midpoint.xml.ns._public.common.audit_3.AuditEventRecordItemType;
Expand Down Expand Up @@ -135,6 +140,11 @@ public abstract class InfoBoxPanel extends Panel{

{
put(TaskType.COMPLEX_TYPE, PageTaskEdit.class);
put(UserType.COMPLEX_TYPE, PageUser.class);
put(RoleType.COMPLEX_TYPE, PageRole.class);
put(OrgType.COMPLEX_TYPE, PageOrgUnit.class);
put(ServiceType.COMPLEX_TYPE, PageService.class);
put(ResourceType.COMPLEX_TYPE, PageResource.class);
}
};
}
Expand Down Expand Up @@ -581,7 +591,7 @@ protected static PageBase getPageBase() {
return pageBase;
}

protected WebPage getLinkRef(boolean onClick) {
protected WebPage getLinkRef() {
IModel<DashboardWidgetType> model = (IModel<DashboardWidgetType>)getDefaultModel();
DashboardWidgetSourceTypeType sourceType = getSourceType(model);
switch (sourceType) {
Expand All @@ -606,9 +616,7 @@ protected WebPage getLinkRef(boolean onClick) {
}
AuditSearchDto searchDto = new AuditSearchDto();
searchDto.setCollection(collection);
if(onClick){
getPageBase().getSessionStorage().getAuditLog().setSearchDto(searchDto);
}
getPageBase().getSessionStorage().getAuditLog().setSearchDto(searchDto);
return getPageBase().createWebPage(pageType, null);
} else {
LOGGER.error("CollectionType from collectionRef is null in widget " + model.getObject().getIdentifier());
Expand All @@ -625,14 +633,41 @@ protected WebPage getLinkRef(boolean onClick) {
return null;
}
PageParameters parameters = new PageParameters();
if(onClick){
parameters.add(OnePageParameterEncoder.PARAMETER, object.getOid());
}
parameters.add(OnePageParameterEncoder.PARAMETER, object.getOid());
return getPageBase().createWebPage(pageType, parameters);
}
}
return null;
}

protected boolean existLinkRef() {
IModel<DashboardWidgetType> model = (IModel<DashboardWidgetType>)getDefaultModel();
DashboardWidgetSourceTypeType sourceType = getSourceType(model);
switch (sourceType) {
case OBJECT_COLLECTION:
ObjectCollectionType collection = getObjectCollectionType();
if(collection != null && collection.getType() != null && collection.getType().getLocalPart() != null) {
return getLinksRefCollections().containsKey(collection.getType().getLocalPart());
} else {
return false;
}
case AUDIT_SEARCH:
collection = getObjectCollectionType();
if(collection != null && collection.getAuditSearch() != null && collection.getAuditSearch().getRecordQuery() != null) {
return getLinksRefCollections().containsKey(AuditEventRecordItemType.COMPLEX_TYPE.getLocalPart());
} else {
return false;
}
case OBJECT:
ObjectType object = getObjectFromObjectRef();
if(object == null) {
return false;
}
QName typeName = WebComponentUtil.classToQName(getPageBase().getPrismContext(), object.getClass());
return getLinksRefObjects().containsKey(typeName);
}
return false;
}

// private String addTimestampToQueryForAuditSearch(String origQuery, AuditSearchType auditSearch) {
// String [] partsOfQuery = origQuery.split("where");
// Duration interval = auditSearch.getInterval();
Expand Down
Expand Up @@ -56,13 +56,13 @@ protected void customInitLayout(WebMarkupContainer parentInfoBox) {
Label moreInfoBoxLabel = new Label(ID_MORE_INFO_BOX_LABEL, getPageBase().createStringResource("PageDashboard.infobox.moreInfo"));
moreInfoBox.add(moreInfoBoxLabel);

if (getLinkRef(false) != null) {
if (existLinkRef()) {
moreInfoBox.add(new AjaxEventBehavior("click") {
private static final long serialVersionUID = 1L;

@Override
protected void onEvent(AjaxRequestTarget target) {
WebPage page = getLinkRef(true);
WebPage page = getLinkRef();
getPageBase().navigateToNext(page);
}
});
Expand Down
Expand Up @@ -19,7 +19,7 @@
xmlns:wicket="http://wicket.apache.org">
<body>
<wicket:extend>
<div class="row">
<div class="row count-column-sm-2 count-column-lg-4">
<div wicket:id="widgets">
<div wicket:id="widget"/>
</div>
Expand Down
37 changes: 36 additions & 1 deletion gui/admin-gui/src/main/resources/static/less/midpoint-theme.less
Expand Up @@ -1482,4 +1482,39 @@ th.countLabel{

.position-relative{
position: relative;
}
}

.item-different-height{
display: inline-block;
margin: 0 0 1em;
width: 100%;
padding-left: 15px;
padding-right: 15px;
}
@media (max-width: 992px) {
.count-column-sm-2{
-moz-column-count: 2;
-webkit-column-count: 2;
column-count: 2;
-moz-column-gap: 0px;
-webkit-column-gap: 0px;
column-gap: 0px;
}
}

@media (min-width: 993px) {
.count-column-lg-4{
-moz-column-count: 4;
-webkit-column-count: 4;
column-count: 4;
-moz-column-gap: 0px;
-webkit-column-gap: 0px;
column-gap: 0px;
}
}

.small-box h3{
white-space: normal;
}


0 comments on commit eaf1854

Please sign in to comment.