Skip to content

Commit

Permalink
fix for MID-8340 Object collection views in GUI don't allow creation …
Browse files Browse the repository at this point in the history
…of new objects (plus button missing)
  • Loading branch information
KaterynaHonchar committed Mar 22, 2023
1 parent ff716e0 commit 91b64f6
Show file tree
Hide file tree
Showing 12 changed files with 15 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import org.apache.wicket.RestartResponseException;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.behavior.AttributeAppender;
import org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable;
import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.model.IModel;
Expand All @@ -26,7 +25,6 @@
import org.jetbrains.annotations.NotNull;

import com.evolveum.midpoint.gui.api.GuiStyleConstants;
import com.evolveum.midpoint.gui.api.component.button.CsvDownloadButtonPanel;
import com.evolveum.midpoint.gui.api.model.LoadableModel;
import com.evolveum.midpoint.gui.api.page.PageBase;
import com.evolveum.midpoint.gui.api.util.GuiDisplayTypeUtil;
Expand Down Expand Up @@ -65,7 +63,6 @@
import com.evolveum.midpoint.web.component.menu.cog.InlineMenuItemAction;
import com.evolveum.midpoint.web.component.util.SelectableBean;
import com.evolveum.midpoint.web.component.util.VisibleBehaviour;
import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour;
import com.evolveum.midpoint.web.page.admin.configuration.PageImportObject;
import com.evolveum.midpoint.web.page.admin.users.component.ExecuteChangeOptionsDto;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;
Expand Down Expand Up @@ -224,7 +221,7 @@ protected void buttonClickPerformed(AjaxRequestTarget target, AssignmentObjectRe
getPageBase().showMainPopup(buttonsPanel, target);
}
};
createNewObjectButton.add(new VisibleBehaviour(this::isCreateNewObjectEnabled));
createNewObjectButton.add(new VisibleBehaviour(this::isCreateNewObjectVisible));
createNewObjectButton.add(AttributeAppender.append("class", "btn btn-default btn-sm"));
return createNewObjectButton;
}
Expand Down Expand Up @@ -415,8 +412,9 @@ private IModel<String> getRefreshPausePlayButtonTitleModel() {
return createStringResource("MainObjectListPanel.refresh.start").getString();
};
}
protected boolean isCreateNewObjectEnabled() {
return !isCollectionViewPanel() || !getNewObjectInfluencesList().isEmpty();
protected boolean isCreateNewObjectVisible() {
return !isCollectionViewPanel() || getObjectCollectionView().isApplicableForOperation(OperationTypeType.ADD) ||
CollectionUtils.isNotEmpty(getNewObjectInfluencesList());
}

@NotNull
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public ObjectDetailsModels<O> getObjectDetailsModel() {
}

@Override
protected boolean isCreateNewObjectEnabled() {
protected boolean isCreateNewObjectVisible() {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ protected String getTitleForNewObjectButton() {
}

@Override
protected boolean isCreateNewObjectEnabled() {
protected boolean isCreateNewObjectVisible() {
return isAuthorized(GuiAuthorizationConstants.MEMBER_OPERATION_CREATE);
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public String getCssClass() {
}

@Override
protected boolean isCreateNewObjectEnabled(){
protected boolean isCreateNewObjectVisible(){
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ protected String getTitleForNewObjectButton() {
}

@Override
protected boolean isCreateNewObjectEnabled() {
protected boolean isCreateNewObjectVisible() {
return isAuthorized(GuiAuthorizationConstants.MEMBER_OPERATION_CREATE);
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ protected void objectDetailsPerformed(AjaxRequestTarget target, UserType object)
}

@Override
protected boolean isCreateNewObjectEnabled() {
protected boolean isCreateNewObjectVisible() {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ protected SelectableBean<F> createObjectWrapper(UserSessionManagementType princi
}

@Override
protected boolean isCreateNewObjectEnabled() {
protected boolean isCreateNewObjectVisible() {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ protected List<InlineMenuItem> createInlineMenu() {
}

@Override
protected boolean isCreateNewObjectEnabled() {
protected boolean isCreateNewObjectVisible() {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ protected List<IColumn<SelectableBean<ConnectorHostType>, String>> createDefault
}

@Override
protected boolean isCreateNewObjectEnabled() {
protected boolean isCreateNewObjectVisible() {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ protected ISelectableDataProvider<SelectableBean<CaseType>> createProvider() {
}

@Override
protected boolean isCreateNewObjectEnabled() {
protected boolean isCreateNewObjectVisible() {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ protected boolean isObjectDetailsEnabled(IModel<SelectableBean<NodeType>> rowMod
}

@Override
protected boolean isCreateNewObjectEnabled() {
protected boolean isCreateNewObjectVisible() {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ protected boolean isShadowDetailsEnabled(IModel<SelectableBean<ShadowType>> rowM
}

@Override
protected boolean isCreateNewObjectEnabled() {
protected boolean isCreateNewObjectVisible() {
return false;
}

Expand Down

0 comments on commit 91b64f6

Please sign in to comment.