@openui5/sap.ui.rta 1.113.0 → 1.114.1

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.
Files changed (152) hide show
  1. package/THIRDPARTY.txt +1 -1
  2. package/package.json +6 -6
  3. package/src/sap/ui/rta/.library +1 -1
  4. package/src/sap/ui/rta/Client.js +1 -1
  5. package/src/sap/ui/rta/RuntimeAuthoring.js +157 -53
  6. package/src/sap/ui/rta/Utils.js +35 -1
  7. package/src/sap/ui/rta/appVariant/AppVariantManager.js +6 -5
  8. package/src/sap/ui/rta/command/AddIFrame.js +1 -1
  9. package/src/sap/ui/rta/command/AddProperty.js +1 -1
  10. package/src/sap/ui/rta/command/AddXML.js +1 -1
  11. package/src/sap/ui/rta/command/AddXMLAtExtensionPoint.js +1 -1
  12. package/src/sap/ui/rta/command/AppDescriptorCommand.js +1 -1
  13. package/src/sap/ui/rta/command/BaseCommand.js +1 -1
  14. package/src/sap/ui/rta/command/BindProperty.js +1 -1
  15. package/src/sap/ui/rta/command/Combine.js +1 -1
  16. package/src/sap/ui/rta/command/CommandFactory.js +1 -1
  17. package/src/sap/ui/rta/command/CompositeCommand.js +1 -1
  18. package/src/sap/ui/rta/command/ControlVariantConfigure.js +1 -1
  19. package/src/sap/ui/rta/command/ControlVariantSave.js +1 -1
  20. package/src/sap/ui/rta/command/ControlVariantSaveAs.js +4 -2
  21. package/src/sap/ui/rta/command/ControlVariantSetTitle.js +1 -1
  22. package/src/sap/ui/rta/command/ControlVariantSwitch.js +1 -1
  23. package/src/sap/ui/rta/command/CreateContainer.js +1 -1
  24. package/src/sap/ui/rta/command/CustomAdd.js +1 -1
  25. package/src/sap/ui/rta/command/FlexCommand.js +1 -1
  26. package/src/sap/ui/rta/command/LREPSerializer.js +4 -2
  27. package/src/sap/ui/rta/command/LocalReset.js +1 -1
  28. package/src/sap/ui/rta/command/Move.js +1 -1
  29. package/src/sap/ui/rta/command/Property.js +1 -1
  30. package/src/sap/ui/rta/command/Remove.js +1 -1
  31. package/src/sap/ui/rta/command/Rename.js +1 -1
  32. package/src/sap/ui/rta/command/Resize.js +1 -1
  33. package/src/sap/ui/rta/command/Reveal.js +1 -1
  34. package/src/sap/ui/rta/command/Settings.js +1 -1
  35. package/src/sap/ui/rta/command/Split.js +1 -1
  36. package/src/sap/ui/rta/command/Stack.js +1 -1
  37. package/src/sap/ui/rta/command/appDescriptor/AddLibrary.js +1 -1
  38. package/src/sap/ui/rta/command/compVariant/CompVariantContent.js +1 -1
  39. package/src/sap/ui/rta/command/compVariant/CompVariantSaveAs.js +1 -1
  40. package/src/sap/ui/rta/command/compVariant/CompVariantSwitch.js +1 -1
  41. package/src/sap/ui/rta/command/compVariant/CompVariantUpdate.js +1 -1
  42. package/src/sap/ui/rta/enablement/elementActionTest.js +93 -76
  43. package/src/sap/ui/rta/library.js +2 -2
  44. package/src/sap/ui/rta/messagebundle.properties +40 -2
  45. package/src/sap/ui/rta/messagebundle_ar.properties +12 -4
  46. package/src/sap/ui/rta/messagebundle_bg.properties +12 -4
  47. package/src/sap/ui/rta/messagebundle_ca.properties +12 -4
  48. package/src/sap/ui/rta/messagebundle_cs.properties +12 -4
  49. package/src/sap/ui/rta/messagebundle_cy.properties +12 -4
  50. package/src/sap/ui/rta/messagebundle_da.properties +12 -4
  51. package/src/sap/ui/rta/messagebundle_de.properties +12 -4
  52. package/src/sap/ui/rta/messagebundle_el.properties +12 -4
  53. package/src/sap/ui/rta/messagebundle_en.properties +10 -2
  54. package/src/sap/ui/rta/messagebundle_en_GB.properties +10 -2
  55. package/src/sap/ui/rta/messagebundle_en_US_sappsd.properties +7 -2
  56. package/src/sap/ui/rta/messagebundle_en_US_saprigi.properties +7 -2
  57. package/src/sap/ui/rta/messagebundle_en_US_saptrc.properties +10 -2
  58. package/src/sap/ui/rta/messagebundle_es.properties +12 -4
  59. package/src/sap/ui/rta/messagebundle_es_MX.properties +12 -4
  60. package/src/sap/ui/rta/messagebundle_et.properties +12 -4
  61. package/src/sap/ui/rta/messagebundle_fi.properties +12 -4
  62. package/src/sap/ui/rta/messagebundle_fr.properties +12 -4
  63. package/src/sap/ui/rta/messagebundle_fr_CA.properties +12 -4
  64. package/src/sap/ui/rta/messagebundle_hi.properties +12 -4
  65. package/src/sap/ui/rta/messagebundle_hr.properties +12 -4
  66. package/src/sap/ui/rta/messagebundle_hu.properties +12 -4
  67. package/src/sap/ui/rta/messagebundle_id.properties +12 -4
  68. package/src/sap/ui/rta/messagebundle_it.properties +12 -4
  69. package/src/sap/ui/rta/messagebundle_iw.properties +12 -4
  70. package/src/sap/ui/rta/messagebundle_ja.properties +16 -8
  71. package/src/sap/ui/rta/messagebundle_kk.properties +12 -4
  72. package/src/sap/ui/rta/messagebundle_ko.properties +16 -8
  73. package/src/sap/ui/rta/messagebundle_lt.properties +12 -4
  74. package/src/sap/ui/rta/messagebundle_lv.properties +12 -4
  75. package/src/sap/ui/rta/messagebundle_ms.properties +16 -8
  76. package/src/sap/ui/rta/messagebundle_nl.properties +12 -4
  77. package/src/sap/ui/rta/messagebundle_no.properties +12 -4
  78. package/src/sap/ui/rta/messagebundle_pl.properties +12 -4
  79. package/src/sap/ui/rta/messagebundle_pt.properties +12 -4
  80. package/src/sap/ui/rta/messagebundle_pt_PT.properties +12 -4
  81. package/src/sap/ui/rta/messagebundle_ro.properties +12 -4
  82. package/src/sap/ui/rta/messagebundle_ru.properties +12 -4
  83. package/src/sap/ui/rta/messagebundle_sh.properties +12 -4
  84. package/src/sap/ui/rta/messagebundle_sk.properties +12 -4
  85. package/src/sap/ui/rta/messagebundle_sl.properties +12 -4
  86. package/src/sap/ui/rta/messagebundle_sv.properties +12 -4
  87. package/src/sap/ui/rta/messagebundle_th.properties +12 -4
  88. package/src/sap/ui/rta/messagebundle_tr.properties +12 -4
  89. package/src/sap/ui/rta/messagebundle_uk.properties +12 -4
  90. package/src/sap/ui/rta/messagebundle_vi.properties +12 -4
  91. package/src/sap/ui/rta/messagebundle_zh_CN.properties +12 -4
  92. package/src/sap/ui/rta/messagebundle_zh_TW.properties +12 -4
  93. package/src/sap/ui/rta/plugin/AddXMLAtExtensionPoint.js +1 -1
  94. package/src/sap/ui/rta/plugin/BaseCreate.js +1 -1
  95. package/src/sap/ui/rta/plugin/Combine.js +1 -1
  96. package/src/sap/ui/rta/plugin/CompVariant.js +6 -2
  97. package/src/sap/ui/rta/plugin/ControlVariant.js +4 -2
  98. package/src/sap/ui/rta/plugin/CreateContainer.js +1 -1
  99. package/src/sap/ui/rta/plugin/CutPaste.js +1 -1
  100. package/src/sap/ui/rta/plugin/DragDrop.js +1 -1
  101. package/src/sap/ui/rta/plugin/EasyAdd.js +1 -1
  102. package/src/sap/ui/rta/plugin/EasyRemove.js +1 -1
  103. package/src/sap/ui/rta/plugin/LocalReset.js +1 -1
  104. package/src/sap/ui/rta/plugin/Plugin.js +1 -1
  105. package/src/sap/ui/rta/plugin/RTAElementMover.js +1 -1
  106. package/src/sap/ui/rta/plugin/Remove.js +1 -1
  107. package/src/sap/ui/rta/plugin/Rename.js +1 -1
  108. package/src/sap/ui/rta/plugin/RenameHandler.js +1 -1
  109. package/src/sap/ui/rta/plugin/Resize.js +1 -1
  110. package/src/sap/ui/rta/plugin/Selection.js +1 -1
  111. package/src/sap/ui/rta/plugin/Settings.js +1 -1
  112. package/src/sap/ui/rta/plugin/Split.js +1 -1
  113. package/src/sap/ui/rta/plugin/Stretch.js +1 -1
  114. package/src/sap/ui/rta/plugin/additionalElements/ActionExtractor.js +11 -24
  115. package/src/sap/ui/rta/plugin/additionalElements/AddElementsDialog.js +1 -1
  116. package/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsPlugin.js +1 -1
  117. package/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsUtils.js +1 -1
  118. package/src/sap/ui/rta/plugin/additionalElements/CommandBuilder.js +1 -1
  119. package/src/sap/ui/rta/plugin/iframe/AddIFrame.js +1 -1
  120. package/src/sap/ui/rta/plugin/iframe/AddIFrameDialog.fragment.xml +17 -13
  121. package/src/sap/ui/rta/plugin/iframe/AddIFrameDialog.js +2 -2
  122. package/src/sap/ui/rta/plugin/iframe/AddIFrameDialogController.js +1 -1
  123. package/src/sap/ui/rta/service/Action.js +1 -1
  124. package/src/sap/ui/rta/service/ControllerExtension.js +1 -1
  125. package/src/sap/ui/rta/service/Outline.js +4 -1
  126. package/src/sap/ui/rta/service/Property.js +1 -1
  127. package/src/sap/ui/rta/service/Selection.js +1 -1
  128. package/src/sap/ui/rta/service/SupportTools.js +1 -1
  129. package/src/sap/ui/rta/toolbar/Adaptation.fragment.xml +59 -20
  130. package/src/sap/ui/rta/toolbar/Adaptation.js +161 -12
  131. package/src/sap/ui/rta/toolbar/Base.js +1 -1
  132. package/src/sap/ui/rta/toolbar/FeedbackDialog.fragment.xml +24 -0
  133. package/src/sap/ui/rta/toolbar/Fiori.js +1 -1
  134. package/src/sap/ui/rta/toolbar/FioriLike.js +1 -1
  135. package/src/sap/ui/rta/toolbar/OverflowToolbarButton.js +1 -1
  136. package/src/sap/ui/rta/toolbar/Personalization.js +1 -1
  137. package/src/sap/ui/rta/toolbar/Standalone.js +1 -1
  138. package/src/sap/ui/rta/toolbar/contextBased/ManageAdaptations.js +68 -37
  139. package/src/sap/ui/rta/toolbar/contextBased/ManageAdaptationsDialog.fragment.xml +5 -23
  140. package/src/sap/ui/rta/toolbar/contextBased/SaveAsAdaptation.js +121 -35
  141. package/src/sap/ui/rta/toolbar/contextBased/SaveAsAdaptationDialog.fragment.xml +12 -10
  142. package/src/sap/ui/rta/toolbar/translation/Translation.js +1 -1
  143. package/src/sap/ui/rta/toolbar/versioning/Versioning.js +1 -1
  144. package/src/sap/ui/rta/util/PluginManager.js +1 -1
  145. package/src/sap/ui/rta/util/PopupManager.js +1 -1
  146. package/src/sap/ui/rta/util/ReloadManager.js +32 -21
  147. package/src/sap/ui/rta/util/ServiceEventBus.js +1 -1
  148. package/src/sap/ui/rta/util/changeVisualization/ChangeIndicator.js +1 -2
  149. package/src/sap/ui/rta/util/changeVisualization/ChangeIndicatorCategorySelection.fragment.xml +1 -1
  150. package/src/sap/ui/rta/util/changeVisualization/ChangeIndicatorRegistry.js +15 -6
  151. package/src/sap/ui/rta/util/changeVisualization/ChangeStates.js +1 -1
  152. package/src/sap/ui/rta/util/changeVisualization/ChangeVisualization.js +16 -9
