@sapui5/sap.ushell_abap 1.150.1 → 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 +5 -5
- package/src/main/js/sap/ushell_abap/adapters/abap/ClientSideTargetResolutionAdapter.js +19 -24
- 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 +434 -559
- 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 +2 -2
- 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 +4 -4
- 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/base/Ui2Error.js +46 -0
- package/src/main/js/sap/ushell_abap/base/Ui2Utils.js +710 -0
- package/src/main/js/sap/ushell_abap/bootstrap/LoadLaunchpad.js +6 -0
- package/src/main/js/sap/ushell_abap/bootstrap/PageSetsRequestHandler.js +26 -51
- package/src/main/js/sap/ushell_abap/bootstrap/SAPCompanionConditionSetter.js +1 -3
- package/src/main/js/sap/ushell_abap/bootstrap/StartupRequestHandler.js +6 -6
- package/src/main/js/sap/ushell_abap/bootstrap/abapConstants.js +1 -0
- 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/AllCatalogs.js +1 -1
- package/src/main/js/sap/ushell_abap/pbServices/ui2/Bag.js +2 -2
- package/src/main/js/sap/ushell_abap/pbServices/ui2/Catalog.js +71 -45
- package/src/main/js/sap/ushell_abap/pbServices/ui2/Chip.js +55 -66
- package/src/main/js/sap/ushell_abap/pbServices/ui2/ChipDefinition.js +1 -1
- package/src/main/js/sap/ushell_abap/pbServices/ui2/ChipInstance.js +4 -4
- package/src/main/js/sap/ushell_abap/pbServices/ui2/Error.js +5 -37
- package/src/main/js/sap/ushell_abap/pbServices/ui2/Factory.js +3 -3
- package/src/main/js/sap/ushell_abap/pbServices/ui2/ODataService.js +2 -2
- package/src/main/js/sap/ushell_abap/pbServices/ui2/ODataWrapper.js +66 -81
- package/src/main/js/sap/ushell_abap/pbServices/ui2/Page.js +14 -17
- package/src/main/js/sap/ushell_abap/pbServices/ui2/PageBuildingService.js +2 -2
- package/src/main/js/sap/ushell_abap/pbServices/ui2/PageSet.js +2 -2
- package/src/main/js/sap/ushell_abap/pbServices/ui2/Utils.js +5 -703
- package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/actions.js +1 -1
- package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/bag.js +3 -3
- package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/configuration.js +3 -3
- package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/configurationUi.js +11 -3
- package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/search.js +3 -3
- package/src/main/js/sap/ushell_abap/pbServices/ui2/contracts/visible.js +1 -1
- package/src/main/js/sap/ushell_abap/services/NavigationDataProvider.js +126 -0
- package/src/main/js/sap/ushell_abap/ui5appruntime/AppInfoAdapter.js +19 -18
- package/ui5.yaml +7 -6
|
@@ -14,6 +14,7 @@ sap.ui.define([
|
|
|
14
14
|
"sap/ushell_abap/pbServices/ui2/Contracts",
|
|
15
15
|
"sap/ushell/Container",
|
|
16
16
|
"sap/ushell/iconfonts",
|
|
17
|
+
"sap/ushell/utils/LogScope",
|
|
17
18
|
"sap/ushell_abap/integration/WebSsoBridge"
|
|
18
19
|
], (
|
|
19
20
|
Log,
|
|
@@ -27,6 +28,7 @@ sap.ui.define([
|
|
|
27
28
|
Contracts,
|
|
28
29
|
Container,
|
|
29
30
|
IconFonts,
|
|
31
|
+
LogScope,
|
|
30
32
|
WebSsoBridge
|
|
31
33
|
) => {
|
|
32
34
|
"use strict";
|
|
@@ -48,6 +50,10 @@ sap.ui.define([
|
|
|
48
50
|
* @private
|
|
49
51
|
*/
|
|
50
52
|
async run () {
|
|
53
|
+
// Apply targeted log-level scopes before the Container starts up any service.
|
|
54
|
+
// Lets ?sap-ushell-xx-log-scope=navigation,fesr lift just those components to DEBUG without flooding DevTools.
|
|
55
|
+
LogScope.applyFromUrl();
|
|
56
|
+
|
|
51
57
|
const aParallelPromises = [];
|
|
52
58
|
|
|
53
59
|
// Call UI5 Core APIs only after the core is initialized
|
|
@@ -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
|
-
"sap/ushell_abap/
|
|
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
|
/**
|
|
@@ -7,11 +7,9 @@
|
|
|
7
7
|
*/
|
|
8
8
|
sap.ui.define([
|
|
9
9
|
"sap/base/Log",
|
|
10
|
-
"sap/base/util/Deferred",
|
|
11
10
|
"sap/ushell/bootstrap/Config"
|
|
12
11
|
], (
|
|
13
12
|
Log,
|
|
14
|
-
Deferred,
|
|
15
13
|
BootstrapConfig
|
|
16
14
|
) => {
|
|
17
15
|
"use strict";
|
|
@@ -43,7 +41,7 @@ sap.ui.define([
|
|
|
43
41
|
}
|
|
44
42
|
|
|
45
43
|
run () {
|
|
46
|
-
const oDeferred =
|
|
44
|
+
const oDeferred = Promise.withResolvers();
|
|
47
45
|
|
|
48
46
|
function fnKeepTrying () {
|
|
49
47
|
if (this.#counter < this.#timeoutCounter) {
|
|
@@ -4,16 +4,16 @@
|
|
|
4
4
|
*/
|
|
5
5
|
sap.ui.define([
|
|
6
6
|
"sap/base/util/ObjectPath",
|
|
7
|
-
"sap/ushell_abap/bootstrap/XhrFactory",
|
|
8
|
-
"sap/ushell_abap/pbServices/ui2/Utils",
|
|
9
7
|
"sap/ushell/base/SAPBusinessClientEnablement",
|
|
10
|
-
"sap/ushell/bootstrap/Config"
|
|
8
|
+
"sap/ushell/bootstrap/Config",
|
|
9
|
+
"sap/ushell_abap/base/Ui2Utils",
|
|
10
|
+
"sap/ushell_abap/bootstrap/XhrFactory"
|
|
11
11
|
], (
|
|
12
12
|
ObjectPath,
|
|
13
|
-
XhrFactory,
|
|
14
|
-
ui2Utils,
|
|
15
13
|
SAPBusinessClientEnablement,
|
|
16
|
-
BootstrapConfig
|
|
14
|
+
BootstrapConfig,
|
|
15
|
+
ui2Utils,
|
|
16
|
+
XhrFactory
|
|
17
17
|
) => {
|
|
18
18
|
"use strict";
|
|
19
19
|
|
package/src/main/js/sap/ushell_abap/integration/fileshares/NavTargetResolutionFileShareSupport.js
CHANGED
|
@@ -3,10 +3,12 @@
|
|
|
3
3
|
sap.ui.define([
|
|
4
4
|
"sap/base/Log",
|
|
5
5
|
"sap/ui/core/Manifest",
|
|
6
|
+
"sap/ushell/base/promisify",
|
|
6
7
|
"sap/ushell/Container"
|
|
7
8
|
], (
|
|
8
9
|
Log,
|
|
9
10
|
Manifest,
|
|
11
|
+
promisify,
|
|
10
12
|
Container
|
|
11
13
|
) => {
|
|
12
14
|
"use strict";
|
|
@@ -46,7 +48,7 @@ sap.ui.define([
|
|
|
46
48
|
NavTargetResolutionFileShareSupport.getDataSource = function () {
|
|
47
49
|
if (!NavTargetResolutionFileShareSupport._getDataSourcePromise) {
|
|
48
50
|
NavTargetResolutionFileShareSupport._getDataSourcePromise = Container.getServiceAsync("NavTargetResolutionInternal").then((oNavTargetResolutionService) => {
|
|
49
|
-
return oNavTargetResolutionService.resolveHashFragment(FILE_SHARE_INTENT);
|
|
51
|
+
return promisify(oNavTargetResolutionService.resolveHashFragment(FILE_SHARE_INTENT));
|
|
50
52
|
}).then((oResolvedHashFragment) => {
|
|
51
53
|
const sManifestUrl = oResolvedHashFragment && oResolvedHashFragment.applicationDependencies && oResolvedHashFragment.applicationDependencies.manifest;
|
|
52
54
|
if (sManifestUrl) {
|
|
@@ -6,16 +6,14 @@
|
|
|
6
6
|
|
|
7
7
|
sap.ui.define([
|
|
8
8
|
"sap/ui/core/EventBus",
|
|
9
|
-
"sap/ushell_abap/
|
|
10
|
-
"sap/ushell_abap/
|
|
11
|
-
"sap/base/Log"
|
|
12
|
-
"sap/ui/thirdparty/jquery"
|
|
9
|
+
"sap/ushell_abap/base/Ui2Error",
|
|
10
|
+
"sap/ushell_abap/base/Ui2Utils",
|
|
11
|
+
"sap/base/Log"
|
|
13
12
|
], (
|
|
14
13
|
EventBus,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
Log
|
|
18
|
-
jQuery
|
|
14
|
+
Ui2Error,
|
|
15
|
+
Ui2Utils,
|
|
16
|
+
Log
|
|
19
17
|
) => {
|
|
20
18
|
"use strict";
|
|
21
19
|
|
|
@@ -53,11 +51,13 @@ sap.ui.define([
|
|
|
53
51
|
let oAlterEgo; // catalog's representation with all relations removed
|
|
54
52
|
let oCatalogPage;
|
|
55
53
|
let aChips = [];
|
|
56
|
-
let oReadPromise; //
|
|
54
|
+
let oReadPromise; // shared in-flight promise; see read
|
|
55
|
+
let bReadPending = false; // true while oReadPromise is in flight
|
|
57
56
|
let bIsStub = true; // TODO replace by aChips === undefined
|
|
58
57
|
let oCachedRemoteErrorArgs;
|
|
59
58
|
let sId;
|
|
60
59
|
let oReadRegisteredChipsPromise; // see readRegisteredChips
|
|
60
|
+
let bReadRegisteredChipsPending = false; // true while oReadRegisteredChipsPromise is in flight
|
|
61
61
|
let aRegisteredChipIds = [];
|
|
62
62
|
const that = this;
|
|
63
63
|
|
|
@@ -71,7 +71,7 @@ sap.ui.define([
|
|
|
71
71
|
*/
|
|
72
72
|
function checkStub () {
|
|
73
73
|
if (bIsStub) {
|
|
74
|
-
throw new
|
|
74
|
+
throw new Ui2Error(`${that}: page is just a stub`, "Page");
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
|
|
@@ -82,7 +82,7 @@ sap.ui.define([
|
|
|
82
82
|
*/
|
|
83
83
|
function checkAlterEgo () {
|
|
84
84
|
if (!oAlterEgo) {
|
|
85
|
-
throw new
|
|
85
|
+
throw new Ui2Error(`${that}: catalog is just an ID`, "Catalog");
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
|
|
@@ -106,7 +106,9 @@ sap.ui.define([
|
|
|
106
106
|
aChips = [];
|
|
107
107
|
bIsStub = true;
|
|
108
108
|
oReadPromise = undefined;
|
|
109
|
+
bReadPending = false;
|
|
109
110
|
oReadRegisteredChipsPromise = undefined;
|
|
111
|
+
bReadRegisteredChipsPending = false;
|
|
110
112
|
aRegisteredChipIds = [];
|
|
111
113
|
|
|
112
114
|
// delete methods on deleted catalog to prevent wrong behavior
|
|
@@ -141,11 +143,10 @@ sap.ui.define([
|
|
|
141
143
|
this.getRemoteCatalogService = function () {
|
|
142
144
|
return oFactory.getRemoteCatalogService(oAlterEgo) || {
|
|
143
145
|
readChips: function (sBaseUrl, sCatalogId, aChipIds, fnSuccess, fnFailure) {
|
|
144
|
-
Log.error(`Catalog '${oAlterEgo.id}', type '${oAlterEgo.type
|
|
145
|
-
}' not supported`, null, "Catalog");
|
|
146
|
+
Log.error(`Catalog '${oAlterEgo.id}', type '${oAlterEgo.type}' not supported`, null, "Catalog");
|
|
146
147
|
// fake an empty response to make the catalog valid
|
|
147
148
|
// When created with alterEgo, we're still synchronous, so make it async
|
|
148
|
-
|
|
149
|
+
Ui2Utils.callHandler(fnSuccess.bind(null, { results: [] }), undefined, /* async=*/true);
|
|
149
150
|
}
|
|
150
151
|
};
|
|
151
152
|
};
|
|
@@ -199,7 +200,8 @@ sap.ui.define([
|
|
|
199
200
|
* @private
|
|
200
201
|
*/
|
|
201
202
|
this.read = function (bRefresh, fnSuccess, fnFailure) {
|
|
202
|
-
|
|
203
|
+
// only relevant when no read is already in progress
|
|
204
|
+
const oReadDeferred = Promise.withResolvers();
|
|
203
205
|
|
|
204
206
|
/**
|
|
205
207
|
* @param {object} oResult
|
|
@@ -208,7 +210,8 @@ sap.ui.define([
|
|
|
208
210
|
function onCatalogLoaded (oResult) {
|
|
209
211
|
oAlterEgo = oResult;
|
|
210
212
|
initialize();
|
|
211
|
-
|
|
213
|
+
bReadPending = false;
|
|
214
|
+
oReadDeferred.resolve();
|
|
212
215
|
}
|
|
213
216
|
|
|
214
217
|
/**
|
|
@@ -218,7 +221,8 @@ sap.ui.define([
|
|
|
218
221
|
function onChipsLoaded (oResult) {
|
|
219
222
|
oAlterEgo.Chips = oResult;
|
|
220
223
|
initialize();
|
|
221
|
-
|
|
224
|
+
bReadPending = false;
|
|
225
|
+
oReadDeferred.resolve();
|
|
222
226
|
}
|
|
223
227
|
|
|
224
228
|
/**
|
|
@@ -244,10 +248,12 @@ sap.ui.define([
|
|
|
244
248
|
* delivered by the ODataService. See fnFailure parameter of {@link sap.ushell_abap.pbServices.ui2.ODataWrapper#onError}
|
|
245
249
|
* for more details.
|
|
246
250
|
*/
|
|
247
|
-
function couldNotLoadRemoteChips () {
|
|
251
|
+
function couldNotLoadRemoteChips (sErrMsg, oErrDetails) {
|
|
248
252
|
initialize(); // fail gracefully
|
|
249
|
-
|
|
250
|
-
|
|
253
|
+
// Store as array so getCachedRemoteFailureArguments()[0] and [1] work correctly
|
|
254
|
+
oCachedRemoteErrorArgs = [sErrMsg, oErrDetails];
|
|
255
|
+
bReadPending = false;
|
|
256
|
+
oReadDeferred.reject(oCachedRemoteErrorArgs);
|
|
251
257
|
}
|
|
252
258
|
|
|
253
259
|
/**
|
|
@@ -275,21 +281,29 @@ sap.ui.define([
|
|
|
275
281
|
}
|
|
276
282
|
}
|
|
277
283
|
|
|
278
|
-
if (!
|
|
279
|
-
|
|
280
|
-
|
|
284
|
+
if (!bReadPending) {
|
|
285
|
+
bReadPending = true;
|
|
286
|
+
// No in-flight read — start a new one
|
|
287
|
+
oReadPromise = oReadDeferred.promise;
|
|
281
288
|
if (!oAlterEgo || (bRefresh && !oAlterEgo.remoteId)) {
|
|
282
289
|
// read the local catalog if it is unknown yet or if refreshing a non-remote catalog
|
|
283
|
-
oFactory.getPageBuildingService().readCatalog(
|
|
284
|
-
|
|
290
|
+
oFactory.getPageBuildingService().readCatalog(
|
|
291
|
+
sId,
|
|
292
|
+
processLocalResponse,
|
|
293
|
+
(sErrMsg, oErrDetails) => {
|
|
294
|
+
bReadPending = false;
|
|
295
|
+
oReadDeferred.reject([sErrMsg, oErrDetails]);
|
|
296
|
+
}
|
|
297
|
+
);
|
|
285
298
|
} else {
|
|
286
299
|
processLocalResponse.bind(this)(oAlterEgo);
|
|
287
300
|
}
|
|
288
301
|
}
|
|
289
302
|
fnFailure = fnFailure || oFactory.getPageBuildingService().getDefaultErrorHandler();
|
|
290
303
|
// TODO this needs "sap.ushell_abap.pbServices.ui2.utils" which is never required!
|
|
291
|
-
oReadPromise
|
|
292
|
-
|
|
304
|
+
oReadPromise
|
|
305
|
+
.then(() => { Ui2Utils.callHandler(fnSuccess, fnFailure); })
|
|
306
|
+
.catch((aRejectArgs) => { fnFailure(aRejectArgs[0], aRejectArgs[1]); });
|
|
293
307
|
};
|
|
294
308
|
|
|
295
309
|
// "public" methods ----------------------------------------------------------
|
|
@@ -334,7 +348,7 @@ sap.ui.define([
|
|
|
334
348
|
this.addSystemToServiceUrl = function (sServiceUrl, sSystem) {
|
|
335
349
|
/* jslint regexp:true */
|
|
336
350
|
if (sServiceUrl.indexOf("/") !== 0 || sServiceUrl.indexOf("//") === 0) {
|
|
337
|
-
throw new
|
|
351
|
+
throw new Ui2Error(`addSystemToServiceUrl: Invalid URL: ${sServiceUrl}`,
|
|
338
352
|
"Catalog");
|
|
339
353
|
}
|
|
340
354
|
sSystem = sSystem || this.getSystemAlias();
|
|
@@ -495,7 +509,7 @@ sap.ui.define([
|
|
|
495
509
|
*/
|
|
496
510
|
this.getChips = function () {
|
|
497
511
|
if (bIsStub) {
|
|
498
|
-
throw new
|
|
512
|
+
throw new Ui2Error(`${that}: catalog is just a stub`, "Catalog");
|
|
499
513
|
}
|
|
500
514
|
return aChips.slice();
|
|
501
515
|
};
|
|
@@ -657,7 +671,7 @@ sap.ui.define([
|
|
|
657
671
|
*/
|
|
658
672
|
this.load = function (fnSuccess, fnFailure) {
|
|
659
673
|
if (!bIsStub) {
|
|
660
|
-
throw new
|
|
674
|
+
throw new Ui2Error("Catalog is not a stub anymore", "Catalog");
|
|
661
675
|
}
|
|
662
676
|
this.read(false, fnSuccess, fnFailure);
|
|
663
677
|
};
|
|
@@ -686,7 +700,7 @@ sap.ui.define([
|
|
|
686
700
|
oFactory.createChip(oRawChipData);
|
|
687
701
|
});
|
|
688
702
|
// TODO this needs "utils" which is never required!
|
|
689
|
-
|
|
703
|
+
Ui2Utils.callHandler(fnSuccess, fnFailure);
|
|
690
704
|
}
|
|
691
705
|
|
|
692
706
|
function createRemoteChips (oRawData) {
|
|
@@ -734,26 +748,38 @@ sap.ui.define([
|
|
|
734
748
|
*/
|
|
735
749
|
this.readRegisteredChips = function (fnSuccess, fnFailure) {
|
|
736
750
|
function start () {
|
|
737
|
-
const
|
|
751
|
+
const oReadDeferred = Promise.withResolvers();
|
|
738
752
|
const aChipIds = aRegisteredChipIds;
|
|
739
753
|
|
|
740
754
|
aRegisteredChipIds = [];
|
|
755
|
+
bReadRegisteredChipsPending = true;
|
|
741
756
|
if (aChipIds.length) {
|
|
742
|
-
that.readChips(
|
|
743
|
-
|
|
757
|
+
that.readChips(
|
|
758
|
+
aChipIds,
|
|
759
|
+
() => {
|
|
760
|
+
bReadRegisteredChipsPending = false;
|
|
761
|
+
oReadDeferred.resolve();
|
|
762
|
+
},
|
|
763
|
+
(sErrMsg, oErrDetails) => {
|
|
764
|
+
bReadRegisteredChipsPending = false;
|
|
765
|
+
oReadDeferred.reject([sErrMsg, oErrDetails]);
|
|
766
|
+
}
|
|
767
|
+
);
|
|
744
768
|
} else {
|
|
745
|
-
|
|
769
|
+
bReadRegisteredChipsPending = false;
|
|
770
|
+
oReadDeferred.resolve();
|
|
746
771
|
}
|
|
747
|
-
return
|
|
772
|
+
return oReadDeferred.promise;
|
|
748
773
|
}
|
|
749
774
|
|
|
750
|
-
if (!oReadRegisteredChipsPromise ||
|
|
775
|
+
if (!oReadRegisteredChipsPromise || !bReadRegisteredChipsPending) {
|
|
751
776
|
oReadRegisteredChipsPromise = start();
|
|
752
777
|
}
|
|
753
778
|
fnFailure = fnFailure || oFactory.getPageBuildingService().getDefaultErrorHandler();
|
|
754
779
|
// TODO this needs "utils" which is never required!
|
|
755
|
-
oReadRegisteredChipsPromise
|
|
756
|
-
.
|
|
780
|
+
oReadRegisteredChipsPromise
|
|
781
|
+
.then(() => { Ui2Utils.callHandler(fnSuccess, fnFailure); })
|
|
782
|
+
.catch((aRejectArgs) => { fnFailure(aRejectArgs[0], aRejectArgs[1]); });
|
|
757
783
|
};
|
|
758
784
|
|
|
759
785
|
/**
|
|
@@ -788,8 +814,8 @@ sap.ui.define([
|
|
|
788
814
|
* @private
|
|
789
815
|
*/
|
|
790
816
|
this.registerChip = function (oChip) {
|
|
791
|
-
if (
|
|
792
|
-
throw new
|
|
817
|
+
if (bReadRegisteredChipsPending) {
|
|
818
|
+
throw new Ui2Error(
|
|
793
819
|
"Invalid state: registerChip while readRegisteredChips pending",
|
|
794
820
|
"Catalog"
|
|
795
821
|
);
|
|
@@ -821,8 +847,8 @@ sap.ui.define([
|
|
|
821
847
|
*/
|
|
822
848
|
this.remove = function (fnSuccess, fnFailure) {
|
|
823
849
|
checkAlterEgo();
|
|
824
|
-
if (
|
|
825
|
-
throw new
|
|
850
|
+
if (bReadPending) {
|
|
851
|
+
throw new Ui2Error(`Catalog is being refreshed: ${this}`,
|
|
826
852
|
"Catalog");
|
|
827
853
|
}
|
|
828
854
|
|
|
@@ -897,7 +923,7 @@ sap.ui.define([
|
|
|
897
923
|
checkAlterEgo();
|
|
898
924
|
if (Object.hasOwnProperty.call(oCatalogData, "__metadata")) {
|
|
899
925
|
// ODataWrapper#update() relies on __metadata!
|
|
900
|
-
throw new
|
|
926
|
+
throw new Ui2Error("Unsupported __metadata update", "Catalog");
|
|
901
927
|
}
|
|
902
928
|
const oNewAlterEgo = JSON.parse(JSON.stringify(oAlterEgo));
|
|
903
929
|
Object.keys(oCatalogData).forEach((sName) => {
|
|
@@ -931,7 +957,7 @@ sap.ui.define([
|
|
|
931
957
|
sId = vCatalogData;
|
|
932
958
|
}
|
|
933
959
|
if (!sId) {
|
|
934
|
-
throw new
|
|
960
|
+
throw new Ui2Error("Missing ID", "Catalog");
|
|
935
961
|
}
|
|
936
962
|
Log.debug(`Created: ${this}`, null, "Catalog");
|
|
937
963
|
}
|