Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
skublik committed Mar 31, 2023
2 parents 738c2a9 + 8bd68bd commit 148149d
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -611,9 +611,11 @@ private DisplayType createDisplayType(PanelDisplay display) {
}

private PolyStringType createPolyStringType(String key) {
PolyStringTranslationType translationType = new PolyStringTranslationType();
translationType.setKey(key);
PolyString polyString = new PolyString(null, null, translationType);
return new PolyStringType(polyString);
PolyStringTranslationType translation = new PolyStringTranslationType();
translation.setKey(key);
translation.setFallback(key);
PolyString poly = new PolyString(null, null, translation);

return new PolyStringType(poly);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,16 @@ public static String translatePolyString(PolyString poly, Locale locale) {
String translatedValue = localizationService.translate(poly, locale, true);
String translationKey = poly.getTranslation() != null ? poly.getTranslation().getKey() : null;

// todo this should not be here, we translated what we could, there's key, fallback and fallbackMessage to handle this properly
if (StringUtils.isNotEmpty(translatedValue) && !translatedValue.equals(translationKey)) {
return translatedValue;
}

// todo this should not be here either
if (poly.getOrig() == null) {
return translatedValue;
}

return poly.getOrig();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1926,6 +1926,8 @@ public static <T extends ObjectType> String createDefaultIcon(PrismObject<T> obj
return createObjectTemplateIcon();
} else if (type == SimulationResultType.class) {
return createSimulationResultIcon();
} else if (type == MarkType.class) {
return createMarkIcon();
}
return "";
}
Expand Down Expand Up @@ -2365,6 +2367,10 @@ private static String createObjectTemplateIcon() {
return getObjectNormalIconStyle(GuiStyleConstants.CLASS_OBJECT_TEMPLATE_ICON);
}

private static String createMarkIcon() {
return getObjectNormalIconStyle(GuiStyleConstants.CLASS_MARK);
}

private static String createSimulationResultIcon() {
return getObjectNormalIconStyle(GuiStyleConstants.CLASS_SIMULATION_RESULT);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,8 @@

import java.util.List;

import com.evolveum.midpoint.gui.api.util.GuiDisplayTypeUtil;

import org.apache.commons.lang3.StringUtils;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink;
import org.apache.wicket.behavior.AttributeAppender;
import org.apache.wicket.markup.html.WebMarkupContainer;
Expand All @@ -24,8 +21,9 @@

import com.evolveum.midpoint.gui.api.GuiStyleConstants;
import com.evolveum.midpoint.gui.api.component.BasePanel;
import com.evolveum.midpoint.gui.api.model.ReadOnlyModel;
import com.evolveum.midpoint.gui.api.prism.ItemStatus;
import com.evolveum.midpoint.gui.api.util.GuiDisplayTypeUtil;
import com.evolveum.midpoint.gui.api.util.LocalizationUtil;
import com.evolveum.midpoint.gui.api.util.WebComponentUtil;
import com.evolveum.midpoint.gui.impl.page.admin.ObjectDetailsModels;
import com.evolveum.midpoint.web.application.SimpleCounter;
Expand Down Expand Up @@ -93,7 +91,7 @@ private WebMarkupContainer createNavigationItemParentPanel(ListItem<ContainerPan
}

private IModel<String> createNavigationDetailsStyleModel(ListItem<ContainerPanelConfigurationType> item) {
return new ReadOnlyModel<>(() -> {
return () -> {
ContainerPanelConfigurationType storageConfig = getConfigurationFromStorage();
ContainerPanelConfigurationType itemModelObject = item.getModelObject();
if (isMenuActive(storageConfig, itemModelObject)) {
Expand All @@ -103,7 +101,7 @@ private IModel<String> createNavigationDetailsStyleModel(ListItem<ContainerPanel
return "open";
}
return "";
});
};
}

private ContainerPanelConfigurationType getConfigurationFromStorage() {
Expand Down Expand Up @@ -182,6 +180,7 @@ private boolean hasSubmenu(ContainerPanelConfigurationType config) {

return !config.getPanel().isEmpty();
}

private DetailsNavigationPanel<O> createDetailsSubNavigationPanel(ListItem<ContainerPanelConfigurationType> item) {
DetailsNavigationPanel<O> subPanel = new DetailsNavigationPanel<>(ID_SUB_NAVIGATION, objectDetailsModel, new PropertyModel<>(item.getModel(), ContainerPanelConfigurationType.F_PANEL.getLocalPart())) {

Expand All @@ -199,14 +198,14 @@ protected void onClickPerformed(ContainerPanelConfigurationType config, AjaxRequ
}

private IModel<String> createCountModel(IModel<ContainerPanelConfigurationType> panelModel) {
return new ReadOnlyModel<>( () -> {
return () -> {
SimpleCounter<ObjectDetailsModels<O>, O> counter = getCounterProvider(panelModel);
if (counter == null) {
return null;
}
int count = counter.count(objectDetailsModel, getPageBase());
return String.valueOf(count);
});
};
}

private SimpleCounter<ObjectDetailsModels<O>, O> getCounterProvider(IModel<ContainerPanelConfigurationType> panelModel) {
Expand All @@ -225,8 +224,6 @@ private boolean isMenuItemVisible(ContainerPanelConfigurationType config) {
return true;
}



return WebComponentUtil.getElementVisibility(config.getVisibility()) && isVisibleForAddApply(config);
}

Expand All @@ -249,7 +246,7 @@ protected void onClickPerformed(ContainerPanelConfigurationType config, AjaxRequ

private IModel<String> createButtonLabel(IModel<ContainerPanelConfigurationType> model) {

return new ReadOnlyModel<>(() -> {
return () -> {
ContainerPanelConfigurationType config = model.getObject();

if (config.getDisplay() == null) {
Expand All @@ -260,20 +257,18 @@ private IModel<String> createButtonLabel(IModel<ContainerPanelConfigurationType>
return "N/A";
}

return WebComponentUtil.getTranslatedPolyString(config.getDisplay().getLabel());
});
return LocalizationUtil.translatePolyString(config.getDisplay().getLabel());
};
}

private IModel<String> getMenuItemIconClass(IModel<ContainerPanelConfigurationType> item) {
return new ReadOnlyModel<>(() -> {
return () -> {
ContainerPanelConfigurationType config = item.getObject();
if (config == null || config.getDisplay() == null) {
return GuiStyleConstants.CLASS_CIRCLE_FULL;
}
String iconCss = GuiDisplayTypeUtil.getIconCssClass(config.getDisplay());
return StringUtils.isNoneEmpty(iconCss) ? iconCss : GuiStyleConstants.CLASS_CIRCLE_FULL;
});

};
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@
identifier = "eventMarkInformationPanel",
applicableForType = MarkType.class,
display = @PanelDisplay(
label = " MarkType.eventMark",
label = "MarkType.eventMark",
icon = GuiStyleConstants.CLASS_CIRCLE_FULL,
order = 30
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1446,7 +1446,7 @@
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="name" type="xsd:string" minOccurs="1">
<xsd:element name="name" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
Unique name of the authentication sequence. This name is fact a short identifier.
Expand Down Expand Up @@ -1661,7 +1661,7 @@
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="name" type="xsd:string" minOccurs="1">
<xsd:element name="name" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
Reference to the authentication module name. Value of this element must match name of
Expand All @@ -1687,7 +1687,7 @@
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="display" type="tns:DisplayType"/>
<xsd:element name="display" type="tns:DisplayType" minOccurs="0"/>
<xsd:element name="description" type="xsd:string" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
Expand Down

0 comments on commit 148149d

Please sign in to comment.