Skip to content

Commit 2ee9ade

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents 4767509 + 1183c59 commit 2ee9ade

File tree

21 files changed

+805
-400
lines changed

21 files changed

+805
-400
lines changed

config/initial-objects/system-configuration/000-system-configuration.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,10 @@
181181
<skipWhenSuccess>true</skipWhenSuccess>
182182
</operationExecutionRecording>
183183
</internals>
184+
<smartIntegration>
185+
<statisticsTtl>P1D</statisticsTtl>
186+
<mappingSuggestionRetryCount>0</mappingSuggestionRetryCount>
187+
</smartIntegration>
184188
<adminGuiConfiguration>
185189
<homePage id="21">
186190
<type>UserType</type>

gui/admin-gui/src/frontend/js/midpoint-theme.js

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -13,40 +13,10 @@ export default class MidPointTheme {
1313
constructor() {
1414
const self = this;
1515

16-
// var tabId = sessionStorage.getItem('tabId');
17-
// if (!tabId) {
18-
// tabId = new URLSearchParams(window.location.search).get('w');
19-
//
20-
// if (!tabId) {
21-
// console.info("No tabId found in sessionStorage or URL parameters. Generating a new one.");
22-
// } else {
23-
// sessionStorage.setItem('tabId', tabId);
24-
// console.info("Found tabId in URL parameters and stored in sessionStorage", tabId);
25-
// }
26-
// } else {
27-
// console.info("Found existing tabId in sessionStorage", tabId);
28-
// }
29-
3016
$(window).on('load', function () {
3117
//dom not only ready, but everything is loaded MID-3668
3218
$("body").removeClass("custom-hold-transition");
3319

34-
// // Subscribe to all Wicket Ajax calls before they are sent
35-
// Wicket.Event.subscribe('/ajax/call/init', function(jqEvent, attrs, jqXHR, settings) {
36-
// console.debug('Entered ajax call init');
37-
//
38-
// if (!attrs) {
39-
// console.warn('attrs is undefined!');
40-
// return;
41-
// }
42-
//
43-
// const tabId = sessionStorage.getItem('tabId');
44-
// console.log('tabId:', tabId);
45-
//
46-
// attrs.ep = attrs.ep || {};
47-
// attrs.ep.tabId = tabId;
48-
// });
49-
5020
self.initAjaxStatusSigns();
5121

5222
Wicket.Event.subscribe('/ajax/call/failure', function (attrs, jqXHR, textStatus, jqEvent, errorThrown) {
@@ -588,7 +558,7 @@ export default class MidPointTheme {
588558
return;
589559
}
590560

591-
if (!url.searchParams.has('w')) {
561+
if (!url.searchParams.has('w') || wParam !== tabId) {
592562
console.log('tabId added to URL');
593563
url.searchParams.set('w', tabId);
594564
window.history.replaceState({}, '', url);

gui/admin-gui/src/main/java/com/evolveum/midpoint/gui/api/component/MainObjectListPanel.java

Lines changed: 62 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,28 @@
2323
import com.evolveum.midpoint.schema.SelectorOptions;
2424
import com.evolveum.midpoint.util.exception.*;
2525

26+
import com.evolveum.midpoint.web.util.OnePageParameterEncoder;
27+
2628
import org.apache.commons.collections4.CollectionUtils;
2729
import org.apache.commons.lang3.StringUtils;
30+
import org.apache.wicket.AttributeModifier;
2831
import org.apache.wicket.Component;
2932
import org.apache.wicket.RestartResponseException;
33+
import org.apache.wicket.ajax.AjaxEventBehavior;
3034
import org.apache.wicket.ajax.AjaxRequestTarget;
35+
import org.apache.wicket.ajax.attributes.AjaxCallListener;
36+
import org.apache.wicket.ajax.attributes.AjaxRequestAttributes;
37+
import org.apache.wicket.ajax.markup.html.AjaxLink;
3138
import org.apache.wicket.behavior.AttributeAppender;
3239
import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
3340
import org.apache.wicket.markup.html.WebPage;
41+
import org.apache.wicket.markup.html.link.AbstractLink;
3442
import org.apache.wicket.model.IModel;
3543
import org.apache.wicket.model.LoadableDetachableModel;
3644
import org.apache.wicket.model.Model;
3745
import org.apache.wicket.model.PropertyModel;
46+
import org.apache.wicket.request.cycle.RequestCycle;
47+
import org.apache.wicket.request.mapper.parameter.PageParameters;
3848
import org.jetbrains.annotations.NotNull;
3949

4050
import com.evolveum.midpoint.gui.api.GuiStyleConstants;
@@ -86,6 +96,8 @@
8696

8797
import org.jetbrains.annotations.Nullable;
8898

99+
import static com.evolveum.midpoint.gui.impl.util.DetailsPageUtil.OBJECT_DETAILS_PAGE_MAP;
100+
89101
/**
90102
* @author katkav
91103
*/
@@ -158,8 +170,56 @@ protected IColumn<SelectableBean<O>, String> createNameColumn(IModel<String> dis
158170
@Serial private static final long serialVersionUID = 1L;
159171

160172
@Override
161-
public void onClick(IModel<SelectableBean<O>> rowModel, AjaxRequestTarget target) {
162-
onNameColumnPerform(rowModel, target);
173+
protected AbstractLink getObjectNameLinkComponent(String id, IModel<SelectableBean<O>> rowModel) {
174+
AbstractLink link = new AjaxLink<>(id) {
175+
@Serial private static final long serialVersionUID = 1L;
176+
177+
@Override
178+
public void onClick(AjaxRequestTarget target) {
179+
//click event is handled in AjaxEventBehavior
180+
}
181+
};
182+
O obj = rowModel.getObject() != null ? rowModel.getObject().getValue() : null;
183+
if (obj != null) {
184+
link.add(new AjaxEventBehavior("click") {
185+
@Serial private static final long serialVersionUID = 1L;
186+
187+
@Override
188+
protected void updateAjaxAttributes(AjaxRequestAttributes attributes) {
189+
super.updateAjaxAttributes(attributes);
190+
191+
attributes.getDynamicExtraParameters().add(
192+
"return { ctrlKey: Wicket.Event.fix(attrs.event).ctrlKey };"
193+
);
194+
195+
attributes.getAjaxCallListeners().add(new AjaxCallListener() {
196+
@Override
197+
public CharSequence getPrecondition(Component component) {
198+
return "if(attrs.event.ctrlKey || attrs.event.which === 2) { " +
199+
"attrs.event.preventDefault(); " + // stop browser navigation
200+
"window.open(attrs.event.currentTarget.href, '_blank'); " +
201+
"return false; " + // cancel AJAX
202+
"} else { return true; }"; // normal click → AJAX
203+
}
204+
});
205+
}
206+
207+
@Override
208+
protected void onEvent(AjaxRequestTarget target) {
209+
onNameColumnPerform(rowModel, target);
210+
}
211+
});
212+
link.add(AttributeModifier.replace("href", urlForNameColumnLink(obj)));
213+
}
214+
return link;
215+
}
216+
217+
private String urlForNameColumnLink(O obj) {
218+
PageParameters parameters = new PageParameters();
219+
parameters.add(OnePageParameterEncoder.PARAMETER, obj.getOid());
220+
Class<? extends PageBase> detailsPageClass = OBJECT_DETAILS_PAGE_MAP.get(obj.getClass());
221+
var url = RequestCycle.get().urlFor(detailsPageClass, parameters);
222+
return url != null ? url.toString() : "#";
163223
}
164224

165225
@Override

gui/admin-gui/src/main/java/com/evolveum/midpoint/gui/api/util/ModelServiceLocator.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838

3939
import java.util.Locale;
4040

41+
import com.evolveum.midpoint.web.session.BrowserTabSessionStorage;
4142
import com.evolveum.midpoint.web.util.validation.MidpointFormValidatorRegistry;
4243
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType;
4344
import org.jetbrains.annotations.NotNull;
@@ -80,6 +81,8 @@ public interface ModelServiceLocator {
8081

8182
ExpressionFactory getExpressionFactory();
8283

84+
BrowserTabSessionStorage getBrowserTabSessionStorage();
85+
8386
/**
8487
* Returns currently applicable user profile, compiled for efficient use in the user interface.
8588
* applicable to currently logged-in user.

gui/admin-gui/src/main/java/com/evolveum/midpoint/web/component/data/column/ObjectNameColumn.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010

1111
import org.apache.wicket.Component;
1212
import org.apache.wicket.ajax.AjaxRequestTarget;
13+
import org.apache.wicket.ajax.markup.html.AjaxLink;
1314
import org.apache.wicket.behavior.AttributeAppender;
1415
import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator;
16+
import org.apache.wicket.markup.html.link.AbstractLink;
1517
import org.apache.wicket.markup.repeater.Item;
1618
import org.apache.wicket.model.IModel;
1719
import org.apache.wicket.model.LoadableDetachableModel;
@@ -54,10 +56,11 @@ protected IModel<String> getContainerName(@NotNull SelectableBean<O> selectableB
5456
@Override
5557
protected Component createComponent(String componentId, IModel<String> labelModel, IModel<SelectableBean<O>> rowModel) {
5658
return new TitleWithMarks(componentId, labelModel, createRealMarksList(rowModel.getObject())) {
59+
@Serial private static final long serialVersionUID = 1L;
5760

5861
@Override
59-
protected void onTitleClicked(AjaxRequestTarget target) {
60-
ObjectNameColumn.this.onClick(rowModel, target);
62+
protected AbstractLink createTitleLinkComponent(String id) {
63+
return getObjectNameLinkComponent(id, rowModel);
6164
}
6265

6366
@Override
@@ -72,6 +75,17 @@ protected IModel<String> createPrimaryMarksTitle() {
7275
};
7376
}
7477

78+
protected AbstractLink getObjectNameLinkComponent(String id, IModel<SelectableBean<O>> rowModel) {
79+
return new AjaxLink<>(id) {
80+
@Serial private static final long serialVersionUID = 1L;
81+
82+
@Override
83+
public void onClick(AjaxRequestTarget target) {
84+
ObjectNameColumn.this.onClick(rowModel, target);
85+
}
86+
};
87+
}
88+
7589
@Override
7690
public void populateItem(Item<ICellPopulator<SelectableBean<O>>> cellItem, String componentId, IModel<SelectableBean<O>> rowModel) {
7791
super.populateItem(cellItem, componentId, rowModel);

gui/admin-gui/src/test/java/com/evolveum/midpoint/web/AbstractGuiIntegrationTest.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
import com.evolveum.midpoint.smart.api.SmartIntegrationService;
3030
import com.evolveum.midpoint.smart.api.conndev.ConnectorDevelopmentService;
3131
import com.evolveum.midpoint.test.AbstractIntegrationTest;
32+
import com.evolveum.midpoint.web.security.MidPointAuthWebSession;
33+
import com.evolveum.midpoint.web.session.BrowserTabSessionStorage;
3234
import com.evolveum.midpoint.web.util.validation.MidpointFormValidatorRegistry;
3335

3436
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;
@@ -125,6 +127,8 @@ public abstract class AbstractGuiIntegrationTest extends AbstractModelIntegratio
125127
public static final File SECURITY_POLICY_FILE = new File(COMMON_DIR, "value-policy.xml");
126128
protected static final String SECURITY_POLICY_OID = "00000000-0000-0000-0000-000000000120";
127129

130+
protected static final String TEST_WINDOW_ID = "testWindowId";
131+
128132
@Autowired private MidPointApplication application;
129133
@Autowired protected PrismContext prismContext;
130134
@Autowired protected ExpressionFactory expressionFactory;
@@ -245,6 +249,11 @@ public ExpressionFactory getExpressionFactory() {
245249
return expressionFactory;
246250
}
247251

252+
@Override
253+
public BrowserTabSessionStorage getBrowserTabSessionStorage() {
254+
return MidPointAuthWebSession.get().getBrowserTabSessionStorage(TEST_WINDOW_ID);
255+
}
256+
248257
@Override
249258
public LocalizationService getLocalizationService() {
250259
return localizationService;

gui/admin-gui/src/test/java/com/evolveum/midpoint/web/AbstractGuiUnitTest.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
import com.evolveum.midpoint.smart.api.conndev.ConnectorDevelopmentService;
2626
import com.evolveum.midpoint.util.exception.SchemaException;
2727
import com.evolveum.midpoint.web.component.prism.ValueStatus;
28+
import com.evolveum.midpoint.web.security.MidPointAuthWebSession;
29+
import com.evolveum.midpoint.web.session.BrowserTabSessionStorage;
2830
import com.evolveum.midpoint.web.util.validation.MidpointFormValidatorRegistry;
2931
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType;
3032
import org.jetbrains.annotations.NotNull;
@@ -49,6 +51,8 @@
4951
*/
5052
public abstract class AbstractGuiUnitTest extends AbstractHigherUnitTest {
5153

54+
protected static final String TEST_WINDOW_ID = "testWindowId";
55+
5256
protected ModelServiceLocator getServiceLocator() {
5357
return new ModelServiceLocator() {
5458

@@ -108,6 +112,12 @@ public ExpressionFactory getExpressionFactory() {
108112
return null;
109113
}
110114

115+
116+
@Override
117+
public BrowserTabSessionStorage getBrowserTabSessionStorage() {
118+
return MidPointAuthWebSession.get().getBrowserTabSessionStorage(TEST_WINDOW_ID);
119+
}
120+
111121
@Override
112122
public LocalizationService getLocalizationService() {
113123
return null;

infra/schema/src/main/resources/xml/ns/public/common/common-connector-dev-3.xsd

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,18 @@
254254
</xsd:sequence>
255255
</xsd:complexType>
256256

257+
<xsd:complexType name="ConnDevRelevantDocumentationsType">
258+
<xsd:annotation>
259+
<xsd:appinfo>
260+
<a:container/>
261+
</xsd:appinfo>
262+
</xsd:annotation>
263+
<xsd:sequence>
264+
<xsd:element name="docId" type="xsd:string"/>
265+
<xsd:element name="chunkId" type="xsd:string"/>
266+
</xsd:sequence>
267+
</xsd:complexType>
268+
257269
<xsd:complexType name="ConnDevBasicObjectClassInfoType">
258270
<xsd:annotation>
259271
<xsd:appinfo>
@@ -268,6 +280,7 @@
268280
<xsd:element name="abstract" type="xsd:boolean"/>
269281
<xsd:element name="embedded" type="xsd:boolean"/>
270282
<xsd:element name="description" type="xsd:string"/>
283+
<xsd:element name="relevantDocumentations" type="tns:ConnDevRelevantDocumentationsType" minOccurs="0" maxOccurs="unbounded"/>
271284
</xsd:sequence>
272285
</xsd:extension>
273286
</xsd:complexContent>
@@ -332,6 +345,8 @@
332345
<xsd:element name="multivalue" type="xsd:boolean"/>
333346
<xsd:element name="returnedByDefault" type="xsd:boolean"/>
334347
<xsd:element name="connIdAttribute" type="xsd:string"/>
348+
<xsd:element name="scimAttribute" type="xsd:string" minOccurs="0"/>
349+
<xsd:element name="relevantDocumentations" type="tns:ConnDevRelevantDocumentationsType" minOccurs="0" maxOccurs="unbounded"/>
335350
</xsd:sequence>
336351
</xsd:complexType>
337352

@@ -363,6 +378,7 @@
363378
<xsd:element name="requestContentType" type="xsd:string"/>
364379
<xsd:element name="responseContentType" type="xsd:string"/>
365380
<xsd:element maxOccurs="unbounded" name="suggestedUse" type="tns:ConnDevHttpEndpointIntentType"/>
381+
<xsd:element name="relevantDocumentations" type="tns:ConnDevRelevantDocumentationsType" minOccurs="0" maxOccurs="unbounded"/>
366382
</xsd:sequence>
367383
</xsd:complexType>
368384

infra/schema/src/main/resources/xml/ns/public/common/common-core-3.xsd

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13865,18 +13865,6 @@
1386513865
</xsd:appinfo>
1386613866
</xsd:annotation>
1386713867
</xsd:element>
13868-
<xsd:element name="smartIntegrationStatisticsTtl" type="xsd:duration" minOccurs="0">
13869-
<xsd:annotation>
13870-
<xsd:documentation>
13871-
Time-to-live for smart integration statistics objects. Statistics older than this
13872-
will be automatically deleted when accessed. Default is P1D (1 day).
13873-
</xsd:documentation>
13874-
<xsd:appinfo>
13875-
<a:since>4.11</a:since>
13876-
<a:displayName>InternalsConfigurationType.smartIntegrationStatisticsTtl</a:displayName>
13877-
</xsd:appinfo>
13878-
</xsd:annotation>
13879-
</xsd:element>
1388013868
</xsd:sequence>
1388113869
<xsd:attribute name="id" type="xsd:long"/>
1388213870
</xsd:complexType>

infra/schema/src/main/resources/xml/ns/public/common/common-smart-integration-3.xsd

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,30 @@
6363
</xsd:documentation>
6464
</xsd:annotation>
6565
</xsd:element>
66+
<xsd:element name="statisticsTtl" type="xsd:duration" minOccurs="0">
67+
<xsd:annotation>
68+
<xsd:documentation>
69+
Time-to-live for smart integration statistics objects. Statistics older than this
70+
will be automatically deleted when accessed. Default is P1D (1 day).
71+
</xsd:documentation>
72+
<xsd:appinfo>
73+
<a:since>4.11</a:since>
74+
<a:displayName>SmartIntegrationConfigurationType.statisticsTtl</a:displayName>
75+
</xsd:appinfo>
76+
</xsd:annotation>
77+
</xsd:element>
78+
<xsd:element name="mappingSuggestionRetryCount" type="xsd:int" minOccurs="0">
79+
<xsd:annotation>
80+
<xsd:documentation>
81+
Number of retry attempts for AI mapping suggestion when validation fails.
82+
Default is 0 (no retry). Set to 1 or higher to enable retry mechanism.
83+
</xsd:documentation>
84+
<xsd:appinfo>
85+
<a:since>4.11</a:since>
86+
<a:displayName>SmartIntegrationConfigurationType.mappingSuggestionRetryCount</a:displayName>
87+
</xsd:appinfo>
88+
</xsd:annotation>
89+
</xsd:element>
6690
</xsd:sequence>
6791
</xsd:complexType>
6892
<xsd:element name="smartIntegrationConfiguration" type="tns:SmartIntegrationConfigurationType"/>

0 commit comments

Comments
 (0)