@sapui5/sap.ushell_abap 1.151.0 → 1.152.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 +30 -31
- package/src/main/js/sap/ushell_abap/adapters/abap/AppStateAdapter.js +1 -1
- package/src/main/js/sap/ushell_abap/adapters/abap/ClientSideTargetResolutionAdapter.js +13 -18
- 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 +31 -41
- package/src/main/js/sap/ushell_abap/adapters/abap/FlpLaunchPageAdapter.js +430 -555
- 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 +1 -1
- package/src/main/js/sap/ushell_abap/adapters/abap/PersonalizationAdapter.js +1 -1
- 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 +119 -125
- package/src/main/js/sap/ushell_abap/adapters/hana/ContainerAdapter.js +27 -33
- package/src/main/js/sap/ushell_abap/bootstrap/PageSetsRequestHandler.js +25 -50
- package/src/main/js/sap/ushell_abap/bootstrap/SAPCompanionConditionSetter.js +1 -3
- package/src/main/js/sap/ushell_abap/integration/fileshares/NavTargetResolutionFileShareSupport.js +3 -1
- package/src/main/js/sap/ushell_abap/library.js +1 -1
- package/src/main/js/sap/ushell_abap/pbServices/ui2/Catalog.js +69 -43
- package/src/main/js/sap/ushell_abap/pbServices/ui2/Chip.js +53 -64
- package/src/main/js/sap/ushell_abap/pbServices/ui2/ODataWrapper.js +63 -78
- package/src/main/js/sap/ushell_abap/pbServices/ui2/Page.js +12 -15
- package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/configurationUi.js +10 -2
- package/src/main/js/sap/ushell_abap/services/NavigationDataProvider.js +4 -4
- package/src/main/js/sap/ushell_abap/ui5appruntime/AppInfoAdapter.js +19 -18
- package/ui5.yaml +1 -3
|
@@ -1,25 +1,23 @@
|
|
|
1
1
|
// Copyright (c) 2009-2026 SAP SE, All Rights Reserved
|
|
2
2
|
|
|
3
3
|
sap.ui.define([
|
|
4
|
-
"sap/
|
|
4
|
+
"sap/base/i18n/date/CalendarWeekNumbering",
|
|
5
|
+
"sap/base/Log",
|
|
5
6
|
"sap/ui/thirdparty/datajs",
|
|
6
|
-
"sap/ui/thirdparty/jquery",
|
|
7
7
|
"sap/ui/VersionInfo",
|
|
8
|
-
"sap/base/Log",
|
|
9
|
-
"sap/ushell/resources",
|
|
10
|
-
"sap/base/i18n/date/CalendarWeekNumbering",
|
|
11
8
|
"sap/ushell/Config",
|
|
12
|
-
"sap/ushell/
|
|
9
|
+
"sap/ushell/resources",
|
|
10
|
+
"sap/ushell/utils/LaunchpadError",
|
|
11
|
+
"sap/ushell_abap/pbServices/ui2/ODataWrapper"
|
|
13
12
|
], (
|
|
14
|
-
|
|
13
|
+
CalendarWeekNumbering,
|
|
14
|
+
Log,
|
|
15
15
|
datajs,
|
|
16
|
-
jQuery,
|
|
17
16
|
VersionInfo,
|
|
18
|
-
Log,
|
|
19
|
-
resources,
|
|
20
|
-
CalendarWeekNumbering,
|
|
21
17
|
Config,
|
|
22
|
-
|
|
18
|
+
resources,
|
|
19
|
+
LaunchpadError,
|
|
20
|
+
ODataWrapper
|
|
23
21
|
) => {
|
|
24
22
|
"use strict";
|
|
25
23
|
|
|
@@ -81,45 +79,42 @@ sap.ui.define([
|
|
|
81
79
|
return {
|
|
82
80
|
themes: aThemes,
|
|
83
81
|
sets: aThemeSets,
|
|
84
|
-
themeRoot: sThemeRoot //
|
|
82
|
+
themeRoot: sThemeRoot // needed for calculate avatar urls
|
|
85
83
|
};
|
|
86
84
|
};
|
|
87
85
|
|
|
88
86
|
/**
|
|
89
87
|
* Returns the list of themes available for the user.
|
|
90
88
|
*
|
|
91
|
-
* @returns {
|
|
89
|
+
* @returns {Promise} Resolves the theme list.
|
|
92
90
|
*/
|
|
93
|
-
this.getThemeList = function () {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
Log.error(oError.message, oError, "sap.ushell_abap.adapters.abap.UserInfoAdapter");
|
|
106
|
-
// fallback to the previous implementation via /UI2/INTEROP
|
|
91
|
+
this.getThemeList = async function () {
|
|
92
|
+
try {
|
|
93
|
+
const oThemeList = await this._getThemeList();
|
|
94
|
+
return {
|
|
95
|
+
options: oThemeList.themes, // rename for compatibility with previous implementation
|
|
96
|
+
sets: oThemeList.sets,
|
|
97
|
+
themeRoot: oThemeList.themeRoot
|
|
98
|
+
};
|
|
99
|
+
} catch (oError) {
|
|
100
|
+
Log.error(oError.message, oError, "sap.ushell_abap.adapters.abap.UserInfoAdapter");
|
|
101
|
+
// fallback to the previous implementation via /UI2/INTEROP
|
|
102
|
+
return new Promise((resolve, reject) => {
|
|
107
103
|
datajs.read({requestUri: "/sap/opu/odata/UI2/INTEROP/Themes"},
|
|
108
104
|
(oData) => { // success
|
|
109
|
-
|
|
105
|
+
resolve({
|
|
110
106
|
options: oData?.results || []
|
|
111
107
|
});
|
|
112
108
|
},
|
|
113
109
|
(oDataJsError) => { // fail
|
|
114
110
|
Log.error(oDataJsError.message, null, "sap.ushell_abap.adapters.abap.UserInfoAdapter");
|
|
115
|
-
const
|
|
111
|
+
const oFallbackError = new LaunchpadError(`Failed to fetch data: ${oDataJsError.message}`, {
|
|
116
112
|
dataJsError: oDataJsError
|
|
117
113
|
});
|
|
118
|
-
|
|
114
|
+
reject(oFallbackError);
|
|
119
115
|
});
|
|
120
116
|
});
|
|
121
|
-
|
|
122
|
-
return oDeferred.promise();
|
|
117
|
+
}
|
|
123
118
|
};
|
|
124
119
|
|
|
125
120
|
/**
|
|
@@ -150,42 +145,41 @@ sap.ui.define([
|
|
|
150
145
|
/**
|
|
151
146
|
* Returns the list of available language for the user.
|
|
152
147
|
*
|
|
153
|
-
* @returns {
|
|
148
|
+
* @returns {Promise} Resolves the list of languages.
|
|
154
149
|
*/
|
|
155
150
|
this.getLanguageList = function () {
|
|
156
|
-
const oDeferred = new jQuery.Deferred();
|
|
157
151
|
const sUri = encodeURI("/sap/opu/odata/UI2/INTEROP/UserProfilePropertyValues?$filter=id eq 'PREFERRED_LOGON_LANGUAGE'");
|
|
158
152
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
153
|
+
return new Promise((resolve, reject) => {
|
|
154
|
+
// read semantic objects from interop service
|
|
155
|
+
datajs.read({ requestUri: sUri },
|
|
156
|
+
// success
|
|
157
|
+
(oData) => {
|
|
158
|
+
let aResult = [{
|
|
159
|
+
text: resources.i18n.getText("userSettings.browserLanguage"),
|
|
160
|
+
key: DEFAULT_LANGUAGE_KEY
|
|
161
|
+
}];
|
|
162
|
+
const aLanguageListFromServer = oData.results.map((oLanguage) => {
|
|
163
|
+
return {
|
|
164
|
+
text: oLanguage.description,
|
|
165
|
+
key: oLanguage.value
|
|
166
|
+
};
|
|
167
|
+
}).sort((oLanguage1, oLanguage2) => {
|
|
168
|
+
return oLanguage1.text.localeCompare(oLanguage2.text);
|
|
169
|
+
});
|
|
175
170
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
171
|
+
aResult = aResult.concat(aLanguageListFromServer);
|
|
172
|
+
resolve(aResult);
|
|
173
|
+
},
|
|
174
|
+
// fail
|
|
175
|
+
(oDataJsError) => {
|
|
176
|
+
Log.error(oDataJsError.message, null, "sap.ushell_abap.adapters.abap.UserInfoAdapter");
|
|
177
|
+
const oError = new LaunchpadError(`Failed to fetch data: ${oDataJsError.message}`, {
|
|
178
|
+
dataJsError: oDataJsError
|
|
179
|
+
});
|
|
180
|
+
reject(oError);
|
|
184
181
|
});
|
|
185
|
-
|
|
186
|
-
});
|
|
187
|
-
|
|
188
|
-
return oDeferred.promise();
|
|
182
|
+
});
|
|
189
183
|
};
|
|
190
184
|
|
|
191
185
|
/**
|
|
@@ -197,7 +191,7 @@ sap.ui.define([
|
|
|
197
191
|
* This is also the indicator that this user profile property cannot be changed via
|
|
198
192
|
* a call to <code>updateUserPreferences</code>.
|
|
199
193
|
*
|
|
200
|
-
* @returns {
|
|
194
|
+
* @returns {Promise} Resolves an object with the received results, .e.g.:
|
|
201
195
|
* <pre>
|
|
202
196
|
* {
|
|
203
197
|
* "NUMBER_FORMAT": [
|
|
@@ -214,7 +208,6 @@ sap.ui.define([
|
|
|
214
208
|
* @private
|
|
215
209
|
*/
|
|
216
210
|
this.getUserProfilePropertyValueLists = function () {
|
|
217
|
-
const oDeferred = new jQuery.Deferred();
|
|
218
211
|
let sUri;
|
|
219
212
|
const oResult = {};
|
|
220
213
|
const aUserProfilePropertyIds = [
|
|
@@ -226,6 +219,7 @@ sap.ui.define([
|
|
|
226
219
|
];
|
|
227
220
|
|
|
228
221
|
const oODataWrapper = this._createWrapper("/sap/opu/odata/UI2/INTEROP/");
|
|
222
|
+
|
|
229
223
|
oODataWrapper.openBatchQueue();
|
|
230
224
|
let sCurrentId;
|
|
231
225
|
|
|
@@ -245,19 +239,19 @@ sap.ui.define([
|
|
|
245
239
|
);
|
|
246
240
|
}
|
|
247
241
|
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
242
|
+
return new Promise((resolve, reject) => {
|
|
243
|
+
oODataWrapper.submitBatchQueue(
|
|
244
|
+
// success
|
|
245
|
+
() => {
|
|
246
|
+
resolve(oResult);
|
|
247
|
+
},
|
|
248
|
+
// error
|
|
249
|
+
(sErrorMessage) => {
|
|
250
|
+
Log.error(sErrorMessage, null, "sap.ushell_abap.adapters.abap.UserInfoAdapter");
|
|
251
|
+
reject(new Error(sErrorMessage));
|
|
252
|
+
}
|
|
253
|
+
);
|
|
254
|
+
});
|
|
261
255
|
};
|
|
262
256
|
|
|
263
257
|
this._createWrapper = function (sBaseUrl) {
|
|
@@ -269,24 +263,14 @@ sap.ui.define([
|
|
|
269
263
|
*
|
|
270
264
|
* @param {object} oUser User object
|
|
271
265
|
*
|
|
272
|
-
* @returns {
|
|
266
|
+
* @returns {Promise} Resolves once the preferences were updated.
|
|
273
267
|
*/
|
|
274
268
|
this.updateUserPreferences = function (oUser) {
|
|
275
269
|
Log.debug("[000] updateUserPreferences", "UserInfoAdapter");
|
|
276
|
-
const that = this;
|
|
277
270
|
let sRelativeUrl;
|
|
278
271
|
let iODataRequestsRunning;
|
|
279
272
|
let oDataObj;
|
|
280
|
-
|
|
281
|
-
function fnSuccess () {
|
|
282
|
-
iODataRequestsRunning -= 1;
|
|
283
|
-
if (iODataRequestsRunning === 0) {
|
|
284
|
-
oDeferred.resolve();
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
function fnFailure (sErrorMessage, oParsedErrorInformation) {
|
|
288
|
-
oDeferred.reject(new Error(sErrorMessage), oParsedErrorInformation);
|
|
289
|
-
}
|
|
273
|
+
|
|
290
274
|
Log.debug("[000] updateUserPreferences: _createWrapper", "UserInfoAdapter");
|
|
291
275
|
oDataWrapper = this._createWrapper("/sap/opu/odata/UI2/INTEROP/");
|
|
292
276
|
|
|
@@ -294,44 +278,54 @@ sap.ui.define([
|
|
|
294
278
|
Log.debug("[000] updateUserPreferences: oDataWrapper.openBatchQueue", "UserInfoAdapter");
|
|
295
279
|
oDataWrapper.openBatchQueue();
|
|
296
280
|
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
let newValue = oUserChangedProperty.newValue;
|
|
304
|
-
if (name.toUpperCase() === "LANGUAGE") {
|
|
305
|
-
name = "PREFERRED_LOGON_LANGUAGE";
|
|
306
|
-
newValue = newValue === DEFAULT_LANGUAGE_KEY ? undefined : newValue;
|
|
281
|
+
return new Promise((resolve, reject) => {
|
|
282
|
+
function fnSuccess () {
|
|
283
|
+
iODataRequestsRunning -= 1;
|
|
284
|
+
if (iODataRequestsRunning === 0) {
|
|
285
|
+
resolve();
|
|
286
|
+
}
|
|
307
287
|
}
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
"shellType='FLP')"
|
|
311
|
-
].join(",")}`;
|
|
312
|
-
|
|
313
|
-
// the preference to update
|
|
314
|
-
oDataObj = {
|
|
315
|
-
id: name,
|
|
316
|
-
shellType: "FLP",
|
|
317
|
-
value: newValue
|
|
318
|
-
};
|
|
319
|
-
// check for the datatype of the value & process oDataObj
|
|
320
|
-
that._updateODataObjectBasedOnDatatype(newValue, oDataObj);
|
|
321
|
-
Log.debug("[000] updateUserPreferences: oDataWrapper: put", "UserInfoAdapter");
|
|
322
|
-
oDataWrapper.put(sRelativeUrl, oDataObj, fnSuccess, fnFailure);
|
|
323
|
-
});
|
|
324
|
-
Log.debug("[000] updateUserPreferences: submitBatchQueue", "UserInfoAdapter");
|
|
325
|
-
// submit
|
|
326
|
-
oDataWrapper.submitBatchQueue(() => {
|
|
327
|
-
// request accepted but does not mean that the single requests
|
|
328
|
-
// have been successfully resolved - see above
|
|
329
|
-
if (iODataRequestsRunning === 0) {
|
|
330
|
-
oDeferred.resolve();
|
|
288
|
+
function fnFailure (sErrorMessage) {
|
|
289
|
+
reject(new Error(sErrorMessage));
|
|
331
290
|
}
|
|
332
|
-
}, fnFailure);
|
|
333
291
|
|
|
334
|
-
|
|
292
|
+
// put the preferences to update in the OData batch queue
|
|
293
|
+
const aUserChangedProperties = oUser.getChangedProperties() || [];
|
|
294
|
+
Log.debug("[000] updateUserPreferences: getChangedProperties", "UserInfoAdapter");
|
|
295
|
+
iODataRequestsRunning = aUserChangedProperties.length;
|
|
296
|
+
aUserChangedProperties.forEach((oUserChangedProperty) => {
|
|
297
|
+
let name = oUserChangedProperty.name;
|
|
298
|
+
let newValue = oUserChangedProperty.newValue;
|
|
299
|
+
if (name.toUpperCase() === "LANGUAGE") {
|
|
300
|
+
name = "PREFERRED_LOGON_LANGUAGE";
|
|
301
|
+
newValue = newValue === DEFAULT_LANGUAGE_KEY ? undefined : newValue;
|
|
302
|
+
}
|
|
303
|
+
sRelativeUrl = `UserProfileProperties(${[
|
|
304
|
+
`id='${name}'`,
|
|
305
|
+
"shellType='FLP')"
|
|
306
|
+
].join(",")}`;
|
|
307
|
+
|
|
308
|
+
// the preference to update
|
|
309
|
+
oDataObj = {
|
|
310
|
+
id: name,
|
|
311
|
+
shellType: "FLP",
|
|
312
|
+
value: newValue
|
|
313
|
+
};
|
|
314
|
+
// check for the datatype of the value & process oDataObj
|
|
315
|
+
this._updateODataObjectBasedOnDatatype(newValue, oDataObj);
|
|
316
|
+
Log.debug("[000] updateUserPreferences: oDataWrapper: put", "UserInfoAdapter");
|
|
317
|
+
oDataWrapper.put(sRelativeUrl, oDataObj, fnSuccess, fnFailure);
|
|
318
|
+
});
|
|
319
|
+
Log.debug("[000] updateUserPreferences: submitBatchQueue", "UserInfoAdapter");
|
|
320
|
+
// submit
|
|
321
|
+
oDataWrapper.submitBatchQueue(() => {
|
|
322
|
+
// request accepted but does not mean that the single requests
|
|
323
|
+
// have been successfully resolved - see above
|
|
324
|
+
if (iODataRequestsRunning === 0) {
|
|
325
|
+
resolve();
|
|
326
|
+
}
|
|
327
|
+
}, fnFailure);
|
|
328
|
+
});
|
|
335
329
|
};
|
|
336
330
|
};
|
|
337
331
|
});
|
|
@@ -3,14 +3,16 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* @fileOverview The Unified Shell's container adapter for the HANA platform.
|
|
5
5
|
*
|
|
6
|
-
* @version 1.
|
|
6
|
+
* @version 1.152.0
|
|
7
7
|
*/
|
|
8
8
|
sap.ui.define([
|
|
9
9
|
"sap/ui/thirdparty/jquery",
|
|
10
|
-
"sap/base/Log"
|
|
10
|
+
"sap/base/Log",
|
|
11
|
+
"sap/ushell/base/promisify"
|
|
11
12
|
], (
|
|
12
13
|
jQuery,
|
|
13
|
-
Log
|
|
14
|
+
Log,
|
|
15
|
+
promisify
|
|
14
16
|
) => {
|
|
15
17
|
"use strict";
|
|
16
18
|
|
|
@@ -72,45 +74,37 @@ sap.ui.define([
|
|
|
72
74
|
/**
|
|
73
75
|
* Logs out the current user from this adapter's systems backend system.
|
|
74
76
|
*
|
|
75
|
-
* @returns {
|
|
77
|
+
* @returns {Promise} Resolved when logout is finished, even when it failed
|
|
76
78
|
* @since 1.11.0
|
|
77
79
|
*/
|
|
78
|
-
this.logout = function () {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
},
|
|
87
|
-
|
|
88
|
-
jQuery.ajax({
|
|
80
|
+
this.logout = async function () {
|
|
81
|
+
try {
|
|
82
|
+
const [, , oXhr] = await promisify(jQuery.ajax({
|
|
83
|
+
type: "HEAD",
|
|
84
|
+
url: oSystem.adjustUrl("/sap/hana/xs/formLogin/token.xsjs"),
|
|
85
|
+
headers: {
|
|
86
|
+
"X-CSRF-Token": "Fetch"
|
|
87
|
+
}
|
|
88
|
+
}), /* bWrapDeferredResult */ true);
|
|
89
|
+
try {
|
|
90
|
+
await promisify(jQuery.ajax({
|
|
89
91
|
type: "POST",
|
|
90
92
|
url: oSystem.adjustUrl("/sap/hana/xs/formLogin/logout.xscfunc"),
|
|
91
93
|
headers: {
|
|
92
94
|
"X-CSRF-Token": oXhr.getResponseHeader("X-CSRF-Token")
|
|
93
|
-
},
|
|
94
|
-
success: function () {
|
|
95
|
-
Log.info(`HANA system logged out: ${oSystem.getAlias()}`,
|
|
96
|
-
null, "sap.ushell_abap.adapters.hana.ContainerAdapter");
|
|
97
|
-
oDeferred.resolve();
|
|
98
|
-
},
|
|
99
|
-
error: function () {
|
|
100
|
-
Log.error(`Logging out HANA system failed: ${
|
|
101
|
-
oSystem.getAlias()}`, null,
|
|
102
|
-
"sap.ushell_abap.adapters.hana.ContainerAdapter");
|
|
103
|
-
oDeferred.resolve();
|
|
104
95
|
}
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
error: function () {
|
|
108
|
-
Log.error(`Fetching X-CSRF-Token failed: ${oSystem.getAlias()}`,
|
|
96
|
+
}));
|
|
97
|
+
Log.info(`HANA system logged out: ${oSystem.getAlias()}`,
|
|
109
98
|
null, "sap.ushell_abap.adapters.hana.ContainerAdapter");
|
|
110
|
-
|
|
99
|
+
} catch {
|
|
100
|
+
Log.error(`Logging out HANA system failed: ${
|
|
101
|
+
oSystem.getAlias()}`, null,
|
|
102
|
+
"sap.ushell_abap.adapters.hana.ContainerAdapter");
|
|
111
103
|
}
|
|
112
|
-
}
|
|
113
|
-
|
|
104
|
+
} catch {
|
|
105
|
+
Log.error(`Fetching X-CSRF-Token failed: ${oSystem.getAlias()}`,
|
|
106
|
+
null, "sap.ushell_abap.adapters.hana.ContainerAdapter");
|
|
107
|
+
}
|
|
114
108
|
};
|
|
115
109
|
};
|
|
116
110
|
}, true /* bExport */);
|
|
@@ -5,19 +5,17 @@
|
|
|
5
5
|
*/
|
|
6
6
|
sap.ui.define([
|
|
7
7
|
"sap/base/Log",
|
|
8
|
-
"sap/
|
|
8
|
+
"sap/ushell/base/requireAsync",
|
|
9
9
|
"sap/ushell_abap/bootstrap/XhrFactory",
|
|
10
10
|
"sap/ushell_abap/base/Ui2Utils"
|
|
11
11
|
], (
|
|
12
12
|
Log,
|
|
13
|
-
|
|
13
|
+
requireAsync,
|
|
14
14
|
XhrFactory,
|
|
15
15
|
ui2Utils
|
|
16
16
|
) => {
|
|
17
17
|
"use strict";
|
|
18
18
|
|
|
19
|
-
/* global OData */
|
|
20
|
-
|
|
21
19
|
const S_PAGE_SETS_FALLBACK_URL_BASE = "/sap/opu/odata/UI2/PAGE_BUILDER_PERS";
|
|
22
20
|
const S_PAGE_SETS_FALLBACK_EXPAND = "Pages/PageChipInstances/Chip/ChipBags/ChipProperties,"
|
|
23
21
|
+ "Pages/PageChipInstances/RemoteCatalog,"
|
|
@@ -114,25 +112,6 @@ sap.ui.define([
|
|
|
114
112
|
return sServiceUrl;
|
|
115
113
|
}
|
|
116
114
|
|
|
117
|
-
/**
|
|
118
|
-
* Processes the OData response.
|
|
119
|
-
* @param {jQuery.Deferred} oDeferred the deferred object updating the cache in OData.read
|
|
120
|
-
* @param {int} iStatus the status code
|
|
121
|
-
* @param {string} sCsrfToken the CSRF token
|
|
122
|
-
* @param {string} sResponse the response message
|
|
123
|
-
*
|
|
124
|
-
* @private
|
|
125
|
-
*/
|
|
126
|
-
#processOData (oDeferred, iStatus, sCsrfToken, sResponse) {
|
|
127
|
-
if (iStatus === 200) {
|
|
128
|
-
oDeferred.resolve(JSON.parse(sResponse).d, sCsrfToken);
|
|
129
|
-
} else {
|
|
130
|
-
// rejecting the deferred will make the request later (in the ushell adapter) fail, so
|
|
131
|
-
// the error handling there takes effect
|
|
132
|
-
oDeferred.reject(new Error(`PageSet request failed: ${sResponse}`));
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
115
|
/**
|
|
137
116
|
* Determines the URL for the PageSets OData service from the startup service result. If the URL is not set
|
|
138
117
|
* a hard-coded fallback URL is returned and set in the startupResult.
|
|
@@ -160,35 +139,24 @@ sap.ui.define([
|
|
|
160
139
|
}
|
|
161
140
|
|
|
162
141
|
/**
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
* @param {
|
|
166
|
-
* @returns {
|
|
142
|
+
* Performs an OData GET request using a plain XHR.
|
|
143
|
+
* @param {string} sUrl the url to be requested
|
|
144
|
+
* @param {object} oStartupResult the startup result object, containing the base URL and the CSRF token
|
|
145
|
+
* @returns {Promise<object>} Resolves the response
|
|
167
146
|
*
|
|
168
147
|
* @private
|
|
169
148
|
*/
|
|
170
|
-
#
|
|
171
|
-
const oDeferred =
|
|
149
|
+
#sendODataRequest (sUrl, oStartupResult) {
|
|
150
|
+
const oDeferred = Promise.withResolvers();
|
|
151
|
+
|
|
172
152
|
// creating the deferred objects here should ensure that the ushell adapters later read
|
|
173
153
|
// the responses from the "cache", even if UI5 bootstrap is faster than the
|
|
174
154
|
// OData requests
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
155
|
+
requireAsync(["sap/ui/thirdparty/datajs"]).then(([datajs]) => {
|
|
156
|
+
datajs.read.$cache = datajs.read.$cache || new ui2Utils.Map();
|
|
157
|
+
datajs.read.$cache.put(sUrl, oDeferred.promise);
|
|
178
158
|
});
|
|
179
|
-
return oDeferred;
|
|
180
|
-
}
|
|
181
159
|
|
|
182
|
-
/**
|
|
183
|
-
* Performs an OData GET request using a plain XHR.
|
|
184
|
-
* @param {string} sUrl the url to be requested
|
|
185
|
-
* @param {object} oStartupResult the startup result object, containing the base URL and the CSRF token
|
|
186
|
-
* @param {function(number, object, function)} fnCallback callback function to be called when the request finished,
|
|
187
|
-
* taking the status code, the CSRF token and the response message
|
|
188
|
-
*
|
|
189
|
-
* @private
|
|
190
|
-
*/
|
|
191
|
-
#requestOData (sUrl, oStartupResult, fnCallback) {
|
|
192
160
|
const oXhr = XhrFactory.createAndOpen(sUrl, oStartupResult);
|
|
193
161
|
// set sap-statistics header, see
|
|
194
162
|
// http://help.sap.com/saphelp_nw74/helpdata/de/40/93b81292194d6a926e105c10d5048d/content.htm
|
|
@@ -199,18 +167,25 @@ sap.ui.define([
|
|
|
199
167
|
if (this.readyState !== /* DONE */4) {
|
|
200
168
|
return; // not yet DONE
|
|
201
169
|
}
|
|
202
|
-
|
|
170
|
+
|
|
171
|
+
if (oXhr.status === 200) {
|
|
172
|
+
oDeferred.resolve([JSON.parse(oXhr.responseText).d, undefined /* sCsrfToken */]);
|
|
173
|
+
} else {
|
|
174
|
+
// rejecting the deferred will make the request later (in the ushell adapter) fail, so
|
|
175
|
+
// the error handling there takes effect
|
|
176
|
+
oDeferred.reject(new Error(`PageSet request failed: ${oXhr.responseText}`));
|
|
177
|
+
}
|
|
203
178
|
};
|
|
179
|
+
|
|
204
180
|
oXhr.send();
|
|
181
|
+
|
|
182
|
+
return oDeferred.promise;
|
|
205
183
|
}
|
|
206
184
|
|
|
207
|
-
requestPageSets (oStartupResult) {
|
|
185
|
+
async requestPageSets (oStartupResult) {
|
|
208
186
|
const sPageSetServiceUrl = this.#getAndAdjustPageSetServiceURL(oStartupResult);
|
|
209
|
-
const oDeferred = this.#createODataDeferred(sPageSetServiceUrl);// TODO make as Promise.all
|
|
210
187
|
|
|
211
|
-
this.#
|
|
212
|
-
this.#processOData(oDeferred, iStatus, sCsrfToken, sResponse);
|
|
213
|
-
});
|
|
188
|
+
await this.#sendODataRequest(sPageSetServiceUrl, oStartupResult);
|
|
214
189
|
}
|
|
215
190
|
|
|
216
191
|
/**
|