Skip to content

Commit

Permalink
MID-4549 Induced entitlements tab: remove relation selection
Browse files Browse the repository at this point in the history
  • Loading branch information
KaterynaHonchar committed Mar 27, 2018
1 parent 2a0c763 commit eb3c88b
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 14 deletions.
Expand Up @@ -220,7 +220,7 @@ private void assignButtonClicked(AjaxRequestTarget target, List<T> selectedOrgs)

protected void initAssignmentParametersPanel(){
DropDownChoicePanel<ObjectTypes> typeSelect = new DropDownChoicePanel<>(
ID_TYPE, typeModel, Model.ofList(WebComponentUtil.createAssignableTypesList()), new EnumChoiceRenderer<>());
ID_TYPE, typeModel, Model.ofList(getObjectTypesList()), new EnumChoiceRenderer<>());
typeSelect.getBaseFormComponent().add(new OnChangeAjaxBehavior() {

private static final long serialVersionUID = 1L;
Expand Down Expand Up @@ -560,4 +560,8 @@ private int getSelectedResourceCount(){
return getResourceTable().getSelectedObjectsCount();

}

protected List<ObjectTypes> getObjectTypesList(){
return WebComponentUtil.createAssignableTypesList();
}
}
Expand Up @@ -20,7 +20,7 @@

<div wicket:id="assignments" class="main-form-panel">
<div class="row">
<div class="col-xs-6">
<div wicket:id="relationContainer" class="col-xs-6">
<label class="col-xs-2 prism-property" ><wicket:message key="AbstractRoleAssignmentPanel.relationLabel" /></label>
<div class="col-xs-3" wicket:id="relation" />
</div>
Expand Down
Expand Up @@ -24,6 +24,7 @@
import javax.xml.namespace.QName;

import com.evolveum.midpoint.prism.PrismContainerValue;
import com.evolveum.midpoint.schema.constants.ObjectTypes;
import com.evolveum.midpoint.schema.constants.SchemaConstants;
import com.evolveum.midpoint.web.component.prism.*;
import com.evolveum.midpoint.web.page.admin.PageAdminFocus;
Expand Down Expand Up @@ -65,6 +66,7 @@ public class AbstractRoleAssignmentPanel extends AssignmentPanel {
private static final long serialVersionUID = 1L;

private static final String ID_RELATION = "relation";
private static final String ID_RELATION_CONTAINER = "relationContainer";
private static final String ID_SHOW_ALL_ASSIGNMENTS_BUTTON = "showAllAssignmentsButton";


Expand All @@ -74,6 +76,20 @@ public AbstractRoleAssignmentPanel(String id, IModel<ContainerWrapper<Assignment

protected void initCustomLayout(WebMarkupContainer assignmentsContainer){

WebMarkupContainer relationContainer = new WebMarkupContainer(ID_RELATION_CONTAINER);
relationContainer.setOutputMarkupId(true);
relationContainer.add(new VisibleEnableBehaviour() {

private static final long serialVersionUID = 1L;

@Override
public boolean isVisible() {
return AbstractRoleAssignmentPanel.this.isRelationVisible();
}

});
assignmentsContainer.addOrReplace(relationContainer);

DropDownChoicePanel<RelationTypes> relation = WebComponentUtil.createEnumPanel(RelationTypes.class, ID_RELATION,
WebComponentUtil.createReadonlyModelFromEnum(RelationTypes.class), Model.of(), this, true);
relation.getBaseFormComponent().add(new AjaxFormComponentUpdatingBehavior("change") {
Expand All @@ -86,17 +102,7 @@ protected void onUpdate(AjaxRequestTarget target) {
});
relation.setOutputMarkupId(true);
relation.setOutputMarkupPlaceholderTag(true);
relation.add(new VisibleEnableBehaviour() {

private static final long serialVersionUID = 1L;

@Override
public boolean isVisible() {
return AbstractRoleAssignmentPanel.this.isRelationVisible();
}

});
assignmentsContainer.addOrReplace(relation);
relationContainer.addOrReplace(relation);

AjaxButton showAllAssignmentsButton = new AjaxButton(ID_SHOW_ALL_ASSIGNMENTS_BUTTON,
createStringResource("AssignmentTablePanel.menu.showAllAssignments")) {
Expand All @@ -121,7 +127,7 @@ public boolean isVisible(){
}

private DropDownChoicePanel<RelationTypes> getRelationPanel() {
return (DropDownChoicePanel<RelationTypes>) getAssignmentContainer().get(ID_RELATION);
return (DropDownChoicePanel<RelationTypes>) getAssignmentContainer().get(ID_RELATION_CONTAINER).get(ID_RELATION);
}


Expand Down Expand Up @@ -151,6 +157,11 @@ protected void addPerformed(AjaxRequestTarget target, List selected, QName relat
addSelectedAssignmentsPerformed(target, selected, relation, kind, intent);
}

@Override
protected List<ObjectTypes> getObjectTypesList(){
return AbstractRoleAssignmentPanel.this.getObjectTypesList();
}

};
panel.setOutputMarkupId(true);
getPageBase().showMainPopup(panel, target);
Expand Down Expand Up @@ -338,4 +349,7 @@ protected boolean isRelationVisible() {
return true;
}

protected List<ObjectTypes> getObjectTypesList(){
return WebComponentUtil.createAssignableTypesList();
}
}
@@ -1,10 +1,12 @@
package com.evolveum.midpoint.web.component.assignment;

import com.evolveum.midpoint.gui.api.util.WebComponentUtil;
import com.evolveum.midpoint.prism.query.AndFilter;
import com.evolveum.midpoint.prism.query.ObjectFilter;
import com.evolveum.midpoint.prism.query.ObjectPaging;
import com.evolveum.midpoint.prism.query.ObjectQuery;
import com.evolveum.midpoint.prism.query.builder.QueryBuilder;
import com.evolveum.midpoint.schema.constants.ObjectTypes;
import com.evolveum.midpoint.schema.constants.SchemaConstants;
import com.evolveum.midpoint.web.component.form.Form;
import com.evolveum.midpoint.web.component.prism.ContainerValueWrapper;
Expand All @@ -16,6 +18,7 @@
import org.apache.wicket.model.IModel;

import javax.xml.namespace.QName;
import java.util.Arrays;
import java.util.List;

/**
Expand Down Expand Up @@ -80,4 +83,12 @@ protected Class getDefaultNewAssignmentFocusType(){
protected void initAssociationContainer(ConstructionType constructionType){
constructionType.beginAssociation();
}

protected boolean isRelationVisible() {
return false;
}

protected List<ObjectTypes> getObjectTypesList(){
return Arrays.asList(ObjectTypes.RESOURCE);
}
}

0 comments on commit eb3c88b

Please sign in to comment.