package/THIRDPARTY.txt CHANGED
@@ -478,7 +478,7 @@ License: Apache-2.0
478
478
  License Text: https://github.com/SAP/openui5/blob/master/LICENSES/Apache-2.0.txt
479
479
  Contained in: lib/jsdoc/ui5/plugin.js
480
480
 
481
- Component: SAP Theming Base Content, version: 11.2.1
481
+ Component: SAP Theming Base Content, version: 11.3.0
482
482
  Copyright: SAP SE or an SAP affiliate company and Theming Base Content contributors
483
483
  License: Apache-2.0
484
484
  License Text: https://github.com/SAP/openui5/blob/master/LICENSES/Apache-2.0.txt
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openui5/sap.ui.rta",
3
- "version": "1.113.0",
3
+ "version": "1.114.1",
4
4
  "description": "OpenUI5 UI Library sap.ui.rta",
5
5
  "author": "SAP SE (https://www.sap.com)",
6
6
  "license": "Apache-2.0",
@@ -14,10 +14,10 @@
14
14
  "url": "https://github.com/SAP/openui5.git"
15
15
  },
16
16
  "dependencies": {
17
- "@openui5/sap.m": "1.113.0",
18
- "@openui5/sap.ui.core": "1.113.0",
19
- "@openui5/sap.ui.dt": "1.113.0",
20
- "@openui5/sap.ui.fl": "1.113.0",
21
- "@openui5/sap.ui.layout": "1.113.0"
17
+ "@openui5/sap.m": "1.114.1",
18
+ "@openui5/sap.ui.core": "1.114.1",
19
+ "@openui5/sap.ui.dt": "1.114.1",
20
+ "@openui5/sap.ui.fl": "1.114.1",
21
+ "@openui5/sap.ui.layout": "1.114.1"
22
22
  }
