@sap-ux/preview-middleware 0.19.20 → 0.19.23

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.
@@ -63,6 +63,7 @@ sap.ui.define([
63
63
  const {annotationExistsInWS} = source.annotationDetails;
64
64
  if (source.metadataReadErrorMsg) {
65
65
  this.children.push({
66
+ path: this.children.length.toString(),
66
67
  enabled: false,
67
68
  tooltip: source.metadataReadErrorMsg,
68
69
  label: this.context.resourceBundle.getText('ADD_ANNOTATION_FILE', [key]),
@@ -70,6 +71,7 @@ sap.ui.define([
70
71
  });
71
72
  } else {
72
73
  this.children.push({
74
+ path: this.children.length.toString(),
73
75
  enabled: true,
74
76
  label: annotationExistsInWS ? this.context.resourceBundle.getText('SHOW_ANNOTATION_FILE', [key]) : this.context.resourceBundle.getText('ADD_ANNOTATION_FILE', [key]),
75
77
  children: []
@@ -1,9 +1,6 @@
1
1
  import FlexCommand from 'sap/ui/rta/command/FlexCommand';
2
2
 
3
- import {
4
- QuickActionContext,
5
- NestedQuickActionDefinition
6
- } from '../../../cpe/quick-actions/quick-action-definition';
3
+ import { QuickActionContext, NestedQuickActionDefinition } from '../../../cpe/quick-actions/quick-action-definition';
7
4
  import type { AnnotationDataSourceResponse } from '../../api-handler';
8
5
  import { getDataSourceAnnotationFileMap } from '../../api-handler';
9
6
  import {
@@ -65,6 +62,7 @@ export class AddNewAnnotationFile
65
62
  const { annotationExistsInWS } = source.annotationDetails;
66
63
  if (source.metadataReadErrorMsg) {
67
64
  this.children.push({
65
+ path: this.children.length.toString(),
68
66
  enabled: false,
69
67
  tooltip: source.metadataReadErrorMsg,
70
68
  label: this.context.resourceBundle.getText('ADD_ANNOTATION_FILE', [key]),
@@ -72,6 +70,7 @@ export class AddNewAnnotationFile
72
70
  });
73
71
  } else {
74
72
  this.children.push({
73
+ path: this.children.length.toString(),
75
74
  enabled: true,
76
75
  label: annotationExistsInWS
77
76
  ? this.context.resourceBundle.getText('SHOW_ANNOTATION_FILE', [key])
@@ -29,12 +29,14 @@ sap.ui.define(["sap/ui/dt/OverlayUtil", "sap/ui/fl/apply/api/FlexRuntimeInfoAPI"
29
29
  const actions = await this.context.actionService.get(smartTable.getId());
30
30
  const changeColumnAction = actions.find(action => action.id === ACTION_ID);
31
31
  if (changeColumnAction) {
32
+ const path = this.children.length.toString();
32
33
  this.children.push({
34
+ path,
33
35
  label: `'${smartTable.getHeader()}' table`,
34
36
  enabled: true,
35
37
  children: []
36
38
  });
37
- this.tableMap[`${this.children.length - 1}`] = {
39
+ this.tableMap[path] = {
38
40
  table: smartTable,
39
41
  tableUpdateEventAttachedOnce: false
40
42
  };
@@ -39,12 +39,14 @@ export class ChangeTableColumnsQuickAction
39
39
  const actions = await this.context.actionService.get(smartTable.getId());
40
40
  const changeColumnAction = actions.find((action) => action.id === ACTION_ID);
41
41
  if (changeColumnAction) {
42
+ const path = this.children.length.toString();
42
43
  this.children.push({
44
+ path,
43
45
  label: `'${(smartTable as Table).getHeader()}' table`,
44
46
  enabled: true,
45
47
  children: []
46
48
  });
47
- this.tableMap[`${this.children.length - 1}`] = {
49
+ this.tableMap[path] = {
48
50
  table: smartTable,
49
51
  tableUpdateEventAttachedOnce: false
50
52
  };
@@ -32,13 +32,15 @@ sap.ui.define(["../table-quick-action-base", "../../../cpe/quick-actions/utils",
32
32
  const personalizationData = smartTable.getP13nMode();
33
33
  const value = this.context.changeService.getConfigurationPropertyValue(smartTable.getId(), 'personalization');
34
34
  const isFilterEnabled = value?.filter === undefined ? personalizationData.includes('Filter') : value.filter;
35
+ const path = this.children.length.toString();
35
36
  this.children.push({
37
+ path,
36
38
  label: `'${smartTable.getHeader()}' table`,
37
39
  enabled: !isFilterEnabled,
38
40
  tooltip: isFilterEnabled ? tooltipText : undefined,
39
41
  children: []
40
42
  });
41
- this.tableMap[`${this.children.length - 1}`] = {
43
+ this.tableMap[path] = {
42
44
  table: smartTable,
43
45
  tableUpdateEventAttachedOnce: false
44
46
  };
@@ -48,13 +48,15 @@ export class EnableTableFilteringQuickAction
48
48
  'personalization'
49
49
  ) as Personalization;
50
50
  const isFilterEnabled = value?.filter === undefined ? personalizationData.includes('Filter') : value.filter;
51
+ const path = this.children.length.toString();
51
52
  this.children.push({
53
+ path,
52
54
  label: `'${(smartTable as Table).getHeader()}' table`,
53
55
  enabled: !isFilterEnabled,
54
56
  tooltip: isFilterEnabled ? tooltipText : undefined,
55
57
  children: []
56
58
  });
57
- this.tableMap[`${this.children.length - 1}`] = {
59
+ this.tableMap[path] = {
58
60
  table: smartTable,
59
61
  tableUpdateEventAttachedOnce: false
60
62
  };
@@ -99,9 +99,9 @@ sap.ui.define([
99
99
  await this.collectChildrenInSection(section, table);
100
100
  } else if (this.iconTabBar && tabKey) {
101
101
  const label = `'${ iconTabBarfilterMap[tabKey] }' table`;
102
- const child = this.createChild(label, table);
102
+ const tableMapKey = this.children.length.toString();
103
+ const child = this.createChild(label, table, tableMapKey);
103
104
  this.children.push(child);
104
- const tableMapKey = `${ this.children.length - 1 }`;
105
105
  this.tableMap[tableMapKey] = {
106
106
  table,
107
107
  iconTabBarFilterKey: tabKey,
@@ -140,9 +140,9 @@ sap.ui.define([
140
140
  return `'${ header }' table`;
141
141
  }
142
142
  } else if (isA(M_TABLE_TYPE, table)) {
143
- const tilte = table?.getHeaderToolbar()?.getTitleControl()?.getText();
144
- if (tilte) {
145
- return `'${ tilte }' table`;
143
+ const title = table?.getHeaderToolbar()?.getTitleControl()?.getText();
144
+ if (title) {
145
+ return `'${ title }' table`;
146
146
  }
147
147
  }
148
148
  return 'Unnamed table';
@@ -178,17 +178,19 @@ sap.ui.define([
178
178
  const existingChildIdx = this.children.findIndex(val => val.label === `'${ section.getTitle() }' section`);
179
179
  let tableMapIndex;
180
180
  const label = this.getTableLabel(table);
181
- const child = this.createChild(label, table);
182
181
  if (existingChildIdx < 0) {
182
+ tableMapIndex = `${ this.children.length }/0`;
183
+ const child = this.createChild(label, table, tableMapIndex);
183
184
  this.children.push({
185
+ path: this.children.length.toString(),
184
186
  label: `'${ section?.getTitle() }' section`,
185
187
  enabled: true,
186
188
  children: [child]
187
189
  });
188
- tableMapIndex = `${ this.children.length - 1 }/0`;
189
190
  } else {
191
+ tableMapIndex = `${ existingChildIdx }/${ this.children[existingChildIdx].children.length }`;
192
+ const child = this.createChild(label, table, tableMapIndex);
190
193
  this.children[existingChildIdx].children.push(child);
191
- tableMapIndex = `${ existingChildIdx.toFixed(0) }/${ this.children[existingChildIdx].children.length - 1 }`;
192
194
  }
193
195
  this.tableMap[tableMapIndex] = {
194
196
  table,
@@ -204,6 +206,7 @@ sap.ui.define([
204
206
  }
205
207
  }
206
208
  async processTable(table, sectionInfo) {
209
+ const tableMapKey = this.children.length.toString();
207
210
  if ([
208
211
  SMART_TABLE_TYPE,
209
212
  M_TABLE_TYPE,
@@ -213,10 +216,9 @@ sap.ui.define([
213
216
  ANALYTICAL_TABLE_TYPE
214
217
  ].some(type => isA(type, table))) {
215
218
  const label = this.getTableLabel(table);
216
- const child = this.createChild(label, table);
219
+ const child = this.createChild(label, table, tableMapKey);
217
220
  this.children.push(child);
218
221
  }
219
- const tableMapKey = `${ this.children.length - 1 }`;
220
222
  this.tableMap[tableMapKey] = {
221
223
  table,
222
224
  sectionInfo: sectionInfo,
@@ -240,8 +242,9 @@ sap.ui.define([
240
242
  children: this.children
241
243
  };
242
244
  }
243
- createChild(label, table) {
245
+ createChild(label, table, path) {
244
246
  const child = {
247
+ path,
245
248
  label,
246
249
  enabled: true,
247
250
  children: []
@@ -148,9 +148,9 @@ export abstract class TableQuickActionDefinitionBase extends QuickActionDefiniti
148
148
  await this.collectChildrenInSection(section, table);
149
149
  } else if (this.iconTabBar && tabKey) {
150
150
  const label = `'${iconTabBarfilterMap[tabKey]}' table`;
151
- const child = this.createChild(label, table);
151
+ const tableMapKey = this.children.length.toString();
152
+ const child = this.createChild(label, table, tableMapKey);
152
153
  this.children.push(child);
153
- const tableMapKey = `${this.children.length - 1}`;
154
154
  this.tableMap[tableMapKey] = {
155
155
  table,
156
156
  iconTabBarFilterKey: tabKey,
@@ -202,9 +202,9 @@ export abstract class TableQuickActionDefinitionBase extends QuickActionDefiniti
202
202
  return `'${header}' table`;
203
203
  }
204
204
  } else if (isA<Table>(M_TABLE_TYPE, table)) {
205
- const tilte = table?.getHeaderToolbar()?.getTitleControl()?.getText();
206
- if (tilte) {
207
- return `'${tilte}' table`;
205
+ const title = table?.getHeaderToolbar()?.getTitleControl()?.getText();
206
+ if (title) {
207
+ return `'${title}' table`;
208
208
  }
209
209
  }
210
210
 
@@ -255,20 +255,19 @@ export abstract class TableQuickActionDefinitionBase extends QuickActionDefiniti
255
255
  );
256
256
  let tableMapIndex;
257
257
  const label = this.getTableLabel(table);
258
- const child = this.createChild(label, table);
259
258
  if (existingChildIdx < 0) {
259
+ tableMapIndex = `${this.children.length}/0`;
260
+ const child = this.createChild(label, table, tableMapIndex);
260
261
  this.children.push({
262
+ path: this.children.length.toString(),
261
263
  label: `'${section?.getTitle()}' section`,
262
264
  enabled: true,
263
265
  children: [child]
264
266
  });
265
-
266
- tableMapIndex = `${this.children.length - 1}/0`;
267
267
  } else {
268
+ tableMapIndex = `${existingChildIdx}/${this.children[existingChildIdx].children.length}`;
269
+ const child = this.createChild(label, table, tableMapIndex);
268
270
  this.children[existingChildIdx].children.push(child);
269
- tableMapIndex = `${existingChildIdx.toFixed(0)}/${
270
- this.children[existingChildIdx].children.length - 1
271
- }`;
272
271
  }
273
272
 
274
273
  this.tableMap[tableMapIndex] = {
@@ -290,6 +289,7 @@ export abstract class TableQuickActionDefinitionBase extends QuickActionDefiniti
290
289
  table: UI5Element,
291
290
  sectionInfo?: { section: ObjectPageSection; subSection: ObjectPageSubSection; layout?: ObjectPageLayout }
292
291
  ): Promise<void> {
292
+ const tableMapKey = this.children.length.toString();
293
293
  if (
294
294
  [
295
295
  SMART_TABLE_TYPE,
@@ -301,11 +301,10 @@ export abstract class TableQuickActionDefinitionBase extends QuickActionDefiniti
301
301
  ].some((type) => isA(type, table))
302
302
  ) {
303
303
  const label = this.getTableLabel(table);
304
- const child = this.createChild(label, table);
304
+ const child = this.createChild(label, table, tableMapKey);
305
305
  this.children.push(child);
306
306
  }
307
307
 
308
- const tableMapKey = `${this.children.length - 1}`;
309
308
  this.tableMap[tableMapKey] = {
310
309
  table,
311
310
  sectionInfo: sectionInfo,
@@ -340,8 +339,9 @@ export abstract class TableQuickActionDefinitionBase extends QuickActionDefiniti
340
339
  };
341
340
  }
342
341
 
343
- createChild(label: string, table: UI5Element): NestedQuickActionChild {
342
+ createChild(label: string, table: UI5Element, path: string): NestedQuickActionChild {
344
343
  const child: NestedQuickActionChild = {
344
+ path,
345
345
  label,
346
346
  enabled: true,
347
347
  children: []
@@ -2,13 +2,19 @@
2
2
  sap.ui.define([
3
3
  'open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common',
4
4
  '../adp/dialog-factory',
5
- '../i18n'
6
- ], function (___sap_ux_private_control_property_editor_common, ___adp_dialog_factory, ___i18n) {
5
+ '../i18n',
6
+ 'sap/base/Log',
7
+ '../utils/core',
8
+ '../utils/version'
9
+ ], function (___sap_ux_private_control_property_editor_common, ___adp_dialog_factory, ___i18n, Log, ___utils_core, ___utils_version) {
7
10
  'use strict';
8
11
  const executeContextMenuAction = ___sap_ux_private_control_property_editor_common['executeContextMenuAction'];
12
+ const reportTelemetry = ___sap_ux_private_control_property_editor_common['reportTelemetry'];
9
13
  const requestControlContextMenu = ___sap_ux_private_control_property_editor_common['requestControlContextMenu'];
10
14
  const DialogFactory = ___adp_dialog_factory['DialogFactory'];
11
15
  const getTextBundle = ___i18n['getTextBundle'];
16
+ const getControlById = ___utils_core['getControlById'];
17
+ const getUi5Version = ___utils_version['getUi5Version'];
12
18
  class ContextMenuService {
13
19
  sendAction = () => {
14
20
  };
@@ -23,6 +29,18 @@ sap.ui.define([
23
29
  if (executeContextMenuAction.match(action)) {
24
30
  const {actionName, controlId} = action.payload;
25
31
  await this.actionService.execute(controlId, actionName);
32
+ try {
33
+ const controlName = getControlById(controlId)?.getMetadata().getName();
34
+ const versionInfo = await getUi5Version();
35
+ await reportTelemetry({
36
+ category: 'OutlineContextMenu',
37
+ actionName,
38
+ controlName,
39
+ ui5Version: `${ versionInfo.major }.${ versionInfo.minor }.${ versionInfo.patch }`
40
+ });
41
+ } catch (err) {
42
+ Log.error('Error in reporting Telemetry:', err);
43
+ }
26
44
  }
27
45
  if (requestControlContextMenu.pending.match(action)) {
28
46
  const controlId = action.payload;
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  executeContextMenuAction,
3
3
  ExternalAction,
4
+ reportTelemetry,
4
5
  requestControlContextMenu
5
6
  } from '@sap-ux-private/control-property-editor-common';
6
7
  import { ActionSenderFunction, SubscribeFunction } from './types';
@@ -8,6 +9,9 @@ import RuntimeAuthoring from 'sap/ui/rta/RuntimeAuthoring';
8
9
  import { ActionService } from 'sap/ui/rta/service/Action';
9
10
  import { DialogFactory } from '../adp/dialog-factory';
10
11
  import { getTextBundle } from '../i18n';
12
+ import Log from 'sap/base/Log';
13
+ import { getControlById } from '../utils/core';
14
+ import { getUi5Version } from '../utils/version';
11
15
 
12
16
  /**
13
17
  * A Class of ContextMenuService
@@ -35,6 +39,18 @@ export class ContextMenuService {
35
39
  if (executeContextMenuAction.match(action)) {
36
40
  const { actionName, controlId } = action.payload;
37
41
  await this.actionService.execute(controlId, actionName);
42
+ try {
43
+ const controlName = getControlById(controlId)?.getMetadata().getName();
44
+ const versionInfo = await getUi5Version();
45
+ await reportTelemetry({
46
+ category: 'OutlineContextMenu',
47
+ actionName,
48
+ controlName,
49
+ ui5Version: `${versionInfo.major}.${versionInfo.minor}.${versionInfo.patch}`
50
+ });
51
+ } catch (err) {
52
+ Log.error('Error in reporting Telemetry:', err);
53
+ }
38
54
  }
39
55
  if (requestControlContextMenu.pending.match(action)) {
40
56
  const controlId = action.payload;
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "bugs": {
10
10
  "url": "https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Apreview-middleware"
11
11
  },
12
- "version": "0.19.20",
12
+ "version": "0.19.23",
13
13
  "license": "Apache-2.0",
14
14
  "author": "@SAP/ux-tools-team",
15
15
  "main": "dist/index.js",
@@ -25,13 +25,13 @@
25
25
  "ejs": "3.1.10",
26
26
  "mem-fs": "2.1.0",
27
27
  "mem-fs-editor": "9.4.0",
28
- "@sap-ux/adp-tooling": "0.13.28",
28
+ "@sap-ux/adp-tooling": "0.13.29",
29
29
  "@sap-ux/btp-utils": "1.0.3",
30
- "@sap-ux/control-property-editor-sources": "npm:@sap-ux/control-property-editor@0.6.2",
30
+ "@sap-ux/control-property-editor-sources": "npm:@sap-ux/control-property-editor@0.6.3",
31
31
  "@sap-ux/feature-toggle": "0.2.3",
32
32
  "@sap-ux/logger": "0.6.0",
33
33
  "@sap-ux/project-access": "1.29.18",
34
- "@sap-ux/system-access": "0.5.35"
34
+ "@sap-ux/system-access": "0.5.36"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@sap-ux-private/playwright": "0.1.0",
@@ -49,8 +49,8 @@
49
49
  "nock": "13.4.0",
50
50
  "npm-run-all2": "6.2.0",
51
51
  "supertest": "6.3.3",
52
- "@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.13.15",
53
- "@sap-ux/axios-extension": "1.19.3",
52
+ "@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.13.17",
53
+ "@sap-ux/axios-extension": "1.20.0",
54
54
  "@sap-ux/i18n": "0.2.3",
55
55
  "@sap-ux/store": "1.0.0",
56
56
  "@sap-ux/ui5-info": "0.9.1"