@sapui5/sap.ushell_abap 1.140.0 → 1.141.1
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 +2 -2
- package/src/main/js/sap/ushell_abap/.library +1 -1
- package/src/main/js/sap/ushell_abap/adapters/abap/AdapterContainer.js +12 -9
- package/src/main/js/sap/ushell_abap/adapters/abap/AppStateAdapter.js +9 -9
- package/src/main/js/sap/ushell_abap/adapters/abap/ClientSideTargetResolutionAdapter.js +39 -36
- 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 -1
- package/src/main/js/sap/ushell_abap/adapters/abap/ContainerAdapter.js +8 -10
- package/src/main/js/sap/ushell_abap/adapters/abap/FlpLaunchPageAdapter.js +150 -91
- package/src/main/js/sap/ushell_abap/adapters/abap/LaunchPageAdapter.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 +1 -1
- package/src/main/js/sap/ushell_abap/adapters/abap/PagePersistenceAdapter.js +18 -15
- 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 +2 -2
- package/src/main/js/sap/ushell_abap/adapters/abap/Ui5ComponentLoaderAdapter.js +1 -1
- package/src/main/js/sap/ushell_abap/adapters/abap/UserInfoAdapter.js +28 -20
- package/src/main/js/sap/ushell_abap/adapters/hana/ContainerAdapter.js +1 -1
- package/src/main/js/sap/ushell_abap/bootstrap/evo/SAPCompanionConditionSetter.js +1 -1
- 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 +1 -1
- package/src/main/js/sap/ushell_abap/bootstrap/evo/abap.request.startup.js +17 -13
- package/src/main/js/sap/ushell_abap/bootstrap/evo/boottask.js +58 -56
- package/src/main/js/sap/ushell_abap/components/TCodeNavigation/MessageCode.js +47 -0
- package/src/main/js/sap/ushell_abap/components/TCodeNavigation/TCodeNavigationError.js +59 -0
- package/src/main/js/sap/ushell_abap/components/TCodeNavigation.js +129 -116
- package/src/main/js/sap/ushell_abap/integration/fileshares/AppRuntimeFileShareSupport.js +4 -4
- package/src/main/js/sap/ushell_abap/library.js +8 -1
- package/src/main/js/sap/ushell_abap/pbServices/ui2/Bag.js +11 -11
- package/src/main/js/sap/ushell_abap/pbServices/ui2/Catalog.js +2 -2
- package/src/main/js/sap/ushell_abap/pbServices/ui2/Chip.js +4 -8
- package/src/main/js/sap/ushell_abap/pbServices/ui2/ChipInstance.js +4 -8
- package/src/main/js/sap/ushell_abap/pbServices/ui2/ODataWrapper.js +18 -6
- package/src/main/js/sap/ushell_abap/pbServices/ui2/Utils.js +6 -9
- package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/actions.js +2 -2
- package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/visible.js +2 -2
- package/src/main/js/sap/ushell_abap/ui5appruntime/AppInfoAdapter.js +2 -2
- package/ui5.yaml +33 -1
|
@@ -4,147 +4,160 @@ sap.ui.define([
|
|
|
4
4
|
"sap/ushell/Container",
|
|
5
5
|
"sap/base/Log",
|
|
6
6
|
"sap/ushell/api/performance/Extension",
|
|
7
|
-
|
|
8
|
-
"sap/
|
|
9
|
-
|
|
7
|
+
"sap/ushell/api/performance/NavigationSource",
|
|
8
|
+
"sap/ushell_abap/components/TCodeNavigation/TCodeNavigationError",
|
|
9
|
+
"sap/ushell_abap/components/TCodeNavigation/MessageCode"
|
|
10
|
+
], (
|
|
11
|
+
Container,
|
|
12
|
+
Log,
|
|
13
|
+
Extension,
|
|
14
|
+
NavigationSource,
|
|
15
|
+
TCodeNavigationError,
|
|
16
|
+
MessageCode
|
|
17
|
+
) => {
|
|
10
18
|
"use strict";
|
|
11
19
|
|
|
12
20
|
/**
|
|
13
|
-
* @
|
|
14
|
-
*
|
|
21
|
+
* @alias sap.ushell_abap.components.TCodeNavigation.NavigationResult
|
|
22
|
+
* @typedef {object}
|
|
15
23
|
* @property {boolean} successful Indicates whether the navigation was successful. //TODO Remove as not needed due to resolved or rejected promise
|
|
16
24
|
* @property {string} messagecode The message code associated with the navigation result.
|
|
17
|
-
*
|
|
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.
|
|
25
|
+
*
|
|
26
|
+
* @since 1.140.0
|
|
26
27
|
* @private
|
|
27
28
|
* @ui5-restricted sap.esh.search.ui
|
|
28
29
|
*/
|
|
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
30
|
|
|
81
31
|
/**
|
|
82
32
|
* TCodeNavigation module for navigating by Transaction (TA) Code.
|
|
83
33
|
* @alias sap.ushell_abap.components.TCodeNavigation
|
|
84
34
|
* @namespace
|
|
85
|
-
* @class
|
|
86
35
|
* @description This module provides functionality to navigate to an application intent based on a transaction code.
|
|
87
36
|
* It checks if the provided transaction code matches any inbound's appInfo parameter `abap.transaction`.
|
|
88
37
|
* If a match is found, it extracts the semantic object, action, and parameters from the inbound
|
|
89
38
|
* and uses the Navigation service to perform the navigation.
|
|
90
|
-
*
|
|
91
|
-
* @
|
|
39
|
+
*
|
|
40
|
+
* @hideconstructor
|
|
41
|
+
*
|
|
92
42
|
* @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
43
|
* @private
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
44
|
+
* @ui5-restricted sap.esh.search.ui
|
|
45
|
+
*/ // TODO add technical name of esearch component / team name
|
|
46
|
+
class TCodeNavigation {
|
|
47
|
+
// Performance extension for tracking navigation sources
|
|
48
|
+
static #oExtension = new Extension("TCodeNavigation");
|
|
49
|
+
|
|
50
|
+
// Expose MessageCode enum
|
|
51
|
+
static MessageCode = MessageCode;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Navigates to an app intent if the given sTCode matches an inbound's appInfo parameter abap.transaction.
|
|
55
|
+
* If a matching inbound is found, it extracts the semantic object, action, and parameters
|
|
56
|
+
* and uses the Navigation service to perform the navigation.
|
|
57
|
+
* @param {string} sTCode The transaction code to search for, can also be an App ID.
|
|
58
|
+
* @param {boolean} bExplace Indicates whether to open the navigation in a new tab.
|
|
59
|
+
* @returns {Promise<sap.ushell_abap.components.TCodeNavigation.NavigationResult>}
|
|
60
|
+
* Resolves with a NavigationResult object containing a successful flag and a message code. Otherwise, it rejects with an error.
|
|
61
|
+
* @throws {sap.ushell_abap.components.TCodeNavigation.TCodeNavigationError} E.g., if no matching inbound is found or if a mandatory parameter is missing.
|
|
62
|
+
*
|
|
63
|
+
* @since 1.140.0
|
|
64
|
+
* @private
|
|
65
|
+
* @ui5-restricted sap.esh.search.ui
|
|
66
|
+
*/
|
|
67
|
+
static async navigateByTCode (sTCode, bExplace) {
|
|
68
|
+
try {
|
|
69
|
+
const NavDataProvider = await Container.getServiceAsync("NavigationDataProvider");
|
|
70
|
+
const oNavigationData = await NavDataProvider.getNavigationData();
|
|
71
|
+
|
|
72
|
+
const oValidInbound = this.#getValidInbound(oNavigationData, sTCode);
|
|
73
|
+
|
|
74
|
+
if (oValidInbound) {
|
|
75
|
+
// Extract semantic object, action, and parameters from the matched inbound for navigation
|
|
76
|
+
const { semanticObject: sSemanticObject, action: sAction } = oValidInbound;
|
|
77
|
+
const oParams = {};
|
|
78
|
+
if (bExplace) {
|
|
79
|
+
oParams["sap-ushell-navmode"] = "explace";
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Log the navigation source for performance tracking
|
|
83
|
+
this.#oExtension.addNavigationSource(NavigationSource.SearchDirectLaunch);
|
|
84
|
+
|
|
85
|
+
const oNavService = await Container.getServiceAsync("Navigation");
|
|
86
|
+
await oNavService.navigate({
|
|
87
|
+
target: {
|
|
88
|
+
semanticObject: sSemanticObject,
|
|
89
|
+
action: sAction
|
|
90
|
+
},
|
|
91
|
+
params: oParams
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
return {
|
|
95
|
+
successful: true,
|
|
96
|
+
messagecode: MessageCode.NAV_SUCCESS
|
|
97
|
+
};
|
|
120
98
|
}
|
|
99
|
+
throw new TCodeNavigationError(
|
|
100
|
+
`No matching inbound found for transaction code: ${sTCode}`,
|
|
101
|
+
{ code: MessageCode.NO_INBOUND_FOUND }
|
|
102
|
+
);
|
|
103
|
+
} catch (oError) {
|
|
104
|
+
Log.error("Error during TCode navigation", oError);
|
|
105
|
+
const oErrorResult = new TCodeNavigationError(
|
|
106
|
+
"Error during TCode navigation.",
|
|
107
|
+
{
|
|
108
|
+
successful: false,
|
|
109
|
+
code: oError.code
|
|
110
|
+
}
|
|
111
|
+
);
|
|
112
|
+
throw oErrorResult;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
121
115
|
|
|
122
|
-
|
|
123
|
-
|
|
116
|
+
/**
|
|
117
|
+
* Finds the first inbound that matches the given transaction code and doesn't have mandatory parameters.
|
|
118
|
+
* @param {object} oNavigationData The navigation data containing inbounds.
|
|
119
|
+
* @param {string} sTCode The transaction code to match.
|
|
120
|
+
* @returns {object|null} The matched inbound or null if no match is found.
|
|
121
|
+
*
|
|
122
|
+
* @since 1.140.0
|
|
123
|
+
* @private
|
|
124
|
+
*/
|
|
125
|
+
static #getValidInbound (oNavigationData, sTCode) {
|
|
126
|
+
if (!oNavigationData?.inbounds) {
|
|
127
|
+
Log.error("No navigation data found");
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
124
130
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
});
|
|
131
|
+
// Find all inbounds with matching transaction code
|
|
132
|
+
const aMatchedInbounds = oNavigationData.inbounds.filter((oInbound) =>
|
|
133
|
+
oInbound.resolutionResult?.appInfo?.["abap.transaction"] === sTCode
|
|
134
|
+
);
|
|
135
|
+
if (aMatchedInbounds.length === 0) {
|
|
136
|
+
return null;
|
|
137
|
+
}
|
|
133
138
|
|
|
134
|
-
|
|
139
|
+
// Return the first matched inbound where all mandatory parameters have default values
|
|
140
|
+
const oValidInbound = aMatchedInbounds.find((oInbound) => {
|
|
141
|
+
const oParams = oInbound.signature?.parameters;
|
|
142
|
+
if (!oParams) {
|
|
143
|
+
return true; // No parameters, consider valid
|
|
144
|
+
}
|
|
145
|
+
// All required parameters must have a default value
|
|
146
|
+
return Object.values(oParams).every((oValue) =>
|
|
147
|
+
!oValue.required || (oValue.defaultValue && oValue.defaultValue.value)
|
|
148
|
+
);
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
if (!oValidInbound) {
|
|
152
|
+
throw new TCodeNavigationError(
|
|
153
|
+
`Mandatory parameter is missing for transaction ${sTCode}`,
|
|
154
|
+
{ code: MessageCode.NO_INBOUND_FOUND }
|
|
155
|
+
);
|
|
135
156
|
}
|
|
136
|
-
|
|
137
|
-
|
|
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;
|
|
157
|
+
|
|
158
|
+
return oValidInbound;
|
|
146
159
|
}
|
|
147
|
-
}
|
|
160
|
+
}
|
|
148
161
|
|
|
149
162
|
return TCodeNavigation;
|
|
150
163
|
});
|
|
@@ -37,14 +37,14 @@ sap.ui.define([
|
|
|
37
37
|
const ACTION = "manage";
|
|
38
38
|
const URL = `/sap/bc/ui2/start_up?so=${SEMANTIC_OBJECT}&action=${ACTION}&systemAliasesFormat=object&formFactor=desktop&shellType=FLP&depth=0`;
|
|
39
39
|
|
|
40
|
-
AppRuntimeFileShareSupport.getDataSource = function () {
|
|
40
|
+
AppRuntimeFileShareSupport.getDataSource = async function () {
|
|
41
41
|
const sSapClient = AppRuntimeFileShareSupport._getClient();
|
|
42
42
|
const sUrl = `${URL}&sap-client=${sSapClient}`;
|
|
43
43
|
|
|
44
44
|
// reject if sap-client not found to avoid 401 responses
|
|
45
45
|
if (!sSapClient) {
|
|
46
46
|
Log.error("Could not determine sap-client parameter.", null, MODULE_NAME);
|
|
47
|
-
|
|
47
|
+
throw new Error("Could not determine sap-client parameter.");
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
if (!AppRuntimeFileShareSupport._getDataSourcePromise) {
|
|
@@ -62,7 +62,7 @@ sap.ui.define([
|
|
|
62
62
|
if (oResponse.ok === false) {
|
|
63
63
|
Log.error("Could not fetch data, request failed",
|
|
64
64
|
`error: ${oResponse.status}, ${oResponse.statusText},\nurl: ${sUrl}`, MODULE_NAME);
|
|
65
|
-
|
|
65
|
+
throw new Error(oResponse.statusText);
|
|
66
66
|
}
|
|
67
67
|
return oResponse.json();
|
|
68
68
|
}).then((oData) => {
|
|
@@ -87,7 +87,7 @@ sap.ui.define([
|
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
const sErrorMessage =
|
|
90
|
+
const sErrorMessage = `No manifest URL defined: ${JSON.stringify(oData)}`;
|
|
91
91
|
Log.error(sErrorMessage, null, MODULE_NAME);
|
|
92
92
|
throw new Error(sErrorMessage);
|
|
93
93
|
}).then((oManifest) => {
|
|
@@ -11,6 +11,13 @@ sap.ui.define([
|
|
|
11
11
|
) => {
|
|
12
12
|
"use strict";
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* @namespace sap.ushell_abap.components
|
|
16
|
+
* @since 1.121.0
|
|
17
|
+
* @private
|
|
18
|
+
* @ui5-restricted
|
|
19
|
+
*/
|
|
20
|
+
|
|
14
21
|
/**
|
|
15
22
|
* SAP library: sap.ushell_abap
|
|
16
23
|
* provides base functions for Fiori launchpad running on SAP NetWeaver ABAP
|
|
@@ -23,7 +30,7 @@ sap.ui.define([
|
|
|
23
30
|
const ushellAbapLib = Library.init({
|
|
24
31
|
name: "sap.ushell_abap",
|
|
25
32
|
apiVersion: 2,
|
|
26
|
-
version: "1.
|
|
33
|
+
version: "1.141.1",
|
|
27
34
|
dependencies: ["sap.ui.core", "sap.m"],
|
|
28
35
|
noLibraryCSS: true,
|
|
29
36
|
extensions: {
|
|
@@ -370,18 +370,18 @@ sap.ui.define([
|
|
|
370
370
|
*
|
|
371
371
|
* @param {function} fnSuccess
|
|
372
372
|
* no-args success handler
|
|
373
|
-
* @param {function(string, object=)} [
|
|
373
|
+
* @param {function(string, object=)} [fnFailure]
|
|
374
374
|
* error handler taking an error message and, since version 1.28.6, an
|
|
375
375
|
* optional object containing the complete error information as delivered
|
|
376
376
|
* by the ODataService. See fnFailure parameter of {@link sap.ushell_abap.pbServices.ui2.ODataWrapper#onError}
|
|
377
377
|
* for more details.
|
|
378
|
-
* If
|
|
378
|
+
* If fnFailure is not given, the default error handler from the factory's
|
|
379
379
|
* page building service is called.
|
|
380
380
|
* @throws Error when called while {@link #save()} or a previous <code>reset()</code> is
|
|
381
381
|
* running.
|
|
382
382
|
* @since 1.3.0
|
|
383
383
|
*/
|
|
384
|
-
this.reset = function (fnSuccess,
|
|
384
|
+
this.reset = function (fnSuccess, fnFailure) {
|
|
385
385
|
const oParent = getParentMock();
|
|
386
386
|
const oPbs = oFactory.getPageBuildingService();
|
|
387
387
|
|
|
@@ -404,11 +404,11 @@ sap.ui.define([
|
|
|
404
404
|
errorIfSaveRunning();
|
|
405
405
|
errorIfResetRunning();
|
|
406
406
|
bResetting = true;
|
|
407
|
-
|
|
407
|
+
fnFailure = fnFailure || oPbs.getDefaultErrorHandler();
|
|
408
408
|
|
|
409
409
|
if (oAlterEgo.$tmp) {
|
|
410
410
|
// if bag is not yet persisted do not call delete and read
|
|
411
|
-
Utils.callHandler(onReadSuccess.bind(null, oAlterEgo),
|
|
411
|
+
Utils.callHandler(onReadSuccess.bind(null, oAlterEgo), fnFailure, true);
|
|
412
412
|
return;
|
|
413
413
|
}
|
|
414
414
|
|
|
@@ -425,7 +425,7 @@ sap.ui.define([
|
|
|
425
425
|
bResetting = false;
|
|
426
426
|
|
|
427
427
|
// NOTE: call error handler with any arguments passed in this wrapper
|
|
428
|
-
|
|
428
|
+
fnFailure.apply(null, arguments);
|
|
429
429
|
});
|
|
430
430
|
};
|
|
431
431
|
|
|
@@ -483,9 +483,9 @@ sap.ui.define([
|
|
|
483
483
|
*
|
|
484
484
|
* @param {function} fnSuccess
|
|
485
485
|
* no-args success handler. Errors thrown in this function will be reported to the page
|
|
486
|
-
* building service's default error handler (not to <code>
|
|
486
|
+
* building service's default error handler (not to <code>fnFailure</code> since the signature
|
|
487
487
|
* does not fit)
|
|
488
|
-
* @param {function(Object<string, string>, Object<string, object>)}
|
|
488
|
+
* @param {function(Object<string, string>, Object<string, object>)} fnFailure
|
|
489
489
|
* error handler taking two maps, each mapping individual property names
|
|
490
490
|
* to error message and complete error information respectively. Since
|
|
491
491
|
* version 1.28.6, the second parameter is always returned,
|
|
@@ -498,7 +498,7 @@ sap.ui.define([
|
|
|
498
498
|
* running.
|
|
499
499
|
* @since 1.3.0
|
|
500
500
|
*/
|
|
501
|
-
this.save = function (fnSuccess,
|
|
501
|
+
this.save = function (fnSuccess, fnFailure) {
|
|
502
502
|
let iNumberOfRequests = 0;
|
|
503
503
|
const oResetPropertyNames = new Utils.Map(); // used as a "hash set"
|
|
504
504
|
const mMessagesByName = {};
|
|
@@ -509,7 +509,7 @@ sap.ui.define([
|
|
|
509
509
|
if (typeof fnSuccess !== "function") {
|
|
510
510
|
throw new SrvcError("Missing success handler", "sap.ushell_abap.pbServices.ui2.Bag");
|
|
511
511
|
}
|
|
512
|
-
if (typeof
|
|
512
|
+
if (typeof fnFailure !== "function") {
|
|
513
513
|
throw new SrvcError("Missing error handler", "sap.ushell_abap.pbServices.ui2.Bag");
|
|
514
514
|
}
|
|
515
515
|
errorIfSaveRunning();
|
|
@@ -577,7 +577,7 @@ sap.ui.define([
|
|
|
577
577
|
fnChangeListener(that);
|
|
578
578
|
}
|
|
579
579
|
if (Object.keys(mMessagesByName).length > 0) {
|
|
580
|
-
|
|
580
|
+
fnFailure(mMessagesByName, mErrorResponseByName);
|
|
581
581
|
} else {
|
|
582
582
|
oAlterEgo.$tmp = false;
|
|
583
583
|
fnSuccess(); // Note: try/catch done by submitBatchQueue()!
|
|
@@ -262,8 +262,8 @@ sap.ui.define([
|
|
|
262
262
|
oAlterEgo = oResult;
|
|
263
263
|
try {
|
|
264
264
|
sRemoteBaseUrl = that.getRemoteBaseUrl();
|
|
265
|
-
} catch (
|
|
266
|
-
couldNotLoadRemoteChips(
|
|
265
|
+
} catch (oError) {
|
|
266
|
+
couldNotLoadRemoteChips(oError.toString());
|
|
267
267
|
return;
|
|
268
268
|
}
|
|
269
269
|
that.getRemoteCatalogService().readChips(sRemoteBaseUrl, oAlterEgo.remoteId, undefined,
|
|
@@ -606,12 +606,8 @@ sap.ui.define([
|
|
|
606
606
|
*
|
|
607
607
|
* @see #isStub()
|
|
608
608
|
*/
|
|
609
|
-
this.getImplementationAsSapui5Async = function (oApi) {
|
|
610
|
-
|
|
611
|
-
checkStub();
|
|
612
|
-
} catch (oError) {
|
|
613
|
-
return Promise.reject(oError);
|
|
614
|
-
}
|
|
609
|
+
this.getImplementationAsSapui5Async = async function (oApi) {
|
|
610
|
+
checkStub();
|
|
615
611
|
|
|
616
612
|
return new Promise((resolve, reject) => {
|
|
617
613
|
sap.ui.require([
|
|
@@ -1016,10 +1012,10 @@ sap.ui.define([
|
|
|
1016
1012
|
if (typeof vConfigurationUpdates === "string") {
|
|
1017
1013
|
try {
|
|
1018
1014
|
mConfigurationUpdates = JSON.parse(vConfigurationUpdates);
|
|
1019
|
-
} catch (
|
|
1015
|
+
} catch (oError) {
|
|
1020
1016
|
// configuration as a whole is incorrect and will be ignored
|
|
1021
1017
|
// Note: toString(true) will also output configuration, thus it is no secret
|
|
1022
|
-
Log.warning(`${this}: ignoring invalid configuration "${vConfigurationUpdates}"`,
|
|
1018
|
+
Log.warning(`${this}: ignoring invalid configuration "${vConfigurationUpdates}"`, oError, "Chip");
|
|
1023
1019
|
return;
|
|
1024
1020
|
}
|
|
1025
1021
|
} else {
|
|
@@ -485,12 +485,8 @@ sap.ui.define([
|
|
|
485
485
|
*
|
|
486
486
|
* @see #isStub()
|
|
487
487
|
*/
|
|
488
|
-
this.getImplementationAsSapui5Async = function () {
|
|
489
|
-
|
|
490
|
-
checkStub();
|
|
491
|
-
} catch (oError) {
|
|
492
|
-
return Promise.reject(oError);
|
|
493
|
-
}
|
|
488
|
+
this.getImplementationAsSapui5Async = async function () {
|
|
489
|
+
checkStub();
|
|
494
490
|
|
|
495
491
|
return oChip.getImplementationAsSapui5Async(oApi);
|
|
496
492
|
};
|
|
@@ -759,8 +755,8 @@ sap.ui.define([
|
|
|
759
755
|
try {
|
|
760
756
|
fnRefreshHandler(); // Note: "this" is undefined
|
|
761
757
|
return true;
|
|
762
|
-
} catch (
|
|
763
|
-
Log.error(`${that}: call to refresh handler failed
|
|
758
|
+
} catch (oError) {
|
|
759
|
+
Log.error(`${that.getId()}: call to refresh handler failed:`, oError, "ChipInstance");
|
|
764
760
|
return false;
|
|
765
761
|
}
|
|
766
762
|
}
|
|
@@ -63,7 +63,7 @@ sap.ui.define([
|
|
|
63
63
|
}
|
|
64
64
|
try {
|
|
65
65
|
return JSON.parse(JSON.stringify(oInputObject));
|
|
66
|
-
} catch
|
|
66
|
+
} catch {
|
|
67
67
|
return undefined;
|
|
68
68
|
}
|
|
69
69
|
}
|
|
@@ -342,6 +342,16 @@ sap.ui.define([
|
|
|
342
342
|
"X-CSRF-Token": oODataService.getCsrfToken()
|
|
343
343
|
};
|
|
344
344
|
|
|
345
|
+
// Ensure fetching a csrf token for POST methods always. As of today, ABAP only requires a valid token for POST requests.
|
|
346
|
+
// Conceptual apart from HEAD request, a back-end can require a valid token for GET as well.
|
|
347
|
+
if (oODataService.getCsrfToken() === "" && sMethod !== "GET") {
|
|
348
|
+
oODataService.refreshCsrfToken(
|
|
349
|
+
this.doRequest.bind(that, sRequestUrl, sMethod, oPayload, fnSuccess, fnFailure, oHandler, /* bIsRepeatedRequest */ true),
|
|
350
|
+
fnFailure
|
|
351
|
+
);
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
|
|
345
355
|
addGlobalSapHeaders(oHeaders);
|
|
346
356
|
addStickySessionHeader(oHeaders);
|
|
347
357
|
|
|
@@ -447,7 +457,9 @@ sap.ui.define([
|
|
|
447
457
|
const sRequestUrl = this.toRequestUrl(sRelativeUrl);
|
|
448
458
|
const oHeaders = addStickySessionHeader(addGlobalSapHeaders()); // may return an empty object
|
|
449
459
|
|
|
450
|
-
if
|
|
460
|
+
// if sRelativeUrl is empty, we ask for the service document, which is only used for fetching an XSRF token,
|
|
461
|
+
// so we are not taking already queued requests into account.
|
|
462
|
+
if (aBatchQueue && sRelativeUrl !== "") {
|
|
451
463
|
Log.debug(`Queued OData request for GET "${sRelativeUrl}"`, null,
|
|
452
464
|
"ODataWrapper");
|
|
453
465
|
aBatchQueue.push({
|
|
@@ -794,15 +806,15 @@ sap.ui.define([
|
|
|
794
806
|
oParsedErrorInformation.httpStatus = oError.response.statusCode;
|
|
795
807
|
}
|
|
796
808
|
}
|
|
797
|
-
} catch (
|
|
809
|
+
} catch (oParseError) {
|
|
798
810
|
// do not rely on subtleties of error response, treat error details as optional
|
|
799
811
|
}
|
|
800
812
|
}
|
|
801
813
|
|
|
802
|
-
Log.error(sMessage, JSON.stringify(oError.response),
|
|
803
|
-
"ODataWrapper");
|
|
814
|
+
Log.error(sMessage, JSON.stringify(oError.response), "ODataWrapper");
|
|
804
815
|
|
|
805
816
|
if (oDeferred) {
|
|
817
|
+
// reject with string as this is used to call the fnFailure
|
|
806
818
|
oDeferred.reject(sMessage, oParsedErrorInformation);
|
|
807
819
|
}
|
|
808
820
|
fnFailure(sMessage, oParsedErrorInformation);
|
|
@@ -1206,7 +1218,7 @@ sap.ui.define([
|
|
|
1206
1218
|
try {
|
|
1207
1219
|
// read the value from UI5 as it may be set via [CTRL-SHIFT-ALT-P]
|
|
1208
1220
|
ODataWrapper["sap-statistics"] = Supportability.isStatisticsEnabled();
|
|
1209
|
-
} catch
|
|
1221
|
+
} catch {
|
|
1210
1222
|
// Read sap-statistics directly form query parameter in scenarios without UI5
|
|
1211
1223
|
ODataWrapper["sap-statistics"] =
|
|
1212
1224
|
/sap-statistics=(true|x|X)/.test(sWindowLocationSearch);
|
|
@@ -76,8 +76,6 @@ sap.ui.define([
|
|
|
76
76
|
*/
|
|
77
77
|
Utils.callHandler = function (fnSuccess, fnFailure, bAsync) {
|
|
78
78
|
// see also redundant declaration in sap.ushell.utils.call which has to be in sync
|
|
79
|
-
let sMessage;
|
|
80
|
-
|
|
81
79
|
if (bAsync) {
|
|
82
80
|
setTimeout(() => {
|
|
83
81
|
Utils.callHandler(fnSuccess, fnFailure, false);
|
|
@@ -87,10 +85,9 @@ sap.ui.define([
|
|
|
87
85
|
|
|
88
86
|
try {
|
|
89
87
|
fnSuccess();
|
|
90
|
-
} catch (
|
|
91
|
-
sMessage =
|
|
92
|
-
Log.error(`Call to success handler failed: ${sMessage}`,
|
|
93
|
-
e.stack);
|
|
88
|
+
} catch (oError) {
|
|
89
|
+
const sMessage = oError.message || oError.toString();
|
|
90
|
+
Log.error(`Call to success handler failed: ${sMessage}`, oError);
|
|
94
91
|
if (fnFailure) {
|
|
95
92
|
fnFailure(sMessage);
|
|
96
93
|
}
|
|
@@ -189,10 +186,10 @@ sap.ui.define([
|
|
|
189
186
|
}
|
|
190
187
|
oXHR.send();
|
|
191
188
|
Log.debug(`Sent request to URL ${sUrl}`, null);
|
|
192
|
-
} catch (
|
|
193
|
-
Log.error(`Error '${
|
|
189
|
+
} catch (oError) {
|
|
190
|
+
Log.error(`Error '${oError.message || oError}' in request to URL ${sUrl}`,
|
|
194
191
|
null);
|
|
195
|
-
throw
|
|
192
|
+
throw oError;
|
|
196
193
|
}
|
|
197
194
|
}
|
|
198
195
|
};
|
|
@@ -229,9 +229,9 @@ sap.ui.define([
|
|
|
229
229
|
}
|
|
230
230
|
try {
|
|
231
231
|
fnSetTypeHandler(sTypeLowerCase);
|
|
232
|
-
} catch (
|
|
232
|
+
} catch (oError) {
|
|
233
233
|
Log.error(`Could not set CHIP type '${sTypeLowerCase}': ${
|
|
234
|
-
|
|
234
|
+
oError.message || oError.toString()}`, null, "chip.types");
|
|
235
235
|
}
|
|
236
236
|
}
|
|
237
237
|
};
|
|
@@ -33,9 +33,9 @@ sap.ui.require([
|
|
|
33
33
|
function callOnVisible () {
|
|
34
34
|
try {
|
|
35
35
|
fnOnVisible(bVisible);
|
|
36
|
-
} catch (
|
|
36
|
+
} catch (oError) {
|
|
37
37
|
Log.error(`${oChipInstance}: call to visible handler failed: ${
|
|
38
|
-
|
|
38
|
+
oError.message || oError.toString()}`, null, "chip.visible");
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
|
|
@@ -24,7 +24,7 @@ sap.ui.define([
|
|
|
24
24
|
* @param {string} sAppId the ID of the app which is loaded
|
|
25
25
|
* @returns {Promise<object>} a Promise resolving with the app data
|
|
26
26
|
*/
|
|
27
|
-
AppInfoAdapter.prototype.getAppInfo = function (sAppId) {
|
|
27
|
+
AppInfoAdapter.prototype.getAppInfo = async function (sAppId) {
|
|
28
28
|
const oUrlParams = new URLSearchParams(window.location.search);
|
|
29
29
|
|
|
30
30
|
// TODO: app ID should always be passed by caller
|
|
@@ -35,7 +35,7 @@ sap.ui.define([
|
|
|
35
35
|
if (sAppId) {
|
|
36
36
|
return this._loadAppIndexData("/sap/bc/ui2/app_index/ui5_app_info_json", sAppId);
|
|
37
37
|
}
|
|
38
|
-
return
|
|
38
|
+
return new Error("Cannot load app info - no app-id provided and URL parameter 'sap-ui-app-id' not set");
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
AppInfoAdapter.prototype._loadAppIndexData = function (sServiceUrl, sAppId) {
|