@openui5/sap.ui.fl 1.136.1 → 1.138.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/REUSE.toml +0 -28
- package/THIRDPARTY.txt +1 -25
- package/package.json +3 -3
- package/src/sap/ui/fl/.library +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/LayerUtils.js +1 -1
- package/src/sap/ui/fl/Utils.js +4 -2
- package/src/sap/ui/fl/apply/_internal/DelegateMediator.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/FlexCustomData.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/Utils.js +3 -8
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/Preprocessor.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/Registration.js +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/RegistrationBuild.js +1 -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/AddNewDataSource.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/AddNewOutbound.js +1 -1
- 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 +1 -1
- package/src/sap/ui/fl/apply/_internal/changes/descriptor/app/ChangeOutbound.js +1 -1
- 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 +1 -1
- 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 +1 -1
- package/src/sap/ui/fl/apply/_internal/flexObjects/AppDescriptorChange.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexObjects/CompVariant.js +6 -6
- 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 +3 -3
- package/src/sap/ui/fl/apply/_internal/flexObjects/FlexObjectFactory.js +3 -3
- 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/VariantChange.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexObjects/VariantManagementChange.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexObjects/getVariantAuthor.js +5 -5
- package/src/sap/ui/fl/apply/_internal/flexState/FlexObjectState.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexState/FlexState.js +3 -8
- package/src/sap/ui/fl/apply/_internal/flexState/Loader.js +6 -6
- 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/CompVariantManagementState.js +1 -1
- package/src/sap/ui/fl/apply/_internal/flexState/compVariants/CompVariantMerger.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 +3 -3
- package/src/sap/ui/fl/apply/_internal/preprocessors/ComponentLifecycleHooks.js +3 -7
- 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/apply/api/FlexRuntimeInfoAPI.js +22 -3
- 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 +1 -1
- package/src/sap/ui/fl/changeHandler/BaseRename.js +1 -1
- package/src/sap/ui/fl/changeHandler/ChangeAnnotation.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/api/DescriptorChange.js +10 -12
- package/src/sap/ui/fl/descriptorRelated/api/DescriptorChangeFactory.js +3 -3
- 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/Settings.js +139 -0
- package/src/sap/ui/fl/initial/_internal/Storage.js +1 -1
- package/src/sap/ui/fl/initial/_internal/StorageFeaturesMerger.js +18 -24
- package/src/sap/ui/fl/initial/_internal/StorageUtils.js +1 -1
- package/src/sap/ui/fl/initial/_internal/changeHandlers/ChangeHandlerRegistration.js +1 -1
- package/src/sap/ui/fl/initial/_internal/changeHandlers/ChangeHandlerStorage.js +19 -7
- package/src/sap/ui/fl/initial/_internal/connectors/BtpServiceConnector.js +3 -1
- package/src/sap/ui/fl/initial/_internal/connectors/Utils.js +5 -2
- package/src/sap/ui/fl/initial/_internal/storageResultDisassemble.js +1 -1
- package/src/sap/ui/fl/initial/api/InitialFlexAPI.js +3 -3
- 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/messagebundle.properties +0 -9
- package/src/sap/ui/fl/messagebundle_ar.properties +0 -6
- package/src/sap/ui/fl/messagebundle_bg.properties +0 -6
- package/src/sap/ui/fl/messagebundle_ca.properties +0 -6
- package/src/sap/ui/fl/messagebundle_cnr.properties +0 -6
- package/src/sap/ui/fl/messagebundle_cs.properties +0 -6
- package/src/sap/ui/fl/messagebundle_cy.properties +0 -6
- package/src/sap/ui/fl/messagebundle_da.properties +0 -6
- package/src/sap/ui/fl/messagebundle_de.properties +0 -6
- package/src/sap/ui/fl/messagebundle_el.properties +0 -6
- package/src/sap/ui/fl/messagebundle_en.properties +0 -6
- package/src/sap/ui/fl/messagebundle_en_GB.properties +0 -6
- package/src/sap/ui/fl/messagebundle_en_US_saprigi.properties +0 -6
- package/src/sap/ui/fl/messagebundle_es.properties +0 -6
- package/src/sap/ui/fl/messagebundle_es_MX.properties +0 -6
- package/src/sap/ui/fl/messagebundle_et.properties +0 -6
- package/src/sap/ui/fl/messagebundle_fi.properties +0 -6
- package/src/sap/ui/fl/messagebundle_fr.properties +0 -6
- package/src/sap/ui/fl/messagebundle_fr_CA.properties +0 -6
- package/src/sap/ui/fl/messagebundle_hi.properties +0 -6
- package/src/sap/ui/fl/messagebundle_hr.properties +0 -6
- package/src/sap/ui/fl/messagebundle_hu.properties +0 -6
- package/src/sap/ui/fl/messagebundle_id.properties +0 -6
- package/src/sap/ui/fl/messagebundle_it.properties +0 -6
- package/src/sap/ui/fl/messagebundle_iw.properties +0 -6
- package/src/sap/ui/fl/messagebundle_ja.properties +0 -6
- package/src/sap/ui/fl/messagebundle_kk.properties +0 -6
- package/src/sap/ui/fl/messagebundle_ko.properties +0 -6
- package/src/sap/ui/fl/messagebundle_lt.properties +0 -6
- package/src/sap/ui/fl/messagebundle_lv.properties +0 -6
- package/src/sap/ui/fl/messagebundle_mk.properties +0 -6
- package/src/sap/ui/fl/messagebundle_ms.properties +0 -6
- package/src/sap/ui/fl/messagebundle_nl.properties +0 -6
- package/src/sap/ui/fl/messagebundle_no.properties +0 -6
- package/src/sap/ui/fl/messagebundle_pl.properties +0 -6
- package/src/sap/ui/fl/messagebundle_pt.properties +0 -6
- package/src/sap/ui/fl/messagebundle_pt_PT.properties +0 -6
- package/src/sap/ui/fl/messagebundle_ro.properties +0 -6
- package/src/sap/ui/fl/messagebundle_ru.properties +0 -6
- package/src/sap/ui/fl/messagebundle_sh.properties +0 -6
- package/src/sap/ui/fl/messagebundle_sk.properties +0 -6
- package/src/sap/ui/fl/messagebundle_sl.properties +0 -6
- package/src/sap/ui/fl/messagebundle_sr.properties +0 -6
- package/src/sap/ui/fl/messagebundle_sv.properties +0 -6
- package/src/sap/ui/fl/messagebundle_th.properties +0 -6
- package/src/sap/ui/fl/messagebundle_tr.properties +0 -6
- package/src/sap/ui/fl/messagebundle_uk.properties +0 -6
- package/src/sap/ui/fl/messagebundle_vi.properties +0 -6
- package/src/sap/ui/fl/messagebundle_zh_CN.properties +0 -6
- package/src/sap/ui/fl/messagebundle_zh_TW.properties +0 -6
- package/src/sap/ui/fl/support/_internal/getAllUIChanges.js +1 -1
- package/src/sap/ui/fl/support/_internal/getChangeDependencies.js +1 -1
- package/src/sap/ui/fl/support/_internal/getFlexObjectInfos.js +1 -1
- package/src/sap/ui/fl/support/_internal/getFlexSettings.js +4 -4
- package/src/sap/ui/fl/support/api/SupportAPI.js +1 -1
- 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/resolveBinding.js +4 -2
- package/src/sap/ui/fl/variants/VariantManagement.js +3 -3
- package/src/sap/ui/fl/variants/VariantManager.js +12 -10
- package/src/sap/ui/fl/variants/VariantModel.js +26 -24
- package/src/sap/ui/fl/variants/context/controller/ContextVisibility.controller.js +1 -1
- package/src/sap/ui/fl/write/_internal/SaveAs.js +7 -8
- package/src/sap/ui/fl/write/_internal/Storage.js +1 -14
- package/src/sap/ui/fl/write/_internal/Versions.js +40 -27
- 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 +1 -1
- 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 -11
- package/src/sap/ui/fl/write/_internal/connectors/LrepConnector.js +4 -14
- package/src/sap/ui/fl/write/_internal/connectors/NeoLrepConnector.js +2 -39
- 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/Utils.js +1 -1
- package/src/sap/ui/fl/write/_internal/controlVariants/ControlVariantWriteUtils.js +2 -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 +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/FlexObjectManager.js +303 -50
- package/src/sap/ui/fl/write/_internal/flexState/UI2Personalization/UI2PersonalizationState.js +1 -1
- package/src/sap/ui/fl/write/_internal/flexState/changes/UIChangeManager.js +3 -3
- package/src/sap/ui/fl/write/_internal/flexState/compVariants/CompVariantState.js +5 -5
- package/src/sap/ui/fl/write/_internal/transport/TransportSelection.js +14 -14
- package/src/sap/ui/fl/write/_internal/transport/Transports.js +1 -1
- package/src/sap/ui/fl/write/api/BusinessNetworkAPI.js +1 -1
- package/src/sap/ui/fl/write/api/ContextSharingAPI.js +7 -7
- package/src/sap/ui/fl/write/api/ControlPersonalizationWriteAPI.js +6 -11
- package/src/sap/ui/fl/write/api/FeaturesAPI.js +23 -17
- package/src/sap/ui/fl/write/api/FieldExtensibility.js +1 -1
- package/src/sap/ui/fl/write/api/PersistenceWriteAPI.js +20 -11
- package/src/sap/ui/fl/write/api/ReloadInfoAPI.js +48 -76
- package/src/sap/ui/fl/write/api/SmartBusinessWriteAPI.js +2 -2
- package/src/sap/ui/fl/write/api/SmartVariantManagementWriteAPI.js +7 -7
- package/src/sap/ui/fl/write/api/VersionsAPI.js +15 -0
- package/src/sap/ui/fl/write/connectors/BaseConnector.js +0 -9
- package/ui5.yaml +0 -1
- package/src/sap/ui/fl/ChangePersistence.js +0 -438
- package/src/sap/ui/fl/ChangePersistenceFactory.js +0 -60
- package/src/sap/ui/fl/FlexController.js +0 -174
- package/src/sap/ui/fl/FlexControllerFactory.js +0 -82
- package/src/sap/ui/fl/registry/Settings.js +0 -477
|
@@ -1,438 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* OpenUI5
|
|
3
|
-
* (c) Copyright 2025 SAP SE or an SAP affiliate company.
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
sap.ui.define([
|
|
8
|
-
"sap/base/Log",
|
|
9
|
-
"sap/ui/fl/apply/_internal/flexObjects/CompVariant",
|
|
10
|
-
"sap/ui/fl/apply/_internal/flexObjects/States",
|
|
11
|
-
"sap/ui/fl/apply/_internal/flexState/changes/DependencyHandler",
|
|
12
|
-
"sap/ui/fl/apply/_internal/flexState/FlexObjectState",
|
|
13
|
-
"sap/ui/fl/apply/_internal/flexState/FlexState",
|
|
14
|
-
"sap/ui/fl/initial/api/Version",
|
|
15
|
-
"sap/ui/fl/registry/Settings",
|
|
16
|
-
"sap/ui/fl/write/_internal/condenser/Condenser",
|
|
17
|
-
"sap/ui/fl/write/_internal/flexState/FlexObjectManager",
|
|
18
|
-
"sap/ui/fl/write/_internal/Storage",
|
|
19
|
-
"sap/ui/fl/Layer",
|
|
20
|
-
"sap/ui/fl/LayerUtils"
|
|
21
|
-
], function(
|
|
22
|
-
Log,
|
|
23
|
-
CompVariant,
|
|
24
|
-
States,
|
|
25
|
-
DependencyHandler,
|
|
26
|
-
FlexObjectState,
|
|
27
|
-
FlexState,
|
|
28
|
-
Version,
|
|
29
|
-
Settings,
|
|
30
|
-
Condenser,
|
|
31
|
-
FlexObjectManager,
|
|
32
|
-
Storage,
|
|
33
|
-
Layer,
|
|
34
|
-
LayerUtils
|
|
35
|
-
) {
|
|
36
|
-
"use strict";
|
|
37
|
-
|
|
38
|
-
/**
|
|
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
|
|
40
|
-
*
|
|
41
|
-
* @constructor
|
|
42
|
-
* @author SAP SE
|
|
43
|
-
* @version 1.136.1
|
|
44
|
-
* @since 1.25.0
|
|
45
|
-
* @private
|
|
46
|
-
* @param {object} mComponent - Component data to initiate <code>ChangePersistence</code> instance
|
|
47
|
-
* @param {string} mComponent.name - Name of the component this instance is responsible for
|
|
48
|
-
*/
|
|
49
|
-
var ChangePersistence = function(mComponent) {
|
|
50
|
-
this._mComponent = mComponent;
|
|
51
|
-
|
|
52
|
-
if (!this._mComponent || !this._mComponent.name) {
|
|
53
|
-
Log.error("The Control does not belong to an SAPUI5 component. Personalization and changes for this control might not work as expected.");
|
|
54
|
-
throw new Error("Missing component name.");
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
this._oMessagebundle = undefined;
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
ChangePersistence.prototype._deleteNotSavedChanges = function(aChanges, aCondensedChanges, bAlreadyDeletedViaCondense) {
|
|
61
|
-
aChanges.filter(function(oChange) {
|
|
62
|
-
return !aCondensedChanges.some(function(oCondensedChange) {
|
|
63
|
-
return oChange.getId() === oCondensedChange.getId();
|
|
64
|
-
});
|
|
65
|
-
}).forEach(function(oChange) {
|
|
66
|
-
if (bAlreadyDeletedViaCondense) {
|
|
67
|
-
this.removeChange(oChange);
|
|
68
|
-
// Remove also from Cache if the persisted change is still there (e.g. navigate away and back to the app)
|
|
69
|
-
FlexState.updateStorageResponse(this._mComponent.name, [{flexObject: oChange.convertToFileContent(), type: "delete"}]);
|
|
70
|
-
} else {
|
|
71
|
-
FlexObjectManager.deleteFlexObjects({
|
|
72
|
-
reference: this._mComponent.name,
|
|
73
|
-
flexObjects: [oChange]
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
}.bind(this));
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
function checkIfOnlyOne(aChanges, sFunctionName) {
|
|
80
|
-
var aProperties = aChanges.map(function(oChange) {
|
|
81
|
-
return oChange[sFunctionName]();
|
|
82
|
-
});
|
|
83
|
-
var aUniqueProperties = aProperties.filter(function(sValue, iIndex, aProperties) {
|
|
84
|
-
return aProperties.indexOf(sValue) === iIndex;
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
return aUniqueProperties.length === 1;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
function canGivenChangesBeCondensed(oAppComponent, aChanges, bCondenseAnyLayer) {
|
|
91
|
-
var bCondenserEnabled = false;
|
|
92
|
-
|
|
93
|
-
if (!oAppComponent || !checkIfOnlyOne(aChanges, "getLayer")) {
|
|
94
|
-
return false;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
if (bCondenseAnyLayer) {
|
|
98
|
-
bCondenserEnabled = true;
|
|
99
|
-
} else {
|
|
100
|
-
var sLayer = aChanges[0].getLayer();
|
|
101
|
-
if ([Layer.CUSTOMER, Layer.PUBLIC, Layer.USER].includes(sLayer)) {
|
|
102
|
-
bCondenserEnabled = true;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
var oUriParameters = new URLSearchParams(window.location.search);
|
|
107
|
-
if (oUriParameters.has("sap-ui-xx-condense-changes")) {
|
|
108
|
-
bCondenserEnabled = oUriParameters.get("sap-ui-xx-condense-changes") === "true";
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
return bCondenserEnabled;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
function isBackendCondensingEnabled() {
|
|
115
|
-
return Settings.getInstanceOrUndef()?.isCondensingEnabled();
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
function updateCacheAndDeleteUnsavedChanges(aAllChanges, aCondensedChanges, bSkipUpdateCache, bAlreadyDeletedViaCondense) {
|
|
119
|
-
this._massUpdateCacheAndDirtyState(aCondensedChanges, bSkipUpdateCache);
|
|
120
|
-
this._deleteNotSavedChanges(aAllChanges, aCondensedChanges, bAlreadyDeletedViaCondense);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
function getAllRelevantChangesForCondensing(aDirtyChanges, aDraftFilenames, bCondenseAnyLayer, sLayer, sReference) {
|
|
124
|
-
if (!aDirtyChanges.length && !bCondenseAnyLayer) {
|
|
125
|
-
return [];
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
// Only consider changes that are persisted, on the same layer, part of the current draft (if applicable)
|
|
129
|
-
// and have the same reference (relevant for app variants)
|
|
130
|
-
const aRelevantChanges = FlexState.getFlexObjectsDataSelector().get({reference: sReference})
|
|
131
|
-
.filter(function(oChange) {
|
|
132
|
-
// CompVariants are currently saved separately and should not be part of the condense request
|
|
133
|
-
// TODO: Remove CompVariant special handling todos#5
|
|
134
|
-
if (oChange instanceof CompVariant) {
|
|
135
|
-
return false;
|
|
136
|
-
}
|
|
137
|
-
if (oChange.getFlexObjectMetadata().reference !== sReference) {
|
|
138
|
-
return false;
|
|
139
|
-
}
|
|
140
|
-
if (sLayer === Layer.CUSTOMER && aDraftFilenames) {
|
|
141
|
-
return oChange.getState() === States.LifecycleState.PERSISTED && aDraftFilenames.includes(oChange.getId());
|
|
142
|
-
}
|
|
143
|
-
return oChange.getState() === States.LifecycleState.PERSISTED
|
|
144
|
-
&& LayerUtils.compareAgainstCurrentLayer(oChange.getLayer(), sLayer) === 0;
|
|
145
|
-
});
|
|
146
|
-
return aRelevantChanges.concat(aDirtyChanges);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
function checkLayerAndSingleTransportRequest(aDirtyChanges) {
|
|
150
|
-
if (aDirtyChanges.length) {
|
|
151
|
-
var aRequests = getRequests(aDirtyChanges);
|
|
152
|
-
var bCheckLayer = true;
|
|
153
|
-
if (Settings.getInstanceOrUndef() && Settings.getInstanceOrUndef().hasPersoConnector()) {
|
|
154
|
-
// Created public fl-Variant as default variant will created public and user changes
|
|
155
|
-
// no single request can be used, because CF needs PersoConnector and KeyuserConntector
|
|
156
|
-
var aLayers = getLayers(aDirtyChanges);
|
|
157
|
-
bCheckLayer = aLayers.length === 1;
|
|
158
|
-
}
|
|
159
|
-
return aRequests.length === 1 && bCheckLayer;
|
|
160
|
-
}
|
|
161
|
-
return true;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
function executeWriteAndRemoveCalls(sCurrentLayer, sRequest, sParentVersion, bSkipUpdateCache, aAllChanges, aCondensedChanges) {
|
|
165
|
-
let pRemoveCallsPromise = Promise.resolve();
|
|
166
|
-
const aDeletedChanges = aAllChanges.filter((oChange) => oChange.getState() === States.LifecycleState.DELETED);
|
|
167
|
-
const aNewChanges = aCondensedChanges.filter((oCondensedChange) => (oCondensedChange.getState() !== States.LifecycleState.DELETED));
|
|
168
|
-
|
|
169
|
-
// "remove" only supports a single change; multiple calls are required
|
|
170
|
-
if (aDeletedChanges.length) {
|
|
171
|
-
pRemoveCallsPromise = this.saveSequenceOfDirtyChanges(aDeletedChanges, bSkipUpdateCache, sParentVersion);
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
// "write" supports multiple changes at once
|
|
175
|
-
return pRemoveCallsPromise.then(function() {
|
|
176
|
-
if (aNewChanges.length) {
|
|
177
|
-
return Storage.write({
|
|
178
|
-
layer: sCurrentLayer,
|
|
179
|
-
flexObjects: prepareDirtyChanges(aNewChanges),
|
|
180
|
-
transport: sRequest,
|
|
181
|
-
isLegacyVariant: false,
|
|
182
|
-
parentVersion: sParentVersion
|
|
183
|
-
}).then(function(oResponse) {
|
|
184
|
-
updateCacheAndDeleteUnsavedChanges.call(this, aAllChanges, aNewChanges, bSkipUpdateCache);
|
|
185
|
-
return oResponse;
|
|
186
|
-
}.bind(this));
|
|
187
|
-
}
|
|
188
|
-
return this._deleteNotSavedChanges(aAllChanges, aCondensedChanges);
|
|
189
|
-
}.bind(this));
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
/**
|
|
193
|
-
* Saves the passed or all dirty changes by calling the appropriate back-end method
|
|
194
|
-
* (create for new changes, deleteChange for deleted changes);
|
|
195
|
-
* to ensure the correct order, the methods are called sequentially;
|
|
196
|
-
* after a change was saved successfully, it is removed from the dirty changes and the cache is updated.
|
|
197
|
-
* If all changes are new they are condensed before they are passed to the Storage. For this the App Component is necessary.
|
|
198
|
-
* Condensing is enabled by default for CUSTOMER and USER layers,
|
|
199
|
-
* but can be overruled with the URL Parameter 'sap-ui-xx-condense-changes'
|
|
200
|
-
*
|
|
201
|
-
* @param {sap.ui.core.UIComponent} [oAppComponent] - AppComponent instance
|
|
202
|
-
* @param {boolean} [bSkipUpdateCache] - If true, then the dirty change shall be saved for the new created app variant, but not for the current app;
|
|
203
|
-
* therefore, the cache update of the current app is skipped because the dirty change is not saved for the running app.
|
|
204
|
-
* @param {sap.ui.fl.apply._internal.flexObjects.FlexObject} [aChanges] - If passed only those changes are saved
|
|
205
|
-
* @param {string} sParentVersion - Parent version
|
|
206
|
-
* @param {string[]} [aDraftFilenames] - Filenames from persisted changes draft version
|
|
207
|
-
* @param {boolean} [bCondenseAnyLayer] - This will enable condensing regardless of the current layer
|
|
208
|
-
* @param {string} [sLayer] - Layer for which the changes should be saved
|
|
209
|
-
* @returns {Promise<object>} Resolving with the storage response after all changes have been saved
|
|
210
|
-
*/
|
|
211
|
-
ChangePersistence.prototype.saveDirtyChanges = function(
|
|
212
|
-
oAppComponent,
|
|
213
|
-
bSkipUpdateCache,
|
|
214
|
-
aChanges,
|
|
215
|
-
sParentVersion,
|
|
216
|
-
aDraftFilenames,
|
|
217
|
-
bCondenseAnyLayer,
|
|
218
|
-
sLayer
|
|
219
|
-
) {
|
|
220
|
-
const sReference = this._mComponent.name;
|
|
221
|
-
const aDirtyChanges = aChanges || FlexObjectState.getDirtyFlexObjects(sReference);
|
|
222
|
-
const sCurrentLayer = aDirtyChanges.length && aDirtyChanges[0].getLayer() || sLayer;
|
|
223
|
-
const aRelevantChangesForCondensing = getAllRelevantChangesForCondensing(
|
|
224
|
-
aDirtyChanges,
|
|
225
|
-
aDraftFilenames,
|
|
226
|
-
bCondenseAnyLayer,
|
|
227
|
-
sCurrentLayer,
|
|
228
|
-
sReference
|
|
229
|
-
);
|
|
230
|
-
const bIsCondensingEnabled = (
|
|
231
|
-
isBackendCondensingEnabled()
|
|
232
|
-
&& canGivenChangesBeCondensed(oAppComponent, aRelevantChangesForCondensing, bCondenseAnyLayer)
|
|
233
|
-
);
|
|
234
|
-
const aAllFlexObjects = bIsCondensingEnabled ? aRelevantChangesForCondensing : aDirtyChanges;
|
|
235
|
-
const aChangesClone = aAllFlexObjects.slice(0);
|
|
236
|
-
const aRequests = getRequests(aDirtyChanges);
|
|
237
|
-
|
|
238
|
-
// Condensing is only allowed if all dirty changes belong to the same Transport Request
|
|
239
|
-
if (checkLayerAndSingleTransportRequest(aDirtyChanges)) {
|
|
240
|
-
const oCondensedChangesPromise = canGivenChangesBeCondensed(oAppComponent, aChangesClone, bCondenseAnyLayer)
|
|
241
|
-
? Condenser.condense(oAppComponent, aChangesClone)
|
|
242
|
-
: Promise.resolve(aChangesClone);
|
|
243
|
-
return oCondensedChangesPromise.then(function(aCondensedChanges) {
|
|
244
|
-
const sRequest = aRequests[0];
|
|
245
|
-
if (bIsCondensingEnabled) {
|
|
246
|
-
return Storage.condense({
|
|
247
|
-
allChanges: aAllFlexObjects,
|
|
248
|
-
condensedChanges: aCondensedChanges,
|
|
249
|
-
layer: sCurrentLayer,
|
|
250
|
-
transport: sRequest,
|
|
251
|
-
isLegacyVariant: false,
|
|
252
|
-
parentVersion: sParentVersion
|
|
253
|
-
}).then(function(oResponse) {
|
|
254
|
-
updateCacheAndDeleteUnsavedChanges.call(this, aAllFlexObjects, aCondensedChanges, bSkipUpdateCache, true);
|
|
255
|
-
return oResponse;
|
|
256
|
-
}.bind(this));
|
|
257
|
-
}
|
|
258
|
-
return executeWriteAndRemoveCalls.call(
|
|
259
|
-
this,
|
|
260
|
-
sCurrentLayer,
|
|
261
|
-
sRequest,
|
|
262
|
-
sParentVersion,
|
|
263
|
-
bSkipUpdateCache,
|
|
264
|
-
aAllFlexObjects,
|
|
265
|
-
aCondensedChanges
|
|
266
|
-
);
|
|
267
|
-
}.bind(this));
|
|
268
|
-
}
|
|
269
|
-
return this.saveSequenceOfDirtyChanges(aDirtyChanges, bSkipUpdateCache, sParentVersion);
|
|
270
|
-
};
|
|
271
|
-
|
|
272
|
-
/**
|
|
273
|
-
* Saves a sequence of dirty changes by calling the appropriate back-end method
|
|
274
|
-
* (create for new changes, deleteChange for deleted changes);
|
|
275
|
-
* to ensure the correct order, the methods are called sequentially;
|
|
276
|
-
* after a change was saved successfully, it is removed from the dirty changes and the cache is updated.
|
|
277
|
-
*
|
|
278
|
-
* @param {sap.ui.fl.apply._internal.flexObjects.FlexObject[]} aDirtyChanges - Array of dirty changes to be saved
|
|
279
|
-
* @param {boolean} [bSkipUpdateCache] If true, then the dirty change shall be saved for the new created app variant, but not for the current app;
|
|
280
|
-
* therefore, the cache update of the current app is skipped because the dirty change is not saved for the running app.
|
|
281
|
-
* @param {string} [sParentVersion] - Indicates if changes should be written as a draft and on which version the changes should be based on
|
|
282
|
-
* @returns {Promise<object>} resolving with the collected storage response after all changes have been saved
|
|
283
|
-
*/
|
|
284
|
-
ChangePersistence.prototype.saveSequenceOfDirtyChanges = async function(aDirtyChanges, bSkipUpdateCache, sParentVersion) {
|
|
285
|
-
var oFirstNewChange;
|
|
286
|
-
if (sParentVersion) {
|
|
287
|
-
// in case of changes saved for a draft only the first writing operation must have the parentVersion targeting the basis
|
|
288
|
-
// followup changes must point the existing draft created with the first request
|
|
289
|
-
var aNewChanges = aDirtyChanges.filter(function(oChange) {
|
|
290
|
-
return oChange.getState() === States.LifecycleState.NEW;
|
|
291
|
-
});
|
|
292
|
-
oFirstNewChange = [].concat(aNewChanges).shift();
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
// A successful save operation returns the flexObject in the response
|
|
296
|
-
// The flexObjects are returned to the calling function where they will be set to persisted
|
|
297
|
-
const oCollectedResponse = {
|
|
298
|
-
response: []
|
|
299
|
-
};
|
|
300
|
-
|
|
301
|
-
for (const oDirtyChange of aDirtyChanges) {
|
|
302
|
-
const oResponse = await performSingleSaveAction(oDirtyChange, oFirstNewChange, sParentVersion);
|
|
303
|
-
this._updateCacheAndDirtyState(oDirtyChange, bSkipUpdateCache);
|
|
304
|
-
if (oResponse?.response) {
|
|
305
|
-
oCollectedResponse.response.push(...oResponse.response);
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
FlexState.getFlexObjectsDataSelector().checkUpdate({reference: this._mComponent.name});
|
|
309
|
-
return oCollectedResponse;
|
|
310
|
-
};
|
|
311
|
-
|
|
312
|
-
function performSingleSaveAction(oDirtyChange, oFirstChange, sParentVersion) {
|
|
313
|
-
switch (oDirtyChange.getState()) {
|
|
314
|
-
case States.LifecycleState.NEW:
|
|
315
|
-
if (sParentVersion !== undefined) {
|
|
316
|
-
sParentVersion = oDirtyChange === oFirstChange ? sParentVersion : Version.Number.Draft;
|
|
317
|
-
}
|
|
318
|
-
return Storage.write({
|
|
319
|
-
layer: oDirtyChange.getLayer(),
|
|
320
|
-
flexObjects: [oDirtyChange.convertToFileContent()],
|
|
321
|
-
transport: oDirtyChange.getRequest(),
|
|
322
|
-
parentVersion: sParentVersion
|
|
323
|
-
});
|
|
324
|
-
case States.LifecycleState.DELETED:
|
|
325
|
-
return Storage.remove({
|
|
326
|
-
flexObject: oDirtyChange.convertToFileContent(),
|
|
327
|
-
layer: oDirtyChange.getLayer(),
|
|
328
|
-
transport: oDirtyChange.getRequest(),
|
|
329
|
-
parentVersion: sParentVersion
|
|
330
|
-
});
|
|
331
|
-
default:
|
|
332
|
-
return Promise.resolve();
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
/**
|
|
337
|
-
* Updates the cache with the dirty change passed and removes it from the array of dirty changes if present.
|
|
338
|
-
* @param {sap.ui.fl.apply._internal.flexObjects.FlexObject} oDirtyChange Dirty change which was saved
|
|
339
|
-
* @param {boolean} [bSkipUpdateCache] If true, then the dirty change shall be saved for the new created app variant, but not for the current app
|
|
340
|
-
* therefore, the cache update of the current app is skipped
|
|
341
|
-
*/
|
|
342
|
-
ChangePersistence.prototype._updateCacheAndDirtyState = function(oDirtyChange, bSkipUpdateCache) {
|
|
343
|
-
if (!bSkipUpdateCache) {
|
|
344
|
-
switch (oDirtyChange.getState()) {
|
|
345
|
-
case States.LifecycleState.NEW:
|
|
346
|
-
FlexState.updateStorageResponse(this._mComponent.name, [{
|
|
347
|
-
type: "add",
|
|
348
|
-
flexObject: oDirtyChange.convertToFileContent()
|
|
349
|
-
}]);
|
|
350
|
-
break;
|
|
351
|
-
case States.LifecycleState.DELETED:
|
|
352
|
-
FlexState.updateStorageResponse(this._mComponent.name, [{
|
|
353
|
-
type: "delete",
|
|
354
|
-
flexObject: oDirtyChange.convertToFileContent()
|
|
355
|
-
}]);
|
|
356
|
-
break;
|
|
357
|
-
case States.LifecycleState.UPDATED:
|
|
358
|
-
FlexState.updateStorageResponse(this._mComponent.name, [{
|
|
359
|
-
type: "update",
|
|
360
|
-
flexObject: oDirtyChange.convertToFileContent()
|
|
361
|
-
}]);
|
|
362
|
-
break;
|
|
363
|
-
default:
|
|
364
|
-
}
|
|
365
|
-
oDirtyChange.setState(States.LifecycleState.PERSISTED);
|
|
366
|
-
}
|
|
367
|
-
};
|
|
368
|
-
|
|
369
|
-
/**
|
|
370
|
-
* @param {sap.ui.fl.apply._internal.flexObjects.FlexObject[]} aDirtyChanges - Array of dirty changes
|
|
371
|
-
* @param {boolean} [bSkipUpdateCache]- If <code>true</code>, then the dirty change shall be saved for the newly created app variant, but not for the current app;
|
|
372
|
-
* therefore, the cache update of the current app is skipped because the dirty change is not saved for the running app.
|
|
373
|
-
*/
|
|
374
|
-
ChangePersistence.prototype._massUpdateCacheAndDirtyState = function(aDirtyChanges, bSkipUpdateCache) {
|
|
375
|
-
aDirtyChanges.forEach(function(oDirtyChange) {
|
|
376
|
-
this._updateCacheAndDirtyState(oDirtyChange, bSkipUpdateCache);
|
|
377
|
-
}, this);
|
|
378
|
-
FlexState.getFlexObjectsDataSelector().checkUpdate({reference: this._mComponent.name});
|
|
379
|
-
};
|
|
380
|
-
|
|
381
|
-
function getRequests(aDirtyChanges) {
|
|
382
|
-
var aRequests = [];
|
|
383
|
-
|
|
384
|
-
aDirtyChanges.forEach(function(oChange) {
|
|
385
|
-
var sRequest = oChange.getRequest();
|
|
386
|
-
if (aRequests.indexOf(sRequest) === -1) {
|
|
387
|
-
aRequests.push(sRequest);
|
|
388
|
-
}
|
|
389
|
-
});
|
|
390
|
-
|
|
391
|
-
return aRequests;
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
function getLayers(aDirtyChanges) {
|
|
395
|
-
var aLayers = [];
|
|
396
|
-
|
|
397
|
-
aDirtyChanges.forEach(function(oChange) {
|
|
398
|
-
var sLayer = oChange.getLayer();
|
|
399
|
-
if (aLayers.indexOf(sLayer) === -1) {
|
|
400
|
-
aLayers.push(sLayer);
|
|
401
|
-
}
|
|
402
|
-
});
|
|
403
|
-
|
|
404
|
-
return aLayers;
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
function prepareDirtyChanges(aDirtyChanges) {
|
|
408
|
-
var aChanges = [];
|
|
409
|
-
|
|
410
|
-
aDirtyChanges.forEach(function(oChange) {
|
|
411
|
-
aChanges.push(oChange.convertToFileContent());
|
|
412
|
-
});
|
|
413
|
-
|
|
414
|
-
return aChanges;
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
ChangePersistence.prototype.removeChange = function(oChange) {
|
|
418
|
-
FlexState.removeDirtyFlexObjects(this._mComponent.name, [oChange]);
|
|
419
|
-
this._deleteChangeInMap(oChange);
|
|
420
|
-
};
|
|
421
|
-
|
|
422
|
-
/**
|
|
423
|
-
* Deletes a change object from the dependency map.
|
|
424
|
-
*
|
|
425
|
-
* @param {sap.ui.fl.apply._internal.flexObjects.FlexObject} oChange change which has to be removed from the mapping
|
|
426
|
-
* @param {boolean} [bRunTimeCreatedChange] set if the change was created at runtime
|
|
427
|
-
* @private
|
|
428
|
-
*/
|
|
429
|
-
ChangePersistence.prototype._deleteChangeInMap = function(oChange, bRunTimeCreatedChange) {
|
|
430
|
-
var sChangeKey = oChange.getId();
|
|
431
|
-
DependencyHandler.removeChangeFromMap(FlexObjectState.getLiveDependencyMap(this._mComponent.name), sChangeKey);
|
|
432
|
-
if (!bRunTimeCreatedChange) {
|
|
433
|
-
DependencyHandler.removeChangeFromDependencies(FlexObjectState.getLiveDependencyMap(this._mComponent.name), sChangeKey);
|
|
434
|
-
}
|
|
435
|
-
};
|
|
436
|
-
|
|
437
|
-
return ChangePersistence;
|
|
438
|
-
});
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* OpenUI5
|
|
3
|
-
* (c) Copyright 2025 SAP SE or an SAP affiliate company.
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
sap.ui.define([
|
|
8
|
-
"sap/ui/fl/apply/_internal/flexState/ManifestUtils",
|
|
9
|
-
"sap/ui/fl/ChangePersistence"
|
|
10
|
-
], function(
|
|
11
|
-
ManifestUtils,
|
|
12
|
-
ChangePersistence
|
|
13
|
-
) {
|
|
14
|
-
"use strict";
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Factory to get or create a new instances of {sap.ui.fl.ChangePersistence}
|
|
18
|
-
* @constructor
|
|
19
|
-
* @alias sap.ui.fl.ChangePersistenceFactory
|
|
20
|
-
* @since 1.27.0
|
|
21
|
-
* @author SAP SE
|
|
22
|
-
* @version 1.136.1
|
|
23
|
-
* @private
|
|
24
|
-
* @ui5-restricted sap.ui.fl
|
|
25
|
-
*/
|
|
26
|
-
var ChangePersistenceFactory = {};
|
|
27
|
-
ChangePersistenceFactory._instanceCache = {};
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Creates or returns an instance of the ChangePersistence
|
|
31
|
-
* @param {string} sComponentName - Name of the component
|
|
32
|
-
* @returns {sap.ui.fl.ChangePersistence} <code>ChangePersistence</code> instance
|
|
33
|
-
*/
|
|
34
|
-
ChangePersistenceFactory.getChangePersistenceForComponent = function(sComponentName) {
|
|
35
|
-
var oChangePersistence = ChangePersistenceFactory._instanceCache[sComponentName];
|
|
36
|
-
if (!oChangePersistence) {
|
|
37
|
-
var oComponent = {
|
|
38
|
-
name: sComponentName
|
|
39
|
-
};
|
|
40
|
-
oChangePersistence = new ChangePersistence(oComponent);
|
|
41
|
-
ChangePersistenceFactory._instanceCache[sComponentName] = oChangePersistence;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return oChangePersistence;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Creates or returns an instance of the ChangePersistence for the component of the specified control.
|
|
49
|
-
* The control needs to be embedded into a component.
|
|
50
|
-
* @param {sap.ui.core.Control} oControl The control for example a SmartField, SmartGroup or View
|
|
51
|
-
* @returns {sap.ui.fl.ChangePersistence} instance
|
|
52
|
-
*/
|
|
53
|
-
ChangePersistenceFactory.getChangePersistenceForControl = function(oControl) {
|
|
54
|
-
var sComponentId;
|
|
55
|
-
sComponentId = ManifestUtils.getFlexReferenceForControl(oControl);
|
|
56
|
-
return ChangePersistenceFactory.getChangePersistenceForComponent(sComponentId);
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
return ChangePersistenceFactory;
|
|
60
|
-
});
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* OpenUI5
|
|
3
|
-
* (c) Copyright 2025 SAP SE or an SAP affiliate company.
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
sap.ui.define([
|
|
8
|
-
"sap/ui/core/util/reflection/JsControlTreeModifier",
|
|
9
|
-
"sap/ui/fl/apply/_internal/changes/Reverter",
|
|
10
|
-
"sap/ui/fl/apply/_internal/flexObjects/States",
|
|
11
|
-
"sap/ui/fl/apply/_internal/flexState/FlexObjectState",
|
|
12
|
-
"sap/ui/fl/apply/_internal/flexState/FlexState",
|
|
13
|
-
"sap/ui/fl/write/_internal/flexState/FlexObjectManager",
|
|
14
|
-
"sap/ui/fl/write/_internal/Versions",
|
|
15
|
-
"sap/ui/fl/ChangePersistenceFactory",
|
|
16
|
-
"sap/ui/fl/Layer"
|
|
17
|
-
], function(
|
|
18
|
-
JsControlTreeModifier,
|
|
19
|
-
Reverter,
|
|
20
|
-
States,
|
|
21
|
-
FlexObjectState,
|
|
22
|
-
FlexState,
|
|
23
|
-
FlexObjectManager,
|
|
24
|
-
Versions,
|
|
25
|
-
ChangePersistenceFactory,
|
|
26
|
-
Layer
|
|
27
|
-
) {
|
|
28
|
-
"use strict";
|
|
29
|
-
|
|
30
|
-
async function revertChangesAndUpdateVariantModel(oAppComponent, sReference, aChanges) {
|
|
31
|
-
if (aChanges.length !== 0) {
|
|
32
|
-
await Reverter.revertMultipleChanges(
|
|
33
|
-
// Always revert changes in reverse order
|
|
34
|
-
[...aChanges].reverse(),
|
|
35
|
-
{
|
|
36
|
-
appComponent: oAppComponent,
|
|
37
|
-
modifier: JsControlTreeModifier,
|
|
38
|
-
reference: sReference
|
|
39
|
-
}
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Retrieves changes (LabelChange, etc.) for an sap.ui.core.mvc.View and applies these changes
|
|
46
|
-
*
|
|
47
|
-
* @param {string} sComponentName - Component name the flexibility controller is responsible for
|
|
48
|
-
* @constructor
|
|
49
|
-
* @class
|
|
50
|
-
* @alias sap.ui.fl.FlexController
|
|
51
|
-
* @since 1.27.0
|
|
52
|
-
* @private
|
|
53
|
-
* @author SAP SE
|
|
54
|
-
* @version 1.136.1
|
|
55
|
-
*/
|
|
56
|
-
var FlexController = function(sComponentName) {
|
|
57
|
-
this._oChangePersistence = undefined;
|
|
58
|
-
this._sComponentName = sComponentName || "";
|
|
59
|
-
if (this._sComponentName) {
|
|
60
|
-
this._oChangePersistence = ChangePersistenceFactory.getChangePersistenceForComponent(this._sComponentName);
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
FlexController.prototype._removeOtherLayerChanges = async function(oAppComponent, sLayer, bRemoveOtherLayerChanges) {
|
|
65
|
-
if (bRemoveOtherLayerChanges && sLayer) {
|
|
66
|
-
var aLayersToReset = Object.values(Layer).filter(function(sLayerToCheck) {
|
|
67
|
-
return sLayerToCheck !== sLayer;
|
|
68
|
-
});
|
|
69
|
-
const sReference = this._sComponentName;
|
|
70
|
-
const aRemovedChanges = FlexObjectManager.removeDirtyFlexObjects({
|
|
71
|
-
reference: sReference,
|
|
72
|
-
layers: aLayersToReset,
|
|
73
|
-
component: oAppComponent
|
|
74
|
-
});
|
|
75
|
-
await revertChangesAndUpdateVariantModel(oAppComponent, sReference, aRemovedChanges);
|
|
76
|
-
return aRemovedChanges;
|
|
77
|
-
}
|
|
78
|
-
return undefined;
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Saves all changes of a persistence instance.
|
|
83
|
-
*
|
|
84
|
-
* @param {sap.ui.core.UIComponent} [oAppComponent] - AppComponent instance
|
|
85
|
-
* @param {boolean} [bSkipUpdateCache=false] - Indicates the cache should not be updated
|
|
86
|
-
* @param {boolean} [bDraft=false] - Indicates if changes should be written as a draft
|
|
87
|
-
* @param {string} [sLayer] - Layer for which the changes should be saved
|
|
88
|
-
* @param {boolean} [bRemoveOtherLayerChanges=false] - Whether to remove changes on other layers before saving
|
|
89
|
-
* @param {boolean} [bCondenseAnyLayer] - This will enable condensing regardless of the current layer
|
|
90
|
-
* @returns {Promise} resolving with an array of responses or rejecting with the first error
|
|
91
|
-
* @public
|
|
92
|
-
*/
|
|
93
|
-
FlexController.prototype.saveAll = function(
|
|
94
|
-
oAppComponent,
|
|
95
|
-
bSkipUpdateCache,
|
|
96
|
-
bDraft,
|
|
97
|
-
sLayer,
|
|
98
|
-
bRemoveOtherLayerChanges,
|
|
99
|
-
bCondenseAnyLayer
|
|
100
|
-
) {
|
|
101
|
-
var sParentVersion;
|
|
102
|
-
var aDraftFilenames;
|
|
103
|
-
if (bDraft) {
|
|
104
|
-
var oVersionModel = Versions.getVersionsModel({
|
|
105
|
-
reference: this._sComponentName,
|
|
106
|
-
layer: Layer.CUSTOMER // only the customer layer has draft active
|
|
107
|
-
});
|
|
108
|
-
sParentVersion = oVersionModel.getProperty("/persistedVersion");
|
|
109
|
-
aDraftFilenames = oVersionModel.getProperty("/draftFilenames");
|
|
110
|
-
}
|
|
111
|
-
return this._removeOtherLayerChanges(oAppComponent, sLayer, bRemoveOtherLayerChanges)
|
|
112
|
-
.then(this._oChangePersistence.saveDirtyChanges.bind(
|
|
113
|
-
this._oChangePersistence,
|
|
114
|
-
oAppComponent,
|
|
115
|
-
bSkipUpdateCache,
|
|
116
|
-
undefined,
|
|
117
|
-
sParentVersion,
|
|
118
|
-
aDraftFilenames,
|
|
119
|
-
bCondenseAnyLayer,
|
|
120
|
-
sLayer
|
|
121
|
-
))
|
|
122
|
-
.then(function(oResult) {
|
|
123
|
-
if (bDraft) {
|
|
124
|
-
var mPropertyBag = {
|
|
125
|
-
reference: this._sComponentName,
|
|
126
|
-
layer: Layer.CUSTOMER // only the customer layer has draft active
|
|
127
|
-
};
|
|
128
|
-
// TODO: array as response is bad practice, should be changed to an object
|
|
129
|
-
if (oResult?.response && oResult.response.length > 0) {
|
|
130
|
-
var aDraftFilenames = [];
|
|
131
|
-
if (Array.isArray(oResult.response)) {
|
|
132
|
-
oResult.response.forEach(function(change) {
|
|
133
|
-
aDraftFilenames.push(change.fileName);
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
mPropertyBag.draftFilenames = aDraftFilenames;
|
|
137
|
-
Versions.onAllChangesSaved(mPropertyBag);
|
|
138
|
-
} else {
|
|
139
|
-
// need to update version model when condensing send post request with a delete change and afterwards call flex/data request with right version parameter
|
|
140
|
-
return Versions.updateModelFromBackend(mPropertyBag);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
return oResult;
|
|
144
|
-
}.bind(this));
|
|
145
|
-
};
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* Saves changes sequentially on the associated change persistence instance;
|
|
149
|
-
* This API must be only used in scenarios without draft (like personalization).
|
|
150
|
-
*
|
|
151
|
-
* @param {sap.ui.fl.apply._internal.flexObjects.FlexObject[]} [aDirtyChanges] - Dirty changes to be saved
|
|
152
|
-
* @param {sap.ui.core.UIComponent} [oAppComponent] - AppComponent instance
|
|
153
|
-
* @returns {Promise<object>} Resolves with the backend response when all changes have been saved
|
|
154
|
-
* @public
|
|
155
|
-
*/
|
|
156
|
-
FlexController.prototype.saveSequenceOfDirtyChanges = async function(aDirtyChanges, oAppComponent) {
|
|
157
|
-
// the same fallback is used in the ChangePersistence, but to update the state we need the changes also here
|
|
158
|
-
const aChanges = aDirtyChanges || FlexObjectState.getDirtyFlexObjects(this._sComponentName);
|
|
159
|
-
const oResponse = await this._oChangePersistence.saveDirtyChanges(oAppComponent, false, aChanges);
|
|
160
|
-
|
|
161
|
-
if (oResponse?.response?.length) {
|
|
162
|
-
var aFilenames = oResponse.response.map((oChangeJson) => oChangeJson.fileName);
|
|
163
|
-
aChanges.forEach(function(oDirtyChange) {
|
|
164
|
-
if (aFilenames.includes(oDirtyChange.getId())) {
|
|
165
|
-
oDirtyChange.setState(States.LifecycleState.PERSISTED);
|
|
166
|
-
}
|
|
167
|
-
});
|
|
168
|
-
FlexState.getFlexObjectsDataSelector().checkUpdate({reference: this._sComponentName});
|
|
169
|
-
}
|
|
170
|
-
return oResponse;
|
|
171
|
-
};
|
|
172
|
-
|
|
173
|
-
return FlexController;
|
|
174
|
-
});
|