@openui5/sap.ui.integration 1.112.2 → 1.113.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/THIRDPARTY.txt +1 -1
- package/package.json +6 -6
- package/src/sap/ui/integration/.library +1 -1
- package/src/sap/ui/integration/ActionDefinition.js +1 -1
- package/src/sap/ui/integration/Designtime.js +1 -1
- package/src/sap/ui/integration/Extension.js +27 -3
- package/src/sap/ui/integration/Host.js +31 -8
- package/src/sap/ui/integration/cards/AdaptiveContent.js +30 -40
- package/src/sap/ui/integration/cards/AnalyticalContent.js +14 -5
- package/src/sap/ui/integration/cards/AnalyticsCloudContent.js +18 -7
- package/src/sap/ui/integration/cards/BaseContent.js +113 -41
- package/src/sap/ui/integration/cards/BaseContentRenderer.js +7 -2
- package/src/sap/ui/integration/cards/BaseListContent.js +22 -21
- package/src/sap/ui/integration/cards/CalendarContent.js +5 -12
- package/src/sap/ui/integration/cards/ComponentContent.js +12 -5
- package/src/sap/ui/integration/cards/Footer.js +1 -1
- package/src/sap/ui/integration/cards/Header.js +26 -13
- package/src/sap/ui/integration/cards/ListContent.js +27 -33
- package/src/sap/ui/integration/cards/NumericHeader.js +26 -13
- package/src/sap/ui/integration/cards/ObjectContent.js +29 -14
- package/src/sap/ui/integration/cards/TableContent.js +23 -15
- package/src/sap/ui/integration/cards/TimelineContent.js +11 -10
- package/src/sap/ui/integration/cards/WebPageContent.js +30 -23
- package/src/sap/ui/integration/cards/actions/CardActions.js +1 -1
- package/src/sap/ui/integration/cards/actions/SubmitAction.js +1 -3
- package/src/sap/ui/integration/cards/adaptivecards/elements/UI5InputChoiceSet.js +1 -1
- package/src/sap/ui/integration/cards/adaptivecards/elements/UI5InputDate.js +1 -1
- package/src/sap/ui/integration/cards/adaptivecards/elements/UI5InputNumber.js +1 -1
- package/src/sap/ui/integration/cards/adaptivecards/elements/UI5InputText.js +1 -1
- package/src/sap/ui/integration/cards/adaptivecards/elements/UI5InputToggle.js +1 -1
- package/src/sap/ui/integration/cards/filters/BaseFilter.js +9 -5
- package/src/sap/ui/integration/cards/filters/DateRangeFilter.js +1 -1
- package/src/sap/ui/integration/cards/filters/FilterBar.js +1 -1
- package/src/sap/ui/integration/cards/filters/FilterBarFactory.js +1 -1
- package/src/sap/ui/integration/cards/filters/SearchFilter.js +1 -1
- package/src/sap/ui/integration/cards/filters/SelectFilter.js +1 -1
- package/src/sap/ui/integration/cards/list/MicrochartsResizeHelper.js +1 -1
- package/src/sap/ui/integration/controls/ActionsStrip.js +1 -1
- package/src/sap/ui/integration/controls/ActionsToolbar.js +1 -1
- package/src/sap/ui/integration/controls/LinkWithIcon.js +1 -1
- package/src/sap/ui/integration/controls/ListContentItem.js +35 -2
- package/src/sap/ui/integration/controls/ListContentItemRenderer.js +5 -11
- package/src/sap/ui/integration/controls/Microchart.js +1 -1
- package/src/sap/ui/integration/controls/MicrochartLegend.js +1 -1
- package/src/sap/ui/integration/controls/ObjectStatus.js +6 -2
- package/src/sap/ui/integration/controls/Paginator.js +12 -5
- package/src/sap/ui/integration/controls/PaginatorRenderer.js +0 -1
- package/src/sap/ui/integration/designtime/baseEditor/BaseEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/PropertyEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/PropertyEditors.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/BasePropertyEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/PropertyEditorFactory.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/arrayEditor/ArrayEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/booleanEditor/BooleanEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/codeEditor/CodeEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/dateEditor/DateEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/dateTimeEditor/DateTimeEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/enumStringEditor/EnumStringEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/groupEditor/GroupEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/iconEditor/IconEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/iconEditor/IsInIconPool.validator.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/integerEditor/IntegerEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/jsonEditor/JsonEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/listEditor/ListEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/mapEditor/MapEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/multiSelectEditor/MultiSelectEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/numberEditor/NumberEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/objectArrayEditor/ObjectArrayEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/selectEditor/SelectEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/separatorEditor/SeparatorEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/stringEditor/StringEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/propertyEditor/textAreaEditor/TextAreaEditor.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/util/binding/ObjectBinding.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/util/unset.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/validator/IsBoolean.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/validator/IsDate.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/validator/IsInteger.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/validator/IsNumber.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/validator/IsSelectedKey.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/validator/IsStringList.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/validator/IsUniqueKey.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/validator/IsUniqueList.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/validator/IsValidBinding.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/validator/MaxLength.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/validator/NotABinding.js +1 -1
- package/src/sap/ui/integration/designtime/baseEditor/validator/ValidatorRegistry.js +1 -1
- package/src/sap/ui/integration/designtime/cardEditor/propertyEditor/complexMapEditor/ComplexMapEditor.js +1 -1
- package/src/sap/ui/integration/designtime/cardEditor/propertyEditor/destinationsEditor/DestinationsEditor.js +1 -1
- package/src/sap/ui/integration/designtime/cardEditor/propertyEditor/filtersEditor/FiltersEditor.js +1 -1
- package/src/sap/ui/integration/designtime/cardEditor/propertyEditor/iconEditor/IconEditor.js +1 -1
- package/src/sap/ui/integration/designtime/cardEditor/propertyEditor/parametersEditor/ParametersEditor.js +1 -1
- package/src/sap/ui/integration/designtime/editor/Card.js +1 -1
- package/src/sap/ui/integration/designtime/editor/CardEditor.js +1 -1
- package/src/sap/ui/integration/designtime/editor/CardPreview.js +38 -119
- package/src/sap/ui/integration/editor/Editor.js +85 -66
- package/src/sap/ui/integration/editor/EditorResourceBundles.js +58 -66
- package/src/sap/ui/integration/editor/Extension.js +1 -1
- package/src/sap/ui/integration/editor/Manifest.js +1 -1
- package/src/sap/ui/integration/editor/Settings.js +1 -1
- package/src/sap/ui/integration/editor/fields/BaseField.js +1 -1
- package/src/sap/ui/integration/editor/fields/BooleanField.js +1 -1
- package/src/sap/ui/integration/editor/fields/DateField.js +1 -1
- package/src/sap/ui/integration/editor/fields/DateTimeField.js +1 -1
- package/src/sap/ui/integration/editor/fields/DestinationField.js +15 -12
- package/src/sap/ui/integration/editor/fields/GroupField.js +1 -1
- package/src/sap/ui/integration/editor/fields/IntegerField.js +1 -1
- package/src/sap/ui/integration/editor/fields/NumberField.js +1 -1
- package/src/sap/ui/integration/editor/fields/ObjectField.js +3 -5
- package/src/sap/ui/integration/editor/fields/ObjectListField.js +1 -1
- package/src/sap/ui/integration/editor/fields/StringField.js +2 -4
- package/src/sap/ui/integration/editor/fields/StringListField.js +1 -1
- package/src/sap/ui/integration/editor/fields/fragment/Controller.js +1 -1
- package/src/sap/ui/integration/editor/fields/viz/ColorSelect.js +1 -1
- package/src/sap/ui/integration/editor/fields/viz/IconSelect.js +1 -1
- package/src/sap/ui/integration/editor/fields/viz/ShapeSelect.js +1 -1
- package/src/sap/ui/integration/editor/fields/viz/VizBase.js +1 -1
- package/src/sap/ui/integration/library.js +2 -2
- package/src/sap/ui/integration/messagebundle.properties +69 -6
- package/src/sap/ui/integration/messagebundle_ar.properties +46 -4
- package/src/sap/ui/integration/messagebundle_bg.properties +46 -4
- package/src/sap/ui/integration/messagebundle_ca.properties +46 -4
- package/src/sap/ui/integration/messagebundle_cs.properties +46 -4
- package/src/sap/ui/integration/messagebundle_cy.properties +46 -4
- package/src/sap/ui/integration/messagebundle_da.properties +46 -4
- package/src/sap/ui/integration/messagebundle_de.properties +46 -4
- package/src/sap/ui/integration/messagebundle_el.properties +46 -4
- package/src/sap/ui/integration/messagebundle_en.properties +46 -4
- package/src/sap/ui/integration/messagebundle_en_GB.properties +46 -4
- package/src/sap/ui/integration/messagebundle_en_US_sappsd.properties +46 -4
- package/src/sap/ui/integration/messagebundle_en_US_saprigi.properties +45 -3
- package/src/sap/ui/integration/messagebundle_en_US_saptrc.properties +47 -5
- package/src/sap/ui/integration/messagebundle_es.properties +46 -4
- package/src/sap/ui/integration/messagebundle_es_MX.properties +46 -4
- package/src/sap/ui/integration/messagebundle_et.properties +46 -4
- package/src/sap/ui/integration/messagebundle_fi.properties +46 -4
- package/src/sap/ui/integration/messagebundle_fr.properties +43 -1
- package/src/sap/ui/integration/messagebundle_fr_CA.properties +43 -1
- package/src/sap/ui/integration/messagebundle_hi.properties +46 -4
- package/src/sap/ui/integration/messagebundle_hr.properties +46 -4
- package/src/sap/ui/integration/messagebundle_hu.properties +46 -4
- package/src/sap/ui/integration/messagebundle_id.properties +46 -4
- package/src/sap/ui/integration/messagebundle_it.properties +46 -4
- package/src/sap/ui/integration/messagebundle_iw.properties +46 -4
- package/src/sap/ui/integration/messagebundle_ja.properties +46 -4
- package/src/sap/ui/integration/messagebundle_kk.properties +46 -4
- package/src/sap/ui/integration/messagebundle_ko.properties +43 -1
- package/src/sap/ui/integration/messagebundle_lt.properties +46 -4
- package/src/sap/ui/integration/messagebundle_lv.properties +46 -4
- package/src/sap/ui/integration/messagebundle_ms.properties +46 -4
- package/src/sap/ui/integration/messagebundle_nl.properties +46 -4
- package/src/sap/ui/integration/messagebundle_no.properties +46 -4
- package/src/sap/ui/integration/messagebundle_pl.properties +46 -4
- package/src/sap/ui/integration/messagebundle_pt.properties +46 -4
- package/src/sap/ui/integration/messagebundle_pt_PT.properties +46 -4
- package/src/sap/ui/integration/messagebundle_ro.properties +46 -4
- package/src/sap/ui/integration/messagebundle_ru.properties +46 -4
- package/src/sap/ui/integration/messagebundle_sh.properties +46 -4
- package/src/sap/ui/integration/messagebundle_sk.properties +46 -4
- package/src/sap/ui/integration/messagebundle_sl.properties +46 -4
- package/src/sap/ui/integration/messagebundle_sv.properties +46 -4
- package/src/sap/ui/integration/messagebundle_th.properties +43 -1
- package/src/sap/ui/integration/messagebundle_tr.properties +46 -4
- package/src/sap/ui/integration/messagebundle_uk.properties +48 -6
- package/src/sap/ui/integration/messagebundle_vi.properties +46 -4
- package/src/sap/ui/integration/messagebundle_zh_CN.properties +46 -4
- package/src/sap/ui/integration/messagebundle_zh_TW.properties +46 -4
- package/src/sap/ui/integration/model/ContextModel.js +1 -1
- package/src/sap/ui/integration/model/ObservableModel.js +1 -1
- package/src/sap/ui/integration/model/PagingModelListBinding.js +1 -1
- package/src/sap/ui/integration/schemas/sap-card.json +51 -3
- package/src/sap/ui/integration/themes/base/Card.less +1 -1
- package/src/sap/ui/integration/themes/base/ListContentItem.less +4 -27
- package/src/sap/ui/integration/themes/base/ObjectStatusIcons.less +4 -6
- package/src/sap/ui/integration/util/BaseFactory.js +1 -1
- package/src/sap/ui/integration/util/BindingHelper.js +1 -1
- package/src/sap/ui/integration/util/BindingResolver.js +1 -1
- package/src/sap/ui/integration/util/CacheAndRequestDataProvider.js +3 -3
- package/src/sap/ui/integration/util/CardObserver.js +2 -2
- package/src/sap/ui/integration/util/ContentFactory.js +15 -7
- package/src/sap/ui/integration/util/CsrfTokenHandler.js +7 -7
- package/src/sap/ui/integration/util/DataProvider.js +8 -3
- package/src/sap/ui/integration/util/DataProviderFactory.js +1 -1
- package/src/sap/ui/integration/util/Destinations.js +1 -1
- package/src/sap/ui/integration/util/ErrorHandler.js +297 -0
- package/src/sap/ui/integration/util/ExtensionDataProvider.js +1 -1
- package/src/sap/ui/integration/util/Form.js +11 -6
- package/src/sap/ui/integration/util/HeaderFactory.js +4 -3
- package/src/sap/ui/integration/util/JSONBindingHelper.js +1 -1
- package/src/sap/ui/integration/util/LoadingProvider.js +2 -18
- package/src/sap/ui/integration/util/Manifest.js +1 -1
- package/src/sap/ui/integration/util/RequestDataProvider.js +163 -77
- package/src/sap/ui/integration/util/ServiceDataProvider.js +1 -1
- package/src/sap/ui/integration/util/ServiceManager.js +1 -1
- package/src/sap/ui/integration/util/SkeletonCard.js +19 -2
- package/src/sap/ui/integration/util/Utils.js +1 -1
- package/src/sap/ui/integration/util/Validators.js +1 -1
- package/src/sap/ui/integration/widgets/Card.js +95 -127
|
@@ -5,14 +5,13 @@
|
|
|
5
5
|
*/
|
|
6
6
|
sap.ui.define([
|
|
7
7
|
"sap/ui/integration/util/DataProvider",
|
|
8
|
-
"sap/ui/thirdparty/jquery",
|
|
9
8
|
"sap/base/Log",
|
|
10
9
|
"sap/ui/model/odata/v4/ODataUtils",
|
|
11
10
|
"sap/ui/core/Core",
|
|
11
|
+
"sap/base/util/fetch",
|
|
12
12
|
"sap/base/util/deepClone"
|
|
13
|
-
], function (DataProvider,
|
|
13
|
+
], function (DataProvider, Log, ODataUtils, Core, fetch, deepClone) {
|
|
14
14
|
"use strict";
|
|
15
|
-
/*global Response*/
|
|
16
15
|
|
|
17
16
|
/**
|
|
18
17
|
* @const List of HTTP response status codes for which the request can be retried.
|
|
@@ -21,6 +20,39 @@ sap.ui.define([
|
|
|
21
20
|
|
|
22
21
|
var aModes = ["no-cors", "same-origin", "cors"];
|
|
23
22
|
var aMethods = ["GET", "POST", "HEAD", "PUT", "PATCH", "DELETE", "OPTIONS"];
|
|
23
|
+
var mDataTypeHeaders = {
|
|
24
|
+
"json": "application/json, */*",
|
|
25
|
+
"xml": "application/xml, text/xml, */*"
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
function combineUrlAndParams(sUrl, oParameters) {
|
|
29
|
+
// url query parameters
|
|
30
|
+
var sParamsString = Object.entries(oParameters).map(function (oParam) {
|
|
31
|
+
return encodeURIComponent(oParam[0]) + "=" + encodeURIComponent(oParam[1]);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
return sUrl + (sUrl.indexOf("?") !== -1 ? "&" : "?") + sParamsString.join('&');
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function isJsonResponse(oResponse) {
|
|
38
|
+
var sContentType = oResponse.headers.get("Content-Type");
|
|
39
|
+
|
|
40
|
+
if (!sContentType) {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return sContentType.indexOf("application/json") !== -1;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function isXmlResponse(oResponse) {
|
|
48
|
+
var sContentType = oResponse.headers.get("Content-Type");
|
|
49
|
+
|
|
50
|
+
if (!sContentType) {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return sContentType.indexOf("application/xml") !== -1 || sContentType.indexOf("text/xml") !== -1;
|
|
55
|
+
}
|
|
24
56
|
|
|
25
57
|
/**
|
|
26
58
|
* Constructor for a new <code>RequestDataProvider</code>.
|
|
@@ -33,7 +65,7 @@ sap.ui.define([
|
|
|
33
65
|
* @extends sap.ui.integration.util.DataProvider
|
|
34
66
|
*
|
|
35
67
|
* @author SAP SE
|
|
36
|
-
* @version 1.
|
|
68
|
+
* @version 1.113.0
|
|
37
69
|
*
|
|
38
70
|
* @constructor
|
|
39
71
|
* @private
|
|
@@ -74,8 +106,8 @@ sap.ui.define([
|
|
|
74
106
|
DataProvider.prototype.destroy.apply(this, arguments);
|
|
75
107
|
};
|
|
76
108
|
|
|
77
|
-
RequestDataProvider.prototype.
|
|
78
|
-
return this.
|
|
109
|
+
RequestDataProvider.prototype.getLastResponse = function () {
|
|
110
|
+
return this._lastResponse;
|
|
79
111
|
};
|
|
80
112
|
|
|
81
113
|
/**
|
|
@@ -108,7 +140,7 @@ sap.ui.define([
|
|
|
108
140
|
};
|
|
109
141
|
|
|
110
142
|
RequestDataProvider.prototype._handleExpiredToken = function (oError) {
|
|
111
|
-
if (this._oCsrfTokenHandler.isExpiredToken(this.
|
|
143
|
+
if (this._oCsrfTokenHandler.isExpiredToken(this.getLastResponse())) {
|
|
112
144
|
// csrf token has expired, reset the token and retry this whole request
|
|
113
145
|
this._oCsrfTokenHandler.resetTokenByRequest(this.getSettings().request);
|
|
114
146
|
|
|
@@ -132,45 +164,59 @@ sap.ui.define([
|
|
|
132
164
|
Log.error("To specify dataType property in the Request Configuration, first set allowCustomDataType to 'true'.");
|
|
133
165
|
}
|
|
134
166
|
|
|
135
|
-
var
|
|
136
|
-
|
|
167
|
+
var sUrl = oRequestConfig.url,
|
|
168
|
+
oParameters = oRequestConfig.parameters,
|
|
137
169
|
sDataType = (this.getAllowCustomDataType() && oRequestConfig.dataType) || "json",
|
|
138
170
|
mHeaders = oRequestConfig.headers || {},
|
|
139
171
|
mBatchRequests = oRequestConfig.batch,
|
|
140
172
|
oBatchSerialized,
|
|
141
|
-
oRequest
|
|
173
|
+
oRequest,
|
|
174
|
+
vBody,
|
|
175
|
+
sMethod = oRequestConfig.method && oRequestConfig.method.toUpperCase() || "GET",
|
|
176
|
+
bJsonRequest = this._hasHeader(oRequestConfig, "Content-Type", "application/json"),
|
|
177
|
+
bGetMethod = ["GET", "HEAD"].includes(sMethod);
|
|
142
178
|
|
|
143
179
|
if ( !sUrl.startsWith("/")) {
|
|
144
180
|
sUrl = this._getRuntimeUrl(oRequestConfig.url);
|
|
145
181
|
}
|
|
146
182
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
183
|
+
if (oParameters) {
|
|
184
|
+
if (bJsonRequest) {
|
|
185
|
+
// application/json
|
|
186
|
+
vBody = JSON.stringify(oParameters);
|
|
187
|
+
} else if (bGetMethod) {
|
|
188
|
+
sUrl = combineUrlAndParams(sUrl, oParameters);
|
|
189
|
+
} else {
|
|
190
|
+
// application/x-www-form-urlencoded
|
|
191
|
+
vBody = new URLSearchParams(oParameters);
|
|
192
|
+
}
|
|
150
193
|
}
|
|
151
194
|
|
|
152
195
|
if (mBatchRequests) {
|
|
153
196
|
oBatchSerialized = ODataUtils.serializeBatchRequest(Object.values(mBatchRequests));
|
|
154
|
-
|
|
155
|
-
vData = oBatchSerialized.body;
|
|
197
|
+
vBody = oBatchSerialized.body;
|
|
156
198
|
mHeaders = Object.assign({}, mHeaders, oBatchSerialized.headers);
|
|
157
199
|
}
|
|
158
200
|
|
|
159
201
|
oRequest = {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
"headers": mHeaders,
|
|
166
|
-
"timeout": oRequestConfig.timeout !== undefined ? oRequestConfig.timeout : 15000,
|
|
167
|
-
"xhrFields": {
|
|
168
|
-
"withCredentials": !!oRequestConfig.withCredentials
|
|
202
|
+
url: sUrl,
|
|
203
|
+
options: {
|
|
204
|
+
mode: oRequestConfig.mode || "cors",
|
|
205
|
+
method: sMethod,
|
|
206
|
+
headers: new Headers(mHeaders)
|
|
169
207
|
}
|
|
170
208
|
};
|
|
171
209
|
|
|
172
|
-
if (
|
|
173
|
-
|
|
210
|
+
if (vBody) {
|
|
211
|
+
oRequest.options.body = vBody;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
if (oRequestConfig.withCredentials) {
|
|
215
|
+
oRequest.options.credentials = "include";
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
if (!oRequest.options.headers.get("Accept") && mDataTypeHeaders[sDataType]) {
|
|
219
|
+
oRequest.options.headers.set("Accept", mDataTypeHeaders[sDataType]);
|
|
174
220
|
}
|
|
175
221
|
|
|
176
222
|
oRequest = this._modifyRequestBeforeSent(oRequest, this.getSettings());
|
|
@@ -192,58 +238,54 @@ sap.ui.define([
|
|
|
192
238
|
}.bind(this));
|
|
193
239
|
};
|
|
194
240
|
|
|
195
|
-
/**
|
|
196
|
-
* Sends a request with jQuery.ajax(). Wrapped in a Promise.
|
|
197
|
-
* @param {Object} oRequest The request to be sent with jQuery.ajax().
|
|
198
|
-
* @param {boolean} bNoRetry Set to true if this request should not be retried when failed.
|
|
199
|
-
* @returns {Promise} A Promise which is resolved when request is done and rejected when it fails.
|
|
200
|
-
*/
|
|
201
241
|
RequestDataProvider.prototype._request = function (oRequest, bNoRetry) {
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
}
|
|
242
|
+
var fnFetch = this._getFetchMethod();
|
|
243
|
+
return fnFetch(oRequest.url, oRequest.options)
|
|
244
|
+
.then(function (oResponse) {
|
|
245
|
+
if (this.bIsDestroyed) {
|
|
246
|
+
return Promise.reject("RequestDataProvider is already destroyed before the response is received.");
|
|
247
|
+
}
|
|
209
248
|
|
|
210
|
-
|
|
249
|
+
this._lastResponse = oResponse;
|
|
211
250
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
251
|
+
if (!oResponse.ok) {
|
|
252
|
+
return oResponse.text().then(function (sResponseText) {
|
|
253
|
+
var aError = [oResponse.status + " " + oResponse.statusText, oResponse, sResponseText, oRequest];
|
|
254
|
+
if (bNoRetry) {
|
|
255
|
+
return Promise.reject(aError);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
return this._retryRequest(aError);
|
|
259
|
+
}.bind(this));
|
|
260
|
+
}
|
|
217
261
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
262
|
+
return oResponse.text().then(function (vData) {
|
|
263
|
+
if (isJsonResponse(oResponse)) {
|
|
264
|
+
vData = JSON.parse(vData !== "" ? vData : null);
|
|
265
|
+
} else if (isXmlResponse(oResponse)) {
|
|
266
|
+
vData = (new window.DOMParser()).parseFromString(vData, "text/xml");
|
|
221
267
|
}
|
|
222
268
|
|
|
223
|
-
|
|
269
|
+
return [vData, oResponse];
|
|
270
|
+
});
|
|
224
271
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
this._retryRequest(aError, oRequest).then(resolve, reject);
|
|
231
|
-
}.bind(this));
|
|
232
|
-
}.bind(this));
|
|
272
|
+
}.bind(this), function (oError) {
|
|
273
|
+
return Promise.reject([oError.toString(), null, null, oRequest]);
|
|
274
|
+
});
|
|
233
275
|
};
|
|
234
276
|
|
|
235
277
|
/**
|
|
236
278
|
* Retries to send the given request if response status code allows it
|
|
237
279
|
* and if a retry-after value is specified in response header or in the request settings.
|
|
238
|
-
* @param {Array} aError The error from
|
|
239
|
-
* @param {Object} oRequest The request to be sent.
|
|
280
|
+
* @param {Array} aError The error information from first failure.
|
|
240
281
|
* @returns {Promise} A Promise which is fulfilled if retry is successful and rejected otherwise.
|
|
241
282
|
*/
|
|
242
|
-
RequestDataProvider.prototype._retryRequest = function (aError
|
|
243
|
-
var
|
|
244
|
-
|
|
283
|
+
RequestDataProvider.prototype._retryRequest = function (aError) {
|
|
284
|
+
var oResponse = aError[1],
|
|
285
|
+
oRequest = aError[3],
|
|
286
|
+
iRetryAfter = this._getRetryAfter(oResponse);
|
|
245
287
|
|
|
246
|
-
if (!RETRY_STATUS_CODES.includes(
|
|
288
|
+
if (!RETRY_STATUS_CODES.includes(oResponse.status)) {
|
|
247
289
|
// Request should not be retried.
|
|
248
290
|
return Promise.reject(aError);
|
|
249
291
|
}
|
|
@@ -254,7 +296,8 @@ sap.ui.define([
|
|
|
254
296
|
}
|
|
255
297
|
|
|
256
298
|
if (this._iRetryAfterTimeout) {
|
|
257
|
-
|
|
299
|
+
aError[0] = "The retry was already scheduled.";
|
|
300
|
+
return Promise.reject(aError);
|
|
258
301
|
}
|
|
259
302
|
|
|
260
303
|
return new Promise(function (resolve, reject) {
|
|
@@ -267,12 +310,12 @@ sap.ui.define([
|
|
|
267
310
|
|
|
268
311
|
/**
|
|
269
312
|
* Reads retry-after value from response headers or from settings.
|
|
270
|
-
* @param {
|
|
313
|
+
* @param {Response} oResponse The failed response.
|
|
271
314
|
* @returns {int} The number of seconds after which to retry the request.
|
|
272
315
|
*/
|
|
273
|
-
RequestDataProvider.prototype._getRetryAfter = function (
|
|
316
|
+
RequestDataProvider.prototype._getRetryAfter = function (oResponse) {
|
|
274
317
|
var oRequestConfig = this.getSettings().request,
|
|
275
|
-
vRetryAfter =
|
|
318
|
+
vRetryAfter = oResponse.headers.get("Retry-After") || oRequestConfig.retryAfter;
|
|
276
319
|
|
|
277
320
|
if (!vRetryAfter) {
|
|
278
321
|
return 0;
|
|
@@ -290,6 +333,32 @@ sap.ui.define([
|
|
|
290
333
|
return parseInt(vRetryAfter);
|
|
291
334
|
};
|
|
292
335
|
|
|
336
|
+
/**
|
|
337
|
+
* Gets the method which should execute the HTTP fetch.
|
|
338
|
+
* @private
|
|
339
|
+
* @returns {Function} The function to use for HTTP fetch.
|
|
340
|
+
*/
|
|
341
|
+
RequestDataProvider.prototype._getFetchMethod = function () {
|
|
342
|
+
var oRequestSettings = this.getSettings().request,
|
|
343
|
+
oCard = Core.byId(this.getCard()),
|
|
344
|
+
oExtension = oCard && oCard.getAggregation("_extension"),
|
|
345
|
+
oHost = Core.byId(this.getHost());
|
|
346
|
+
|
|
347
|
+
if (oExtension) {
|
|
348
|
+
return function (sResource, mOptions) {
|
|
349
|
+
return oExtension.fetch(sResource, mOptions, deepClone(oRequestSettings, 1000));
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
if (oHost) {
|
|
354
|
+
return function (sResource, mOptions) {
|
|
355
|
+
return oHost.fetch(sResource, mOptions, deepClone(oRequestSettings, 1000), oCard);
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
return fetch;
|
|
360
|
+
};
|
|
361
|
+
|
|
293
362
|
/**
|
|
294
363
|
* Checks if header with given value is part of the request.
|
|
295
364
|
* Header name is case-insensitive, but the value is case-sensitive (RFC7230 https://tools.ietf.org/html/rfc7230#section-3.2).
|
|
@@ -317,14 +386,32 @@ sap.ui.define([
|
|
|
317
386
|
RequestDataProvider.prototype._isValidRequest = function (oRequest) {
|
|
318
387
|
|
|
319
388
|
if (!oRequest) {
|
|
389
|
+
Log.error("Request is not valid. Request object is missing.");
|
|
390
|
+
return false;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
if (!oRequest.url) {
|
|
394
|
+
Log.error("Request is not valid. URL is missing.");
|
|
395
|
+
return false;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
if (!oRequest.options) {
|
|
399
|
+
Log.error("Request is not valid. Options are missing.");
|
|
400
|
+
return false;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
if (aModes.indexOf(oRequest.options.mode) === -1) {
|
|
404
|
+
Log.error("Request is not valid. Mode is not among " + aModes.toString());
|
|
320
405
|
return false;
|
|
321
406
|
}
|
|
322
407
|
|
|
323
|
-
if (
|
|
408
|
+
if (aMethods.indexOf(oRequest.options.method) === -1) {
|
|
409
|
+
Log.error("Request is not valid. Method is not among " + aModes.toString());
|
|
324
410
|
return false;
|
|
325
411
|
}
|
|
326
412
|
|
|
327
|
-
if (
|
|
413
|
+
if (oRequest.options.headers && !(oRequest.options.headers instanceof Headers)) {
|
|
414
|
+
Log.error("Request is not valid. The headers option is not instance of Headers interface.");
|
|
328
415
|
return false;
|
|
329
416
|
}
|
|
330
417
|
|
|
@@ -344,7 +431,7 @@ sap.ui.define([
|
|
|
344
431
|
*/
|
|
345
432
|
RequestDataProvider.prototype._deserializeBatchResponse = function (mBatchRequests, sResponseBody) {
|
|
346
433
|
return new Promise(function(resolve, reject) {
|
|
347
|
-
var sContentType = this.
|
|
434
|
+
var sContentType = this.getLastResponse().headers.get("Content-Type"),
|
|
348
435
|
aBatchResponses = ODataUtils.deserializeBatchResponse(sContentType, sResponseBody, false),
|
|
349
436
|
aKeys = Object.keys(mBatchRequests),
|
|
350
437
|
mResult = {};
|
|
@@ -375,30 +462,29 @@ sap.ui.define([
|
|
|
375
462
|
/**
|
|
376
463
|
* Override if modification to the request is needed.
|
|
377
464
|
* Allows the host to modify the headers or the full request.
|
|
378
|
-
* @param {Object} oRequest The current request
|
|
465
|
+
* @param {Object} oRequest The current request.
|
|
379
466
|
* @param {Object} oSettings The request settings
|
|
380
467
|
* @returns {map} The modified headers
|
|
381
468
|
*/
|
|
382
469
|
RequestDataProvider.prototype._modifyRequestBeforeSent = function (oRequest, oSettings) {
|
|
383
470
|
var oCard = Core.byId(this.getCard()),
|
|
384
471
|
oHost = Core.byId(this.getHost()),
|
|
385
|
-
|
|
472
|
+
oModifiedHeaders;
|
|
386
473
|
|
|
387
474
|
if (!oHost) {
|
|
388
475
|
return oRequest;
|
|
389
476
|
}
|
|
390
477
|
|
|
391
|
-
oClonedRequest = deepClone(oRequest, 100);
|
|
392
|
-
|
|
393
478
|
if (oHost.modifyRequestHeaders) {
|
|
394
|
-
|
|
479
|
+
oModifiedHeaders = oHost.modifyRequestHeaders(Object.fromEntries(oRequest.options.headers), oSettings, oCard);
|
|
480
|
+
oRequest.options.headers = new Headers(oModifiedHeaders);
|
|
395
481
|
}
|
|
396
482
|
|
|
397
483
|
if (oHost.modifyRequest) {
|
|
398
|
-
|
|
484
|
+
oRequest = oHost.modifyRequest(oRequest, oSettings, oCard);
|
|
399
485
|
}
|
|
400
486
|
|
|
401
|
-
return
|
|
487
|
+
return oRequest;
|
|
402
488
|
};
|
|
403
489
|
|
|
404
490
|
/**
|
|
@@ -4,11 +4,15 @@
|
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
|
|
5
5
|
*/
|
|
6
6
|
sap.ui.define([
|
|
7
|
+
"sap/ui/integration/library",
|
|
7
8
|
"sap/ui/integration/widgets/Card",
|
|
8
9
|
"sap/ui/integration/util/ManifestResolver"
|
|
9
|
-
], function (Card, ManifestResolver) {
|
|
10
|
+
], function (library, Card, ManifestResolver) {
|
|
10
11
|
"use strict";
|
|
11
12
|
|
|
13
|
+
//Shortcut to sap.ui.integration.library.CardDataMode
|
|
14
|
+
var CardDataMode = library.CardDataMode;
|
|
15
|
+
|
|
12
16
|
/**
|
|
13
17
|
* Constructor for a new <code>SkeletonCard</code>.
|
|
14
18
|
* @inherit
|
|
@@ -19,7 +23,7 @@ sap.ui.define([
|
|
|
19
23
|
* @extends sap.ui.integration.widgets.Card
|
|
20
24
|
*
|
|
21
25
|
* @author SAP SE
|
|
22
|
-
* @version 1.
|
|
26
|
+
* @version 1.113.0
|
|
23
27
|
*
|
|
24
28
|
* @constructor
|
|
25
29
|
* @private
|
|
@@ -33,6 +37,11 @@ sap.ui.define([
|
|
|
33
37
|
}
|
|
34
38
|
});
|
|
35
39
|
|
|
40
|
+
SkeletonCard.prototype.init = function () {
|
|
41
|
+
Card.prototype.init.apply(this, arguments);
|
|
42
|
+
this.setDataMode(CardDataMode.Active);
|
|
43
|
+
};
|
|
44
|
+
|
|
36
45
|
/**
|
|
37
46
|
* Resolves the card manifest to a static manifest.
|
|
38
47
|
* Processes all bindings and translations then returns the result as a static manifest in which bindings and translations are resolved.
|
|
@@ -50,6 +59,14 @@ sap.ui.define([
|
|
|
50
59
|
return true;
|
|
51
60
|
};
|
|
52
61
|
|
|
62
|
+
/**
|
|
63
|
+
* @override
|
|
64
|
+
*/
|
|
65
|
+
SkeletonCard.prototype.refresh = function () {
|
|
66
|
+
Card.prototype.refresh.apply(this);
|
|
67
|
+
this.startManifestProcessing();
|
|
68
|
+
};
|
|
69
|
+
|
|
53
70
|
/**
|
|
54
71
|
* @override
|
|
55
72
|
* @returns {sap.ui.integration.util.SkeletonCard} The result card.
|