@openui5/sap.ui.fl 1.128.0 → 1.130.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 +2 -2
- package/package.json +3 -3
- package/src/sap/ui/fl/.library +1 -1
- package/src/sap/ui/fl/ChangePersistence.js +38 -458
- 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 +27 -51
- 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 +8 -8
- package/src/sap/ui/fl/apply/_internal/DelegateMediator.js +1 -1
- package/src/sap/ui/fl/apply/_internal/appVariant/DescriptorChangeTypes.js +2 -1
- package/src/sap/ui/fl/apply/_internal/changes/Applier.js +152 -197
- package/src/sap/ui/fl/apply/_internal/changes/FlexCustomData.js +23 -17
- package/src/sap/ui/fl/apply/_internal/changes/Reverter.js +27 -37
- package/src/sap/ui/fl/apply/_internal/changes/Utils.js +26 -31
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/Preprocessor.js +5 -5
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/Registration.js +3 -2
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/RegistrationBuild.js +6 -4
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/AddAnnotationsToOData.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/AddNewDataSource.js +152 -0
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/AddNewInbound.js +12 -18
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/AddNewOutbound.js +67 -0
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/AddTechnicalAttributes.js +1 -1
- 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 +11 -9
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/ChangeOutbound.js +5 -3
- 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 +1 -1
- 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 +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/ui5/ChangeModel.js +78 -0
- 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/controlVariants/URLHandler.js +18 -5
- 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 +2 -2
- package/src/sap/ui/fl/apply/_internal/flexObjects/AppDescriptorChange.js +2 -4
- package/src/sap/ui/fl/apply/_internal/flexObjects/CompVariant.js +19 -10
- package/src/sap/ui/fl/apply/_internal/flexObjects/ControllerExtensionChange.js +4 -3
- package/src/sap/ui/fl/apply/_internal/flexObjects/FlVariant.js +4 -3
- package/src/sap/ui/fl/apply/_internal/flexObjects/FlexObject.js +16 -12
- package/src/sap/ui/fl/apply/_internal/flexObjects/FlexObjectFactory.js +23 -22
- package/src/sap/ui/fl/apply/_internal/flexObjects/States.js +4 -3
- package/src/sap/ui/fl/apply/_internal/flexObjects/UIChange.js +6 -5
- package/src/sap/ui/fl/apply/_internal/flexObjects/UpdatableChange.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexObjects/Variant.js +4 -3
- package/src/sap/ui/fl/apply/_internal/flexObjects/getVariantAuthor.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexState/FlexObjectState.js +4 -4
- package/src/sap/ui/fl/apply/_internal/flexState/FlexState.js +50 -73
- 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 +10 -6
- package/src/sap/ui/fl/apply/_internal/flexState/changes/UIChangesState.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexState/compVariants/CompVariantManagementState.js +105 -0
- package/src/sap/ui/fl/apply/_internal/flexState/compVariants/CompVariantMerger.js +2 -2
- package/src/sap/ui/fl/apply/_internal/flexState/compVariants/prepareCompVariantsMap.js +16 -15
- package/src/sap/ui/fl/apply/_internal/flexState/controlVariants/Switcher.js +10 -12
- package/src/sap/ui/fl/apply/_internal/flexState/controlVariants/VariantManagementState.js +69 -14
- package/src/sap/ui/fl/apply/_internal/preprocessors/ComponentLifecycleHooks.js +2 -2
- package/src/sap/ui/fl/apply/_internal/preprocessors/ControllerExtension.js +1 -1
- package/src/sap/ui/fl/apply/_internal/preprocessors/RegistrationDelegator.js +6 -6
- package/src/sap/ui/fl/apply/_internal/preprocessors/XmlPreprocessor.js +1 -1
- package/src/sap/ui/fl/apply/api/AnnotationChangeHandlerAPI.js +63 -0
- package/src/sap/ui/fl/apply/api/ControlVariantApplyAPI.js +25 -10
- package/src/sap/ui/fl/apply/api/SmartVariantManagementApplyAPI.js +18 -45
- package/src/sap/ui/fl/changeHandler/AddIFrame.js +4 -4
- package/src/sap/ui/fl/changeHandler/AddXML.js +1 -1
- package/src/sap/ui/fl/changeHandler/AddXMLAtExtensionPoint.js +2 -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 +1 -1
- package/src/sap/ui/fl/changeHandler/BaseRename.js +1 -1
- package/src/sap/ui/fl/changeHandler/HideControl.js +26 -5
- 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 +33 -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/api/DescriptorChangeFactory.js +14 -13
- 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/designtime/util/editIFrame.js +2 -1
- package/src/sap/ui/fl/initial/_internal/FlexConfiguration.js +1 -1
- package/src/sap/ui/fl/initial/_internal/Storage.js +46 -8
- package/src/sap/ui/fl/initial/_internal/StorageFeaturesMerger.js +1 -1
- package/src/sap/ui/fl/initial/_internal/StorageUtils.js +3 -3
- package/src/sap/ui/fl/initial/_internal/changeHandlers/ChangeHandlerRegistration.js +25 -2
- package/src/sap/ui/fl/initial/_internal/changeHandlers/ChangeHandlerStorage.js +54 -22
- 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 +15 -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/registry/Settings.js +1 -1
- package/src/sap/ui/fl/support/_internal/extractChangeDependencies.js +29 -58
- package/src/sap/ui/fl/support/_internal/getAllUIChanges.js +1 -1
- package/src/sap/ui/fl/support/_internal/getChangeDependencies.js +12 -66
- package/src/sap/ui/fl/support/_internal/getFlexObjectInfos.js +7 -4
- package/src/sap/ui/fl/support/_internal/getFlexSettings.js +30 -19
- package/src/sap/ui/fl/support/api/SupportAPI.js +8 -4
- 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/DescriptorChangeCheck.js +133 -20
- package/src/sap/ui/fl/util/IFrame.js +3 -3
- package/src/sap/ui/fl/util/ManagedObjectModel.js +1 -1
- package/src/sap/ui/fl/util/changePropertyValueByPath.js +15 -4
- package/src/sap/ui/fl/util/resolveBinding.js +9 -9
- package/src/sap/ui/fl/variants/VariantModel.js +81 -42
- package/src/sap/ui/fl/variants/context/controller/ContextVisibility.controller.js +2 -2
- package/src/sap/ui/fl/write/_internal/SaveAs.js +12 -3
- package/src/sap/ui/fl/write/_internal/Storage.js +6 -6
- package/src/sap/ui/fl/write/_internal/Versions.js +7 -3
- 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 +34 -1
- package/src/sap/ui/fl/write/_internal/condenser/Condenser.js +165 -178
- package/src/sap/ui/fl/write/_internal/condenser/UIReconstruction.js +62 -61
- package/src/sap/ui/fl/write/_internal/condenser/Utils.js +17 -19
- package/src/sap/ui/fl/write/_internal/condenser/classifications/Create.js +13 -13
- package/src/sap/ui/fl/write/_internal/condenser/classifications/Destroy.js +17 -19
- package/src/sap/ui/fl/write/_internal/condenser/classifications/Move.js +32 -35
- package/src/sap/ui/fl/write/_internal/condenser/classifications/Update.js +2 -10
- 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 +98 -5
- package/src/sap/ui/fl/write/_internal/connectors/NeoLrepConnector.js +1 -1
- package/src/sap/ui/fl/write/_internal/connectors/ObjectPathConnector.js +3 -3
- package/src/sap/ui/fl/write/_internal/connectors/PersonalizationConnector.js +1 -1
- package/src/sap/ui/fl/write/_internal/connectors/Utils.js +1 -1
- package/src/sap/ui/fl/write/_internal/controlVariants/ControlVariantWriteUtils.js +59 -0
- package/src/sap/ui/fl/write/_internal/delegates/ODataV2ReadDelegate.js +1 -2
- 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 +122 -77
- 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 +18 -18
- 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 +12 -11
- package/src/sap/ui/fl/write/_internal/fieldExtensibility/cap/editor/propertyEditor/timeEditor/TimeEditor.js +6 -8
- package/src/sap/ui/fl/write/_internal/flexState/FlexObjectManager.js +212 -5
- package/src/sap/ui/fl/write/_internal/flexState/UI2Personalization/UI2PersonalizationState.js +1 -1
- package/src/sap/ui/fl/write/_internal/flexState/changes/UIChangeManager.js +109 -0
- package/src/sap/ui/fl/write/_internal/flexState/compVariants/CompVariantState.js +62 -54
- 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/ChangesWriteAPI.js +73 -3
- package/src/sap/ui/fl/write/api/ContextBasedAdaptationsAPI.js +22 -19
- package/src/sap/ui/fl/write/api/ControlPersonalizationWriteAPI.js +56 -30
- package/src/sap/ui/fl/write/api/FieldExtensibility.js +1 -1
- package/src/sap/ui/fl/write/api/LocalResetAPI.js +17 -27
- package/src/sap/ui/fl/write/api/PersistenceWriteAPI.js +28 -51
- package/src/sap/ui/fl/write/api/SmartBusinessWriteAPI.js +11 -7
- package/src/sap/ui/fl/write/api/VersionsAPI.js +32 -8
|
@@ -6,69 +6,41 @@
|
|
|
6
6
|
|
|
7
7
|
sap.ui.define([
|
|
8
8
|
"sap/base/Log",
|
|
9
|
-
"sap/ui/core/util/reflection/JsControlTreeModifier",
|
|
10
|
-
"sap/ui/core/Component",
|
|
11
|
-
"sap/ui/fl/apply/_internal/changes/Applier",
|
|
12
|
-
"sap/ui/fl/apply/_internal/flexObjects/FlexObjectFactory",
|
|
13
9
|
"sap/ui/fl/apply/_internal/flexObjects/States",
|
|
14
10
|
"sap/ui/fl/apply/_internal/flexState/changes/DependencyHandler",
|
|
15
11
|
"sap/ui/fl/apply/_internal/flexState/changes/UIChangesState",
|
|
16
|
-
"sap/ui/fl/apply/_internal/flexState/controlVariants/VariantManagementState",
|
|
17
|
-
"sap/ui/fl/apply/_internal/flexState/DataSelector",
|
|
18
12
|
"sap/ui/fl/apply/_internal/flexState/FlexObjectState",
|
|
19
13
|
"sap/ui/fl/apply/_internal/flexState/FlexState",
|
|
20
14
|
"sap/ui/fl/initial/api/Version",
|
|
21
15
|
"sap/ui/fl/registry/Settings",
|
|
22
16
|
"sap/ui/fl/write/_internal/condenser/Condenser",
|
|
17
|
+
"sap/ui/fl/write/_internal/flexState/FlexObjectManager",
|
|
23
18
|
"sap/ui/fl/write/_internal/Storage",
|
|
24
19
|
"sap/ui/fl/Layer",
|
|
25
|
-
"sap/ui/fl/LayerUtils"
|
|
26
|
-
"sap/ui/fl/Utils"
|
|
20
|
+
"sap/ui/fl/LayerUtils"
|
|
27
21
|
], function(
|
|
28
22
|
Log,
|
|
29
|
-
JsControlTreeModifier,
|
|
30
|
-
Component,
|
|
31
|
-
Applier,
|
|
32
|
-
FlexObjectFactory,
|
|
33
23
|
States,
|
|
34
24
|
DependencyHandler,
|
|
35
25
|
UIChangesState,
|
|
36
|
-
VariantManagementState,
|
|
37
|
-
DataSelector,
|
|
38
26
|
FlexObjectState,
|
|
39
27
|
FlexState,
|
|
40
28
|
Version,
|
|
41
29
|
Settings,
|
|
42
30
|
Condenser,
|
|
31
|
+
FlexObjectManager,
|
|
43
32
|
Storage,
|
|
44
33
|
Layer,
|
|
45
|
-
LayerUtils
|
|
46
|
-
Utils
|
|
34
|
+
LayerUtils
|
|
47
35
|
) {
|
|
48
36
|
"use strict";
|
|
49
37
|
|
|
50
|
-
const oVariantIndependentUIChangesDataSelector = new DataSelector({
|
|
51
|
-
id: "variantIndependentUIChanges",
|
|
52
|
-
parentDataSelector: FlexState.getFlexObjectsDataSelector(),
|
|
53
|
-
executeFunction(aFlexObjects) {
|
|
54
|
-
return aFlexObjects.filter(function(oFlexObject) {
|
|
55
|
-
const bIsUIChange = oFlexObject.isA("sap.ui.fl.apply._internal.flexObjects.UIChange");
|
|
56
|
-
const bIsControllerExtension = oFlexObject.isA("sap.ui.fl.apply._internal.flexObjects.ControllerExtensionChange");
|
|
57
|
-
const bCorrectFileType = oFlexObject.getFileType() === "change" || oFlexObject.getFileType() === "codeExt";
|
|
58
|
-
return (bIsUIChange || bIsControllerExtension)
|
|
59
|
-
&& bCorrectFileType
|
|
60
|
-
&& !oFlexObject.getVariantReference()
|
|
61
|
-
&& !oFlexObject.getSelector().persistencyKey;
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
|
|
66
38
|
/**
|
|
67
39
|
* Helper object to access a change from the back end. Access helper object for each change (and variant) which was fetched from the back end
|
|
68
40
|
*
|
|
69
41
|
* @constructor
|
|
70
42
|
* @author SAP SE
|
|
71
|
-
* @version 1.
|
|
43
|
+
* @version 1.130.0
|
|
72
44
|
* @since 1.25.0
|
|
73
45
|
* @private
|
|
74
46
|
* @param {object} mComponent - Component data to initiate <code>ChangePersistence</code> instance
|
|
@@ -83,186 +55,6 @@ sap.ui.define([
|
|
|
83
55
|
}
|
|
84
56
|
|
|
85
57
|
this._oMessagebundle = undefined;
|
|
86
|
-
oVariantIndependentUIChangesDataSelector.clearCachedResult({reference: this._mComponent.name});
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
async function getChangesFromFlexState(sReference, mPropertyBag, bInvalidateCache) {
|
|
90
|
-
try {
|
|
91
|
-
if (bInvalidateCache) {
|
|
92
|
-
await FlexState.update(mPropertyBag);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
await FlexState.getStorageResponse(sReference);
|
|
96
|
-
} catch (oError) {
|
|
97
|
-
Log.warning("Problem during ChangePersistence.prototype.getChangesForComponent");
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Calls the back end asynchronously and fetches all changes for the component
|
|
103
|
-
* New changes (dirty state) that are not yet saved to the back end won't be returned.
|
|
104
|
-
* @param {object} [mPropertyBag] Contains additional data needed for reading changes
|
|
105
|
-
* @param {object} [mPropertyBag.appDescriptor] Manifest that belongs to the current running component
|
|
106
|
-
* @param {string} [mPropertyBag.siteId] ID of the site belonging to the current running component
|
|
107
|
-
* @param {string} [mPropertyBag.currentLayer] Specifies a single layer for loading changes. If this parameter is set, the max layer filtering is not applied
|
|
108
|
-
* @param {boolean} [mPropertyBag.ignoreMaxLayerParameter] Indicates that changes shall be loaded without layer filtering
|
|
109
|
-
* @param {boolean} [mPropertyBag.includeCtrlVariants] - Indicates that control variant changes shall be included
|
|
110
|
-
* @param {string} [mPropertyBag.cacheKey] Key to validate the cache entry stored on client side
|
|
111
|
-
* @param {string} [mPropertyBag.version] Number of the version to retrieve changes for
|
|
112
|
-
* @param {boolean} bInvalidateCache - should the cache be invalidated
|
|
113
|
-
* @returns {Promise} Promise resolving with an array of changes
|
|
114
|
-
* @public
|
|
115
|
-
*/
|
|
116
|
-
ChangePersistence.prototype.getChangesForComponent = async function(mPropertyBag, bInvalidateCache) {
|
|
117
|
-
mPropertyBag ||= {};
|
|
118
|
-
await getChangesFromFlexState(this._mComponent.name, mPropertyBag, bInvalidateCache);
|
|
119
|
-
|
|
120
|
-
const aAllChanges = FlexState.getFlexObjectsDataSelector().get({reference: this._mComponent.name});
|
|
121
|
-
if (!aAllChanges.length) {
|
|
122
|
-
return [];
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
// TODO: remove and use UIChangesState
|
|
126
|
-
let aRelevantUIChanges = oVariantIndependentUIChangesDataSelector.get({reference: this._mComponent.name});
|
|
127
|
-
|
|
128
|
-
if (!mPropertyBag.includeCtrlVariants) {
|
|
129
|
-
aRelevantUIChanges = aRelevantUIChanges.concat(
|
|
130
|
-
VariantManagementState.getInitialUIChanges({reference: this._mComponent.name})
|
|
131
|
-
);
|
|
132
|
-
} else {
|
|
133
|
-
aRelevantUIChanges = aRelevantUIChanges.concat(
|
|
134
|
-
VariantManagementState.getVariantDependentFlexObjects(this._mComponent.name)
|
|
135
|
-
);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
if (mPropertyBag.currentLayer) {
|
|
139
|
-
aRelevantUIChanges = LayerUtils.filterChangeOrChangeDefinitionsByCurrentLayer(aRelevantUIChanges, mPropertyBag.currentLayer);
|
|
140
|
-
}
|
|
141
|
-
return aRelevantUIChanges;
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Adds a new change into dependency map positioned right after the referenced change and updates the change dependencies
|
|
146
|
-
*
|
|
147
|
-
* @param {sap.ui.core.Component} oAppComponent - Application component for the view
|
|
148
|
-
* @param {sap.ui.fl.apply._internal.flexObjects.FlexObject} oChange - Change instance
|
|
149
|
-
* @param {sap.ui.fl.apply._internal.flexObjects.FlexObject} [oReferenceChange] - Reference change. New change is positioned right after this one in the dependency map
|
|
150
|
-
*/
|
|
151
|
-
ChangePersistence.prototype.addChangeAndUpdateDependencies = function(oAppComponent, oChange, oReferenceChange) {
|
|
152
|
-
// the change status should always be initial when it gets added to the map / dependencies
|
|
153
|
-
// if the component gets recreated the status of the change might not be initial
|
|
154
|
-
oChange.setInitialApplyState();
|
|
155
|
-
if (oReferenceChange) {
|
|
156
|
-
DependencyHandler.insertChange(oChange, this.getDependencyMapForComponent(), oReferenceChange);
|
|
157
|
-
}
|
|
158
|
-
DependencyHandler.addChangeAndUpdateDependencies(oChange, oAppComponent, this.getDependencyMapForComponent());
|
|
159
|
-
};
|
|
160
|
-
|
|
161
|
-
ChangePersistence.prototype._addRunTimeCreatedChangeToDependencyMap = function(oAppComponent, oChange) {
|
|
162
|
-
DependencyHandler.addRuntimeChangeToMap(oChange, oAppComponent, this.getDependencyMapForComponent());
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* Getter for the private aggregation containing sap.ui.fl.apply._internal.flexObjects.FlexObject objects mapped by their selector ids.
|
|
167
|
-
* @return {Object<string,object>} mChanges mapping with changes sorted by their selector ids
|
|
168
|
-
* @public
|
|
169
|
-
*/
|
|
170
|
-
ChangePersistence.prototype.getDependencyMapForComponent = function() {
|
|
171
|
-
return FlexObjectState.getLiveDependencyMap(this._mComponent.name);
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
function finalizeChangeCreation(oChange, oAppComponent) {
|
|
175
|
-
this._addRunTimeCreatedChangeToDependencyMap(oAppComponent, oChange);
|
|
176
|
-
this._addPropagationListener(oAppComponent);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* Adds a new change and returns the id of the new change.
|
|
181
|
-
*
|
|
182
|
-
* @param {object} vChange - The complete and finalized JSON object representation the file content of the change or a Change instance
|
|
183
|
-
* @param {sap.ui.core.Component} oAppComponent - Application component instance
|
|
184
|
-
* @returns {sap.ui.fl.apply._internal.flexObjects.FlexObject} the newly created change
|
|
185
|
-
* @public
|
|
186
|
-
*/
|
|
187
|
-
ChangePersistence.prototype.addChange = function(vChange, oAppComponent) {
|
|
188
|
-
var oChange = this.addDirtyChange(vChange);
|
|
189
|
-
finalizeChangeCreation.call(this, oChange, oAppComponent);
|
|
190
|
-
return oChange;
|
|
191
|
-
};
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
* Adds new changes and returns the ids of the new changes.
|
|
195
|
-
*
|
|
196
|
-
* @param {object[]} aChanges - Array with complete and finalized JSON object representation the file content of the changes or Change instances
|
|
197
|
-
* @param {sap.ui.core.Component} oAppComponent - Application component instance
|
|
198
|
-
* @returns {sap.ui.fl.apply._internal.flexObjects.FlexObject[]} the newly created changes
|
|
199
|
-
* @public
|
|
200
|
-
*/
|
|
201
|
-
ChangePersistence.prototype.addChanges = function(aChanges, oAppComponent) {
|
|
202
|
-
var aNewChanges = this.addDirtyChanges(aChanges);
|
|
203
|
-
aNewChanges.forEach(function(oChange) {
|
|
204
|
-
finalizeChangeCreation.call(this, oChange, oAppComponent);
|
|
205
|
-
}.bind(this));
|
|
206
|
-
return aNewChanges;
|
|
207
|
-
};
|
|
208
|
-
|
|
209
|
-
function createChange(vChange) {
|
|
210
|
-
return (
|
|
211
|
-
typeof vChange.isA === "function"
|
|
212
|
-
&& vChange.isA("sap.ui.fl.apply._internal.flexObjects.FlexObject")
|
|
213
|
-
)
|
|
214
|
-
? vChange
|
|
215
|
-
: FlexObjectFactory.createFromFileContent(vChange);
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
/**
|
|
219
|
-
* Adds a new dirty change.
|
|
220
|
-
*
|
|
221
|
-
* @param {object} vChange - JSON object of change or change object
|
|
222
|
-
* @returns {sap.ui.fl.apply._internal.flexObjects.FlexObject} The prepared change object
|
|
223
|
-
* @public
|
|
224
|
-
*/
|
|
225
|
-
ChangePersistence.prototype.addDirtyChange = function(vChange) {
|
|
226
|
-
const oNewChange = createChange(vChange);
|
|
227
|
-
FlexState.addDirtyFlexObject(this._mComponent.name, oNewChange);
|
|
228
|
-
return oNewChange;
|
|
229
|
-
};
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* Adds new dirty changes.
|
|
233
|
-
*
|
|
234
|
-
* @param {object[]} aChanges - JSON objects of changes or change objects
|
|
235
|
-
* @returns {sap.ui.fl.apply._internal.flexObjects.FlexObject[]} The prepared change objects
|
|
236
|
-
* @public
|
|
237
|
-
*/
|
|
238
|
-
ChangePersistence.prototype.addDirtyChanges = function(aChanges) {
|
|
239
|
-
const aNewChanges = aChanges.map(createChange);
|
|
240
|
-
FlexState.addDirtyFlexObjects(this._mComponent.name, aNewChanges);
|
|
241
|
-
return aNewChanges;
|
|
242
|
-
};
|
|
243
|
-
|
|
244
|
-
/**
|
|
245
|
-
* If the first changes were created, the <code>propagationListener</code> of <code>sap.ui.fl</code> might not yet
|
|
246
|
-
* be attached to the application component and must be added then.
|
|
247
|
-
*
|
|
248
|
-
* @param {sap.ui.core.UIComponent} oComponent Component having an app component that might not have a propagation listener yet
|
|
249
|
-
* @private
|
|
250
|
-
*/
|
|
251
|
-
ChangePersistence.prototype._addPropagationListener = function(oComponent) {
|
|
252
|
-
var oAppComponent = Utils.getAppComponentForControl(oComponent);
|
|
253
|
-
if (oAppComponent instanceof Component) {
|
|
254
|
-
var fnCheckIsNotFlPropagationListener = function(fnPropagationListener) {
|
|
255
|
-
return !fnPropagationListener._bIsSapUiFlFlexControllerApplyChangesOnControl;
|
|
256
|
-
};
|
|
257
|
-
|
|
258
|
-
var bNoFlPropagationListenerAttached = oAppComponent.getPropagationListeners().every(fnCheckIsNotFlPropagationListener);
|
|
259
|
-
|
|
260
|
-
if (bNoFlPropagationListenerAttached) {
|
|
261
|
-
var fnPropagationListener = Applier.applyAllChangesForControl.bind(Applier, oAppComponent, this._mComponent.name);
|
|
262
|
-
fnPropagationListener._bIsSapUiFlFlexControllerApplyChangesOnControl = true;
|
|
263
|
-
oAppComponent.addPropagationListener(fnPropagationListener);
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
58
|
};
|
|
267
59
|
|
|
268
60
|
ChangePersistence.prototype._deleteNotSavedChanges = function(aChanges, aCondensedChanges, bAlreadyDeletedViaCondense) {
|
|
@@ -276,7 +68,10 @@ sap.ui.define([
|
|
|
276
68
|
// Remove also from Cache if the persisted change is still there (e.g. navigate away and back to the app)
|
|
277
69
|
FlexState.updateStorageResponse(this._mComponent.name, [{flexObject: oChange.convertToFileContent(), type: "delete"}]);
|
|
278
70
|
} else {
|
|
279
|
-
|
|
71
|
+
FlexObjectManager.deleteFlexObjects({
|
|
72
|
+
reference: this._mComponent.name,
|
|
73
|
+
flexObjects: [oChange]
|
|
74
|
+
});
|
|
280
75
|
}
|
|
281
76
|
}.bind(this));
|
|
282
77
|
};
|
|
@@ -316,13 +111,8 @@ sap.ui.define([
|
|
|
316
111
|
return bCondenserEnabled;
|
|
317
112
|
}
|
|
318
113
|
|
|
319
|
-
function isBackendCondensingEnabled(
|
|
320
|
-
|
|
321
|
-
if (bEnabled && !checkIfOnlyOne(aChanges, "getNamespace")) {
|
|
322
|
-
bEnabled = false;
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
return bEnabled;
|
|
114
|
+
function isBackendCondensingEnabled() {
|
|
115
|
+
return Settings.getInstanceOrUndef()?.isCondensingEnabled();
|
|
326
116
|
}
|
|
327
117
|
|
|
328
118
|
function updateCacheAndDeleteUnsavedChanges(aAllChanges, aCondensedChanges, bSkipUpdateCache, bAlreadyDeletedViaCondense) {
|
|
@@ -360,19 +150,13 @@ sap.ui.define([
|
|
|
360
150
|
}
|
|
361
151
|
|
|
362
152
|
function executeWriteAndRemoveCalls(sCurrentLayer, sRequest, sParentVersion, bSkipUpdateCache, aAllChanges, aCondensedChanges) {
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
if (oCondensedChange.getState() === States.LifecycleState.DELETED) {
|
|
367
|
-
aCondensedDeleteChanges.push(oCondensedChange);
|
|
368
|
-
return false;
|
|
369
|
-
}
|
|
370
|
-
return true;
|
|
371
|
-
});
|
|
153
|
+
let pRemoveCallsPromise = Promise.resolve();
|
|
154
|
+
const aDeletedChanges = aAllChanges.filter((oChange) => oChange.getState() === States.LifecycleState.DELETED);
|
|
155
|
+
const aNewChanges = aCondensedChanges.filter((oCondensedChange) => (oCondensedChange.getState() !== States.LifecycleState.DELETED));
|
|
372
156
|
|
|
373
157
|
// "remove" only supports a single change; multiple calls are required
|
|
374
|
-
if (
|
|
375
|
-
pRemoveCallsPromise = this.saveSequenceOfDirtyChanges(
|
|
158
|
+
if (aDeletedChanges.length) {
|
|
159
|
+
pRemoveCallsPromise = this.saveSequenceOfDirtyChanges(aDeletedChanges, bSkipUpdateCache, sParentVersion);
|
|
376
160
|
}
|
|
377
161
|
|
|
378
162
|
// "write" supports multiple changes at once
|
|
@@ -421,52 +205,50 @@ sap.ui.define([
|
|
|
421
205
|
bCondenseAnyLayer,
|
|
422
206
|
sLayer
|
|
423
207
|
) {
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
208
|
+
const aDirtyChanges = aChanges || FlexObjectState.getDirtyFlexObjects(this._mComponent.name);
|
|
209
|
+
const sCurrentLayer = aDirtyChanges.length && aDirtyChanges[0].getLayer() || sLayer;
|
|
210
|
+
const aRelevantChangesForCondensing = getAllRelevantChangesForCondensing.call(
|
|
427
211
|
this,
|
|
428
212
|
aDirtyChanges,
|
|
429
213
|
aDraftFilenames,
|
|
430
214
|
bCondenseAnyLayer,
|
|
431
215
|
sCurrentLayer
|
|
432
216
|
);
|
|
433
|
-
|
|
434
|
-
isBackendCondensingEnabled(
|
|
217
|
+
const bIsCondensingEnabled = (
|
|
218
|
+
isBackendCondensingEnabled()
|
|
435
219
|
&& canGivenChangesBeCondensed(oAppComponent, aRelevantChangesForCondensing, bCondenseAnyLayer)
|
|
436
220
|
);
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
221
|
+
const aAllFlexObjects = bIsCondensingEnabled ? aRelevantChangesForCondensing : aDirtyChanges;
|
|
222
|
+
const aChangesClone = aAllFlexObjects.slice(0);
|
|
223
|
+
const aRequests = getRequests(aDirtyChanges);
|
|
440
224
|
|
|
441
225
|
// Condensing is only allowed if all dirty changes belong to the same Transport Request
|
|
442
226
|
if (checkLayerAndSingleTransportRequest(aDirtyChanges)) {
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
}
|
|
227
|
+
const oCondensedChangesPromise = canGivenChangesBeCondensed(oAppComponent, aChangesClone, bCondenseAnyLayer)
|
|
228
|
+
? Condenser.condense(oAppComponent, aChangesClone)
|
|
229
|
+
: Promise.resolve(aChangesClone);
|
|
447
230
|
return oCondensedChangesPromise.then(function(aCondensedChanges) {
|
|
448
|
-
|
|
231
|
+
const sRequest = aRequests[0];
|
|
449
232
|
if (bIsCondensingEnabled) {
|
|
450
233
|
return Storage.condense({
|
|
451
|
-
allChanges:
|
|
234
|
+
allChanges: aAllFlexObjects,
|
|
452
235
|
condensedChanges: aCondensedChanges,
|
|
453
236
|
layer: sCurrentLayer,
|
|
454
237
|
transport: sRequest,
|
|
455
238
|
isLegacyVariant: false,
|
|
456
239
|
parentVersion: sParentVersion
|
|
457
240
|
}).then(function(oResponse) {
|
|
458
|
-
updateCacheAndDeleteUnsavedChanges.call(this,
|
|
241
|
+
updateCacheAndDeleteUnsavedChanges.call(this, aAllFlexObjects, aCondensedChanges, bSkipUpdateCache, true);
|
|
459
242
|
return oResponse;
|
|
460
243
|
}.bind(this));
|
|
461
244
|
}
|
|
462
|
-
// Non-condensing route
|
|
463
245
|
return executeWriteAndRemoveCalls.call(
|
|
464
246
|
this,
|
|
465
247
|
sCurrentLayer,
|
|
466
248
|
sRequest,
|
|
467
249
|
sParentVersion,
|
|
468
250
|
bSkipUpdateCache,
|
|
469
|
-
|
|
251
|
+
aAllFlexObjects,
|
|
470
252
|
aCondensedChanges
|
|
471
253
|
);
|
|
472
254
|
}.bind(this));
|
|
@@ -490,7 +272,7 @@ sap.ui.define([
|
|
|
490
272
|
var oFirstNewChange;
|
|
491
273
|
if (sParentVersion) {
|
|
492
274
|
// in case of changes saved for a draft only the first writing operation must have the parentVersion targeting the basis
|
|
493
|
-
// followup changes must point the
|
|
275
|
+
// followup changes must point the existing draft created with the first request
|
|
494
276
|
var aNewChanges = aDirtyChanges.filter(function(oChange) {
|
|
495
277
|
return oChange.getState() === States.LifecycleState.NEW;
|
|
496
278
|
});
|
|
@@ -510,6 +292,7 @@ sap.ui.define([
|
|
|
510
292
|
oCollectedResponse.response.push(...oResponse.response);
|
|
511
293
|
}
|
|
512
294
|
}
|
|
295
|
+
FlexState.getFlexObjectsDataSelector().checkUpdate({reference: this._mComponent.name});
|
|
513
296
|
return oCollectedResponse;
|
|
514
297
|
};
|
|
515
298
|
|
|
@@ -558,7 +341,7 @@ sap.ui.define([
|
|
|
558
341
|
flexObject: oDirtyChange.convertToFileContent()
|
|
559
342
|
}]);
|
|
560
343
|
break;
|
|
561
|
-
case States.LifecycleState.
|
|
344
|
+
case States.LifecycleState.UPDATED:
|
|
562
345
|
FlexState.updateStorageResponse(this._mComponent.name, [{
|
|
563
346
|
type: "update",
|
|
564
347
|
flexObject: oDirtyChange.convertToFileContent()
|
|
@@ -567,7 +350,6 @@ sap.ui.define([
|
|
|
567
350
|
default:
|
|
568
351
|
}
|
|
569
352
|
oDirtyChange.setState(States.LifecycleState.PERSISTED);
|
|
570
|
-
FlexState.getFlexObjectsDataSelector().checkUpdate({reference: this._mComponent.name});
|
|
571
353
|
}
|
|
572
354
|
};
|
|
573
355
|
|
|
@@ -580,6 +362,7 @@ sap.ui.define([
|
|
|
580
362
|
aDirtyChanges.forEach(function(oDirtyChange) {
|
|
581
363
|
this._updateCacheAndDirtyState(oDirtyChange, bSkipUpdateCache);
|
|
582
364
|
}, this);
|
|
365
|
+
FlexState.getFlexObjectsDataSelector().checkUpdate({reference: this._mComponent.name});
|
|
583
366
|
};
|
|
584
367
|
|
|
585
368
|
function getRequests(aDirtyChanges) {
|
|
@@ -618,57 +401,8 @@ sap.ui.define([
|
|
|
618
401
|
return aChanges;
|
|
619
402
|
}
|
|
620
403
|
|
|
621
|
-
/**
|
|
622
|
-
* Prepares a change to be deleted with the next call to
|
|
623
|
-
* @see {ChangePersistence#saveDirtyChanges};
|
|
624
|
-
*
|
|
625
|
-
* If the given change is already in the dirty changes and
|
|
626
|
-
* has the 'NEW' state it will be removed, assuming,
|
|
627
|
-
* it has just been created in the current session;
|
|
628
|
-
*
|
|
629
|
-
* Otherwise it will be marked for deletion.
|
|
630
|
-
*
|
|
631
|
-
* @param {sap.ui.fl.apply._internal.flexObjects.FlexObject} oChange the change to be deleted
|
|
632
|
-
* @param {boolean} [bRunTimeCreatedChange] set if the change was created at runtime
|
|
633
|
-
* @param {boolean} [bSkipRemoveFromFlexState] set if the change should not be removed from the FlexState
|
|
634
|
-
*/
|
|
635
|
-
ChangePersistence.prototype.deleteChange = function(oChange, bRunTimeCreatedChange, bSkipRemoveFromFlexState) {
|
|
636
|
-
const nIndexInDirtyChanges = FlexObjectState.getDirtyFlexObjects(this._mComponent.name).indexOf(oChange);
|
|
637
|
-
|
|
638
|
-
if (nIndexInDirtyChanges > -1) {
|
|
639
|
-
if (oChange.getState() === States.LifecycleState.DELETED) {
|
|
640
|
-
return;
|
|
641
|
-
}
|
|
642
|
-
if (!bSkipRemoveFromFlexState) {
|
|
643
|
-
FlexState.removeDirtyFlexObject(this._mComponent.name, oChange);
|
|
644
|
-
}
|
|
645
|
-
this._deleteChangeInMap(oChange, bRunTimeCreatedChange);
|
|
646
|
-
return;
|
|
647
|
-
}
|
|
648
|
-
|
|
649
|
-
oChange.markForDeletion();
|
|
650
|
-
this.addDirtyChange(oChange);
|
|
651
|
-
this._deleteChangeInMap(oChange, bRunTimeCreatedChange);
|
|
652
|
-
};
|
|
653
|
-
|
|
654
|
-
/**
|
|
655
|
-
* Prepares multiple changes to be deleted with the next call to
|
|
656
|
-
* @see {ChangePersistence#saveDirtyChanges};
|
|
657
|
-
*
|
|
658
|
-
* Removal from the FlexState happens in one go to trigger only one invalidation.
|
|
659
|
-
*
|
|
660
|
-
* @param {sap.ui.fl.apply._internal.flexObjects.FlexObject[]} aChanges the changes to be deleted
|
|
661
|
-
* @param {boolean} [bRunTimeCreatedChanges] set if the change was created at runtime
|
|
662
|
-
*/
|
|
663
|
-
ChangePersistence.prototype.deleteChanges = function(aChanges, bRunTimeCreatedChanges) {
|
|
664
|
-
aChanges.forEach(function(oChange) {
|
|
665
|
-
this.deleteChange(oChange, bRunTimeCreatedChanges, true);
|
|
666
|
-
}.bind(this));
|
|
667
|
-
FlexState.removeDirtyFlexObjects(this._mComponent.name, aChanges);
|
|
668
|
-
};
|
|
669
|
-
|
|
670
404
|
ChangePersistence.prototype.removeChange = function(oChange) {
|
|
671
|
-
FlexState.
|
|
405
|
+
FlexState.removeDirtyFlexObjects(this._mComponent.name, [oChange]);
|
|
672
406
|
this._deleteChangeInMap(oChange);
|
|
673
407
|
};
|
|
674
408
|
|
|
@@ -681,164 +415,10 @@ sap.ui.define([
|
|
|
681
415
|
*/
|
|
682
416
|
ChangePersistence.prototype._deleteChangeInMap = function(oChange, bRunTimeCreatedChange) {
|
|
683
417
|
var sChangeKey = oChange.getId();
|
|
684
|
-
DependencyHandler.removeChangeFromMap(this.
|
|
418
|
+
DependencyHandler.removeChangeFromMap(FlexObjectState.getLiveDependencyMap(this._mComponent.name), sChangeKey);
|
|
685
419
|
if (!bRunTimeCreatedChange) {
|
|
686
|
-
DependencyHandler.removeChangeFromDependencies(this.
|
|
687
|
-
}
|
|
688
|
-
};
|
|
689
|
-
|
|
690
|
-
function isLocalAndInLayer(sLayer, oObject) {
|
|
691
|
-
return (oObject.getRequest() === "$TMP" || oObject.getRequest() === "") && oObject.getLayer() === sLayer;
|
|
692
|
-
}
|
|
693
|
-
|
|
694
|
-
function isPersistedAndInLayer(sLayer, oObject) {
|
|
695
|
-
return oObject.getState() === States.LifecycleState.PERSISTED && oObject.getLayer() === sLayer;
|
|
696
|
-
}
|
|
697
|
-
|
|
698
|
-
function getAllCompVariantsEntities() {
|
|
699
|
-
var aCompVariantEntities = [];
|
|
700
|
-
var mCompVariantsMap = FlexState.getCompVariantsMap(this._mComponent.name);
|
|
701
|
-
for (var sPersistencyKey in mCompVariantsMap) {
|
|
702
|
-
for (var sId in mCompVariantsMap[sPersistencyKey].byId) {
|
|
703
|
-
aCompVariantEntities.push(mCompVariantsMap[sPersistencyKey].byId[sId]);
|
|
704
|
-
}
|
|
705
|
-
}
|
|
706
|
-
return aCompVariantEntities;
|
|
707
|
-
}
|
|
708
|
-
/**
|
|
709
|
-
* Transports all the UI changes and app variant descriptor (if exists) to the target system
|
|
710
|
-
*
|
|
711
|
-
* @param {object} oRootControl - the root control of the running application
|
|
712
|
-
* @param {string} sStyleClass - RTA style class name
|
|
713
|
-
* @param {string} sLayer - Working layer
|
|
714
|
-
* @param {array} [aAppVariantDescriptors] - an array of app variant descriptors which needs to be transported
|
|
715
|
-
* @returns {Promise} promise that resolves when all the artifacts are successfully transported
|
|
716
|
-
*/
|
|
717
|
-
ChangePersistence.prototype.transportAllUIChanges = function(oRootControl, sStyleClass, sLayer, aAppVariantDescriptors) {
|
|
718
|
-
return this.getChangesForComponent({currentLayer: sLayer, includeCtrlVariants: true}).then(function(aLocalChanges) {
|
|
719
|
-
var aCompVariantEntities = getAllCompVariantsEntities.call(this);
|
|
720
|
-
|
|
721
|
-
aLocalChanges = aLocalChanges.concat(
|
|
722
|
-
aCompVariantEntities.filter(isLocalAndInLayer.bind(this, sLayer)));
|
|
723
|
-
|
|
724
|
-
return Storage.publish({
|
|
725
|
-
transportDialogSettings: {
|
|
726
|
-
styleClass: sStyleClass
|
|
727
|
-
},
|
|
728
|
-
layer: sLayer,
|
|
729
|
-
reference: this._mComponent.name,
|
|
730
|
-
localChanges: aLocalChanges,
|
|
731
|
-
appVariantDescriptors: aAppVariantDescriptors
|
|
732
|
-
});
|
|
733
|
-
}.bind(this));
|
|
734
|
-
};
|
|
735
|
-
|
|
736
|
-
/**
|
|
737
|
-
* Removes unsaved changes.
|
|
738
|
-
*
|
|
739
|
-
* @param {string|string[]} [vLayer] - Layer or multiple layers for which changes shall be deleted. If omitted, changes on all layers are considered.
|
|
740
|
-
* @param {sap.ui.core.Component} [oComponent] - Component instance, required if oControl is specified
|
|
741
|
-
* @param {string} [oControl] - Control for which the changes should be deleted. If omitted, all changes for the app component are considered.
|
|
742
|
-
* @param {string} [sGenerator] - Generator of changes (optional)
|
|
743
|
-
* @param {string[]} [aChangeTypes] - Types of changes (optional)
|
|
744
|
-
*
|
|
745
|
-
* @returns {Promise} Promise that resolves after the deletion took place
|
|
746
|
-
*/
|
|
747
|
-
ChangePersistence.prototype.removeDirtyChanges = function(vLayer, oComponent, oControl, sGenerator, aChangeTypes) {
|
|
748
|
-
var aLayers = [].concat(vLayer || []);
|
|
749
|
-
var aDirtyChanges = FlexObjectState.getDirtyFlexObjects(this._mComponent.name);
|
|
750
|
-
|
|
751
|
-
var aChangesToBeRemoved = aDirtyChanges.filter(function(oChange) {
|
|
752
|
-
var bChangeValid = true;
|
|
753
|
-
|
|
754
|
-
if (aLayers.length && !aLayers.includes(oChange.getLayer())) {
|
|
755
|
-
return false;
|
|
756
|
-
}
|
|
757
|
-
|
|
758
|
-
if (sGenerator && oChange.getSupportInformation().generator !== sGenerator) {
|
|
759
|
-
return false;
|
|
760
|
-
}
|
|
761
|
-
|
|
762
|
-
if (oControl) {
|
|
763
|
-
var vSelector = oChange.getSelector();
|
|
764
|
-
bChangeValid = oControl.getId() === JsControlTreeModifier.getControlIdBySelector(vSelector, oComponent);
|
|
765
|
-
}
|
|
766
|
-
|
|
767
|
-
if (aChangeTypes) {
|
|
768
|
-
bChangeValid &&= aChangeTypes.indexOf(oChange.getChangeType()) !== -1;
|
|
769
|
-
}
|
|
770
|
-
|
|
771
|
-
return bChangeValid;
|
|
772
|
-
});
|
|
773
|
-
|
|
774
|
-
FlexState.removeDirtyFlexObjects(this._mComponent.name, aChangesToBeRemoved);
|
|
775
|
-
aChangesToBeRemoved.forEach(function(oChange) {
|
|
776
|
-
var nIndex = aDirtyChanges.indexOf(oChange);
|
|
777
|
-
aDirtyChanges.splice(nIndex, 1);
|
|
778
|
-
});
|
|
779
|
-
|
|
780
|
-
return Promise.resolve(aChangesToBeRemoved);
|
|
781
|
-
};
|
|
782
|
-
|
|
783
|
-
/**
|
|
784
|
-
* Reset changes on the server. Specification of a generator, selector string or change type string is optional
|
|
785
|
-
* but at least one of these parameters has to be filled.
|
|
786
|
-
* This function returns an array of changes which need to be reverted from UI. When neither a selector nor a change type is provided,
|
|
787
|
-
* an empty array is returned (this triggers a reset of the changes for an entire application component and reloads it).
|
|
788
|
-
*
|
|
789
|
-
* @param {string} sLayer Layer for which changes shall be deleted
|
|
790
|
-
* @param {string} [sGenerator] Generator of changes (optional)
|
|
791
|
-
* @param {string[]} [aSelectorIds] Selector IDs in local format (optional)
|
|
792
|
-
* @param {string[]} [aChangeTypes] Types of changes (optional)
|
|
793
|
-
*
|
|
794
|
-
* @returns {Promise} Promise that resolves with an array of changes which need to be reverted from UI
|
|
795
|
-
*/
|
|
796
|
-
ChangePersistence.prototype.resetChanges = async function(sLayer, sGenerator, aSelectorIds, aChangeTypes) {
|
|
797
|
-
const bSelectorIdsProvided = aSelectorIds && aSelectorIds.length > 0;
|
|
798
|
-
const bChangeTypesProvided = aChangeTypes && aChangeTypes.length > 0;
|
|
799
|
-
|
|
800
|
-
// In case of application reset and PUBLIC layer available, also includes comp variant entities
|
|
801
|
-
const isPublicLayerAvailable = Settings.getInstanceOrUndef() && Settings.getInstanceOrUndef().isPublicLayerAvailable();
|
|
802
|
-
const isApplicationReset = sGenerator === undefined && aSelectorIds === undefined && aChangeTypes === undefined;
|
|
803
|
-
const aCompVariantsEntries = (isPublicLayerAvailable && isApplicationReset) ?
|
|
804
|
-
getAllCompVariantsEntities.call(this).filter(isPersistedAndInLayer.bind(this, sLayer))
|
|
805
|
-
: [];
|
|
806
|
-
|
|
807
|
-
const aUiChanges = await this.getChangesForComponent({currentLayer: sLayer, includeCtrlVariants: true});
|
|
808
|
-
const aFlexObjects = aUiChanges.concat(aCompVariantsEntries);
|
|
809
|
-
const mParams = {
|
|
810
|
-
reference: this._mComponent.name,
|
|
811
|
-
layer: sLayer,
|
|
812
|
-
changes: aFlexObjects
|
|
813
|
-
};
|
|
814
|
-
if (sGenerator) {
|
|
815
|
-
mParams.generator = sGenerator;
|
|
816
|
-
}
|
|
817
|
-
if (bSelectorIdsProvided) {
|
|
818
|
-
mParams.selectorIds = aSelectorIds;
|
|
819
|
-
}
|
|
820
|
-
if (bChangeTypesProvided) {
|
|
821
|
-
mParams.changeTypes = aChangeTypes;
|
|
822
|
-
}
|
|
823
|
-
|
|
824
|
-
const oResponse = await Storage.reset(mParams);
|
|
825
|
-
// If reset changes for control, returns an array of deleted changes for reverting
|
|
826
|
-
if (aSelectorIds || aChangeTypes) {
|
|
827
|
-
const aNames = [];
|
|
828
|
-
if (oResponse && oResponse.response && oResponse.response.length > 0) {
|
|
829
|
-
oResponse.response.forEach(function(oChangeContentId) {
|
|
830
|
-
aNames.push(oChangeContentId.fileName);
|
|
831
|
-
});
|
|
832
|
-
}
|
|
833
|
-
const aChangesToRevert = UIChangesState.getAllUIChanges(this._mComponent.name).filter(function(oChange) {
|
|
834
|
-
return aNames.indexOf(oChange.getId()) !== -1;
|
|
835
|
-
});
|
|
836
|
-
FlexState.updateStorageResponse(this._mComponent.name, aChangesToRevert.map((oFlexObject) => {
|
|
837
|
-
return {flexObject: oFlexObject.convertToFileContent(), type: "delete"};
|
|
838
|
-
}));
|
|
839
|
-
return aChangesToRevert;
|
|
420
|
+
DependencyHandler.removeChangeFromDependencies(FlexObjectState.getLiveDependencyMap(this._mComponent.name), sChangeKey);
|
|
840
421
|
}
|
|
841
|
-
return [];
|
|
842
422
|
};
|
|
843
423
|
|
|
844
424
|
return ChangePersistence;
|