@sapui5/sap.ushell_abap 1.139.0 → 1.140.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/main/js/sap/ushell_abap/.library +1 -1
- package/src/main/js/sap/ushell_abap/adapters/abap/AdapterContainer.js +7 -4
- package/src/main/js/sap/ushell_abap/adapters/abap/AppStateAdapter.js +3 -3
- package/src/main/js/sap/ushell_abap/adapters/abap/ClientSideTargetResolutionAdapter.js +45 -48
- package/src/main/js/sap/ushell_abap/adapters/abap/CommonDataModelAdapter.js +1 -1
- package/src/main/js/sap/ushell_abap/adapters/abap/ConfigurationDefaultsAdapter.js +1 -2
- package/src/main/js/sap/ushell_abap/adapters/abap/ContainerAdapter.js +8 -8
- package/src/main/js/sap/ushell_abap/adapters/abap/FlpLaunchPageAdapter.js +83 -79
- package/src/main/js/sap/ushell_abap/adapters/abap/LaunchPageAdapter.js +1 -1
- package/src/main/js/sap/ushell_abap/adapters/abap/MenuAdapter.js +1 -1
- package/src/main/js/sap/ushell_abap/adapters/abap/NavTargetResolutionAdapter.js +1 -1
- package/src/main/js/sap/ushell_abap/adapters/abap/NavTargetResolutionInternalAdapter.js +1 -1
- package/src/main/js/sap/ushell_abap/adapters/abap/PageBuildingAdapter.js +10 -12
- package/src/main/js/sap/ushell_abap/adapters/abap/PagePersistenceAdapter.js +3 -3
- package/src/main/js/sap/ushell_abap/adapters/abap/PersonalizationAdapter.js +3 -3
- package/src/main/js/sap/ushell_abap/adapters/abap/PersonalizationV2Adapter.js +1 -1
- package/src/main/js/sap/ushell_abap/adapters/abap/SearchAdapter.js +1 -1
- package/src/main/js/sap/ushell_abap/adapters/abap/SupportTicketAdapter.js +1 -1
- package/src/main/js/sap/ushell_abap/adapters/abap/Ui5ComponentLoaderAdapter.js +1 -1
- package/src/main/js/sap/ushell_abap/adapters/abap/UserInfoAdapter.js +6 -8
- package/src/main/js/sap/ushell_abap/adapters/hana/ContainerAdapter.js +1 -1
- package/src/main/js/sap/ushell_abap/bootstrap/evo/SAPCompanionConditionSetter.js +4 -4
- package/src/main/js/sap/ushell_abap/bootstrap/evo/XhrLogonEventHandler.js +5 -2
- package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.bootstrap.utils.js +2 -2
- package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.configure.ushell.js +1 -1
- package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.request.pageset.js +53 -30
- package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.theme.handler.js +2 -1
- package/src/main/js/sap/ushell_abap/bootstrap/evo/boottask.js +27 -18
- package/src/main/js/sap/ushell_abap/components/TCodeNavigation.js +150 -0
- package/src/main/js/sap/ushell_abap/library.js +1 -1
- package/src/main/js/sap/ushell_abap/pbServices/ui2/AllCatalogs.js +2 -2
- package/src/main/js/sap/ushell_abap/pbServices/ui2/Bag.js +4 -8
- package/src/main/js/sap/ushell_abap/pbServices/ui2/Catalog.js +17 -15
- package/src/main/js/sap/ushell_abap/pbServices/ui2/Chip.js +10 -15
- package/src/main/js/sap/ushell_abap/pbServices/ui2/ChipDefinition.js +4 -5
- package/src/main/js/sap/ushell_abap/pbServices/ui2/ChipInstance.js +4 -5
- package/src/main/js/sap/ushell_abap/pbServices/ui2/Error.js +2 -2
- package/src/main/js/sap/ushell_abap/pbServices/ui2/Factory.js +12 -20
- package/src/main/js/sap/ushell_abap/pbServices/ui2/ODataService.js +9 -12
- package/src/main/js/sap/ushell_abap/pbServices/ui2/ODataWrapper.js +28 -28
- package/src/main/js/sap/ushell_abap/pbServices/ui2/Page.js +3 -5
- package/src/main/js/sap/ushell_abap/pbServices/ui2/PageBuildingService.js +19 -22
- package/src/main/js/sap/ushell_abap/pbServices/ui2/PageSet.js +9 -10
- package/src/main/js/sap/ushell_abap/pbServices/ui2/RemoteCatalogService.js +2 -2
- package/src/main/js/sap/ushell_abap/pbServices/ui2/Utils.js +13 -60
- package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/actions.js +1 -2
- package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/configuration.js +1 -1
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
// Copyright (c) 2009-2025 SAP SE, All Rights Reserved
|
|
2
|
+
|
|
3
|
+
sap.ui.define([
|
|
4
|
+
"sap/ushell/Container",
|
|
5
|
+
"sap/base/Log",
|
|
6
|
+
"sap/ushell/api/performance/Extension",
|
|
7
|
+
// navigation sources
|
|
8
|
+
"sap/ushell/api/performance/NavigationSource"
|
|
9
|
+
], (Container, Log, Extension, NavigationSource) => {
|
|
10
|
+
"use strict";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @typedef {object} sap.ushell_abap.components.TCodeNavigation.NavigationResult
|
|
14
|
+
*
|
|
15
|
+
* @property {boolean} successful Indicates whether the navigation was successful. //TODO Remove as not needed due to resolved or rejected promise
|
|
16
|
+
* @property {string} messagecode The message code associated with the navigation result.
|
|
17
|
+
* @private
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Message codes for navigation results.
|
|
22
|
+
* @enum {string} sap.ushell_abap.components.TCodeNavigation.MessageCode
|
|
23
|
+
* @property {string} NAV_SUCCESS Indicates that the navigation was successful.
|
|
24
|
+
* @property {string} NO_INBOUND_FOUND Indicates that no matching inbound was found for the transaction code or a mandatory parameter is missing.
|
|
25
|
+
* @property {string} UNKNOWN_ERROR Indicates an unknown error occurred during navigation.
|
|
26
|
+
* @private
|
|
27
|
+
* @ui5-restricted sap.esh.search.ui
|
|
28
|
+
*/
|
|
29
|
+
const MessageCode = {
|
|
30
|
+
NAV_SUCCESS: "NAV_SUCCESS",
|
|
31
|
+
NO_INBOUND_FOUND: "NO_INBOUND_FOUND",
|
|
32
|
+
UNKNOWN_ERROR: "UNKNOWN_ERROR"
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
// Performance extension for tracking navigation sources
|
|
36
|
+
const oExtension = new Extension("TCodeNavigation");
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Finds the first inbound that matches the given transaction code and doesn't have mandatory parameters.
|
|
40
|
+
* @param {object} oNavigationData The navigation data containing inbounds.
|
|
41
|
+
* @param {string} sTCode The transaction code to match.
|
|
42
|
+
* @returns {object|null} The matched inbound or null if no match is found.
|
|
43
|
+
* @private
|
|
44
|
+
*/
|
|
45
|
+
function _getValidInbound (oNavigationData, sTCode) {
|
|
46
|
+
if (!oNavigationData?.inbounds) {
|
|
47
|
+
Log.error("No navigation data found");
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Find all inbounds with matching transaction code
|
|
52
|
+
const aMatchedInbounds = oNavigationData.inbounds.filter((oInbound) =>
|
|
53
|
+
oInbound.resolutionResult?.appInfo?.["abap.transaction"] === sTCode
|
|
54
|
+
);
|
|
55
|
+
if (aMatchedInbounds.length === 0) {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Return the first matched inbound where all mandatory parameters have default values
|
|
60
|
+
const oValidInbound = aMatchedInbounds.find((oInbound) => {
|
|
61
|
+
const oParams = oInbound.signature?.parameters;
|
|
62
|
+
if (!oParams) {
|
|
63
|
+
return true; // No parameters, consider valid
|
|
64
|
+
}
|
|
65
|
+
// All required parameters must have a default value
|
|
66
|
+
return Object.values(oParams).every((oValue) =>
|
|
67
|
+
!oValue.required || (oValue.defaultValue && oValue.defaultValue.value)
|
|
68
|
+
);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
if (!oValidInbound) {
|
|
72
|
+
throw Object.assign(
|
|
73
|
+
new Error(`Mandatory parameter is missing for transaction ${sTCode}`),
|
|
74
|
+
{ code: MessageCode.NO_INBOUND_FOUND }
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return oValidInbound;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* TCodeNavigation module for navigating by Transaction (TA) Code.
|
|
83
|
+
* @alias sap.ushell_abap.components.TCodeNavigation
|
|
84
|
+
* @namespace
|
|
85
|
+
* @class
|
|
86
|
+
* @description This module provides functionality to navigate to an application intent based on a transaction code.
|
|
87
|
+
* It checks if the provided transaction code matches any inbound's appInfo parameter `abap.transaction`.
|
|
88
|
+
* If a match is found, it extracts the semantic object, action, and parameters from the inbound
|
|
89
|
+
* and uses the Navigation service to perform the navigation.
|
|
90
|
+
* @private
|
|
91
|
+
* @ui5-restricted sap.esh.search.ui // TODO add technical name of esearch component / team name
|
|
92
|
+
* @since 1.140.0
|
|
93
|
+
*/
|
|
94
|
+
class TCodeNavigation {
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Navigates to an app intent if the given sTCode matches an inbound's appInfo parameter abap.transaction.
|
|
99
|
+
* If a matching inbound is found, it extracts the semantic object, action, and parameters
|
|
100
|
+
* and uses the Navigation service to perform the navigation.
|
|
101
|
+
* @param {string} sTCode The transaction code to search for, can also be an App ID.
|
|
102
|
+
* @param {boolean} bExplace Indicates whether to open the navigation in a new tab.
|
|
103
|
+
* @returns {Promise<NavigationResult>} Resolves with a NavigationResult object containing a successful flag and a message code. Otherwise, it rejects with an error.
|
|
104
|
+
* @throws {Error} E.g., if no matching inbound is found or if a mandatory parameter is missing.
|
|
105
|
+
* @private
|
|
106
|
+
*/
|
|
107
|
+
TCodeNavigation.navigateByTCode = async (sTCode, bExplace) => {
|
|
108
|
+
try {
|
|
109
|
+
const NavDataProvider = await Container.getServiceAsync("NavigationDataProvider");
|
|
110
|
+
const oNavigationData = await NavDataProvider.getNavigationData();
|
|
111
|
+
|
|
112
|
+
const oValidInbound = _getValidInbound(oNavigationData, sTCode);
|
|
113
|
+
|
|
114
|
+
if (oValidInbound) {
|
|
115
|
+
// Extract semantic object, action, and parameters from the matched inbound for navigation
|
|
116
|
+
const { semanticObject: sSemanticObject, action: sAction } = oValidInbound;
|
|
117
|
+
const oParams = {};
|
|
118
|
+
if (bExplace) {
|
|
119
|
+
oParams["sap-ushell-navmode"] = "explace";
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// Log the navigation source for performance tracking
|
|
123
|
+
oExtension.addNavigationSource(NavigationSource.SearchDirectLaunch);
|
|
124
|
+
|
|
125
|
+
const oNavService = await Container.getServiceAsync("Navigation");
|
|
126
|
+
await oNavService.navigate({
|
|
127
|
+
target: {
|
|
128
|
+
semanticObject: sSemanticObject,
|
|
129
|
+
action: sAction
|
|
130
|
+
},
|
|
131
|
+
params: oParams
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
return { successful: true, messagecode: MessageCode.NAV_SUCCESS };
|
|
135
|
+
}
|
|
136
|
+
throw Object.assign(
|
|
137
|
+
new Error(`No matching inbound found for transaction code: ${sTCode}`),
|
|
138
|
+
{ code: MessageCode.NO_INBOUND_FOUND }
|
|
139
|
+
);
|
|
140
|
+
} catch (oError) {
|
|
141
|
+
Log.error("Error during TCode navigation", oError);
|
|
142
|
+
const oErrorResult = new Error("Error during TCode navigation.");
|
|
143
|
+
oErrorResult.successful = false;
|
|
144
|
+
oErrorResult.messagecode = oError.code || MessageCode.UNKNOWN_ERROR;
|
|
145
|
+
throw oErrorResult;
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
return TCodeNavigation;
|
|
150
|
+
});
|
|
@@ -38,7 +38,7 @@ sap.ui.define([
|
|
|
38
38
|
* @class
|
|
39
39
|
* @since 1.7.0
|
|
40
40
|
*/
|
|
41
|
-
|
|
41
|
+
function AllCatalogs (oFactory, sPageId) {
|
|
42
42
|
let aCatalogs = [];
|
|
43
43
|
let bIsStub = true;
|
|
44
44
|
const that = this;
|
|
@@ -180,7 +180,7 @@ sap.ui.define([
|
|
|
180
180
|
throw new SrvcError("Missing page ID", "AllCatalogs");
|
|
181
181
|
}
|
|
182
182
|
Log.debug(`Created: ${this}`, null, "AllCatalogs");
|
|
183
|
-
}
|
|
183
|
+
}
|
|
184
184
|
|
|
185
185
|
return AllCatalogs;
|
|
186
186
|
});
|
|
@@ -39,7 +39,7 @@ sap.ui.define([
|
|
|
39
39
|
* @class
|
|
40
40
|
* @since 1.3.0
|
|
41
41
|
*/
|
|
42
|
-
|
|
42
|
+
function Bag (oFactory, oAlterEgo, oParentBag, fnChangeListener) {
|
|
43
43
|
let oPropertiesByName;
|
|
44
44
|
let bResetting = false;
|
|
45
45
|
let bSaving = false;
|
|
@@ -121,8 +121,6 @@ sap.ui.define([
|
|
|
121
121
|
* @private
|
|
122
122
|
*/
|
|
123
123
|
function getNames (aNames, bTranslatable) {
|
|
124
|
-
let oNameSet;
|
|
125
|
-
|
|
126
124
|
if (aNames.length === 0) { // no parent names --> no duplicates expected, run faster code
|
|
127
125
|
oPropertiesByName.keys().forEach((sKey) => {
|
|
128
126
|
if (bTranslatable === (oPropertiesByName.get(sKey).translatable === "X")) {
|
|
@@ -133,7 +131,7 @@ sap.ui.define([
|
|
|
133
131
|
}
|
|
134
132
|
|
|
135
133
|
// parent names present --> expect duplicates and avoid them with slower code
|
|
136
|
-
oNameSet = new Utils.Map();
|
|
134
|
+
const oNameSet = new Utils.Map();
|
|
137
135
|
aNames.forEach((sKey) => {
|
|
138
136
|
oNameSet.put(sKey);
|
|
139
137
|
});
|
|
@@ -462,9 +460,7 @@ sap.ui.define([
|
|
|
462
460
|
* @since 1.17.1
|
|
463
461
|
*/
|
|
464
462
|
this.resetProperty = function (sPropertyName) {
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
oProperty = oPropertiesByName.get(sPropertyName);
|
|
463
|
+
const oProperty = oPropertiesByName.get(sPropertyName);
|
|
468
464
|
if (oProperty) {
|
|
469
465
|
oProperty.$currentValue = undefined; // undefined value is marker to delete property on save
|
|
470
466
|
if (!Object.prototype.hasOwnProperty.call(oProperty, "value")) { // no persisted value
|
|
@@ -708,7 +704,7 @@ sap.ui.define([
|
|
|
708
704
|
|
|
709
705
|
fillPropertyMap(oAlterEgo);
|
|
710
706
|
Log.debug(`Created: ${this}`, null, "sap.ushell_abap.pbServices.ui2.Bag");
|
|
711
|
-
}
|
|
707
|
+
}
|
|
712
708
|
|
|
713
709
|
return Bag;
|
|
714
710
|
});
|
|
@@ -49,7 +49,7 @@ sap.ui.define([
|
|
|
49
49
|
* @since 1.2.0
|
|
50
50
|
* @private
|
|
51
51
|
*/
|
|
52
|
-
|
|
52
|
+
function Catalog (oFactory, vCatalogData) {
|
|
53
53
|
let oAlterEgo; // catalog's representation with all relations removed
|
|
54
54
|
let oCatalogPage;
|
|
55
55
|
let aChips = [];
|
|
@@ -123,7 +123,7 @@ sap.ui.define([
|
|
|
123
123
|
|
|
124
124
|
/**
|
|
125
125
|
* Gets this catalog's remote base URL.
|
|
126
|
-
* @returns {string}
|
|
126
|
+
* @returns {string} url to the remote catalog service
|
|
127
127
|
* @private
|
|
128
128
|
*/
|
|
129
129
|
this.getRemoteBaseUrl = function () {
|
|
@@ -135,7 +135,7 @@ sap.ui.define([
|
|
|
135
135
|
/**
|
|
136
136
|
* Gets the remote catalog service.
|
|
137
137
|
*
|
|
138
|
-
* @returns {sap.ushell_abap.pbServices.ui2.RemoteCatalogService}
|
|
138
|
+
* @returns {sap.ushell_abap.pbServices.ui2.RemoteCatalogService} remote catalog service
|
|
139
139
|
* @private
|
|
140
140
|
*/
|
|
141
141
|
this.getRemoteCatalogService = function () {
|
|
@@ -186,7 +186,7 @@ sap.ui.define([
|
|
|
186
186
|
* If the catalog is a remote catalog, an attempt to load its chips is made.
|
|
187
187
|
* In this case, if the loading fails, the catalog is fully initialized ( with an empty chips collection ) and
|
|
188
188
|
* returned as 2nd argument of the reject handler (note that it is no longer a stub!)
|
|
189
|
-
* @param {boolean} bRefresh
|
|
189
|
+
* @param {boolean} bRefresh boolean indicating whether the catalog should be refreshed
|
|
190
190
|
* @param {function} fnSuccess
|
|
191
191
|
* no-args success handler
|
|
192
192
|
* @param {function(string, object=)} [fnFailure]
|
|
@@ -387,13 +387,18 @@ sap.ui.define([
|
|
|
387
387
|
this.clone = function (sNewDomainId, sNewTitle, fnSuccess, fnFailure) {
|
|
388
388
|
let oCatalogData;
|
|
389
389
|
/**
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
390
|
+
* keeps calls to failure handler consistent with failure handler calls
|
|
391
|
+
* in sap.ushell_abap.pbServices.ui2.Factory#createNewCatalog
|
|
392
|
+
*
|
|
393
|
+
* @param {string} sErrorMessage the error message
|
|
394
|
+
* @param {Error|object|undefined} oMaybeErrorInformation an optional object containing the complete error information as
|
|
395
|
+
*
|
|
396
|
+
* @returns {function} failure handler
|
|
397
|
+
*/
|
|
398
|
+
function fnFailureWrapper (sErrorMessage, oMaybeErrorInformation) {
|
|
394
399
|
return fnFailure(sErrorMessage, undefined,
|
|
395
400
|
oMaybeErrorInformation);
|
|
396
|
-
}
|
|
401
|
+
}
|
|
397
402
|
|
|
398
403
|
if (oAlterEgo && oAlterEgo.type === "REMOTE") {
|
|
399
404
|
oCatalogData = this.getCatalogData();
|
|
@@ -435,13 +440,12 @@ sap.ui.define([
|
|
|
435
440
|
*/
|
|
436
441
|
this.getCatalogData = function () {
|
|
437
442
|
/* jslint nomen:true */
|
|
438
|
-
let oCatalogData;
|
|
439
443
|
|
|
440
444
|
if (!oAlterEgo) {
|
|
441
445
|
return undefined; // only ID is known!
|
|
442
446
|
}
|
|
443
447
|
|
|
444
|
-
oCatalogData = JSON.parse(JSON.stringify(oAlterEgo));
|
|
448
|
+
const oCatalogData = JSON.parse(JSON.stringify(oAlterEgo));
|
|
445
449
|
delete oCatalogData.__metadata;
|
|
446
450
|
return oCatalogData;
|
|
447
451
|
};
|
|
@@ -890,14 +894,12 @@ sap.ui.define([
|
|
|
890
894
|
* @see #getCatalogData
|
|
891
895
|
*/
|
|
892
896
|
this.update = function (oCatalogData, fnSuccess, fnFailure) {
|
|
893
|
-
let oNewAlterEgo;
|
|
894
|
-
|
|
895
897
|
checkAlterEgo();
|
|
896
898
|
if (Object.hasOwnProperty.call(oCatalogData, "__metadata")) {
|
|
897
899
|
// ODataWrapper#update() relies on __metadata!
|
|
898
900
|
throw new SrvcError("Unsupported __metadata update", "Catalog");
|
|
899
901
|
}
|
|
900
|
-
oNewAlterEgo = JSON.parse(JSON.stringify(oAlterEgo));
|
|
902
|
+
const oNewAlterEgo = JSON.parse(JSON.stringify(oAlterEgo));
|
|
901
903
|
Object.keys(oCatalogData).forEach((sName) => {
|
|
902
904
|
oNewAlterEgo[sName] = oCatalogData[sName];
|
|
903
905
|
});
|
|
@@ -932,7 +934,7 @@ sap.ui.define([
|
|
|
932
934
|
throw new SrvcError("Missing ID", "Catalog");
|
|
933
935
|
}
|
|
934
936
|
Log.debug(`Created: ${this}`, null, "Catalog");
|
|
935
|
-
}
|
|
937
|
+
}
|
|
936
938
|
|
|
937
939
|
return Catalog;
|
|
938
940
|
});
|
|
@@ -65,7 +65,7 @@ sap.ui.define([
|
|
|
65
65
|
* @class
|
|
66
66
|
* @since 1.2.0
|
|
67
67
|
*/
|
|
68
|
-
|
|
68
|
+
function Chip (oAlterEgo, oFactory) {
|
|
69
69
|
const that = this;
|
|
70
70
|
let oBags;
|
|
71
71
|
/**
|
|
@@ -307,10 +307,9 @@ sap.ui.define([
|
|
|
307
307
|
let oContract;
|
|
308
308
|
let fnInitializer;
|
|
309
309
|
let sName;
|
|
310
|
-
let mRequestedContracts;
|
|
311
310
|
|
|
312
311
|
checkStub();
|
|
313
|
-
mRequestedContracts = oDefinition.contracts;
|
|
312
|
+
const mRequestedContracts = oDefinition.contracts;
|
|
314
313
|
if (mRequestedContracts) {
|
|
315
314
|
for (sName in mRequestedContracts) {
|
|
316
315
|
if (Object.prototype.hasOwnProperty.call(mRequestedContracts, sName)) {
|
|
@@ -530,17 +529,13 @@ sap.ui.define([
|
|
|
530
529
|
* @see #isStub()
|
|
531
530
|
*/
|
|
532
531
|
this.getImplementationAsSapui5 = function (oApi) {
|
|
533
|
-
let oData;
|
|
534
|
-
let oImplementation;
|
|
535
|
-
let sBaseChipId;
|
|
536
|
-
|
|
537
532
|
Log.error("Deprecated API call of 'Chip.getImplementationAsSapui5'. Please use 'getImplementationAsSapui5Async' instead",
|
|
538
533
|
null,
|
|
539
534
|
"sap.ushell_abap.pbServices.ui2.Chip"
|
|
540
535
|
);
|
|
541
536
|
|
|
542
537
|
checkStub();
|
|
543
|
-
oData = {
|
|
538
|
+
const oData = {
|
|
544
539
|
/**
|
|
545
540
|
* @namespace
|
|
546
541
|
* The namespace for the instance specific CHIP API, which allows you to
|
|
@@ -548,10 +543,10 @@ sap.ui.define([
|
|
|
548
543
|
*/
|
|
549
544
|
chip: oApi
|
|
550
545
|
};
|
|
551
|
-
oImplementation = oDefinition.implementation.sapui5;
|
|
546
|
+
const oImplementation = oDefinition.implementation.sapui5;
|
|
552
547
|
|
|
553
548
|
// In case the chip is used in FLP wave 2 or later context we load it from the standard path
|
|
554
|
-
sBaseChipId = this.getBaseChipId();
|
|
549
|
+
const sBaseChipId = this.getBaseChipId();
|
|
555
550
|
if ((sBaseChipId !== "X-SAP-UI2-CHIP:/UI2/STATIC_APPLAUNCHER") && (sBaseChipId !== "X-SAP-UI2-CHIP:/UI2/DYNAMIC_APPLAUNCHER")) {
|
|
556
551
|
if (oImplementation.$VirtualNamespace) {
|
|
557
552
|
oImplementation.$absolutePath = this.toAbsoluteUrl(oImplementation.basePath);
|
|
@@ -748,8 +743,8 @@ sap.ui.define([
|
|
|
748
743
|
}:${oChipInstance.getId()}`;
|
|
749
744
|
|
|
750
745
|
/**
|
|
751
|
-
* @param {string} sActualId
|
|
752
|
-
* @returns {boolean}
|
|
746
|
+
* @param {string} sActualId the actual CHIP ID to compare with the expected one
|
|
747
|
+
* @returns {boolean} the result of the comparison
|
|
753
748
|
* @private
|
|
754
749
|
*/
|
|
755
750
|
function matchesExpectation (sActualId) {
|
|
@@ -1002,9 +997,9 @@ sap.ui.define([
|
|
|
1002
997
|
* Updates the given parameter map from the given JSON string. All parameters that actually were
|
|
1003
998
|
* defined in the CHIP definition XML are accepted. All others will raise a warning to the log.
|
|
1004
999
|
*
|
|
1005
|
-
* @param {
|
|
1000
|
+
* @param {Object<string,string>} mParameters
|
|
1006
1001
|
* the parameter map to fill
|
|
1007
|
-
* @param {
|
|
1002
|
+
* @param {Object<string,string>|string} vConfigurationUpdates
|
|
1008
1003
|
* the configuration updates as parameter map or as JSON string
|
|
1009
1004
|
* <p>If one parameter value is <code>undefined</code> (which can only happen by supplying a
|
|
1010
1005
|
* map) then this property is removed from <code>mParameters</code>.
|
|
@@ -1123,7 +1118,7 @@ sap.ui.define([
|
|
|
1123
1118
|
}
|
|
1124
1119
|
initBags(oAlterEgo.ChipBags && oAlterEgo.ChipBags.results);
|
|
1125
1120
|
Log.debug(`Created: ${this}`, null, "Chip");
|
|
1126
|
-
}
|
|
1121
|
+
}
|
|
1127
1122
|
|
|
1128
1123
|
// "public" methods (static) ------------------------------------------------
|
|
1129
1124
|
|
|
@@ -43,7 +43,6 @@ sap.ui.define([
|
|
|
43
43
|
*/
|
|
44
44
|
function getAttribute (oDomElement, sName) {
|
|
45
45
|
let oAttribute;
|
|
46
|
-
let aAttributes;
|
|
47
46
|
let i;
|
|
48
47
|
let n;
|
|
49
48
|
if (typeof oDomElement.getAttributeNS === "function") {
|
|
@@ -51,7 +50,7 @@ sap.ui.define([
|
|
|
51
50
|
}
|
|
52
51
|
// ugly workaround for IE's XMLHttpRequest which doesn't know getAttributeNS, but knows the
|
|
53
52
|
// attribute's namespace
|
|
54
|
-
aAttributes = oDomElement.attributes;
|
|
53
|
+
const aAttributes = oDomElement.attributes;
|
|
55
54
|
for (i = 0, n = aAttributes.length; i < n; i += 1) {
|
|
56
55
|
oAttribute = aAttributes[i];
|
|
57
56
|
if (!oAttribute.namespaceURI && getLocalName(oAttribute) === sName) {
|
|
@@ -83,7 +82,7 @@ sap.ui.define([
|
|
|
83
82
|
* this used for calling the handlers from <code>mChildHandlers</code>
|
|
84
83
|
* @param {object} oDomNode
|
|
85
84
|
* the DOM node
|
|
86
|
-
* @param {
|
|
85
|
+
* @param {Object<string,function(object)>} mChildHandlers
|
|
87
86
|
* maps the child name to a handler function. The handler function's parameter is the DOM node.
|
|
88
87
|
*/
|
|
89
88
|
function visit (oThat, oDomNode, mChildHandlers) {
|
|
@@ -117,7 +116,7 @@ sap.ui.define([
|
|
|
117
116
|
* @see sap.ushell_abap.pbServices.ui2.Chip
|
|
118
117
|
* @since 1.2.0
|
|
119
118
|
*/
|
|
120
|
-
|
|
119
|
+
function ChipDefinition (oXml) {
|
|
121
120
|
const that = this;
|
|
122
121
|
|
|
123
122
|
if (oXml instanceof ChipDefinition) {
|
|
@@ -211,7 +210,7 @@ sap.ui.define([
|
|
|
211
210
|
|
|
212
211
|
// paranoid mode to avoid memory leaks
|
|
213
212
|
oXml = null;
|
|
214
|
-
}
|
|
213
|
+
}
|
|
215
214
|
|
|
216
215
|
return ChipDefinition;
|
|
217
216
|
});
|
|
@@ -46,7 +46,7 @@ sap.ui.define([
|
|
|
46
46
|
* @see sap.ushell_abap.pbServices.ui2.PageBuildingService
|
|
47
47
|
* @since 1.2.0
|
|
48
48
|
*/
|
|
49
|
-
|
|
49
|
+
function ChipInstance (oFactory, oAlterEgo, oChip, oPage) {
|
|
50
50
|
let oApi;
|
|
51
51
|
let oBags;
|
|
52
52
|
let oConfiguration;
|
|
@@ -697,10 +697,9 @@ sap.ui.define([
|
|
|
697
697
|
*/
|
|
698
698
|
this.load = function (fnSuccess, fnFailure) {
|
|
699
699
|
// TODO disallow multiple calls?
|
|
700
|
-
let fnLoad;
|
|
701
700
|
|
|
702
701
|
fnFailure = fnFailure || oFactory.getPageBuildingService().getDefaultErrorHandler();
|
|
703
|
-
fnLoad = initialize.bind(null, fnSuccess, fnFailure);
|
|
702
|
+
const fnLoad = initialize.bind(null, fnSuccess, fnFailure);
|
|
704
703
|
|
|
705
704
|
if (oChip.isStub()) {
|
|
706
705
|
oChip.load(fnLoad, fnFailure);
|
|
@@ -929,7 +928,7 @@ sap.ui.define([
|
|
|
929
928
|
* <code>a</code> back to "foo", but our user will never see this again, because the system
|
|
930
929
|
* persisted both <code>a</code> and <code>b</code> in PERS.
|
|
931
930
|
*
|
|
932
|
-
* @param {
|
|
931
|
+
* @param {Object<string,string>} mConfigurationUpdates
|
|
933
932
|
* The configuration updates. The values must be strings. You can however set a value to
|
|
934
933
|
* <code>undefined</code>. This removes it from the list of updated property and effectively
|
|
935
934
|
* resets it to the default value.
|
|
@@ -995,7 +994,7 @@ sap.ui.define([
|
|
|
995
994
|
|
|
996
995
|
delete oAlterEgo.Chip;
|
|
997
996
|
Log.debug(`Created: ${this}`, null, "ChipInstance");
|
|
998
|
-
}
|
|
997
|
+
}
|
|
999
998
|
|
|
1000
999
|
/**
|
|
1001
1000
|
* Clones and loads the new CHIP instance.
|
|
@@ -25,7 +25,7 @@ sap.ui.define([
|
|
|
25
25
|
* @class
|
|
26
26
|
* @since 1.2.0
|
|
27
27
|
*/
|
|
28
|
-
|
|
28
|
+
function SrvcError (sMessage, sComponent, bLogError) {
|
|
29
29
|
// see also redundant declaration in utils.js which has to be in sync
|
|
30
30
|
const oError = new Error(sMessage); // reuse Error constructor to benefit from it (e.g. stack)
|
|
31
31
|
|
|
@@ -38,7 +38,7 @@ sap.ui.define([
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
return oError;
|
|
41
|
-
}
|
|
41
|
+
}
|
|
42
42
|
|
|
43
43
|
return SrvcError;
|
|
44
44
|
});
|
|
@@ -56,14 +56,18 @@ sap.ui.define([
|
|
|
56
56
|
* @class
|
|
57
57
|
* @since 1.2.0
|
|
58
58
|
*/
|
|
59
|
-
|
|
59
|
+
function Factory (oPbs) {
|
|
60
60
|
const mChips = {}; // cache for CHIPs
|
|
61
61
|
const mCatalogs = {}; // cache for catalogs
|
|
62
62
|
const mChipDefinitions = {}; // cache for CHIP definitions
|
|
63
|
-
let oRemoteCatalogServicesByBaseUrl; // mapping from base URL to remote catalog service
|
|
64
63
|
const that = this;
|
|
65
64
|
|
|
66
|
-
//
|
|
65
|
+
// constructor code -------------------------------------------------------
|
|
66
|
+
const oRemoteCatalogServicesByBaseUrl = new Utils.Map();
|
|
67
|
+
if (!oPbs) {
|
|
68
|
+
throw new SrvcError("Missing page building service", "Factory");
|
|
69
|
+
}
|
|
70
|
+
Log.debug(`Created: ${this}`, null, "Factory");
|
|
67
71
|
|
|
68
72
|
// "private" methods ---------------------------------------------------------
|
|
69
73
|
|
|
@@ -373,9 +377,6 @@ sap.ui.define([
|
|
|
373
377
|
* @since 1.2.0
|
|
374
378
|
*/
|
|
375
379
|
this.createChipInstance = function (oRawChipInstance, fnSuccess, fnFailure, oPage) {
|
|
376
|
-
let oChip;
|
|
377
|
-
let oChipInstance;
|
|
378
|
-
|
|
379
380
|
// ensure at least a "null object" CHIP that knows its IDs
|
|
380
381
|
oRawChipInstance.Chip = oRawChipInstance.Chip || { $proxy: true };
|
|
381
382
|
oRawChipInstance.Chip.id = oRawChipInstance.Chip.id || oRawChipInstance.chipId;
|
|
@@ -387,8 +388,8 @@ sap.ui.define([
|
|
|
387
388
|
this.createCatalog(oRawChipInstance.RemoteCatalog);
|
|
388
389
|
}
|
|
389
390
|
|
|
390
|
-
oChip = this.createChip(oRawChipInstance.Chip);
|
|
391
|
-
oChipInstance = new ChipInstance(this, oRawChipInstance, oChip, oPage);
|
|
391
|
+
const oChip = this.createChip(oRawChipInstance.Chip);
|
|
392
|
+
const oChipInstance = new ChipInstance(this, oRawChipInstance, oChip, oPage);
|
|
392
393
|
if (fnSuccess) {
|
|
393
394
|
oChipInstance.load(fnSuccess.bind(null, oChipInstance), fnFailure);
|
|
394
395
|
}
|
|
@@ -499,8 +500,7 @@ sap.ui.define([
|
|
|
499
500
|
* @since 1.2.0
|
|
500
501
|
*/
|
|
501
502
|
this.createPage = function (sPageId, fnSuccess, fnFailure, bPartially) {
|
|
502
|
-
|
|
503
|
-
oPage = new Page(this, sPageId);
|
|
503
|
+
const oPage = new Page(this, sPageId);
|
|
504
504
|
if (fnSuccess) {
|
|
505
505
|
oPage.load(fnSuccess.bind(null, oPage), fnFailure, bPartially);
|
|
506
506
|
}
|
|
@@ -529,8 +529,7 @@ sap.ui.define([
|
|
|
529
529
|
* @since 1.11.0
|
|
530
530
|
*/
|
|
531
531
|
this.createPageSet = function (sPageSetId, fnSuccess, fnFailure) {
|
|
532
|
-
|
|
533
|
-
oPageSet = new PageSet(this, sPageSetId);
|
|
532
|
+
const oPageSet = new PageSet(this, sPageSetId);
|
|
534
533
|
if (fnSuccess) {
|
|
535
534
|
oPageSet.load(fnSuccess.bind(null, oPageSet), fnFailure);
|
|
536
535
|
}
|
|
@@ -601,14 +600,7 @@ sap.ui.define([
|
|
|
601
600
|
aResult.push("})");
|
|
602
601
|
return aResult.join("");
|
|
603
602
|
};
|
|
604
|
-
|
|
605
|
-
// constructor code -------------------------------------------------------
|
|
606
|
-
oRemoteCatalogServicesByBaseUrl = new Utils.Map();
|
|
607
|
-
if (!oPbs) {
|
|
608
|
-
throw new SrvcError("Missing page building service", "Factory");
|
|
609
|
-
}
|
|
610
|
-
Log.debug(`Created: ${this}`, null, "Factory");
|
|
611
|
-
};
|
|
603
|
+
}
|
|
612
604
|
|
|
613
605
|
// public factory function ***************************************************
|
|
614
606
|
|
|
@@ -34,8 +34,12 @@ sap.ui.define([
|
|
|
34
34
|
* @public
|
|
35
35
|
* @since 1.19.0
|
|
36
36
|
*/
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
function ODataService (oODataWrapper, fnDefaultFailure) {
|
|
38
|
+
if (!oODataWrapper) {
|
|
39
|
+
throw new SrvcError("Missing OData wrapper", "ODataService");
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const sBaseUrl = oODataWrapper.getBaseUrl();
|
|
39
43
|
|
|
40
44
|
// BEWARE: constructor code below!
|
|
41
45
|
|
|
@@ -104,15 +108,13 @@ sap.ui.define([
|
|
|
104
108
|
* @see sap.ushell_abap.pbServices.ui2.ODataWrapper#read
|
|
105
109
|
*/
|
|
106
110
|
this.refreshCsrfToken = function (fnSuccess, fnFailure) {
|
|
107
|
-
let oTokenData;
|
|
108
|
-
|
|
109
111
|
if (typeof fnSuccess !== "function") {
|
|
110
112
|
throw new SrvcError("Success callback is not a function",
|
|
111
113
|
"ODataService");
|
|
112
114
|
}
|
|
113
115
|
fnFailure = fnFailure || fnDefaultFailure;
|
|
114
116
|
|
|
115
|
-
oTokenData = mCsrfTokens.get(sBaseUrl);
|
|
117
|
+
const oTokenData = mCsrfTokens.get(sBaseUrl);
|
|
116
118
|
|
|
117
119
|
if (!oTokenData.fetchingInProgress) {
|
|
118
120
|
// fetch token
|
|
@@ -169,13 +171,12 @@ sap.ui.define([
|
|
|
169
171
|
* @see #refreshCsrfToken
|
|
170
172
|
*/
|
|
171
173
|
this.setCsrfToken = function (sNewCsrfToken) {
|
|
172
|
-
let oTokenData;
|
|
173
174
|
// sNewCsrfToken must be a string OR undefined
|
|
174
175
|
if (sNewCsrfToken && typeof sNewCsrfToken !== "string") {
|
|
175
176
|
throw new SrvcError(`Invalid CSRF token: ${sNewCsrfToken}`,
|
|
176
177
|
"ODataService");
|
|
177
178
|
}
|
|
178
|
-
oTokenData = mCsrfTokens.get(sBaseUrl);
|
|
179
|
+
const oTokenData = mCsrfTokens.get(sBaseUrl);
|
|
179
180
|
oTokenData.token = sNewCsrfToken;
|
|
180
181
|
};
|
|
181
182
|
|
|
@@ -223,11 +224,7 @@ sap.ui.define([
|
|
|
223
224
|
};
|
|
224
225
|
|
|
225
226
|
// constructor code -------------------------------------------------------
|
|
226
|
-
if (!oODataWrapper) {
|
|
227
|
-
throw new SrvcError("Missing OData wrapper", "ODataService");
|
|
228
|
-
}
|
|
229
227
|
|
|
230
|
-
sBaseUrl = oODataWrapper.getBaseUrl();
|
|
231
228
|
if (!mCsrfTokens.get(sBaseUrl)) {
|
|
232
229
|
mCsrfTokens.put(sBaseUrl, {
|
|
233
230
|
// token: undefined,
|
|
@@ -238,7 +235,7 @@ sap.ui.define([
|
|
|
238
235
|
}
|
|
239
236
|
|
|
240
237
|
this.setDefaultErrorHandler(fnDefaultFailure);
|
|
241
|
-
}
|
|
238
|
+
}
|
|
242
239
|
|
|
243
240
|
/**
|
|
244
241
|
* for test purposes only
|