@openui5/sap.ui.fl 1.127.0 → 1.128.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 +3 -3
- package/src/sap/ui/fl/.library +1 -1
- package/src/sap/ui/fl/ChangePersistence.js +37 -47
- package/src/sap/ui/fl/ChangePersistenceFactory.js +1 -1
- package/src/sap/ui/fl/FakeLrepConnectorLocalStorage.js +1 -1
- package/src/sap/ui/fl/FakeLrepConnectorSessionStorage.js +1 -1
- package/src/sap/ui/fl/FakeLrepLocalStorage.js +1 -1
- package/src/sap/ui/fl/FlexController.js +11 -9
- package/src/sap/ui/fl/FlexControllerFactory.js +1 -1
- package/src/sap/ui/fl/LayerUtils.js +1 -1
- package/src/sap/ui/fl/Utils.js +17 -12
- package/src/sap/ui/fl/apply/_internal/DelegateMediator.js +1 -1
- package/src/sap/ui/fl/apply/_internal/appVariant/DescriptorChangeTypes.js +3 -1
- package/src/sap/ui/fl/apply/_internal/changes/FlexCustomData.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/Utils.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/Preprocessor.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/Registration.js +2 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/RegistrationBuild.js +3 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/AddAnnotationsToOData.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/AddNewInbound.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/AddTechnicalAttributes.js +75 -0
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/ChangeDataSource.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/ChangeInbound.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/ChangeOutbound.js +76 -0
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/RemoveAllInboundsExceptOne.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/SetAch.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/SetDescription.js +44 -0
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/SetTitle.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/fiori/SetAbstract.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/fiori/SetCloudDevAdaptationStatus.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/fiori/SetRegistrationIds.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/ovp/AddNewCard.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/ovp/ChangeCard.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/ovp/DeleteCard.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/AddComponentUsages.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/AddLibrary.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/AddNewModel.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/AddNewModelEnhanceWith.js +56 -9
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/SetFlexExtensionPointEnabled.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/SetMinUI5Version.js +1 -1
- package/src/sap/ui/fl/apply/_internal/connectors/ObjectStorageUtils.js +1 -1
- package/src/sap/ui/fl/apply/_internal/extensionPoint/Processor.js +1 -1
- package/src/sap/ui/fl/apply/_internal/extensionPoint/Registry.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexObjects/AnnotationChange.js +66 -0
- package/src/sap/ui/fl/apply/_internal/flexObjects/AppDescriptorChange.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexObjects/CompVariant.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexObjects/ControllerExtensionChange.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexObjects/FlVariant.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexObjects/FlexObject.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexObjects/FlexObjectFactory.js +12 -1
- package/src/sap/ui/fl/apply/_internal/flexObjects/UIChange.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexObjects/Variant.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexObjects/getVariantAuthor.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexState/FlexObjectState.js +41 -1
- package/src/sap/ui/fl/apply/_internal/flexState/FlexState.js +39 -39
- package/src/sap/ui/fl/apply/_internal/flexState/InitialPrepareFunctions.js +3 -0
- package/src/sap/ui/fl/apply/_internal/flexState/Loader.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexState/ManifestUtils.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexState/UI2Personalization/UI2PersonalizationState.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexState/changes/DependencyHandler.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexState/changes/ExtensionPointState.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexState/changes/UIChangesState.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexState/compVariants/CompVariantMerger.js +9 -2
- package/src/sap/ui/fl/apply/_internal/flexState/compVariants/Utils.js +2 -2
- package/src/sap/ui/fl/apply/_internal/flexState/controlVariants/Switcher.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexState/controlVariants/VariantManagementState.js +1 -1
- package/src/sap/ui/fl/apply/_internal/preprocessors/ControllerExtension.js +1 -1
- package/src/sap/ui/fl/apply/_internal/preprocessors/RegistrationDelegator.js +1 -1
- package/src/sap/ui/fl/apply/_internal/preprocessors/XmlPreprocessor.js +1 -1
- package/src/sap/ui/fl/changeHandler/AddIFrame.js +1 -1
- package/src/sap/ui/fl/changeHandler/AddXML.js +1 -1
- package/src/sap/ui/fl/changeHandler/AddXMLAtExtensionPoint.js +1 -1
- package/src/sap/ui/fl/changeHandler/Base.js +1 -1
- package/src/sap/ui/fl/changeHandler/BaseAddViaDelegate.js +1 -1
- package/src/sap/ui/fl/changeHandler/BaseAddXml.js +13 -4
- package/src/sap/ui/fl/changeHandler/BaseRename.js +1 -1
- package/src/sap/ui/fl/changeHandler/HideControl.js +1 -1
- package/src/sap/ui/fl/changeHandler/MoveControls.js +1 -1
- package/src/sap/ui/fl/changeHandler/MoveElements.js +1 -1
- package/src/sap/ui/fl/changeHandler/PropertyBindingChange.js +1 -1
- package/src/sap/ui/fl/changeHandler/PropertyChange.js +1 -1
- package/src/sap/ui/fl/changeHandler/StashControl.js +1 -1
- package/src/sap/ui/fl/changeHandler/UnhideControl.js +1 -1
- package/src/sap/ui/fl/changeHandler/UnstashControl.js +1 -1
- package/src/sap/ui/fl/changeHandler/UpdateIFrame.js +1 -1
- package/src/sap/ui/fl/descriptorRelated/Utils.js +19 -0
- package/src/sap/ui/fl/descriptorRelated/api/DescriptorChangeFactory.js +4 -4
- package/src/sap/ui/fl/descriptorRelated/api/DescriptorInlineChangeFactory.js +1 -1
- package/src/sap/ui/fl/descriptorRelated/api/DescriptorVariantFactory.js +1 -1
- package/src/sap/ui/fl/initial/_internal/FlexConfiguration.js +1 -1
- package/src/sap/ui/fl/initial/_internal/Storage.js +1 -1
- package/src/sap/ui/fl/initial/_internal/StorageFeaturesMerger.js +1 -1
- package/src/sap/ui/fl/initial/_internal/StorageResultMerger.js +1 -0
- package/src/sap/ui/fl/initial/_internal/StorageUtils.js +2 -1
- package/src/sap/ui/fl/initial/_internal/changeHandlers/ChangeHandlerRegistration.js +1 -1
- package/src/sap/ui/fl/initial/_internal/changeHandlers/ChangeHandlerStorage.js +1 -1
- package/src/sap/ui/fl/initial/_internal/connectors/Utils.js +1 -1
- package/src/sap/ui/fl/initial/_internal/storageResultDisassemble.js +1 -1
- package/src/sap/ui/fl/interfaces/BaseLoadConnector.js +1 -1
- package/src/sap/ui/fl/interfaces/Delegate.js +1 -1
- package/src/sap/ui/fl/library.js +43 -43
- package/src/sap/ui/fl/support/_internal/getAllUIChanges.js +9 -59
- package/src/sap/ui/fl/support/_internal/getChangeDependencies.js +1 -1
- package/src/sap/ui/fl/support/_internal/getFlexObjectInfos.js +53 -0
- package/src/sap/ui/fl/support/_internal/getFlexSettings.js +1 -1
- package/src/sap/ui/fl/support/api/SupportAPI.js +56 -5
- package/src/sap/ui/fl/support/apps/contentbrowser/controller/ContentDetails.controller.js +1 -1
- package/src/sap/ui/fl/support/apps/contentbrowser/controller/ContentDetailsEdit.controller.js +1 -1
- package/src/sap/ui/fl/support/apps/contentbrowser/controller/LayerContentMaster.controller.js +1 -1
- package/src/sap/ui/fl/support/apps/contentbrowser/controller/Layers.controller.js +1 -1
- package/src/sap/ui/fl/support/apps/contentbrowser/lrepConnector/LRepConnector.js +1 -1
- package/src/sap/ui/fl/support/apps/contentbrowser/utils/DataUtils.js +1 -1
- package/src/sap/ui/fl/support/apps/contentbrowser/utils/ErrorUtils.js +1 -1
- package/src/sap/ui/fl/transport/TransportSelection.js +1 -1
- package/src/sap/ui/fl/util/IFrame.js +1 -1
- package/src/sap/ui/fl/util/ManagedObjectModel.js +1 -1
- package/src/sap/ui/fl/util/changePropertyValueByPath.js +13 -2
- package/src/sap/ui/fl/util/resolveBinding.js +1 -1
- package/src/sap/ui/fl/variants/VariantManagement.js +23 -14
- package/src/sap/ui/fl/variants/VariantModel.js +7 -6
- package/src/sap/ui/fl/variants/context/i18n/i18n_en_US_saptrc.properties +12 -12
- package/src/sap/ui/fl/write/_internal/SaveAs.js +11 -12
- package/src/sap/ui/fl/write/_internal/Storage.js +1 -1
- package/src/sap/ui/fl/write/_internal/Versions.js +8 -68
- package/src/sap/ui/fl/write/_internal/appVariant/AppVariant.js +1 -1
- package/src/sap/ui/fl/write/_internal/appVariant/AppVariantFactory.js +1 -1
- package/src/sap/ui/fl/write/_internal/appVariant/AppVariantInlineChange.js +1 -1
- package/src/sap/ui/fl/write/_internal/appVariant/AppVariantInlineChangeFactory.js +65 -16
- package/src/sap/ui/fl/write/_internal/condenser/Condenser.js +1 -1
- package/src/sap/ui/fl/write/_internal/condenser/UIReconstruction.js +1 -1
- package/src/sap/ui/fl/write/_internal/connectors/BackendConnector.js +1 -1
- package/src/sap/ui/fl/write/_internal/connectors/BtpServiceConnector.js +1 -1
- package/src/sap/ui/fl/write/_internal/connectors/KeyUserConnector.js +1 -1
- package/src/sap/ui/fl/write/_internal/connectors/LrepConnector.js +1 -1
- package/src/sap/ui/fl/write/_internal/connectors/NeoLrepConnector.js +1 -1
- package/src/sap/ui/fl/write/_internal/connectors/ObjectPathConnector.js +1 -1
- package/src/sap/ui/fl/write/_internal/connectors/PersonalizationConnector.js +1 -1
- package/src/sap/ui/fl/write/_internal/connectors/SessionStorageConnector.js +1 -0
- package/src/sap/ui/fl/write/_internal/connectors/Utils.js +1 -1
- package/src/sap/ui/fl/write/_internal/extensionPoint/Processor.js +1 -1
- package/src/sap/ui/fl/write/_internal/fieldExtensibility/ABAPAccess.js +1 -1
- package/src/sap/ui/fl/write/_internal/fieldExtensibility/ABAPExtensibilityVariant.js +1 -1
- package/src/sap/ui/fl/write/_internal/fieldExtensibility/ABAPExtensibilityVariantFactory.js +1 -1
- package/src/sap/ui/fl/write/_internal/fieldExtensibility/MultiTenantABAPExtensibilityVariant.js +1 -1
- package/src/sap/ui/fl/write/_internal/fieldExtensibility/ServiceValidation.js +1 -1
- package/src/sap/ui/fl/write/_internal/fieldExtensibility/SingleTenantABAPExtensibilityVariant.js +1 -1
- package/src/sap/ui/fl/write/_internal/fieldExtensibility/UriParser.js +1 -1
- package/src/sap/ui/fl/write/_internal/fieldExtensibility/Utils.js +1 -1
- package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/CAPAccess.js +1 -1
- package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/dialog/CustomFieldCAPDialog.js +1 -1
- package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/editor/propertyEditor/booleanEditor/BooleanEditor.js +1 -1
- package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/editor/propertyEditor/rangeEditor/RangeEditor.js +1 -1
- package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/editor/propertyEditor/timeEditor/TimeEditor.js +1 -1
- package/src/sap/ui/fl/write/_internal/flexState/{FlexObjectState.js → FlexObjectManager.js} +26 -56
- package/src/sap/ui/fl/write/_internal/flexState/UI2Personalization/UI2PersonalizationState.js +1 -1
- package/src/sap/ui/fl/write/_internal/flexState/compVariants/CompVariantState.js +9 -6
- package/src/sap/ui/fl/write/_internal/transport/TransportSelection.js +1 -1
- package/src/sap/ui/fl/write/_internal/transport/Transports.js +1 -1
- package/src/sap/ui/fl/write/api/ContextBasedAdaptationsAPI.js +6 -6
- package/src/sap/ui/fl/write/api/ControlPersonalizationWriteAPI.js +4 -2
- package/src/sap/ui/fl/write/api/FieldExtensibility.js +1 -1
- package/src/sap/ui/fl/write/api/LocalResetAPI.js +3 -4
- package/src/sap/ui/fl/write/api/PersistenceWriteAPI.js +8 -8
- package/src/sap/ui/fl/write/api/TranslationAPI.js +6 -6
- package/src/sap/ui/fl/write/api/VersionsAPI.js +34 -9
|
@@ -6,30 +6,28 @@
|
|
|
6
6
|
|
|
7
7
|
sap.ui.define([
|
|
8
8
|
"sap/base/util/restricted/_omit",
|
|
9
|
-
"sap/ui/fl/apply/_internal/flexObjects/States",
|
|
10
9
|
"sap/ui/fl/apply/_internal/flexState/changes/UIChangesState",
|
|
11
10
|
"sap/ui/fl/apply/_internal/flexState/compVariants/CompVariantMerger",
|
|
12
11
|
"sap/ui/fl/apply/_internal/flexState/controlVariants/VariantManagementState",
|
|
12
|
+
"sap/ui/fl/apply/_internal/flexState/FlexObjectState",
|
|
13
13
|
"sap/ui/fl/apply/_internal/flexState/FlexState",
|
|
14
14
|
"sap/ui/fl/apply/_internal/flexState/ManifestUtils",
|
|
15
15
|
"sap/ui/fl/write/_internal/flexState/compVariants/CompVariantState",
|
|
16
16
|
"sap/ui/fl/write/_internal/Versions",
|
|
17
17
|
"sap/ui/fl/FlexControllerFactory",
|
|
18
|
-
"sap/ui/fl/ChangePersistenceFactory",
|
|
19
18
|
"sap/ui/fl/LayerUtils",
|
|
20
19
|
"sap/ui/fl/Utils"
|
|
21
20
|
], function(
|
|
22
21
|
_omit,
|
|
23
|
-
States,
|
|
24
22
|
UIChangesState,
|
|
25
23
|
CompVariantMerger,
|
|
26
24
|
VariantManagementState,
|
|
25
|
+
FlexObjectState,
|
|
27
26
|
FlexState,
|
|
28
27
|
ManifestUtils,
|
|
29
28
|
CompVariantState,
|
|
30
29
|
Versions,
|
|
31
30
|
FlexControllerFactory,
|
|
32
|
-
ChangePersistenceFactory,
|
|
33
31
|
LayerUtils,
|
|
34
32
|
Utils
|
|
35
33
|
) {
|
|
@@ -37,13 +35,13 @@ sap.ui.define([
|
|
|
37
35
|
|
|
38
36
|
/**
|
|
39
37
|
* @namespace
|
|
40
|
-
* @alias sap.ui.fl.write._internal.flexState.
|
|
38
|
+
* @alias sap.ui.fl.write._internal.flexState.FlexObjectManager
|
|
41
39
|
* @since 1.83
|
|
42
|
-
* @version 1.
|
|
40
|
+
* @version 1.128.0
|
|
43
41
|
* @private
|
|
44
42
|
* @ui5-restricted sap.ui.fl
|
|
45
43
|
*/
|
|
46
|
-
var
|
|
44
|
+
var FlexObjectManager = {};
|
|
47
45
|
|
|
48
46
|
function getCompVariantEntities(mPropertyBag) {
|
|
49
47
|
const aEntities = [];
|
|
@@ -82,11 +80,6 @@ sap.ui.define([
|
|
|
82
80
|
return CompVariantState.persistAll(sReference);
|
|
83
81
|
}
|
|
84
82
|
|
|
85
|
-
function getChangePersistence(mPropertyBag) {
|
|
86
|
-
mPropertyBag.reference ||= ManifestUtils.getFlexReferenceForSelector(mPropertyBag.selector);
|
|
87
|
-
return ChangePersistenceFactory.getChangePersistenceForComponent(mPropertyBag.reference);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
83
|
function saveChangePersistenceEntities(mPropertyBag, oAppComponent) {
|
|
91
84
|
var oFlexController = FlexControllerFactory.createForSelector(mPropertyBag.selector);
|
|
92
85
|
|
|
@@ -106,7 +99,7 @@ sap.ui.define([
|
|
|
106
99
|
* @param {string} sReference - Flex reference of the application
|
|
107
100
|
* @returns {sap.ui.fl.apply._internal.flexObjects.FlexObject[]} Filtered list of FlexObjects
|
|
108
101
|
*/
|
|
109
|
-
|
|
102
|
+
FlexObjectManager.filterHiddenFlexObjects = function(aFlexObjects, sReference) {
|
|
110
103
|
const aFilteredFlexObjects = VariantManagementState.filterHiddenFlexObjects(aFlexObjects, sReference);
|
|
111
104
|
return CompVariantState.filterHiddenFlexObjects(aFilteredFlexObjects, sReference);
|
|
112
105
|
};
|
|
@@ -124,7 +117,7 @@ sap.ui.define([
|
|
|
124
117
|
* @param {boolean} [mPropertyBag.version] - The version for which the objects are retrieved if the Cache should be invalidated
|
|
125
118
|
* @returns {Promise<sap.ui.fl.apply._internal.flexObjects.FlexObject[]>} Flex objects, containing changes, compVariants & changes as well as ctrl_variant and changes
|
|
126
119
|
*/
|
|
127
|
-
|
|
120
|
+
FlexObjectManager.getFlexObjects = async function(mPropertyBag) {
|
|
128
121
|
mPropertyBag.reference = ManifestUtils.getFlexReferenceForControl(mPropertyBag.selector);
|
|
129
122
|
if (mPropertyBag.invalidateCache) {
|
|
130
123
|
await FlexState.update(mPropertyBag);
|
|
@@ -160,25 +153,6 @@ sap.ui.define([
|
|
|
160
153
|
return aRelevantFlexObjects.concat(getCompVariantEntities(mPropertyBag));
|
|
161
154
|
};
|
|
162
155
|
|
|
163
|
-
/**
|
|
164
|
-
* Collects modified changes from the different states within the <code>sap.ui.fl</code> library.
|
|
165
|
-
* This includes the flexState entities as well as the <code>sap.ui.fl.ChangePersistence</code>.
|
|
166
|
-
*
|
|
167
|
-
* @param {object} mPropertyBag - Object with parameters as properties
|
|
168
|
-
* @param {sap.ui.fl.Selector} mPropertyBag.selector - Retrieves the associated flex persistence
|
|
169
|
-
* @param {boolean} mPropertyBag.includeCtrlVariants - Flag if control variant changes should be included
|
|
170
|
-
* @returns {sap.ui.fl.apply._internal.flexObjects.FlexObject[]} Flex objects, containing changes, compVariants & changes as well as ctrl_variant and changes
|
|
171
|
-
*/
|
|
172
|
-
FlexObjectState.getDirtyFlexObjects = function(mPropertyBag) {
|
|
173
|
-
mPropertyBag.includeDirtyChanges = true;
|
|
174
|
-
var oChangePersistence = getChangePersistence(mPropertyBag);
|
|
175
|
-
var aChangePersistenceEntities = oChangePersistence.getDirtyChanges();
|
|
176
|
-
var aCompVariantEntities = getCompVariantEntities(mPropertyBag);
|
|
177
|
-
return aChangePersistenceEntities.concat(aCompVariantEntities).filter(function(oFlexObject) {
|
|
178
|
-
return oFlexObject.getState() !== States.LifecycleState.PERSISTED;
|
|
179
|
-
});
|
|
180
|
-
};
|
|
181
|
-
|
|
182
156
|
/**
|
|
183
157
|
* Checks if dirty flex objects exist for the flex persistence associated with the selector control;
|
|
184
158
|
* Includes dirty changes on the descriptor as well as dirty changes on SmartVariantManagement of the application.
|
|
@@ -187,12 +161,9 @@ sap.ui.define([
|
|
|
187
161
|
* @param {sap.ui.fl.Selector} mPropertyBag.selector To retrieve the associated flex persistence
|
|
188
162
|
* @returns {boolean} <code>true</code> if dirty flex objects exist
|
|
189
163
|
*/
|
|
190
|
-
|
|
164
|
+
FlexObjectManager.hasDirtyFlexObjects = function(mPropertyBag) {
|
|
191
165
|
var sReference = ManifestUtils.getFlexReferenceForSelector(mPropertyBag.selector);
|
|
192
|
-
|
|
193
|
-
return true;
|
|
194
|
-
}
|
|
195
|
-
return CompVariantState.hasDirtyChanges(sReference);
|
|
166
|
+
return FlexObjectState.getDirtyFlexObjects(sReference).length > 0 || CompVariantState.hasDirtyChanges(sReference);
|
|
196
167
|
};
|
|
197
168
|
|
|
198
169
|
/**
|
|
@@ -211,26 +182,25 @@ sap.ui.define([
|
|
|
211
182
|
* @param {string} [mPropertyBag.adaptationId] - Adaptation to load into Flex State after saving (e.g. undefined when exiting RTA)
|
|
212
183
|
* @returns {Promise<sap.ui.fl.apply._internal.flexObjects.FlexObject[]>} Flex objects, containing changes, compVariants & changes as well as ctrl_variant and changes
|
|
213
184
|
*/
|
|
214
|
-
|
|
185
|
+
FlexObjectManager.saveFlexObjects = async function(mPropertyBag) {
|
|
215
186
|
var oAppComponent = Utils.getAppComponentForSelector(mPropertyBag.selector);
|
|
216
187
|
mPropertyBag.reference = ManifestUtils.getFlexReferenceForControl(mPropertyBag.selector);
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
});
|
|
188
|
+
await saveCompEntities(mPropertyBag);
|
|
189
|
+
await saveChangePersistenceEntities(mPropertyBag, oAppComponent);
|
|
190
|
+
|
|
191
|
+
if (mPropertyBag.version !== undefined && Versions.hasVersionsModel(mPropertyBag)) {
|
|
192
|
+
var oModel = Versions.getVersionsModel(mPropertyBag);
|
|
193
|
+
mPropertyBag.version = oModel.getProperty("/displayedVersion");
|
|
194
|
+
}
|
|
195
|
+
if (mPropertyBag.layer) {
|
|
196
|
+
// TODO: sync the layer parameter name with new persistence and remove this line
|
|
197
|
+
mPropertyBag.currentLayer = mPropertyBag.layer;
|
|
198
|
+
}
|
|
199
|
+
// with invalidation more parameters are required to make a new storage request
|
|
200
|
+
mPropertyBag.componentId = oAppComponent.getId();
|
|
201
|
+
mPropertyBag.invalidateCache = true;
|
|
202
|
+
return FlexObjectManager.getFlexObjects(_omit(mPropertyBag, "skipUpdateCache"));
|
|
233
203
|
};
|
|
234
204
|
|
|
235
|
-
return
|
|
205
|
+
return FlexObjectManager;
|
|
236
206
|
});
|
|
@@ -101,7 +101,7 @@ sap.ui.define([
|
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
function updateObjectAndStorage(oFlexObject, oStoredResponse, sParentVersion) {
|
|
104
|
+
function updateObjectAndStorage(oFlexObject, oStoredResponse, sParentVersion, sReference) {
|
|
105
105
|
return Storage.update({
|
|
106
106
|
flexObject: oFlexObject.convertToFileContent(),
|
|
107
107
|
layer: oFlexObject.getLayer(),
|
|
@@ -125,6 +125,7 @@ sap.ui.define([
|
|
|
125
125
|
// update StorageResponse
|
|
126
126
|
var aObjectArray = getSubSection(oStoredResponse.changes.comp, oFlexObject);
|
|
127
127
|
var oFileContent = oFlexObject.convertToFileContent();
|
|
128
|
+
FlexState.getFlexObjectsDataSelector().checkUpdate({ reference: sReference });
|
|
128
129
|
updateArrayByName(aObjectArray, oFileContent);
|
|
129
130
|
return oFileContent;
|
|
130
131
|
});
|
|
@@ -152,7 +153,7 @@ sap.ui.define([
|
|
|
152
153
|
}
|
|
153
154
|
}
|
|
154
155
|
|
|
155
|
-
function deleteObjectAndRemoveFromStorage(oFlexObject, mCompVariantsMapByPersistencyKey, oStoredResponse, sParentVersion) {
|
|
156
|
+
function deleteObjectAndRemoveFromStorage(oFlexObject, mCompVariantsMapByPersistencyKey, oStoredResponse, sParentVersion, sReference) {
|
|
156
157
|
var oFileContent = oFlexObject.convertToFileContent();
|
|
157
158
|
return Storage.remove({
|
|
158
159
|
flexObject: oFileContent,
|
|
@@ -171,6 +172,7 @@ sap.ui.define([
|
|
|
171
172
|
getSubSection(oStoredResponse.changes.comp, oFlexObject),
|
|
172
173
|
oFileContent.fileName
|
|
173
174
|
);
|
|
175
|
+
FlexState.getFlexObjectsDataSelector().checkUpdate({ reference: sReference });
|
|
174
176
|
return oFileContent;
|
|
175
177
|
});
|
|
176
178
|
}
|
|
@@ -308,7 +310,7 @@ sap.ui.define([
|
|
|
308
310
|
*
|
|
309
311
|
* @namespace sap.ui.fl.write._internal.flexState.compVariants.CompVariantState
|
|
310
312
|
* @since 1.83
|
|
311
|
-
* @version 1.
|
|
313
|
+
* @version 1.128.0
|
|
312
314
|
* @private
|
|
313
315
|
* @ui5-restricted sap.ui.fl
|
|
314
316
|
*/
|
|
@@ -444,7 +446,7 @@ sap.ui.define([
|
|
|
444
446
|
oMapOfPersistencyKey.variants.push(oFlexObject);
|
|
445
447
|
oMapOfPersistencyKey.byId[oFlexObject.getId()] = oFlexObject;
|
|
446
448
|
FlexState.addDirtyFlexObject(mPropertyBag.reference, oFlexObject);
|
|
447
|
-
if (oChangeSpecificData.layer
|
|
449
|
+
if (oChangeSpecificData.layer !== Layer.USER && oChangeSpecificData.layer !== Layer.PUBLIC) {
|
|
448
450
|
mPropertyBag.id = mPropertyBag.control.getCurrentVariantId();
|
|
449
451
|
revertAllVariantUpdate(getVariantById(mPropertyBag));
|
|
450
452
|
}
|
|
@@ -892,6 +894,7 @@ sap.ui.define([
|
|
|
892
894
|
// update StorageResponse
|
|
893
895
|
const oFileContent = oFlexObject.convertToFileContent();
|
|
894
896
|
getSubSection(oStoredResponse.changes.comp, oFlexObject).push(oFileContent);
|
|
897
|
+
FlexState.getFlexObjectsDataSelector().checkUpdate({ reference: mPropertyBag.reference });
|
|
895
898
|
return oFileContent;
|
|
896
899
|
});
|
|
897
900
|
}
|
|
@@ -903,10 +906,10 @@ sap.ui.define([
|
|
|
903
906
|
return writeObjectAndAddToState(oFlexObject, oStoredResponse, sParentVersion);
|
|
904
907
|
case States.LifecycleState.DIRTY:
|
|
905
908
|
ifVariantClearRevertData(oFlexObject);
|
|
906
|
-
return updateObjectAndStorage(oFlexObject, oStoredResponse, sParentVersion);
|
|
909
|
+
return updateObjectAndStorage(oFlexObject, oStoredResponse, sParentVersion, mPropertyBag.reference);
|
|
907
910
|
case States.LifecycleState.DELETED:
|
|
908
911
|
ifVariantClearRevertData(oFlexObject);
|
|
909
|
-
return deleteObjectAndRemoveFromStorage(oFlexObject, mCompVariantsMapByPersistencyKey, oStoredResponse, sParentVersion);
|
|
912
|
+
return deleteObjectAndRemoveFromStorage(oFlexObject, mCompVariantsMapByPersistencyKey, oStoredResponse, sParentVersion, mPropertyBag.reference);
|
|
910
913
|
default:
|
|
911
914
|
return undefined;
|
|
912
915
|
}
|
|
@@ -26,7 +26,7 @@ sap.ui.define([
|
|
|
26
26
|
* @private
|
|
27
27
|
* @alias sap.ui.fl.write._internal.transport.TransportSelection
|
|
28
28
|
* @author SAP SE
|
|
29
|
-
* @version 1.
|
|
29
|
+
* @version 1.128.0
|
|
30
30
|
* @since 1.74.0
|
|
31
31
|
* Helper object to select an ABAP transport for an LREP object. This is not a generic utility to select a transport request, but part
|
|
32
32
|
* of the SmartVariant control.
|
|
@@ -27,7 +27,7 @@ sap.ui.define([
|
|
|
27
27
|
* Entity that handles ABAP transport related information.
|
|
28
28
|
* @alias sap.ui.fl.write._internal.transport.Transports
|
|
29
29
|
* @author SAP SE
|
|
30
|
-
* @version 1.
|
|
30
|
+
* @version 1.128.0
|
|
31
31
|
* @since 1.74.0
|
|
32
32
|
* @private
|
|
33
33
|
* @ui5-restricted sap.ui.fl.write._internal.transport
|
|
@@ -15,7 +15,7 @@ sap.ui.define([
|
|
|
15
15
|
"sap/ui/fl/LayerUtils",
|
|
16
16
|
"sap/ui/fl/Utils",
|
|
17
17
|
"sap/ui/fl/initial/_internal/FlexInfoSession",
|
|
18
|
-
"sap/ui/fl/write/_internal/flexState/
|
|
18
|
+
"sap/ui/fl/write/_internal/flexState/FlexObjectManager",
|
|
19
19
|
"sap/ui/fl/apply/_internal/flexState/compVariants/CompVariantMerger",
|
|
20
20
|
"sap/ui/fl/write/_internal/flexState/compVariants/CompVariantState",
|
|
21
21
|
"sap/ui/fl/apply/_internal/flexState/controlVariants/VariantManagementState",
|
|
@@ -33,7 +33,7 @@ sap.ui.define([
|
|
|
33
33
|
LayerUtils,
|
|
34
34
|
FlexUtils,
|
|
35
35
|
FlexInfoSession,
|
|
36
|
-
|
|
36
|
+
FlexObjectManager,
|
|
37
37
|
CompVariantMerger,
|
|
38
38
|
CompVariantState,
|
|
39
39
|
VariantManagementState,
|
|
@@ -781,7 +781,7 @@ sap.ui.define([
|
|
|
781
781
|
flexObjects: []
|
|
782
782
|
};
|
|
783
783
|
|
|
784
|
-
return
|
|
784
|
+
return FlexObjectManager.getFlexObjects({
|
|
785
785
|
selector: mPropertyBag.control,
|
|
786
786
|
invalidateCache: false,
|
|
787
787
|
includeCtrlVariants: true,
|
|
@@ -834,7 +834,7 @@ sap.ui.define([
|
|
|
834
834
|
if (oContextBasedAdaptationModel.getProperty("/count") !== 0) {
|
|
835
835
|
return Promise.resolve(false);
|
|
836
836
|
}
|
|
837
|
-
return
|
|
837
|
+
return FlexObjectManager.getFlexObjects({
|
|
838
838
|
selector: mPropertyBag.control,
|
|
839
839
|
invalidateCache: false,
|
|
840
840
|
includeCtrlVariants: true,
|
|
@@ -888,7 +888,7 @@ sap.ui.define([
|
|
|
888
888
|
|
|
889
889
|
return createContextBasedAdaptation.call(this, mPropertyBag, mPropertyBag.contextBasedAdaptation)
|
|
890
890
|
.then(function() {
|
|
891
|
-
return
|
|
891
|
+
return FlexObjectManager.getFlexObjects({
|
|
892
892
|
selector: mPropertyBag.control,
|
|
893
893
|
invalidateCache: false,
|
|
894
894
|
includeCtrlVariants: true,
|
|
@@ -897,7 +897,7 @@ sap.ui.define([
|
|
|
897
897
|
});
|
|
898
898
|
}).then(function(aFlexObjects) {
|
|
899
899
|
// currently getFlexObjects contains also VENDOR layer ctrl variant changes which need to be removed before copy
|
|
900
|
-
// TODO refactor when
|
|
900
|
+
// TODO refactor when FlexObjectManager.getFlexObjects will be refactored
|
|
901
901
|
var aCustomerFlexObjects = LayerUtils.filterChangeOrChangeDefinitionsByCurrentLayer(aFlexObjects, Layer.CUSTOMER);
|
|
902
902
|
var aCopiedChanges = copyVariantsAndChanges(aCustomerFlexObjects, mPropertyBag.contextBasedAdaptation.id);
|
|
903
903
|
return writeChangesToBackend(mPropertyBag, aCopiedChanges);
|
|
@@ -8,6 +8,7 @@ sap.ui.define([
|
|
|
8
8
|
"sap/base/Log",
|
|
9
9
|
"sap/ui/core/util/reflection/JsControlTreeModifier",
|
|
10
10
|
"sap/ui/core/Element",
|
|
11
|
+
"sap/ui/fl/apply/_internal/flexState/FlexObjectState",
|
|
11
12
|
"sap/ui/fl/apply/_internal/flexState/FlexState",
|
|
12
13
|
"sap/ui/fl/apply/_internal/controlVariants/Utils",
|
|
13
14
|
"sap/ui/fl/apply/api/ControlVariantApplyAPI",
|
|
@@ -23,6 +24,7 @@ sap.ui.define([
|
|
|
23
24
|
Log,
|
|
24
25
|
JsControlTreeModifier,
|
|
25
26
|
Element,
|
|
27
|
+
FlexObjectState,
|
|
26
28
|
FlexState,
|
|
27
29
|
VariantUtils,
|
|
28
30
|
ControlVariantApplyAPI,
|
|
@@ -305,8 +307,8 @@ sap.ui.define([
|
|
|
305
307
|
throw Error("App Component could not be determined");
|
|
306
308
|
}
|
|
307
309
|
|
|
308
|
-
|
|
309
|
-
var aDirtyFlexObjects =
|
|
310
|
+
const sReference = FlexRuntimeInfoAPI.getFlexReference({element: mPropertyBag.selector});
|
|
311
|
+
var aDirtyFlexObjects = FlexObjectState.getDirtyFlexObjects(sReference);
|
|
310
312
|
|
|
311
313
|
return aDirtyFlexObjects.some(function(oFlexObject) {
|
|
312
314
|
if (oFlexObject.getLayer() !== Layer.USER) {
|
|
@@ -7,22 +7,22 @@
|
|
|
7
7
|
sap.ui.define([
|
|
8
8
|
"sap/ui/fl/apply/_internal/flexObjects/States",
|
|
9
9
|
"sap/ui/fl/apply/_internal/flexState/changes/UIChangesState",
|
|
10
|
+
"sap/ui/fl/apply/_internal/flexState/FlexObjectState",
|
|
10
11
|
"sap/ui/fl/apply/_internal/flexState/ManifestUtils",
|
|
11
12
|
"sap/ui/fl/write/api/PersistenceWriteAPI",
|
|
12
13
|
"sap/ui/fl/write/api/ChangesWriteAPI",
|
|
13
14
|
"sap/ui/core/util/reflection/JsControlTreeModifier",
|
|
14
15
|
"sap/ui/fl/Utils",
|
|
15
|
-
"sap/ui/fl/ChangePersistenceFactory",
|
|
16
16
|
"sap/base/util/restricted/_union"
|
|
17
17
|
], function(
|
|
18
18
|
States,
|
|
19
19
|
UIChangesState,
|
|
20
|
+
FlexObjectState,
|
|
20
21
|
ManifestUtils,
|
|
21
22
|
PersistenceWriteAPI,
|
|
22
23
|
ChangesWriteAPI,
|
|
23
24
|
JsControlTreeModifier,
|
|
24
25
|
Utils,
|
|
25
|
-
ChangePersistenceFactory,
|
|
26
26
|
union
|
|
27
27
|
) {
|
|
28
28
|
"use strict";
|
|
@@ -111,8 +111,7 @@ sap.ui.define([
|
|
|
111
111
|
oChange.restorePreviousState();
|
|
112
112
|
var oControl = JsControlTreeModifier.bySelector(oChange.getSelector(), oAppComponent);
|
|
113
113
|
if (oChange.getState() === States.LifecycleState.PERSISTED) {
|
|
114
|
-
|
|
115
|
-
var aDirtyChanges = oChangePersistence.getDirtyChanges();
|
|
114
|
+
const aDirtyChanges = FlexObjectState.getDirtyFlexObjects(oAppComponent.name);
|
|
116
115
|
var iIndex = aDirtyChanges.indexOf(oChange);
|
|
117
116
|
if (iIndex >= 0) {
|
|
118
117
|
aDirtyChanges.splice(iIndex, 1);
|
|
@@ -13,7 +13,7 @@ sap.ui.define([
|
|
|
13
13
|
"sap/ui/fl/apply/_internal/flexState/ManifestUtils",
|
|
14
14
|
"sap/ui/fl/registry/Settings",
|
|
15
15
|
"sap/ui/fl/write/_internal/condenser/Condenser",
|
|
16
|
-
"sap/ui/fl/write/_internal/flexState/
|
|
16
|
+
"sap/ui/fl/write/_internal/flexState/FlexObjectManager",
|
|
17
17
|
"sap/ui/fl/write/_internal/Storage",
|
|
18
18
|
"sap/ui/fl/write/api/FeaturesAPI",
|
|
19
19
|
"sap/ui/fl/initial/_internal/FlexInfoSession",
|
|
@@ -31,7 +31,7 @@ sap.ui.define([
|
|
|
31
31
|
ManifestUtils,
|
|
32
32
|
Settings,
|
|
33
33
|
Condenser,
|
|
34
|
-
|
|
34
|
+
FlexObjectManager,
|
|
35
35
|
Storage,
|
|
36
36
|
FeaturesAPI,
|
|
37
37
|
FlexInfoSession,
|
|
@@ -93,7 +93,7 @@ sap.ui.define([
|
|
|
93
93
|
* @ui5-restricted sap.ui.rta
|
|
94
94
|
*/
|
|
95
95
|
PersistenceWriteAPI.hasDirtyChanges = function(mPropertyBag) {
|
|
96
|
-
return
|
|
96
|
+
return FlexObjectManager.hasDirtyFlexObjects(mPropertyBag);
|
|
97
97
|
};
|
|
98
98
|
|
|
99
99
|
/**
|
|
@@ -111,7 +111,7 @@ sap.ui.define([
|
|
|
111
111
|
PersistenceWriteAPI.hasHigherLayerChanges = function(mPropertyBag) {
|
|
112
112
|
mPropertyBag.upToLayer ||= LayerUtils.getCurrentLayer();
|
|
113
113
|
|
|
114
|
-
return
|
|
114
|
+
return FlexObjectManager.getFlexObjects(mPropertyBag)
|
|
115
115
|
.then(function(aFlexObjects) {
|
|
116
116
|
return aFlexObjects.filter(function(oFlexObject) {
|
|
117
117
|
return LayerUtils.isOverLayer(oFlexObject.getLayer(), mPropertyBag.upToLayer);
|
|
@@ -123,7 +123,7 @@ sap.ui.define([
|
|
|
123
123
|
}
|
|
124
124
|
// Hidden control variants and their related changes might be necessary for referenced variants, but are not relevant for this check
|
|
125
125
|
// Same apply for changes of deleted comp variants
|
|
126
|
-
return
|
|
126
|
+
return FlexObjectManager.filterHiddenFlexObjects(aFilteredFlexObjects, mPropertyBag.reference).length > 0;
|
|
127
127
|
});
|
|
128
128
|
};
|
|
129
129
|
|
|
@@ -150,7 +150,7 @@ sap.ui.define([
|
|
|
150
150
|
var oFlexInfoSession = FlexInfoSession.getByReference(sReference);
|
|
151
151
|
oFlexInfoSession.saveChangeKeepSession = true;
|
|
152
152
|
FlexInfoSession.setByReference(oFlexInfoSession, sReference);
|
|
153
|
-
return
|
|
153
|
+
return FlexObjectManager.saveFlexObjects(mPropertyBag).then(function(oFlexObject) {
|
|
154
154
|
if (oFlexObject && oFlexObject.length !== 0) {
|
|
155
155
|
return PersistenceWriteAPI.getResetAndPublishInfo(mPropertyBag).then(function(oResult) {
|
|
156
156
|
// other attributes like adaptationId, isEndUserAdaptation, init needs to be taken from flex info session if available
|
|
@@ -468,8 +468,8 @@ sap.ui.define([
|
|
|
468
468
|
}
|
|
469
469
|
|
|
470
470
|
mPropertyBag.invalidateCache = false;
|
|
471
|
-
// TODO: Check the mPropertyBag.selector parameter name - the methods called on
|
|
472
|
-
return
|
|
471
|
+
// TODO: Check the mPropertyBag.selector parameter name - the methods called on FlexObjectManager expect a control
|
|
472
|
+
return FlexObjectManager.getFlexObjects(mPropertyBag);
|
|
473
473
|
};
|
|
474
474
|
|
|
475
475
|
/**
|
|
@@ -5,19 +5,19 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
sap.ui.define([
|
|
8
|
-
"sap/ui/fl/
|
|
8
|
+
"sap/ui/fl/apply/_internal/flexState/FlexObjectState",
|
|
9
9
|
"sap/ui/fl/apply/_internal/flexState/ManifestUtils",
|
|
10
10
|
"sap/ui/fl/write/_internal/Storage",
|
|
11
|
+
"sap/ui/fl/Utils",
|
|
11
12
|
"sap/base/util/isEmptyObject",
|
|
12
|
-
"sap/base/i18n/Localization"
|
|
13
|
-
"sap/ui/fl/Utils"
|
|
13
|
+
"sap/base/i18n/Localization"
|
|
14
14
|
], function(
|
|
15
15
|
FlexObjectState,
|
|
16
16
|
ManifestUtils,
|
|
17
17
|
Storage,
|
|
18
|
+
Utils,
|
|
18
19
|
isEmptyObject,
|
|
19
|
-
Localization
|
|
20
|
-
Utils
|
|
20
|
+
Localization
|
|
21
21
|
) {
|
|
22
22
|
"use strict";
|
|
23
23
|
|
|
@@ -41,7 +41,7 @@ sap.ui.define([
|
|
|
41
41
|
* @returns {boolean} <code>true</code> in case translatable texts are present
|
|
42
42
|
*/
|
|
43
43
|
TranslationAPI.hasTranslationRelevantDirtyChanges = function(mPropertyBag) {
|
|
44
|
-
return FlexObjectState.getDirtyFlexObjects(mPropertyBag).some(function(oChange) {
|
|
44
|
+
return FlexObjectState.getDirtyFlexObjects(ManifestUtils.getFlexReferenceForControl(mPropertyBag.selector)).some(function(oChange) {
|
|
45
45
|
return !isEmptyObject(oChange.getTexts());
|
|
46
46
|
});
|
|
47
47
|
};
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
sap.ui.define([
|
|
8
|
+
"sap/ui/fl/apply/_internal/flexState/FlexObjectState",
|
|
8
9
|
"sap/ui/fl/apply/_internal/flexState/FlexState",
|
|
9
10
|
"sap/ui/fl/apply/_internal/flexState/ManifestUtils",
|
|
10
11
|
"sap/ui/fl/initial/_internal/FlexInfoSession",
|
|
@@ -12,8 +13,10 @@ sap.ui.define([
|
|
|
12
13
|
"sap/ui/fl/write/_internal/Versions",
|
|
13
14
|
"sap/ui/fl/write/api/ContextBasedAdaptationsAPI",
|
|
14
15
|
"sap/ui/fl/write/api/FeaturesAPI",
|
|
16
|
+
"sap/ui/fl/ChangePersistenceFactory",
|
|
15
17
|
"sap/ui/fl/Utils"
|
|
16
18
|
], function(
|
|
19
|
+
FlexObjectState,
|
|
17
20
|
FlexState,
|
|
18
21
|
ManifestUtils,
|
|
19
22
|
FlexInfoSession,
|
|
@@ -21,12 +24,13 @@ sap.ui.define([
|
|
|
21
24
|
Versions,
|
|
22
25
|
ContextBasedAdaptationsAPI,
|
|
23
26
|
FeaturesAPI,
|
|
27
|
+
ChangePersistenceFactory,
|
|
24
28
|
Utils
|
|
25
29
|
) {
|
|
26
30
|
"use strict";
|
|
27
31
|
|
|
28
|
-
function getFlexReferenceForControl(
|
|
29
|
-
|
|
32
|
+
function getFlexReferenceForControl(oControl) {
|
|
33
|
+
const sReference = ManifestUtils.getFlexReferenceForControl(oControl);
|
|
30
34
|
|
|
31
35
|
if (!sReference) {
|
|
32
36
|
throw Error("The application ID could not be determined");
|
|
@@ -35,6 +39,11 @@ sap.ui.define([
|
|
|
35
39
|
return sReference;
|
|
36
40
|
}
|
|
37
41
|
|
|
42
|
+
function doDirtyChangesExist(sReference) {
|
|
43
|
+
const aDirtyChanges = FlexObjectState.getDirtyFlexObjects(sReference);
|
|
44
|
+
return aDirtyChanges.length > 0;
|
|
45
|
+
}
|
|
46
|
+
|
|
38
47
|
function getVersionsModel(mPropertyBag) {
|
|
39
48
|
if (!mPropertyBag.control) {
|
|
40
49
|
throw Error("No control was provided");
|
|
@@ -45,11 +54,15 @@ sap.ui.define([
|
|
|
45
54
|
|
|
46
55
|
var sReference = getFlexReferenceForControl(mPropertyBag.control);
|
|
47
56
|
|
|
48
|
-
|
|
49
|
-
nonNormalizedReference: sReference,
|
|
57
|
+
const oVersionModel = Versions.getVersionsModel({
|
|
50
58
|
reference: sReference,
|
|
51
59
|
layer: mPropertyBag.layer
|
|
52
60
|
});
|
|
61
|
+
|
|
62
|
+
if (doDirtyChangesExist(sReference)) {
|
|
63
|
+
oVersionModel.updateDraftVersion();
|
|
64
|
+
}
|
|
65
|
+
return oVersionModel;
|
|
53
66
|
}
|
|
54
67
|
|
|
55
68
|
function incorporateAdaptationIdInSwitch(mPropertyBag) {
|
|
@@ -249,13 +262,15 @@ sap.ui.define([
|
|
|
249
262
|
}
|
|
250
263
|
|
|
251
264
|
const sReference = getFlexReferenceForControl(mPropertyBag.control);
|
|
265
|
+
if (doDirtyChangesExist(sReference)) {
|
|
266
|
+
return Promise.reject("Unsaved changes exist");
|
|
267
|
+
}
|
|
252
268
|
|
|
253
269
|
const oFlexInfo = FlexInfoSession.getByReference(sReference);
|
|
254
270
|
delete oFlexInfo.version;
|
|
255
271
|
FlexInfoSession.setByReference(oFlexInfo, sReference);
|
|
256
272
|
|
|
257
273
|
return Versions.activate({
|
|
258
|
-
nonNormalizedReference: sReference,
|
|
259
274
|
reference: sReference,
|
|
260
275
|
layer: mPropertyBag.layer,
|
|
261
276
|
title: mPropertyBag.title,
|
|
@@ -276,21 +291,31 @@ sap.ui.define([
|
|
|
276
291
|
* rejects if an error occurs or the layer does not support draft handling
|
|
277
292
|
*/
|
|
278
293
|
VersionsAPI.discardDraft = function(mPropertyBag) {
|
|
294
|
+
const oAppComponent = Utils.getAppComponentForControl(mPropertyBag.control);
|
|
295
|
+
const sReference = getFlexReferenceForControl(oAppComponent);
|
|
296
|
+
function removeDirtyChanges() {
|
|
297
|
+
const oChangePersistence = ChangePersistenceFactory.getChangePersistenceForComponent(sReference);
|
|
298
|
+
const aDirtyChanges = FlexObjectState.getDirtyFlexObjects(sReference);
|
|
299
|
+
oChangePersistence.deleteChanges(aDirtyChanges, true);
|
|
300
|
+
return aDirtyChanges.length > 0;
|
|
301
|
+
}
|
|
302
|
+
|
|
279
303
|
if (!mPropertyBag.control) {
|
|
280
304
|
return Promise.reject("No control was provided");
|
|
281
305
|
}
|
|
282
306
|
if (!mPropertyBag.layer) {
|
|
283
307
|
return Promise.reject("No layer was provided");
|
|
284
308
|
}
|
|
285
|
-
|
|
286
|
-
const oAppComponent = Utils.getAppComponentForControl(mPropertyBag.control);
|
|
287
|
-
const sReference = getFlexReferenceForControl(oAppComponent);
|
|
288
309
|
return Versions.discardDraft({
|
|
289
|
-
nonNormalizedReference: sReference,
|
|
290
310
|
reference: sReference,
|
|
291
311
|
layer: mPropertyBag.layer
|
|
292
312
|
})
|
|
293
313
|
.then(function(oDiscardInfo) {
|
|
314
|
+
// in case of a existing draft known by the backend;
|
|
315
|
+
// we remove dirty changes only after successful DELETE request
|
|
316
|
+
const bDirtyChangesRemoved = removeDirtyChanges();
|
|
317
|
+
oDiscardInfo.dirtyChangesDiscarded = bDirtyChangesRemoved;
|
|
318
|
+
|
|
294
319
|
if (oDiscardInfo.backendChangesDiscarded) {
|
|
295
320
|
const bHasAdaptationsModel = ContextBasedAdaptationsAPI.hasAdaptationsModel({
|
|
296
321
|
layer: mPropertyBag.layer,
|