Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Evolveum/midpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Kateryna Honchar committed Sep 7, 2022
2 parents 375b56c + 618988a commit 0fb3740
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<!DOCTYPE html>
<html xmlns:wicket="http://wicket.apache.org">
<wicket:panel>
<div class="d-flex flex-wrap">
<div class="d-flex flex-wrap" wicket:id="topButtonsContainer">
<div wicket:id="topButtons"/>
</div>
<div class="d-flex flex-wrap justify-content-between my-3">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ enum Operation {

private static final String DOT_CLASS = ResourceContentPanel.class.getName() + ".";

private static final String ID_TOP_TABLE_BUTTONS_CONTAINER = "topButtonsContainer";
private static final String ID_TOP_TABLE_BUTTONS = "topButtons";
private static final String ID_INTENT = "intent";
private static final String ID_REAL_OBJECT_CLASS = "realObjectClass";
Expand Down Expand Up @@ -136,6 +137,7 @@ private void updateResourceContentSearch() {
ResourceContentSearchDto searchDto = resourceContentSearch.getObject();
getContentStorage(kind, isRepoSearch ? SessionStorage.KEY_RESOURCE_PAGE_REPOSITORY_CONTENT :
SessionStorage.KEY_RESOURCE_PAGE_RESOURCE_CONTENT).setContentSearch(searchDto);

}

private ResourceContentStorage getContentStorage(ShadowKindType kind, String searchMode) {
Expand All @@ -145,10 +147,14 @@ private ResourceContentStorage getContentStorage(ShadowKindType kind, String sea
protected void initLayout() {
setOutputMarkupId(true);

WebMarkupContainer topButtonsContainer = new WebMarkupContainer(ID_TOP_TABLE_BUTTONS_CONTAINER);
add(topButtonsContainer);
topButtonsContainer.setOutputMarkupId(true);
topButtonsContainer.add(new VisibleBehaviour(() -> isTopTableButtonsVisible()));

RepeatingView topButtons = new RepeatingView(ID_TOP_TABLE_BUTTONS);
topButtons.setOutputMarkupId(true);
topButtons.add(new VisibleBehaviour(() -> isTopTableButtonsVisible()));
add(topButtons);
topButtonsContainer.add(topButtons);

initSychronizationButton(topButtons);
initAttributeMappingButton (topButtons);
Expand Down Expand Up @@ -188,6 +194,7 @@ protected void onUpdate(AjaxRequestTarget target) {
updateResourceContentSearch();
mainForm.addOrReplace(initTable(getObjectWrapperModel()));
target.add(mainForm);
target.add(get(ID_TOP_TABLE_BUTTONS_CONTAINER));

}
});
Expand Down Expand Up @@ -246,6 +253,7 @@ protected void onChange(AjaxRequestTarget target) {
LOGGER.trace("Object class panel update: {}", isUseObjectClass());
updateResourceContentSearch();
mainForm.addOrReplace(initTable(getObjectWrapperModel()));
target.add(get(ID_TOP_TABLE_BUTTONS_CONTAINER));
target.add(mainForm);
}

Expand Down Expand Up @@ -364,9 +372,11 @@ private IModel<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>> get

if ((!isUseObjectClass() && resourceContentSearch.getObject().getKind() == null)
|| (isUseObjectClass() && resourceContentSearch.getObject().getObjectClass() == null)) {
getPageBase().warn("Couldn't recognize resource object type");
LOGGER.debug("Couldn't recognize resource object type");
target.add(getPageBase().getFeedbackPanel());
if (target != null) {
getPageBase().warn("Couldn't recognize resource object type");
LOGGER.debug("Couldn't recognize resource object type");
target.add(getPageBase().getFeedbackPanel());
}
return null;
}
PrismContainerValueWrapper<ResourceObjectTypeDefinitionType> foundValue = null;
Expand All @@ -393,7 +403,9 @@ private IModel<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>> get
}
}
if (isUseObjectClass()
&& resourceContentSearch.getObject().getObjectClass().equals(objectTypeDefinition.getObjectClass())
&& (resourceContentSearch.getObject().getObjectClass().equals(objectTypeDefinition.getObjectClass())
|| (objectTypeDefinition.getDelineation() != null
&& resourceContentSearch.getObject().getObjectClass().equals(objectTypeDefinition.getDelineation().getObjectClass())))
&& Boolean.TRUE.equals(objectTypeDefinition.isDefaultForObjectClass())) {
foundValue = value;
}
Expand All @@ -406,9 +418,11 @@ private IModel<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>> get
}
if (foundValue == null) {
if (defaultValue == null) {
getPageBase().warn("Couldn't recognize resource object type");
LOGGER.debug("Couldn't recognize resource object type");
target.add(getPageBase().getFeedbackPanel());
if (target != null) {
getPageBase().warn("Couldn't recognize resource object type");
LOGGER.debug("Couldn't recognize resource object type");
target.add(getPageBase().getFeedbackPanel());
}
return null;
}
foundValue = defaultValue;
Expand All @@ -417,7 +431,7 @@ private IModel<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>> get
}

protected boolean isTopTableButtonsVisible() {
return true;
return getResourceObjectTypeValue(null) != null;
}

private List<QName> createObjectClassChoices(IModel<PrismObjectWrapper<ResourceType>> model) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ protected WebMarkupContainer getMultivalueContainerDetailsPanel(ListItem<PrismCo

@Override
protected boolean isCreateNewObjectVisible() {
return false;
return ResourceSchemaHandlingPanel.this.isCreateNewObjectVisible();
}

@Override
Expand Down Expand Up @@ -139,6 +139,10 @@ public void editItemPerformed(AjaxRequestTarget target, IModel<PrismContainerVal
form.add(objectTypesPanel);
}

protected boolean isCreateNewObjectVisible() {
return true;
}

protected void editItemPerformed(
AjaxRequestTarget target,
IModel<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>> rowModel,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public ResourceTilePanel(String id, IModel<TemplateTile<O>> model) {
private void initLayout() {
add(AttributeAppender.append(
"class",
"card col-12 catalog-tile-panel d-flex flex-column align-items-center p-3 pb-5 pt-4 h-100 mb-0 btn"));
"card selectable col-12 catalog-tile-panel d-flex flex-column align-items-center p-3 pb-5 pt-4 h-100 mb-0 btn"));
setOutputMarkupId(true);

WebMarkupContainer icon = new WebMarkupContainer(ID_ICON);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ protected void editItemPerformed(
target.add(getPageBase().getFeedbackPanel());
}
}

@Override
protected boolean isCreateNewObjectVisible() {
return false;
}
};
table.setOutputMarkupId(true);
add(table);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import java.util.Collection;
import java.util.List;

import org.apache.commons.io.FileUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
Expand Down Expand Up @@ -253,7 +254,7 @@ public ResponseEntity<?> getReportFile(
// Explicitly needed, because Spring would change content type to "*"
// even if application/octet-stream is in produces section
.contentType(MediaType.APPLICATION_OCTET_STREAM)
.body(new FileInputStream(resolution.file));
.body(FileUtils.readFileToByteArray(resolution.file));
} else {
response = ResponseEntity.status(resolution.status).build();
}
Expand Down

0 comments on commit 0fb3740

Please sign in to comment.