23
23
  }
@@ -6,7 +6,7 @@
6
6
  <copyright>OpenUI5
7
7
  * (c) Copyright 2009-2023 SAP SE or an SAP affiliate company.
8
8
  * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.</copyright>
9
- <version>1.113.0</version>
9
+ <version>1.114.1</version>
10
10
 
11
11
  <documentation>SAPUI5 library with RTA controls.</documentation>
12
12
 
@@ -57,7 +57,7 @@ sap.ui.define([
57
57
  * @alias sap.ui.rta.Client
58
58
  * @author SAP SE
59
59
  * @since 1.56.0
60
- * @version 1.113.0
60
+ * @version 1.114.1
61
61
  * @private
62
62
  * @ui5-restricted
63
63
  */
@@ -15,6 +15,7 @@ sap.ui.define([
15
15
  "sap/ui/thirdparty/jquery",
16
16
  "sap/ui/base/ManagedObject",
17
17
  "sap/ui/core/BusyIndicator",
18
+ "sap/ui/core/Core",
18
19
  "sap/ui/dt/DesignTime",
19
20
  "sap/ui/dt/DOMUtil",
20
21
  "sap/ui/dt/ElementUtil",
@@ -22,6 +23,7 @@ sap.ui.define([
22
23
  "sap/ui/dt/OverlayRegistry",
23
24
  "sap/ui/dt/Util",
24
25
  "sap/ui/events/KeyCodes",
26
+ "sap/ui/fl/apply/_internal/flexState/ManifestUtils",
25
27
  "sap/ui/fl/write/api/Version",
26
28
  "sap/ui/fl/write/api/ContextBasedAdaptationsAPI",
27
29
  "sap/ui/fl/write/api/ControlPersonalizationWriteAPI",
@@ -62,6 +64,7 @@ sap.ui.define([
62
64
  jQuery,
63
65
  ManagedObject,
64
66
  BusyIndicator,
67
+ Core,
65
68
  DesignTime,
66
69
  DOMUtil,
67
70
  ElementUtil,
@@ -69,6 +72,7 @@ sap.ui.define([
69
72
  OverlayRegistry,
70
73
  DtUtil,
71
74
  KeyCodes,
75
+ ManifestUtils,
72
76
  Version,
73
77
  ContextBasedAdaptationsAPI,
74
78
  ControlPersonalizationWriteAPI,
@@ -116,7 +120,7 @@ sap.ui.define([
116
120
  * @class The runtime authoring allows to adapt the fields of a running application.
117
121
  * @extends sap.ui.base.ManagedObject
118
122
  * @author SAP SE
119
- * @version 1.113.0
123
+ * @version 1.114.1
120
124
  * @constructor
121
125
  * @private
122
126
  * @since 1.30
@@ -437,6 +441,7 @@ sap.ui.define([
437
441
  * @public
438
442
  */
439
443
  RuntimeAuthoring.prototype.start = function() {
444
+ var bIsAutomaticRestart = RuntimeAuthoring.needsRestart(this.getLayer());
440
445
  var oDesignTimePromise;
441
446
  var vError;
442
447
  // Create DesignTime
@@ -450,8 +455,8 @@ sap.ui.define([
450
455
  }
451
456
 
452
457
  return this._loadUShellServicesPromise
453
- .then(initVersioning.bind(this))
454
- .then(initContextBasedAdaptations.bind(this))
458
+ .then(initVersioning.bind(this, bIsAutomaticRestart))
459
+ .then(initContextBasedAdaptations.bind(this, bIsAutomaticRestart))
455
460
  /*
456
461
  Check if the application has personalized changes and reload without them;
457
462
  Also Check if the application has an available draft and if yes, reload with those changes.
@@ -461,7 +466,8 @@ sap.ui.define([
461
466
  layer: this.getLayer(),
462
467
  selector: this.getRootControlInstance(),
463
468
  versioningEnabled: this._oVersionsModel.getProperty("/versioningEnabled"),
464
- developerMode: this.getFlexSettings().developerMode
469
+ developerMode: this.getFlexSettings().developerMode,
470
+ adaptationId: this._oContextBasedAdaptationsModel.getProperty("/displayedAdaptation/id")
465
471
  });
466
472
  }.bind(this))
467
473
  .then(function(bReloadTriggered) {
@@ -570,7 +576,7 @@ sap.ui.define([
570
576
  validateFlexEnabled(this);
571
577
  }
572
578
  this._sStatus = STARTED;
573
- RuntimeAuthoring.disableRestart(Layer.CUSTOMER);
579
+ RuntimeAuthoring.disableRestart(this.getLayer());
574
580
  this.fireStart({
575
581
  editablePluginsCount: this.getPluginManager().getEditableOverlaysCount()
576
582
  });
@@ -1029,10 +1035,13 @@ sap.ui.define([
1029
1035
  var bIsSaveAsAvailable = aRtaFeaturesAvailability[1];
1030
1036
  var bIsContextBasedAdaptationAvailable = aRtaFeaturesAvailability[2];
1031
1037
  var bIsHomePage = aRtaFeaturesAvailability[3];
1038
+ var oManifest = FlexUtils.getAppDescriptor(oRootControl);
1039
+ //context based adaptation is not supported for overview pages
1040
+ var bIsContextBasedAdaptationSupported = oManifest && !ManifestUtils.getOvpEntry(oManifest);
1032
1041
  return {
1033
1042
  publishAvailable: bIsPublishAvailable,
1034
1043
  saveAsAvailable: !bIsHomePage && bIsPublishAvailable && bIsSaveAsAvailable,
1035
- contextBasedAdaptationAvailable: !bIsHomePage && bIsContextBasedAdaptationAvailable
1044
+ contextBasedAdaptationAvailable: !bIsHomePage && bIsContextBasedAdaptationSupported && bIsContextBasedAdaptationAvailable
1036
1045
  };
1037
1046
  });
1038
1047
  }
@@ -1055,33 +1064,30 @@ sap.ui.define([
1055
1064
  * @returns {Promise} Resolves as soon as the MessageBox is closed
1056
1065
  */
1057
1066
  function onStackModified() {
1058
- var bBackEndDraftExists = this._oVersionsModel.getProperty("/backendDraft");
1059
- var bDraftDisplayed = this._oVersionsModel.getProperty("/displayedVersion") === Version.Number.Draft;
1060
1067
  var oCommandStack = this.getCommandStack();
1061
1068
  var bCanUndo = oCommandStack.canUndo();
1062
1069
 
1070
+ // FIXME Missing check whether action is saveable e.g. switching a view should not trigger this
1071
+ // bCanUndo and _bUserDiscardedDraft seem to be redundant logic,
1072
+ // because displayedVersion would be draft already
1063
1073
  if (
1064
1074
  !this.getShowToolbars() ||
1065
1075
  !bCanUndo ||
1066
- this._bUserDiscardedDraft ||
1067
- bDraftDisplayed ||
1068
- !bBackEndDraftExists
1076
+ this._bUserDiscardedDraft
1069
1077
  ) {
1070
- return modifyStack.call(this);
1078
+ modifyStack.call(this);
1079
+ return;
1071
1080
  }
1072
1081
 
1073
1082
  // warn the user: the existing draft would be discarded in case the user saves
1074
- return Utils.showMessageBox("warning", "MSG_DRAFT_DISCARD_AND_CREATE_NEW_DIALOG", {
1075
- titleKey: "TIT_DRAFT_DISCARD_DIALOG",
1076
- actions: [MessageBox.Action.OK, MessageBox.Action.CANCEL],
1077
- emphasizedAction: MessageBox.Action.OK
1078
- })
1079
- .then(function(sAction) {
1080
- if (sAction === MessageBox.Action.OK) {
1081
- discardDraftConfirmed.call(this);
1082
- } else {
1083
- this.undo();
1083
+ Utils.checkDraftOverwrite(this._oVersionsModel)
1084
+ .then(function(bDialogShown) {
1085
+ if (bDialogShown) {
1086
+ this._bUserDiscardedDraft = true;
1084
1087
  }
1088
+ modifyStack.call(this);
1089
+ }.bind(this), function() {
1090
+ this.undo();
1085
1091
  }.bind(this));
1086
1092
  }
1087
1093
 
@@ -1203,6 +1209,10 @@ sap.ui.define([
1203
1209
  // Save changes on the current layer and discard dirty changes on other layers
1204
1210
  mPropertyBag.saveAsDraft = this.getLayer() === Layer.CUSTOMER;
1205
1211
  }
1212
+ if (this._oContextBasedAdaptationsModel.getProperty("/contextBasedAdaptationsEnabled")) {
1213
+ // If an adaptation is being processed, saving without exiting must retrieve the updated state of the adaptation
1214
+ mPropertyBag.adaptationId = bIsExit ? undefined : this._oContextBasedAdaptationsModel.getProperty("/displayedAdaptation/id");
1215
+ }
1206
1216
 
1207
1217
  return this._oSerializer.saveCommands(mPropertyBag)
1208
1218
  .then(function() {
@@ -1286,50 +1296,127 @@ sap.ui.define([
1286
1296
  return this.stop(true, true);
1287
1297
  }
1288
1298
 
1289
- function onSwitchVersion(oEvent) {
1290
- var sVersion = oEvent.getParameter("version");
1291
- var sDisplayedVersion = this._oVersionsModel.getProperty("/displayedVersion");
1292
-
1293
- if (sVersion === sDisplayedVersion) {
1294
- // already displayed version needs no switch
1295
- return;
1299
+ function onDeleteAdaptation() {
1300
+ if (this.canSave()) {
1301
+ showDeleteAdaptationMessageBox.call(this, "DAC_DATA_LOSS_DIALOG_DESCRIPTION", "DAC_DIALOG_HEADER", true /*bDirtyChanges*/);
1302
+ } else {
1303
+ showDeleteAdaptationMessageBox.call(this, "DAC_DIALOG_DESCRIPTION", "DAC_DIALOG_HEADER");
1296
1304
  }
1305
+ }
1306
+
1307
+ function showDeleteAdaptationMessageBox(sMessageKey, sTitleKey, bDirtyChanges) {
1308
+ Utils.showMessageBox("confirm", sMessageKey, {
1309
+ titleKey: sTitleKey
1310
+ }).then(function(sAction) {
1311
+ if (sAction === MessageBox.Action.OK) {
1312
+ BusyIndicator.show();
1313
+ if (bDirtyChanges) {
1314
+ // a reload is triggered later and will destroy RTA & the command stack
1315
+ this.getCommandStack().removeAllCommands(true);
1316
+ }
1317
+ deleteAdaptation.call(this);
1318
+ }
1319
+ }.bind(this));
1320
+ }
1297
1321
 
1322
+ function deleteAdaptation() {
1323
+ ContextBasedAdaptationsAPI.remove({
1324
+ control: this.getRootControlInstance(),
1325
+ layer: this.getLayer(),
1326
+ adaptationId: this._oContextBasedAdaptationsModel.getProperty("/displayedAdaptation/id")
1327
+ }).then(function() {
1328
+ BusyIndicator.hide();
1329
+ var sAdaptationId = this._oContextBasedAdaptationsModel.deleteAdaptation();
1330
+ switchAdaptation.call(this, sAdaptationId);
1331
+ }.bind(this)).catch(function(oError) {
1332
+ BusyIndicator.hide();
1333
+ Log.error(oError.stack);
1334
+ var sMessage = "MSG_LREP_TRANSFER_ERROR";
1335
+ var oOptions = { titleKey: "DAC_DIALOG_HEADER" };
1336
+ oOptions.details = oError.userMessage;
1337
+ Utils.showMessageBox("error", sMessage, oOptions);
1338
+ });
1339
+ }
1340
+
1341
+ function handleDataLoss(sMessageKey, sTitleKey, callbackFn) {
1298
1342
  if (this.canSave()) {
1299
- this._sSwitchToVersion = sVersion;
1300
- Utils.showMessageBox("warning", "MSG_SWITCH_VERSION_DIALOG", {
1301
- titleKey: "TIT_SWITCH_VERSION_DIALOG",
1343
+ Utils.showMessageBox("warning", sMessageKey, {
1344
+ titleKey: sTitleKey,
1302
1345
  actions: [MessageBox.Action.YES, MessageBox.Action.NO, MessageBox.Action.CANCEL],
1303
1346
  emphasizedAction: MessageBox.Action.YES
1304
1347
  }).then(function(sAction) {
1305
1348
  if (sAction === MessageBox.Action.YES) {
1306
- this._serializeToLrep()
1307
- .then(switchVersion.bind(this, this._sSwitchToVersion));
1349
+ return this._serializeToLrep()
1350
+ .then(callbackFn);
1308
1351
  } else if (sAction === MessageBox.Action.NO) {
1309
1352
  // avoids the data loss popup; a reload is triggered later and will destroy RTA & the command stack
1310
1353
  this.getCommandStack().removeAllCommands(true);
1311
- switchVersion.call(this, this._sSwitchToVersion);
1354
+ return callbackFn();
1312
1355
  }
1313
- return undefined;
1356
+ return Promise.resolve();
1314
1357
  }.bind(this));
1358
+ return Promise.resolve();
1359
+ }
1360
+ return callbackFn();
1361
+ }
1362
+
1363
+ function onSwitchAdaptation(oEvent) {
1364
+ var fnCallback = oEvent.getParameter("callback") || function() {};
1365
+ if (oEvent.getParameter("trigger") === "SaveAs") {
1366
+ // remove all changes from command stack when triggered from saveAs dialog as they are already saved in a new adaptation
1367
+ this.getCommandStack().removeAllCommands(true);
1368
+ }
1369
+ var sAdaptationId = oEvent.getParameter("adaptationId");
1370
+ this._sSwitchToAdaptationId = sAdaptationId;
1371
+ return handleDataLoss.call(this, "MSG_SWITCH_VERSION_DIALOG", "BTN_SWITCH_ADAPTATIONS",
1372
+ switchAdaptation.bind(this, this._sSwitchToAdaptationId))
1373
+ .then(fnCallback)
1374
+ .catch(function(oError) {
1375
+ Utils.showMessageBox("error", "MSG_SWITCH_ADAPTATION_FAILED", {error: oError});
1376
+ Log.error("sap.ui.rta: " + oError.stack || oError.message || oError);
1377
+ });
1378
+ }
1379
+
1380
+ function switchAdaptation(sAdaptationId) {
1381
+ var sVersion = this._oVersionsModel.getProperty("/displayedVersion");
1382
+ return switchVersion.call(this, sVersion, sAdaptationId);
1383
+ }
1384
+
1385
+ function onSwitchVersion(oEvent) {
1386
+ var fnCallback = oEvent.getParameter("callback") || function() {};
1387
+ var sVersion = oEvent.getParameter("version");
1388
+ var sDisplayedVersion = this._oVersionsModel.getProperty("/displayedVersion");
1389
+
1390
+ if (sVersion === sDisplayedVersion) {
1391
+ // already displayed version needs no switch
1315
1392
  return;
1316
1393
  }
1317
- switchVersion.call(this, sVersion);
1394
+
1395
+ this._sSwitchToVersion = sVersion;
1396
+ handleDataLoss.call(this, "MSG_SWITCH_VERSION_DIALOG", "TIT_SWITCH_VERSION_DIALOG",
1397
+ switchVersion.bind(this, this._sSwitchToVersion))
1398
+ .then(fnCallback)
1399
+ .catch(function(oError) {
1400
+ Utils.showMessageBox("error", "MSG_SWITCH_VERSION_FAILED", {error: oError});
1401
+ Log.error("sap.ui.rta: " + oError.stack || oError.message || oError);
1402
+ });
1318
1403
  }
1319
1404
 
1320
- function switchVersion(sVersion) {
1405
+ function switchVersion(sVersion, sAdaptationId) {
1321
1406
  RuntimeAuthoring.enableRestart(this.getLayer(), this.getRootControlInstance());
1322
1407
 
1323
- VersionsAPI.loadVersionForApplication({
1408
+ return VersionsAPI.loadVersionForApplication({
1324
1409
  control: this.getRootControlInstance(),
1325
1410
  layer: this.getLayer(),
1326
- version: sVersion
1411
+ version: sVersion,
1412
+ adaptationId: sAdaptationId
1413
+ }).then(function() {
1414
+ var oReloadInfo = {
1415
+ versionSwitch: true,
1416
+ version: sVersion
1417
+ };
1418
+ ReloadManager.triggerReload(oReloadInfo);
1327
1419
  });
1328
- var oReloadInfo = {
1329
- versionSwitch: true,
1330
- version: sVersion
1331
- };
1332
- ReloadManager.triggerReload(oReloadInfo);
1333
1420
  }
1334
1421
 
1335
1422
  function onPublishVersion() {
@@ -1348,11 +1435,6 @@ sap.ui.define([
1348
1435
  });
1349
1436
  }
1350
1437
 
1351
- function discardDraftConfirmed() {
1352
- this._bUserDiscardedDraft = true;
1353
- modifyStack.call(this);
1354
- }
1355
-
1356
1438
  function isOldVersionDisplayed() {
1357
1439
  return VersionsAPI.isOldVersionDisplayed({
1358
1440
  control: this.getRootControlInstance(),
@@ -1367,7 +1449,15 @@ sap.ui.define([
1367
1449
  });
1368
1450
  }
1369
1451
 
1370
- function initVersioning() {
1452
+ /**
1453
+ * Inits version models. Clears old state if RTA is starting from end user mode (no switch)
1454
+ * @param {boolean} bIsAutomaticRestart - If true this is not an RTA start but a reload due to version/adaptation switch
1455
+ * @returns {Promise<void>} - Promise
1456
+ */
1457
+ function initVersioning(bIsAutomaticRestart) {
1458
+ if (!bIsAutomaticRestart) {
1459
+ VersionsAPI.clearInstances();
1460
+ }
1371
1461
  return VersionsAPI.initialize({
1372
1462
  control: this.getRootControlInstance(),
1373
1463
  layer: this.getLayer()
@@ -1376,7 +1466,15 @@ sap.ui.define([
1376
1466
  }.bind(this));
1377
1467
  }
1378
1468
 
1379
- function initContextBasedAdaptations() {
1469
+ /**
1470
+ * Inits CBA models. Clears old state if RTA is starting from end user mode (no switch)
1471
+ * @param {boolean} bIsAutomaticRestart - If true this is not an RTA start but a reload due to version/adaptation switch
1472
+ * @returns {Promise<void>} - Promise
1473
+ */
1474
+ function initContextBasedAdaptations(bIsAutomaticRestart) {
1475
+ if (!bIsAutomaticRestart) {
1476
+ ContextBasedAdaptationsAPI.clearInstances();
1477
+ }
1380
1478
  return ContextBasedAdaptationsAPI.initialize({
1381
1479
  control: this.getRootControlInstance(),
1382
1480
  layer: this.getLayer()
@@ -1407,6 +1505,8 @@ sap.ui.define([
1407
1505
  oProperties.activate = onActivate.bind(this);
1408
1506
  oProperties.discardDraft = onDiscardDraft.bind(this);
1409
1507
  oProperties.switchVersion = onSwitchVersion.bind(this);
1508
+ oProperties.switchAdaptation = onSwitchAdaptation.bind(this);
1509
+ oProperties.deleteAdaptation = onDeleteAdaptation.bind(this);
1410
1510
  oProperties.openChangeCategorySelectionPopover = this.getChangeVisualization
1411
1511
  ? this.getChangeVisualization().openChangeCategorySelectionPopover.bind(this.getChangeVisualization())
1412
1512
  : function() {};
@@ -1434,6 +1534,7 @@ sap.ui.define([
1434
1534
  // the "Visualization" tab should not be visible if the "fiori-tools-rta-mode" URL-parameter is set to any value but "false"
1435
1535
  var bVisualizationButtonVisible;
1436
1536
  bVisualizationButtonVisible = !oUriParameters.has("fiori-tools-rta-mode") || oUriParameters.get("fiori-tools-rta-mode") === "false";
1537
+ var bFeedbackButtonVisible = Core.getConfiguration().getFlexibilityServices()[0].connector !== "LocalStorageConnector";
1437
1538
  this.bPersistedDataTranslatable = false;
1438
1539
 
1439
1540
  this._oToolbarControlsModel = new JSONModel({
@@ -1481,6 +1582,9 @@ sap.ui.define([
1481
1582
  visualizationButton: {
1482
1583
  visible: bVisualizationButtonVisible,
1483
1584
  enabled: bVisualizationButtonVisible
1585
+ },
1586
+ feedbackButton: {
1587
+ visible: bFeedbackButtonVisible
1484
1588
  }
1485
1589
  });
1486
1590
 
@@ -1513,7 +1617,7 @@ sap.ui.define([
1513
1617
  }.bind(this));
1514
1618
 
1515
1619
  this.getToolbar().setModel(this._oVersionsModel, "versions");
1516
- this.getToolbar().setModel(this._oContextBasedAdaptationsModel, "contextBasedAdaptation");
1620
+ this.getToolbar().setModel(this._oContextBasedAdaptationsModel, "contextBasedAdaptations");
1517
1621
  this.getToolbar().setModel(this._oToolbarControlsModel, "controls");
1518
1622
 
1519
1623
  return Promise.all([oTranslationPromise, oSaveAsPromise]);
@@ -9,6 +9,7 @@ sap.ui.define([
9
9
  "sap/ui/fl/Utils",
10
10
  "sap/ui/fl/Layer",
11
11
  "sap/ui/fl/LayerUtils",
12
+ "sap/ui/fl/write/api/Version",
12
13
  "sap/ui/dt/OverlayUtil",
13
14
  "sap/ui/dt/DOMUtil",
14
15
  "sap/ui/dt/ElementUtil",
@@ -26,6 +27,7 @@ function(
26
27
  FlexUtils,
27
28
  Layer,
28
29
  FlexLayerUtils,
30
+ Version,
29
31
  OverlayUtil,
30
32
  DOMUtil,
31
33
  ElementUtil,
@@ -45,7 +47,7 @@ function(
45
47
  *
46
48
  * @namespace
47
49
  * @author SAP SE
48
- * @version 1.113.0
50
+ * @version 1.114.1
49
51
  *
50
52
  * @private
51
53
  * @since 1.30
@@ -644,5 +646,37 @@ function(
644
646
  });
645
647
  };
646
648
 
649
+ /**
650
+ * Check if an existing draft would be overwritten if a change is done on the currently shown version
651
+ * If so it opens a confirmation dialog.
652
+ * @param {object} oVersionsModel The versions model
653
+ * @return {Promise.<boolean>} It either resolves with an indicator whether a confirmation
654
+ * was shown or rejects with "cancel" if cancel was pressed
655
+ */
656
+ Utils.checkDraftOverwrite = function(oVersionsModel) {
657
+ var bBackEndDraftExists = oVersionsModel.getProperty("/backendDraft");
658
+ var bDraftDisplayed = oVersionsModel.getProperty("/displayedVersion") === Version.Number.Draft;
659
+
660
+ if (
661
+ bDraftDisplayed ||
662
+ !bBackEndDraftExists
663
+ ) {
664
+ return Promise.resolve(false);
665
+ }
666
+
667
+ // warn the user: the existing draft would be discarded in case the user saves
668
+ return Utils.showMessageBox("warning", "MSG_DRAFT_DISCARD_AND_CREATE_NEW_DIALOG", {
669
+ titleKey: "TIT_DRAFT_DISCARD_DIALOG",
670
+ actions: [MessageBox.Action.OK, MessageBox.Action.CANCEL],
671
+ emphasizedAction: MessageBox.Action.OK
672
+ })
673
+ .then(function(sAction) {
674
+ if (sAction !== MessageBox.Action.OK) {
675
+ throw "cancel";
676
+ }
677
+ return true;
678
+ });
679
+ };
680
+
647
681
  return Utils;
648
682
  }, /* bExport= */true);
@@ -24,7 +24,7 @@ sap.ui.define([
24
24
  * @class
25
25
  * @extends sap.ui.base.ManagedObject
26
26
  * @author SAP SE
27
- * @version 1.113.0
27
+ * @version 1.114.1
28
28
  * @constructor
29
29
  * @private
30
30
  * @since 1.53
@@ -118,16 +118,17 @@ sap.ui.define([
118
118
  });
119
119
 
120
120
  aAllInlineChangeOperations.push(oInlineChangePromise);
121
-
122
- // create a inline change using a change type 'appdescr_app_removeAllInboundsExceptOne'
123
- oPropertyChange = AppVariantUtils.prepareRemoveAllInboundsExceptOneChange(sCurrentRunningInboundId);
124
- aAllInlineChangeOperations.push(AppVariantUtils.createInlineChange(oPropertyChange, "appdescr_app_removeAllInboundsExceptOne", vSelector));
125
121
  } else {
126
122
  // create a inline change using a change type 'appdescr_app_changeInbound'
127
123
  oPropertyChange = AppVariantUtils.prepareChangeInboundChange(sCurrentRunningInboundId, sAppVariantId, oAppVariantSpecificData);
128
124
  aAllInlineChangeOperations.push(AppVariantUtils.createInlineChange(oPropertyChange, "appdescr_app_changeInbound", vSelector));
129
125
  }
130
126
 
127
+ // remove all other inbounds except appVariant inbound
128
+ // create a inline change using a change type 'appdescr_app_removeAllInboundsExceptOne'
129
+ oPropertyChange = AppVariantUtils.prepareRemoveAllInboundsExceptOneChange(sCurrentRunningInboundId);
130
+ aAllInlineChangeOperations.push(AppVariantUtils.createInlineChange(oPropertyChange, "appdescr_app_removeAllInboundsExceptOne", vSelector));
131
+
131
132
  return Promise.all(aAllInlineChangeOperations);
132
133
  });
133
134
  };
@@ -16,7 +16,7 @@ sap.ui.define([
16
16
  * @class
17
17
  * @extends sap.ui.rta.command.FlexCommand
18
18
  * @author SAP SE
19
- * @version 1.113.0
19
+ * @version 1.114.1
20
20
  * @constructor
21
21
  * @private
22
22
  * @since 1.75
@@ -14,7 +14,7 @@ sap.ui.define([
14
14
  * @class
15
15
  * @extends sap.ui.rta.command.FlexCommand
16
16
  * @author SAP SE
17
- * @version 1.113.0
17
+ * @version 1.114.1
18
18
  * @constructor
19
19
  * @private
20
20
  * @since 1.78
@@ -16,7 +16,7 @@ sap.ui.define([
16
16
  * @class
17
17
  * @extends sap.ui.rta.command.FlexCommand
18
18
  * @author SAP SE
19
- * @version 1.113.0
19
+ * @version 1.114.1
20
20
  * @constructor
21
21
  * @private
22
22
  * @since 1.54
@@ -24,7 +24,7 @@ sap.ui.define([
24
24
  * @class
25
25
  * @extends sap.ui.rta.command.FlexCommand
26
26
  * @author SAP SE
27
- * @version 1.113.0
27
+ * @version 1.114.1
28
28
  * @constructor
29
29
  * @private
30
30
  * @since 1.76
@@ -21,7 +21,7 @@ sap.ui.define([
21
21
  * @extends sap.ui.rta.command.BaseCommand
22
22
  *
23
23
  * @author SAP SE
24
- * @version 1.113.0
24
+ * @version 1.114.1
25
25
  *
26
26
  * @constructor
27
27
  * @private
@@ -13,7 +13,7 @@ sap.ui.define(["sap/ui/base/ManagedObject"], function(ManagedObject) {
13
13
  * @extends sap.ui.base.ManagedObject
14
14
  *
15
15
  * @author SAP SE
16
- * @version 1.113.0
16
+ * @version 1.114.1
17
17
  *
18
18
  * @constructor
19
19
  * @private
@@ -26,7 +26,7 @@ sap.ui.define([
26
26
  * @class
27
27
  * @extends sap.ui.rta.command.FlexCommand
28
28
  * @author SAP SE
29
- * @version 1.113.0
29
+ * @version 1.114.1
30
30
  * @constructor
31
31
  * @private
32
32
  * @since 1.38
@@ -16,7 +16,7 @@ sap.ui.define([
16
16
  * @class
17
17
  * @extends sap.ui.rta.command.FlexCommand
18
18
  * @author SAP SE
19
- * @version 1.113.0
19
+ * @version 1.114.1
20
20
  * @constructor
21
21
  * @private
22
22
  * @since 1.46
@@ -485,7 +485,7 @@ sap.ui.define([
485
485
  * @extends sap.ui.base.ManagedObject
486
486
  *
487
487
  * @author SAP SE
488
- * @version 1.113.0
488
+ * @version 1.114.1
489
489
  *
490
490
  * @constructor
491
491
  * @private
@@ -21,7 +21,7 @@ sap.ui.define([
21
21
  * @extends sap.ui.rta.command.BaseCommand
22
22
  *
23
23
  * @author SAP SE
24
- * @version 1.113.0
24
+ * @version 1.114.1
25
25
  *
26
26
  * @constructor
27
27
  * @private
@@ -24,7 +24,7 @@ sap.ui.define([
24
24
  * @class
25
25
  * @extends sap.ui.rta.command.BaseCommand
26
26
  * @author SAP SE
27
- * @version 1.113.0
27
+ * @version 1.114.1
28
28
  * @constructor
29
29
  * @private
30
30
  * @since 1.52
@@ -20,7 +20,7 @@ sap.ui.define([
20
20
  * @class
21
21
  * @extends sap.ui.rta.command.BaseCommand
22
22
  * @author SAP SE
23
- * @version 1.113.0
23
+ * @version 1.114.1
24
24
  * @constructor
25
25
  * @private
26
26
  * @since 1.86
@@ -28,7 +28,7 @@ sap.ui.define([
28
28
  * @class
29
29
  * @extends sap.ui.rta.command.BaseCommand
30
30
  * @author SAP SE
31
- * @version 1.113.0
31
+ * @version 1.114.1
32
32
  * @constructor
33
33
  * @private
34
34
  * @since 1.86
@@ -66,6 +66,8 @@ sap.ui.define([
66
66
  this.oModel = this.getModel();
67
67
  this.setSourceDefaultVariant(this.oModel.getData()[this.sVariantManagementReference].defaultVariant);
68
68
  this.sLayer = mFlexSettings.layer;
69
+ var mComponentPropertyBag = mFlexSettings;
70
+ mComponentPropertyBag.variantManagementControl = this.oVariantManagementControl;
69
71
 
70
72
  function storeEventParameters(oEvent, oArgs) {
71
73
  var mParameters = oEvent.getParameters();
@@ -84,7 +86,7 @@ sap.ui.define([
84
86
  this.oVariantManagementControl.attachSave({resolve: resolve}, storeEventParameters, this);
85
87
  this.oVariantManagementControl.attachCancel({resolve: resolve}, handleCancel, this);
86
88
  this.oVariantManagementControl.openSaveAsDialogForKeyUser(rtaUtils.getRtaStyleClassName(),
87
- ContextSharingAPI.createComponent(mFlexSettings));
89
+ ContextSharingAPI.createComponent(mComponentPropertyBag));
88
90
  }.bind(this))
89
91
  .then(function(bState) {
90
92
  return bState;