@sapui5/sap.ushell_abap 1.102.1 → 1.103.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sapui5/sap.ushell_abap",
3
- "version": "1.102.1",
3
+ "version": "1.103.0",
4
4
  "description": "SAPUI5 Library sap.ushell_abap",
5
5
  "homepage": "https://sap.github.io/ui5-tooling/pages/SAPUI5/",
6
6
  "keywords": [
@@ -2,7 +2,7 @@
2
2
  <library xmlns="http://www.sap.com/sap.ui.library.xsd">
3
3
  <name>sap.ushell_abap</name>
4
4
  <vendor>SAP SE</vendor>
5
- <version>1.102.1</version>
5
+ <version>1.103.0</version>
6
6
  <copyright>Copyright (c) 2009-2022 SAP SE, All Rights Reserved</copyright>
7
7
  <documentation>SAP library: sap.ushell_abap</documentation>
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  /**
4
4
  * @fileOverview The Unified Shell's AppStateAdapter for the ABAP platform.
5
- * @version 1.102.1
5
+ * @version 1.103.0
6
6
  */
7
7
  sap.ui.define([
8
8
  "sap/base/util/ObjectPath",
@@ -9,7 +9,7 @@
9
9
  * <li>provide the resolveHashFragmentFallback function, a fallback method called by ClientSideTargetResolution service.</li>
10
10
  * </ul>
11
11
  *
12
- * @version 1.102.1
12
+ * @version 1.103.0
13
13
  */
14
14
  sap.ui.define([
15
15
  "sap/ui/thirdparty/jquery",
@@ -2,7 +2,7 @@
2
2
 
3
3
  /**
4
4
  * @fileOverview The ConfigurationDefaults adapter for the ABAP platform.
5
- * @version 1.102.1
5
+ * @version 1.103.0
6
6
  */
7
7
  sap.ui.define([
8
8
  "sap/ushell_abap/bootstrap/evo/abap.constants",
@@ -2,7 +2,7 @@
2
2
  /**
3
3
  * @fileOverview The Unified Shell's container adapter for the ABAP platform.
4
4
  *
5
- * @version 1.102.1
5
+ * @version 1.103.0
6
6
  */
7
7
  sap.ui.define([
8
8
  "sap/ui/thirdparty/jquery",
@@ -4,7 +4,7 @@
4
4
  * @fileOverview The Unified Shell's page building adapter for the ABAP platform.
5
5
  *
6
6
  * @deprecated since 1.100
7
- * @version 1.102.1
7
+ * @version 1.103.0
8
8
  */
9
9
  sap.ui.define([
10
10
  "sap/ui/thirdparty/URI",
@@ -6,8 +6,10 @@
6
6
 
7
7
  sap.ui.define([
8
8
  "sap/ushell/Config",
9
- "sap/base/Log"
10
- ], function (Config, Log) {
9
+ "sap/base/Log",
10
+ "sap/base/util/deepClone",
11
+ "sap/ushell/utils"
12
+ ], function (Config, Log, deepClone, ushellUtils) {
11
13
  "use strict";
12
14
 
13
15
  /**
@@ -35,6 +37,37 @@ sap.ui.define([
35
37
  return Promise.resolve(bMenuEnabled && iAssignedSpacesCount > 0);
36
38
  };
37
39
 
40
+ /**
41
+ * !! Part of the partially implemented "Filter empty Spaces" feature !!
42
+ * Fetches the Spaces from the Backend service and caches the result.
43
+ *
44
+ * @returns {Promise<object[]>} Resolves a list of Spaces
45
+ *
46
+ * @private
47
+ * @since 1.103.0
48
+ */
49
+ MenuAdapter.prototype._getSpacesFromService = function () {
50
+ if (!this._oSpaceSetPromise) {
51
+ var sDeviceType = ushellUtils.getFormFactor();
52
+ var sDeviceTypeQuery = sDeviceType ? "&$filter=deviceType%20eq%20%27" + sDeviceType + "%27" : "";
53
+ var sServiceUrl = "/sap/opu/odata/SAP/Z_JOL_SPACE_EMPTY_SRV/spaceSet?$expand=pages&$format=json" + sDeviceTypeQuery;
54
+
55
+ this._oSpaceSetPromise = fetch(sServiceUrl)
56
+ .then(function (oResponse) {
57
+ return oResponse.json();
58
+ })
59
+ .then(function (oParsedResponse) {
60
+ var aSpaces = oParsedResponse.d.results;
61
+ aSpaces.forEach(function (oSpace) {
62
+ oSpace.pages = oSpace.pages.results;
63
+ delete oSpace.pages.results;
64
+ });
65
+ return aSpaces;
66
+ });
67
+ }
68
+ return this._oSpaceSetPromise;
69
+ };
70
+
38
71
  /**
39
72
  * Gets the menu entries for the spaces assigned to the user.
40
73
  * Handles the MyHomeSpace visibility.
@@ -48,6 +81,27 @@ sap.ui.define([
48
81
  var bMyHomeSpaceEnabled = Config.last("/core/spaces/myHome/enabled");
49
82
  var bMyHomeUserEnabled = Config.last("/core/spaces/myHome/userEnabled");
50
83
  var sMyHomeSpaceId = Config.last("/core/spaces/myHome/myHomeSpaceId");
84
+ var bHideEmptySpacesFeatureEnabled = Config.last("/core/spaces/hideEmptySpaces/featureEnabled");
85
+
86
+ // Temporary feature toggle for the "Hide empty Spaces" feature
87
+ if (bHideEmptySpacesFeatureEnabled) {
88
+ var bHideEmptySpacesEnabled = Config.last("/core/spaces/hideEmptySpaces/enabled");
89
+ var bHideEmptySpacesUserEnabled = Config.last("/core/spaces/hideEmptySpaces/userEnabled");
90
+
91
+ return this._getSpacesFromService().then(function (aSpaces) {
92
+ // only remove myHomeSpace when myHome is enabled and user has disabled it
93
+ // remove myHomeSpace when homeApp is enabled
94
+ if ((bHomeAppEnabled && bMyHomeSpaceEnabled) || (bMyHomeSpaceEnabled && !bMyHomeUserEnabled)) {
95
+ for (var i = 0; i < aSpaces.length; i++) {
96
+ if (aSpaces[i].id === sMyHomeSpaceId) {
97
+ aSpaces = aSpaces.slice(1);
98
+ break;
99
+ }
100
+ }
101
+ }
102
+ return this._buildMenuEntriesHideEmptySpaces(aSpaces, bHideEmptySpacesEnabled && bHideEmptySpacesUserEnabled);
103
+ }.bind(this));
104
+ }
51
105
 
52
106
  var aMetatagMenu = this._getAssignedSpaces();
53
107
 
@@ -79,6 +133,24 @@ sap.ui.define([
79
133
  var bMyHomeSpaceEnabled = Config.last("/core/spaces/myHome/enabled");
80
134
  var bMyHomeUserEnabled = Config.last("/core/spaces/myHome/userEnabled");
81
135
  var sMyHomeSpaceId = Config.last("/core/spaces/myHome/myHomeSpaceId");
136
+ var bHideEmptySpacesFeatureEnabled = Config.last("/core/spaces/hideEmptySpaces/featureEnabled");
137
+
138
+ // Temporary feature toggle for the "Hide empty Spaces" feature
139
+ if (bHideEmptySpacesFeatureEnabled) {
140
+ return this._getSpacesFromService().then(function (aSpaces) {
141
+ // only remove myHomeSpace when myHome is enabled and user has disabled it
142
+ // but always keep myHomeSpace when homeApp is enabled
143
+ if (!bHomeAppEnabled && bMyHomeSpaceEnabled && !bMyHomeUserEnabled) {
144
+ for (var i = 0; i < aSpaces.length; i++) {
145
+ if (aSpaces[i].id === sMyHomeSpaceId) {
146
+ aSpaces = aSpaces.slice(1);
147
+ break;
148
+ }
149
+ }
150
+ }
151
+ return this._buildMenuEntriesHideEmptySpaces(aSpaces, false);
152
+ }.bind(this));
153
+ }
82
154
 
83
155
  var aMetatagMenu = this._getAssignedSpaces();
84
156
  // only remove myHomeSpace when myHome is enabled and user has disabled it
@@ -107,6 +179,11 @@ sap.ui.define([
107
179
  // Create a 1st level menu entry for each user-assigned space
108
180
  // having 2nd level sub menu entries for its pages inside if needed
109
181
 
182
+ // Temporary feature toggle for the "Hide empty Spaces" feature
183
+ var bHideEmptySpacesFeatureEnabled = Config.last("/core/spaces/hideEmptySpaces/featureEnabled");
184
+ if (bHideEmptySpacesFeatureEnabled) {
185
+ return this._buildMenuEntriesHideEmptySpaces(aMetatagMenu, false);
186
+ }
110
187
  var aMenuEntries = aMetatagMenu
111
188
  .filter(function (oSpace) {
112
189
 
@@ -178,6 +255,102 @@ sap.ui.define([
178
255
  return aMenuEntries;
179
256
  };
180
257
 
258
+ /**
259
+ * A temporary copy of the _buildMenuEntries method for the "Hide empty Spaces" feature toggle
260
+ * @param {object[]} aMenuEntries The raw menu entries
261
+ * @param {boolean} bFilterEmptySpaces Filter empty spaces?
262
+ * @returns {MenuEntry[]} The filtered menu entries
263
+ */
264
+ MenuAdapter.prototype._buildMenuEntriesHideEmptySpaces = function (aMenuEntries, bFilterEmptySpaces) {
265
+ var aMenu = deepClone(aMenuEntries);
266
+ // Create a 1st level menu entry for each user-assigned space
267
+ // having 2nd level sub menu entries for its pages inside if needed
268
+
269
+ return aMenu
270
+ .map(function (oSpace) {
271
+ if (oSpace.pages) {
272
+ // Remove empty pages from their spaces
273
+ oSpace.pages = oSpace.pages.filter(function (oPage) {
274
+ if (bFilterEmptySpaces && oPage.isEmpty) {
275
+ return false;
276
+ }
277
+ return true;
278
+ });
279
+ }
280
+ return oSpace;
281
+ })
282
+ .filter(function (oSpace) {
283
+ // Remove empty spaces
284
+ if (bFilterEmptySpaces && oSpace.isEmpty) {
285
+ return false;
286
+ }
287
+
288
+ // No menu entry for a space, if no page assigned
289
+ if (!oSpace.pages || oSpace.pages.length === 0) {
290
+ Log.warning("FLP space " + oSpace.id + " without page omitted in FLP menu.", "", "sap.ushell_abap.adapters.abap.MenuAdapter");
291
+ return false;
292
+ }
293
+ return true;
294
+ })
295
+ .map(function (oSpace) {
296
+ var oTopMenuEntry = {
297
+ title: oSpace.title || oSpace.id,
298
+ "help-id": "Space-" + oSpace.id,
299
+ description: oSpace.description,
300
+ icon: undefined,
301
+ type: "IBN",
302
+ target: {
303
+ semanticObject: "Launchpad",
304
+ action: "openFLPPage",
305
+ parameters: [
306
+ {
307
+ name: "spaceId",
308
+ value: oSpace.id
309
+ },
310
+ {
311
+ name: "pageId",
312
+ value: oSpace.pages[0].id
313
+ }
314
+ ],
315
+ innerAppRoute: undefined
316
+ },
317
+ menuEntries: []
318
+ };
319
+
320
+ var aSubMenuEntries = oSpace.pages.map(function (oPage) {
321
+ return {
322
+ title: oPage.title || oPage.id,
323
+ "help-id": "Page-" + oPage.id,
324
+ description: oPage.description,
325
+ icon: undefined,
326
+ type: "IBN",
327
+ target: {
328
+ semanticObject: "Launchpad",
329
+ action: "openFLPPage",
330
+ parameters: [
331
+ {
332
+ name: "spaceId",
333
+ value: oSpace.id
334
+ },
335
+ {
336
+ name: "pageId",
337
+ value: oPage.id
338
+ }
339
+ ],
340
+ innerAppRoute: undefined
341
+ },
342
+ menuEntries: []
343
+ };
344
+ });
345
+
346
+ if (aSubMenuEntries.length > 1) {
347
+ oTopMenuEntry.menuEntries = aSubMenuEntries;
348
+ }
349
+
350
+ return oTopMenuEntry;
351
+ });
352
+ };
353
+
181
354
  /**
182
355
  * Gets the menu entries for the pages assigned to the user by querying the
183
356
  * content of the meta tag with the name' sap.ushell.assignedSpaces'.
@@ -8,7 +8,7 @@
8
8
  * service now calls the ClientSideTargetResolution service in the abap
9
9
  * platform.
10
10
  *
11
- * @version 1.102.1
11
+ * @version 1.103.0
12
12
  */
13
13
  sap.ui.define([], function () {
14
14
  "use strict";
@@ -2,7 +2,7 @@
2
2
 
3
3
  /**
4
4
  * @fileOverview The Unified Shell's page building adapter for the ABAP platform.
5
- * @version 1.102.1
5
+ * @version 1.103.0
6
6
  */
7
7
  sap.ui.define([
8
8
  "sap/base/util/ObjectPath",
@@ -2,7 +2,7 @@
2
2
 
3
3
  /**
4
4
  * @fileOverview PagePersistenceAdapter for the ABAP platform.
5
- * @version 1.102.1
5
+ * @version 1.103.0
6
6
  */
7
7
  sap.ui.define([
8
8
  "sap/base/util/ObjectPath",
@@ -7,7 +7,7 @@
7
7
  * Container header properties transported via pseudo-items are mapped to the
8
8
  * respective header properties in setItem/getItem/delItem
9
9
  *
10
- * @version 1.102.1
10
+ * @version 1.103.0
11
11
  */
12
12
  sap.ui.define([
13
13
  "sap/ushell_abap/adapters/abap/AdapterContainer",
@@ -2,7 +2,7 @@
2
2
 
3
3
  /**
4
4
  * @fileOverview The Search adapter for the ABAP platform.
5
- * @version 1.102.1
5
+ * @version 1.103.0
6
6
  */
7
7
  sap.ui.define([], function () {
8
8
  "use strict";
@@ -2,7 +2,7 @@
2
2
 
3
3
  /**
4
4
  * @fileOverview The SupportTicket adapter for the ABAP platform.
5
- * @version 1.102.1
5
+ * @version 1.103.0
6
6
  */
7
7
  sap.ui.define([
8
8
  "sap/base/util/isEmptyObject",
@@ -2,7 +2,7 @@
2
2
  /**
3
3
  * @fileOverview The Unified Shell's Ui5ComponentLoaderAdapter for the ABAP platform
4
4
  *
5
- * @version 1.102.1
5
+ * @version 1.103.0
6
6
  */
7
7
  sap.ui.define([
8
8
  ], function () {
@@ -3,7 +3,7 @@
3
3
  /**
4
4
  * @fileOverview The Unified Shell's container adapter for the HANA platform.
5
5
  *
6
- * @version 1.102.1
6
+ * @version 1.103.0
7
7
  */
8
8
  /**
9
9
  * @namespace Default namespace for Unified Shell adapters for the HANA platform. They can usually
@@ -14,7 +14,7 @@
14
14
  * It furthermore calculates if FLP pages get activated and if needed sets up
15
15
  * the configuration environment to run these.
16
16
  *
17
- * @version 1.102.1
17
+ * @version 1.103.0
18
18
  */
19
19
  sap.ui.define([
20
20
  "./abap.constants",
@@ -17,6 +17,10 @@ sap.ui.define([
17
17
  spaces: {
18
18
  myHome: {
19
19
  enabled: true
20
+ },
21
+ hideEmptySpaces: {
22
+ enabled: true,
23
+ featureEnabled: false // Feature toggle - activate locally with URL param sap-ushell-xx-overwrite-config=ushell/spaces/hideEmptySpaces/featureEnabled:true
20
24
  }
21
25
  }
22
26
  },
@@ -16,13 +16,13 @@ sap.ui.define([
16
16
  * @namespace
17
17
  * @name sap.ushell_abap
18
18
  * @author SAP SE
19
- * @version 1.102.1
19
+ * @version 1.103.0
20
20
  * @private
21
21
  * @ui5-restricted
22
22
  */
23
23
  var ushellAbapLib = sap.ui.getCore().initLibrary({
24
24
  name: "sap.ushell_abap",
25
- version: "1.102.1",
25
+ version: "1.103.0",
26
26
  dependencies: ["sap.ui.core", "sap.m"],
27
27
  noLibraryCSS: true,
28
28
  extensions: {
package/ui5.yaml CHANGED
@@ -366,8 +366,9 @@ builder:
366
366
  - sap/ushell/services/Personalization.js
367
367
  - sap/ushell/services/PluginManager.js
368
368
  - sap/ushell/services/ReferenceResolver.js
369
- - sap/ushell/services/SupportTicket.js
370
369
  - sap/ushell/services/ShellNavigation.js
370
+ - sap/ushell/services/SpaceContent.js
371
+ - sap/ushell/services/SupportTicket.js
371
372
  - sap/ushell/services/URLParsing.js
372
373
  - sap/ushell/services/URLShortening.js
373
374
  - sap/ushell/services/Ui5ComponentLoader.js
@@ -628,8 +629,9 @@ builder:
628
629
  - sap/ushell/services/Personalization.js
629
630
  - sap/ushell/services/PluginManager.js
630
631
  - sap/ushell/services/ReferenceResolver.js
631
- - sap/ushell/services/SupportTicket.js
632
632
  - sap/ushell/services/ShellNavigation.js
633
+ - sap/ushell/services/SpaceContent.js
634
+ - sap/ushell/services/SupportTicket.js
633
635
  - sap/ushell/services/URLParsing.js
634
636
  - sap/ushell/services/URLShortening.js
635
637
  - sap/ushell/services/Ui5ComponentLoader.js