@sap-ux/preview-middleware 0.13.71 → 0.13.73
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/dist/base/flp.js +14 -13
- package/dist/client/adp/api-handler.js +3 -2
- package/dist/client/adp/api-handler.ts +6 -4
- package/dist/client/adp/command-executor.js +10 -6
- package/dist/client/adp/command-executor.ts +9 -5
- package/dist/client/adp/controllers/AddFragment.controller.js +6 -6
- package/dist/client/adp/controllers/AddFragment.controller.ts +13 -7
- package/dist/client/adp/controllers/BaseDialog.controller.js +15 -1
- package/dist/client/adp/controllers/BaseDialog.controller.ts +22 -4
- package/dist/client/adp/controllers/ControllerExtension.controller.js +20 -23
- package/dist/client/adp/controllers/ControllerExtension.controller.ts +35 -26
- package/dist/client/adp/controllers/ExtensionPoint.controller.js +2 -3
- package/dist/client/adp/controllers/ExtensionPoint.controller.ts +7 -4
- package/dist/client/adp/init-dialogs.js +32 -32
- package/dist/client/adp/init-dialogs.ts +27 -27
- package/dist/client/adp/init.js +6 -4
- package/dist/client/adp/init.ts +4 -3
- package/dist/client/adp/ui5-version-utils.js +18 -18
- package/dist/client/adp/ui5-version-utils.ts +16 -15
- package/dist/client/cpe/changes/service.js +9 -6
- package/dist/client/cpe/changes/service.ts +13 -8
- package/dist/client/cpe/changes/validator.js +2 -2
- package/dist/client/cpe/changes/validator.ts +3 -2
- package/dist/client/cpe/control-data.ts +4 -1
- package/dist/client/cpe/documentation.ts +1 -1
- package/dist/client/cpe/error-utils.js +21 -0
- package/dist/client/cpe/error-utils.ts +9 -0
- package/dist/client/cpe/init.js +7 -5
- package/dist/client/cpe/init.ts +4 -3
- package/dist/client/cpe/outline/index.js +5 -3
- package/dist/client/cpe/outline/index.ts +2 -1
- package/dist/client/cpe/selection.js +7 -5
- package/dist/client/cpe/selection.ts +4 -3
- package/dist/client/flp/init.js +2 -3
- package/dist/client/flp/init.ts +29 -19
- package/package.json +6 -6
|
@@ -16,37 +16,13 @@ sap.ui.define(["sap/ui/core/Fragment", "sap/ui/fl/Utils", "./controllers/AddFrag
|
|
|
16
16
|
return DialogNames;
|
|
17
17
|
}(DialogNames || {});
|
|
18
18
|
/**
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
contextMenu.addMenuItem({
|
|
27
|
-
id: 'ADD_FRAGMENT',
|
|
28
|
-
text: getAddFragmentItemText,
|
|
29
|
-
handler: async overlays => await handler(overlays[0], rta, DialogNames.ADD_FRAGMENT),
|
|
30
|
-
enabled: isFragmentCommandEnabled,
|
|
31
|
-
icon: 'sap-icon://attachment-html'
|
|
32
|
-
});
|
|
33
|
-
contextMenu.addMenuItem({
|
|
34
|
-
id: 'EXTEND_CONTROLLER',
|
|
35
|
-
text: 'Extend With Controller',
|
|
36
|
-
handler: async overlays => await handler(overlays[0], rta, DialogNames.CONTROLLER_EXTENSION),
|
|
37
|
-
icon: 'sap-icon://create-form',
|
|
38
|
-
enabled: overlays => isControllerExtensionEnabled(overlays, syncViewsIds)
|
|
39
|
-
});
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Handler for enablement of Extend With Controller context menu entry
|
|
44
|
-
*
|
|
45
|
-
* @param overlays Control overlays
|
|
46
|
-
* @param syncViewsIds Runtime Authoring
|
|
47
|
-
*
|
|
48
|
-
* @returns boolean
|
|
49
|
-
*/
|
|
19
|
+
* Handler for enablement of Extend With Controller context menu entry
|
|
20
|
+
*
|
|
21
|
+
* @param overlays Control overlays
|
|
22
|
+
* @param syncViewsIds Runtime Authoring
|
|
23
|
+
*
|
|
24
|
+
* @returns boolean
|
|
25
|
+
*/
|
|
50
26
|
const isControllerExtensionEnabled = (overlays, syncViewsIds) => {
|
|
51
27
|
const clickedControlId = FlUtils.getViewForControl(overlays[0].getElement()).getId();
|
|
52
28
|
return overlays.length <= 1 && !syncViewsIds.includes(clickedControlId);
|
|
@@ -109,15 +85,39 @@ sap.ui.define(["sap/ui/core/Fragment", "sap/ui/fl/Utils", "./controllers/AddFrag
|
|
|
109
85
|
});
|
|
110
86
|
await controller.setup(dialog);
|
|
111
87
|
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Adds a new item to the context menu
|
|
91
|
+
*
|
|
92
|
+
* @param rta Runtime Authoring
|
|
93
|
+
* @param syncViewsIds Ids of all application sync views
|
|
94
|
+
*/
|
|
95
|
+
const initDialogs = (rta, syncViewsIds) => {
|
|
96
|
+
const contextMenu = rta.getDefaultPlugins().contextMenu;
|
|
97
|
+
contextMenu.addMenuItem({
|
|
98
|
+
id: 'ADD_FRAGMENT',
|
|
99
|
+
text: getAddFragmentItemText,
|
|
100
|
+
handler: async overlays => await handler(overlays[0], rta, DialogNames.ADD_FRAGMENT),
|
|
101
|
+
enabled: isFragmentCommandEnabled,
|
|
102
|
+
icon: 'sap-icon://attachment-html'
|
|
103
|
+
});
|
|
104
|
+
contextMenu.addMenuItem({
|
|
105
|
+
id: 'EXTEND_CONTROLLER',
|
|
106
|
+
text: 'Extend With Controller',
|
|
107
|
+
handler: async overlays => await handler(overlays[0], rta, DialogNames.CONTROLLER_EXTENSION),
|
|
108
|
+
icon: 'sap-icon://create-form',
|
|
109
|
+
enabled: overlays => isControllerExtensionEnabled(overlays, syncViewsIds)
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
112
|
var __exports = {
|
|
113
113
|
__esModule: true
|
|
114
114
|
};
|
|
115
115
|
__exports.DialogNames = DialogNames;
|
|
116
|
-
__exports.initDialogs = initDialogs;
|
|
117
116
|
__exports.isControllerExtensionEnabled = isControllerExtensionEnabled;
|
|
118
117
|
__exports.isFragmentCommandEnabled = isFragmentCommandEnabled;
|
|
119
118
|
__exports.getAddFragmentItemText = getAddFragmentItemText;
|
|
120
119
|
__exports.handler = handler;
|
|
120
|
+
__exports.initDialogs = initDialogs;
|
|
121
121
|
return __exports;
|
|
122
122
|
});
|
|
123
123
|
//# sourceMappingURL=init-dialogs.js.map
|
|
@@ -27,33 +27,7 @@ export const enum DialogNames {
|
|
|
27
27
|
|
|
28
28
|
type Controller = AddFragment | ControllerExtension | ExtensionPoint;
|
|
29
29
|
|
|
30
|
-
/**
|
|
31
|
-
* Adds a new item to the context menu
|
|
32
|
-
*
|
|
33
|
-
* @param rta Runtime Authoring
|
|
34
|
-
* @param syncViewsIds Ids of all application sync views
|
|
35
|
-
*/
|
|
36
|
-
export const initDialogs = (rta: RuntimeAuthoring, syncViewsIds: string[]): void => {
|
|
37
|
-
const contextMenu = rta.getDefaultPlugins().contextMenu;
|
|
38
|
-
|
|
39
|
-
contextMenu.addMenuItem({
|
|
40
|
-
id: 'ADD_FRAGMENT',
|
|
41
|
-
text: getAddFragmentItemText,
|
|
42
|
-
handler: async (overlays: UI5Element[]) => await handler(overlays[0], rta, DialogNames.ADD_FRAGMENT),
|
|
43
|
-
enabled: isFragmentCommandEnabled,
|
|
44
|
-
icon: 'sap-icon://attachment-html'
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
contextMenu.addMenuItem({
|
|
48
|
-
id: 'EXTEND_CONTROLLER',
|
|
49
|
-
text: 'Extend With Controller',
|
|
50
|
-
handler: async (overlays: UI5Element[]) => await handler(overlays[0], rta, DialogNames.CONTROLLER_EXTENSION),
|
|
51
|
-
icon: 'sap-icon://create-form',
|
|
52
|
-
enabled: (overlays: ElementOverlay[]) => isControllerExtensionEnabled(overlays, syncViewsIds)
|
|
53
|
-
});
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
/**
|
|
30
|
+
/**
|
|
57
31
|
* Handler for enablement of Extend With Controller context menu entry
|
|
58
32
|
*
|
|
59
33
|
* @param overlays Control overlays
|
|
@@ -139,3 +113,29 @@ export async function handler(
|
|
|
139
113
|
|
|
140
114
|
await controller.setup(dialog as Dialog);
|
|
141
115
|
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Adds a new item to the context menu
|
|
119
|
+
*
|
|
120
|
+
* @param rta Runtime Authoring
|
|
121
|
+
* @param syncViewsIds Ids of all application sync views
|
|
122
|
+
*/
|
|
123
|
+
export const initDialogs = (rta: RuntimeAuthoring, syncViewsIds: string[]): void => {
|
|
124
|
+
const contextMenu = rta.getDefaultPlugins().contextMenu;
|
|
125
|
+
|
|
126
|
+
contextMenu.addMenuItem({
|
|
127
|
+
id: 'ADD_FRAGMENT',
|
|
128
|
+
text: getAddFragmentItemText,
|
|
129
|
+
handler: async (overlays: UI5Element[]) => await handler(overlays[0], rta, DialogNames.ADD_FRAGMENT),
|
|
130
|
+
enabled: isFragmentCommandEnabled,
|
|
131
|
+
icon: 'sap-icon://attachment-html'
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
contextMenu.addMenuItem({
|
|
135
|
+
id: 'EXTEND_CONTROLLER',
|
|
136
|
+
text: 'Extend With Controller',
|
|
137
|
+
handler: async (overlays: UI5Element[]) => await handler(overlays[0], rta, DialogNames.CONTROLLER_EXTENSION),
|
|
138
|
+
icon: 'sap-icon://create-form',
|
|
139
|
+
enabled: (overlays: ElementOverlay[]) => isControllerExtensionEnabled(overlays, syncViewsIds)
|
|
140
|
+
});
|
|
141
|
+
};
|
package/dist/client/adp/init.js
CHANGED
|
@@ -5,8 +5,9 @@ sap.ui.define([
|
|
|
5
5
|
'./init-dialogs',
|
|
6
6
|
'open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common',
|
|
7
7
|
'sap/ui/VersionInfo',
|
|
8
|
-
'./ui5-version-utils'
|
|
9
|
-
|
|
8
|
+
'./ui5-version-utils',
|
|
9
|
+
'../cpe/error-utils'
|
|
10
|
+
], function (log, __init, ___init_dialogs, ___sap_ux_private_control_property_editor_common, VersionInfo, ___ui5_version_utils, ___cpe_error_utils) {
|
|
10
11
|
'use strict';
|
|
11
12
|
function _interopRequireDefault(obj) {
|
|
12
13
|
return obj && obj.__esModule && typeof obj.default !== 'undefined' ? obj.default : obj;
|
|
@@ -30,6 +31,7 @@ sap.ui.define([
|
|
|
30
31
|
const startPostMessageCommunication = ___sap_ux_private_control_property_editor_common['startPostMessageCommunication'];
|
|
31
32
|
const enableTelemetry = ___sap_ux_private_control_property_editor_common['enableTelemetry'];
|
|
32
33
|
const getUI5VersionValidationMessage = ___ui5_version_utils['getUI5VersionValidationMessage'];
|
|
34
|
+
const getError = ___cpe_error_utils['getError'];
|
|
33
35
|
var __exports = async function (rta) {
|
|
34
36
|
const {version} = await VersionInfo.load();
|
|
35
37
|
const versionParts = version.split('.');
|
|
@@ -47,7 +49,7 @@ sap.ui.define([
|
|
|
47
49
|
try {
|
|
48
50
|
await handler(action);
|
|
49
51
|
} catch (error) {
|
|
50
|
-
log.error('Handler Failed: ', error);
|
|
52
|
+
log.error('Handler Failed: ', getError(error));
|
|
51
53
|
}
|
|
52
54
|
}
|
|
53
55
|
});
|
|
@@ -97,7 +99,7 @@ sap.ui.define([
|
|
|
97
99
|
});
|
|
98
100
|
}
|
|
99
101
|
} catch (error) {
|
|
100
|
-
log.error('Could not get application sync views', error);
|
|
102
|
+
log.error('Could not get application sync views', getError(error));
|
|
101
103
|
}
|
|
102
104
|
return syncViewIds;
|
|
103
105
|
}
|
package/dist/client/adp/init.ts
CHANGED
|
@@ -13,6 +13,7 @@ import { ActionHandler } from '../cpe/types';
|
|
|
13
13
|
import VersionInfo from 'sap/ui/VersionInfo';
|
|
14
14
|
import { getUI5VersionValidationMessage } from './ui5-version-utils';
|
|
15
15
|
import UI5Element from 'sap/ui/dt/Element';
|
|
16
|
+
import { getError } from '../cpe/error-utils';
|
|
16
17
|
|
|
17
18
|
export default async function (rta: RuntimeAuthoring) {
|
|
18
19
|
const { version } = (await VersionInfo.load()) as { version: string };
|
|
@@ -38,7 +39,7 @@ export default async function (rta: RuntimeAuthoring) {
|
|
|
38
39
|
try {
|
|
39
40
|
await handler(action);
|
|
40
41
|
} catch (error) {
|
|
41
|
-
log.error('Handler Failed: ', error);
|
|
42
|
+
log.error('Handler Failed: ', getError(error));
|
|
42
43
|
}
|
|
43
44
|
}
|
|
44
45
|
}
|
|
@@ -76,7 +77,7 @@ export default async function (rta: RuntimeAuthoring) {
|
|
|
76
77
|
|
|
77
78
|
/**
|
|
78
79
|
* Get Ids for all sync views
|
|
79
|
-
*
|
|
80
|
+
*
|
|
80
81
|
* @param minor UI5 Version
|
|
81
82
|
*
|
|
82
83
|
* @returns array of Ids for application sync views
|
|
@@ -102,7 +103,7 @@ async function getAllSyncViewsIds(minor: number): Promise<string[]> {
|
|
|
102
103
|
});
|
|
103
104
|
}
|
|
104
105
|
} catch (error) {
|
|
105
|
-
log.error('Could not get application sync views', error);
|
|
106
|
+
log.error('Could not get application sync views', getError(error));
|
|
106
107
|
}
|
|
107
108
|
|
|
108
109
|
return syncViewIds;
|
|
@@ -3,6 +3,24 @@
|
|
|
3
3
|
sap.ui.define([], function () {
|
|
4
4
|
"use strict";
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Parses the UI5 version
|
|
8
|
+
* Returns NaN for snapshot or snapshot-untested
|
|
9
|
+
* Returns x.xx for snapshot-x.xx
|
|
10
|
+
*
|
|
11
|
+
* @param version the UI5 version to parse
|
|
12
|
+
* @returns The major and the minor version, e.g. 1.86
|
|
13
|
+
*/
|
|
14
|
+
function parseUI5Version(version) {
|
|
15
|
+
const versionParts = version.replace(/snapshot-untested|snapshot-|snapshot/, '').split('.');
|
|
16
|
+
const major = parseInt(versionParts[0], 10);
|
|
17
|
+
const minor = parseInt(versionParts[1], 10);
|
|
18
|
+
return {
|
|
19
|
+
major,
|
|
20
|
+
minor
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
6
24
|
/**
|
|
7
25
|
* Checks if the given version is lower than the required minimal version.
|
|
8
26
|
* @param version to check
|
|
@@ -37,24 +55,6 @@ sap.ui.define([], function () {
|
|
|
37
55
|
}
|
|
38
56
|
return undefined;
|
|
39
57
|
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Parses the UI5 version
|
|
43
|
-
* Returns NaN for snapshot or snapshot-untested
|
|
44
|
-
* Returns x.xx for snapshot-x.xx
|
|
45
|
-
*
|
|
46
|
-
* @param version the UI5 version to parse
|
|
47
|
-
* @returns The major and the minor version, e.g. 1.86
|
|
48
|
-
*/
|
|
49
|
-
function parseUI5Version(version) {
|
|
50
|
-
const versionParts = version.replace(/snapshot-untested|snapshot-|snapshot/, '').split('.');
|
|
51
|
-
const major = parseInt(versionParts[0], 10);
|
|
52
|
-
const minor = parseInt(versionParts[1], 10);
|
|
53
|
-
return {
|
|
54
|
-
major,
|
|
55
|
-
minor
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
58
|
var __exports = {
|
|
59
59
|
__esModule: true
|
|
60
60
|
};
|
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parses the UI5 version
|
|
3
|
+
* Returns NaN for snapshot or snapshot-untested
|
|
4
|
+
* Returns x.xx for snapshot-x.xx
|
|
5
|
+
*
|
|
6
|
+
* @param version the UI5 version to parse
|
|
7
|
+
* @returns The major and the minor version, e.g. 1.86
|
|
8
|
+
*/
|
|
9
|
+
function parseUI5Version(version: string): { major: number; minor: number } {
|
|
10
|
+
const versionParts = version.replace(/snapshot-untested|snapshot-|snapshot/, '').split('.');
|
|
11
|
+
const major = parseInt(versionParts[0], 10);
|
|
12
|
+
const minor = parseInt(versionParts[1], 10);
|
|
13
|
+
|
|
14
|
+
return { major, minor };
|
|
15
|
+
}
|
|
16
|
+
|
|
1
17
|
/**
|
|
2
18
|
* Checks if the given version is lower than the required minimal version.
|
|
3
19
|
* @param version to check
|
|
@@ -34,18 +50,3 @@ export function getUI5VersionValidationMessage(ui5Version: string): string | und
|
|
|
34
50
|
return undefined;
|
|
35
51
|
}
|
|
36
52
|
|
|
37
|
-
/**
|
|
38
|
-
* Parses the UI5 version
|
|
39
|
-
* Returns NaN for snapshot or snapshot-untested
|
|
40
|
-
* Returns x.xx for snapshot-x.xx
|
|
41
|
-
*
|
|
42
|
-
* @param version the UI5 version to parse
|
|
43
|
-
* @returns The major and the minor version, e.g. 1.86
|
|
44
|
-
*/
|
|
45
|
-
function parseUI5Version(version: string): { major: number; minor: number } {
|
|
46
|
-
const versionParts = version.replace(/snapshot-untested|snapshot-|snapshot/, '').split('.');
|
|
47
|
-
const major = parseInt(versionParts[0], 10);
|
|
48
|
-
const minor = parseInt(versionParts[1], 10);
|
|
49
|
-
|
|
50
|
-
return { major, minor };
|
|
51
|
-
}
|
|
@@ -3,8 +3,9 @@ sap.ui.define([
|
|
|
3
3
|
'open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common',
|
|
4
4
|
'./flex-change',
|
|
5
5
|
'sap/base/Log',
|
|
6
|
-
'../rta-service'
|
|
7
|
-
|
|
6
|
+
'../rta-service',
|
|
7
|
+
'../error-utils'
|
|
8
|
+
], function (___sap_ux_private_control_property_editor_common, ___flex_change, Log, ___rta_service, ___error_utils) {
|
|
8
9
|
'use strict';
|
|
9
10
|
const changeProperty = ___sap_ux_private_control_property_editor_common['changeProperty'];
|
|
10
11
|
const changeStackModified = ___sap_ux_private_control_property_editor_common['changeStackModified'];
|
|
@@ -14,6 +15,7 @@ sap.ui.define([
|
|
|
14
15
|
const reloadApplication = ___sap_ux_private_control_property_editor_common['reloadApplication'];
|
|
15
16
|
const applyChange = ___flex_change['applyChange'];
|
|
16
17
|
const modeAndStackChangeHandler = ___rta_service['modeAndStackChangeHandler'];
|
|
18
|
+
const getError = ___error_utils['getError'];
|
|
17
19
|
function assertProperties(properties, target) {
|
|
18
20
|
for (const property of properties) {
|
|
19
21
|
const value = target[property];
|
|
@@ -55,7 +57,8 @@ sap.ui.define([
|
|
|
55
57
|
if (control) {
|
|
56
58
|
name = control.getMetadata().getName();
|
|
57
59
|
}
|
|
58
|
-
const
|
|
60
|
+
const error = getError(exception);
|
|
61
|
+
const modifiedMessage = modifyRTAErrorMessage(error.message, id, name);
|
|
59
62
|
const errorMessage = modifiedMessage || `RTA Exception applying expression "${ action.payload.value }"`;
|
|
60
63
|
const propertyChangeFailedAction = propertyChangeFailed({
|
|
61
64
|
...action.payload,
|
|
@@ -134,7 +137,7 @@ sap.ui.define([
|
|
|
134
137
|
headers: { 'Content-Type': 'application/json' },
|
|
135
138
|
body: JSON.stringify({ fileName: change.fileName })
|
|
136
139
|
}));
|
|
137
|
-
await Promise.all(filesToDelete).catch(error => Log.error(error));
|
|
140
|
+
await Promise.all(filesToDelete).catch(error => Log.error(getError(error).message));
|
|
138
141
|
await this.fetchSavedChanges();
|
|
139
142
|
this.updateStack();
|
|
140
143
|
}
|
|
@@ -163,7 +166,7 @@ sap.ui.define([
|
|
|
163
166
|
}
|
|
164
167
|
}
|
|
165
168
|
} catch (error) {
|
|
166
|
-
Log.error('CPE: Change creation Failed', error);
|
|
169
|
+
Log.error('CPE: Change creation Failed', getError(error));
|
|
167
170
|
}
|
|
168
171
|
});
|
|
169
172
|
activeChanges = activeChanges.filter(change => !!change);
|
|
@@ -223,7 +226,7 @@ sap.ui.define([
|
|
|
223
226
|
}
|
|
224
227
|
return result;
|
|
225
228
|
} catch (error) {
|
|
226
|
-
Log.error(
|
|
229
|
+
Log.error('Retry operation failed:', getError(error));
|
|
227
230
|
continue;
|
|
228
231
|
}
|
|
229
232
|
}
|
|
@@ -20,6 +20,7 @@ import type Event from 'sap/ui/base/Event';
|
|
|
20
20
|
import type FlexCommand from 'sap/ui/rta/command/FlexCommand';
|
|
21
21
|
import Log from 'sap/base/Log';
|
|
22
22
|
import { modeAndStackChangeHandler } from '../rta-service';
|
|
23
|
+
import { getError } from '../error-utils';
|
|
23
24
|
|
|
24
25
|
interface ChangeContent {
|
|
25
26
|
property: string;
|
|
@@ -44,6 +45,8 @@ interface Change {
|
|
|
44
45
|
changeType: string;
|
|
45
46
|
}
|
|
46
47
|
|
|
48
|
+
type SavedChangesResponse = Record<string, Change>;
|
|
49
|
+
|
|
47
50
|
type Properties<T extends object> = { [K in keyof T]-?: K extends string ? K : never }[keyof T];
|
|
48
51
|
/**
|
|
49
52
|
* Assert change for its validity. Throws error if no value found in saved changes.
|
|
@@ -121,8 +124,10 @@ export class ChangeService {
|
|
|
121
124
|
if (control) {
|
|
122
125
|
name = control.getMetadata().getName();
|
|
123
126
|
}
|
|
127
|
+
|
|
128
|
+
const error = getError(exception);
|
|
124
129
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
125
|
-
const modifiedMessage = modifyRTAErrorMessage(
|
|
130
|
+
const modifiedMessage = modifyRTAErrorMessage(error.message, id, name);
|
|
126
131
|
const errorMessage =
|
|
127
132
|
modifiedMessage || `RTA Exception applying expression "${action.payload.value}"`;
|
|
128
133
|
const propertyChangeFailedAction = propertyChangeFailed({ ...action.payload, errorMessage });
|
|
@@ -163,7 +168,7 @@ export class ChangeService {
|
|
|
163
168
|
*/
|
|
164
169
|
private async fetchSavedChanges(): Promise<void> {
|
|
165
170
|
const savedChangesResponse = await fetch(FlexChangesEndPoints.changes + `?_=${Date.now()}`);
|
|
166
|
-
const savedChanges = await savedChangesResponse.json();
|
|
171
|
+
const savedChanges = (await savedChangesResponse.json()) as SavedChangesResponse;
|
|
167
172
|
const changes = (
|
|
168
173
|
Object.keys(savedChanges ?? {})
|
|
169
174
|
.map((key): SavedPropertyChange | UnknownSavedChange | undefined => {
|
|
@@ -236,7 +241,7 @@ export class ChangeService {
|
|
|
236
241
|
})
|
|
237
242
|
);
|
|
238
243
|
|
|
239
|
-
await Promise.all(filesToDelete).catch((error) => Log.error(error));
|
|
244
|
+
await Promise.all(filesToDelete).catch((error) => Log.error(getError(error).message));
|
|
240
245
|
|
|
241
246
|
await this.fetchSavedChanges();
|
|
242
247
|
this.updateStack();
|
|
@@ -273,7 +278,7 @@ export class ChangeService {
|
|
|
273
278
|
}
|
|
274
279
|
}
|
|
275
280
|
} catch (error) {
|
|
276
|
-
Log.error('CPE: Change creation Failed', error);
|
|
281
|
+
Log.error('CPE: Change creation Failed', getError(error));
|
|
277
282
|
}
|
|
278
283
|
});
|
|
279
284
|
|
|
@@ -304,10 +309,10 @@ export class ChangeService {
|
|
|
304
309
|
|
|
305
310
|
switch (changeType) {
|
|
306
311
|
case 'propertyChange':
|
|
307
|
-
value = command.getProperty('newValue');
|
|
312
|
+
value = command.getProperty('newValue') as string;
|
|
308
313
|
break;
|
|
309
314
|
case 'propertyBindingChange':
|
|
310
|
-
value = command.getProperty('newBinding');
|
|
315
|
+
value = command.getProperty('newBinding') as string;
|
|
311
316
|
break;
|
|
312
317
|
}
|
|
313
318
|
const { fileName } = command.getPreparedChange().getDefinition();
|
|
@@ -316,7 +321,7 @@ export class ChangeService {
|
|
|
316
321
|
type: 'pending',
|
|
317
322
|
changeType,
|
|
318
323
|
controlId: selectorId,
|
|
319
|
-
propertyName: command.getProperty('propertyName'),
|
|
324
|
+
propertyName: command.getProperty('propertyName') as string,
|
|
320
325
|
isActive: index >= inactiveCommandCount,
|
|
321
326
|
value,
|
|
322
327
|
controlName: command.getElement().getMetadata().getName().split('.').pop() ?? '',
|
|
@@ -354,7 +359,7 @@ export class ChangeService {
|
|
|
354
359
|
}
|
|
355
360
|
return result;
|
|
356
361
|
} catch (error) {
|
|
357
|
-
Log.error(
|
|
362
|
+
Log.error('Retry operation failed:', getError(error));
|
|
358
363
|
continue;
|
|
359
364
|
}
|
|
360
365
|
}
|
|
@@ -10,7 +10,7 @@ sap.ui.define(["sap/base/i18n/ResourceBundle"], function (ResourceBundle) {
|
|
|
10
10
|
*/
|
|
11
11
|
function validateBindingModel(value) {
|
|
12
12
|
const bindingValue = value.replace(/[{}]/gi, '').trim();
|
|
13
|
-
const bindingParts = bindingValue.split('>').filter(el => el
|
|
13
|
+
const bindingParts = bindingValue.split('>').filter(el => el !== '');
|
|
14
14
|
if (!bindingParts.length) {
|
|
15
15
|
throw new SyntaxError('Invalid binding string.');
|
|
16
16
|
}
|
|
@@ -21,7 +21,7 @@ sap.ui.define(["sap/base/i18n/ResourceBundle"], function (ResourceBundle) {
|
|
|
21
21
|
});
|
|
22
22
|
const resourceKey = bindingParts[1].trim();
|
|
23
23
|
if (!resourceBundle.hasText(resourceKey)) {
|
|
24
|
-
throw new SyntaxError('Invalid key in the binding string. Supported value pattern is {i18n>YOUR_KEY}. Check if the key already exists in i18n.properties. If not, add the key in the i18n.properties file and reload the editor for the new key to take effect.');
|
|
24
|
+
throw new SyntaxError('Invalid key in the binding string. Supported value pattern is {i18n>YOUR_KEY}. Check if the key already exists in i18n.properties.' + 'If not, add the key in the i18n.properties file and reload the editor for the new key to take effect.');
|
|
25
25
|
}
|
|
26
26
|
} else {
|
|
27
27
|
throw new SyntaxError('Invalid binding string. Supported value pattern is {i18n>YOUR_KEY}');
|
|
@@ -7,7 +7,7 @@ import ResourceBundle from 'sap/base/i18n/ResourceBundle';
|
|
|
7
7
|
*/
|
|
8
8
|
export function validateBindingModel(value: string): void {
|
|
9
9
|
const bindingValue = value.replace(/[{}]/gi, '').trim();
|
|
10
|
-
const bindingParts = bindingValue.split('>').filter((el) => el
|
|
10
|
+
const bindingParts = bindingValue.split('>').filter((el) => el !== '');
|
|
11
11
|
|
|
12
12
|
if (!bindingParts.length) {
|
|
13
13
|
throw new SyntaxError('Invalid binding string.');
|
|
@@ -21,7 +21,8 @@ export function validateBindingModel(value: string): void {
|
|
|
21
21
|
const resourceKey = bindingParts[1].trim();
|
|
22
22
|
if (!resourceBundle.hasText(resourceKey)) {
|
|
23
23
|
throw new SyntaxError(
|
|
24
|
-
'Invalid key in the binding string. Supported value pattern is {i18n>YOUR_KEY}. Check if the key already exists in i18n.properties.
|
|
24
|
+
'Invalid key in the binding string. Supported value pattern is {i18n>YOUR_KEY}. Check if the key already exists in i18n.properties.' +
|
|
25
|
+
'If not, add the key in the i18n.properties file and reload the editor for the new key to take effect.'
|
|
25
26
|
);
|
|
26
27
|
}
|
|
27
28
|
} else {
|
|
@@ -18,6 +18,9 @@ import { UI5ControlProperty } from './types';
|
|
|
18
18
|
import DataType from 'sap/ui/base/DataType';
|
|
19
19
|
|
|
20
20
|
type AnalyzedType = Pick<UI5ControlProperty, 'isArray' | 'primitiveType' | 'ui5Type' | 'enumValues'>;
|
|
21
|
+
interface Name {
|
|
22
|
+
getName(): string;
|
|
23
|
+
}
|
|
21
24
|
/**
|
|
22
25
|
* A property is disabled if it is an array or the type is 'any'
|
|
23
26
|
* - since we currently don't have a good editor for it Otherwise, it is enabled.
|
|
@@ -103,7 +106,7 @@ function analyzePropertyType(property: ManagedObjectMetadataProperties): Analyze
|
|
|
103
106
|
return analyzedType;
|
|
104
107
|
}
|
|
105
108
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
|
106
|
-
const name = Object.getPrototypeOf(propertyDataType).getName();
|
|
109
|
+
const name = (Object.getPrototypeOf(propertyDataType) as Name).getName();
|
|
107
110
|
if (!name) {
|
|
108
111
|
analyzedType.primitiveType = 'enum';
|
|
109
112
|
} else {
|
|
@@ -83,7 +83,7 @@ function parseControlMetaModel(controlLibMetadata: SchemaForApiJsonFiles, contro
|
|
|
83
83
|
const selectedControlMetadata = (controlLibMetadata.symbols ?? []).find((control) => control.name === controlName);
|
|
84
84
|
if (selectedControlMetadata) {
|
|
85
85
|
// base type info of control is available on property 'extends'
|
|
86
|
-
controlInfo.baseType = selectedControlMetadata.extends;
|
|
86
|
+
controlInfo.baseType = selectedControlMetadata.extends as string | undefined;
|
|
87
87
|
controlInfo.doc = selectedControlMetadata.description ?? '';
|
|
88
88
|
const properties: (Ui5Property & PropertiesInfo)[] | undefined = (
|
|
89
89
|
selectedControlMetadata['ui5-metadata'] as Ui5Metadata
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define([], function () {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Returns the Error if the error is an instance of `Error` otherwise a new Error instance with string representation of the error.
|
|
8
|
+
*
|
|
9
|
+
* @param error {unknown} - the error instance
|
|
10
|
+
* @returns {Error} the error
|
|
11
|
+
*/
|
|
12
|
+
function getError(error) {
|
|
13
|
+
return error instanceof Error ? error : new Error(JSON.stringify(error));
|
|
14
|
+
}
|
|
15
|
+
var __exports = {
|
|
16
|
+
__esModule: true
|
|
17
|
+
};
|
|
18
|
+
__exports.getError = getError;
|
|
19
|
+
return __exports;
|
|
20
|
+
});
|
|
21
|
+
//# sourceMappingURL=error-utils.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the Error if the error is an instance of `Error` otherwise a new Error instance with string representation of the error.
|
|
3
|
+
*
|
|
4
|
+
* @param error {unknown} - the error instance
|
|
5
|
+
* @returns {Error} the error
|
|
6
|
+
*/
|
|
7
|
+
export function getError(error: unknown): Error {
|
|
8
|
+
return error instanceof Error ? error : new Error(JSON.stringify(error));
|
|
9
|
+
}
|
package/dist/client/cpe/init.js
CHANGED
|
@@ -9,8 +9,9 @@ sap.ui.define([
|
|
|
9
9
|
'./logger',
|
|
10
10
|
'./ui5-utils',
|
|
11
11
|
'./connector-service',
|
|
12
|
-
'./rta-service'
|
|
13
|
-
|
|
12
|
+
'./rta-service',
|
|
13
|
+
'./error-utils'
|
|
14
|
+
], function (___sap_ux_private_control_property_editor_common, ___outline_index, ___selection, ___changes_service, ___documentation, Log, ___logger, ___ui5_utils, ___connector_service, ___rta_service, ___error_utils) {
|
|
14
15
|
'use strict';
|
|
15
16
|
const startPostMessageCommunication = ___sap_ux_private_control_property_editor_common['startPostMessageCommunication'];
|
|
16
17
|
const iconsLoaded = ___sap_ux_private_control_property_editor_common['iconsLoaded'];
|
|
@@ -24,6 +25,7 @@ sap.ui.define([
|
|
|
24
25
|
const getIcons = ___ui5_utils['getIcons'];
|
|
25
26
|
const WorkspaceConnectorService = ___connector_service['WorkspaceConnectorService'];
|
|
26
27
|
const RtaService = ___rta_service['RtaService'];
|
|
28
|
+
const getError = ___error_utils['getError'];
|
|
27
29
|
function init(rta) {
|
|
28
30
|
Log.info('Initializing Control Property Editor');
|
|
29
31
|
const flexSettings = rta.getFlexSettings();
|
|
@@ -51,19 +53,19 @@ sap.ui.define([
|
|
|
51
53
|
try {
|
|
52
54
|
await handler(action);
|
|
53
55
|
} catch (error) {
|
|
54
|
-
Log.error('Handler Failed: ', error);
|
|
56
|
+
Log.error('Handler Failed: ', getError(error));
|
|
55
57
|
}
|
|
56
58
|
}
|
|
57
59
|
}, logger);
|
|
58
60
|
for (const service of services) {
|
|
59
61
|
service.init(sendAction, subscribe);
|
|
60
62
|
}
|
|
61
|
-
initOutline(rta, sendAction).catch(error => Log.error('Error during initialization of Control Property Editor', error));
|
|
63
|
+
initOutline(rta, sendAction).catch(error => Log.error('Error during initialization of Control Property Editor', getError(error)));
|
|
62
64
|
const icons = getIcons();
|
|
63
65
|
sendAction(iconsLoaded(icons));
|
|
64
66
|
sendAction(appLoaded());
|
|
65
67
|
} catch (error) {
|
|
66
|
-
Log.error('Error during initialization of Control Property Editor', error);
|
|
68
|
+
Log.error('Error during initialization of Control Property Editor', getError(error));
|
|
67
69
|
}
|
|
68
70
|
return Promise.resolve();
|
|
69
71
|
}
|
package/dist/client/cpe/init.ts
CHANGED
|
@@ -17,6 +17,7 @@ import { logger } from './logger';
|
|
|
17
17
|
import { getIcons } from './ui5-utils';
|
|
18
18
|
import { WorkspaceConnectorService } from './connector-service';
|
|
19
19
|
import { RtaService } from './rta-service';
|
|
20
|
+
import { getError } from './error-utils';
|
|
20
21
|
|
|
21
22
|
export default function init(rta: RuntimeAuthoring): Promise<void> {
|
|
22
23
|
Log.info('Initializing Control Property Editor');
|
|
@@ -51,7 +52,7 @@ export default function init(rta: RuntimeAuthoring): Promise<void> {
|
|
|
51
52
|
try {
|
|
52
53
|
await handler(action);
|
|
53
54
|
} catch (error) {
|
|
54
|
-
Log.error('Handler Failed: ', error);
|
|
55
|
+
Log.error('Handler Failed: ', getError(error));
|
|
55
56
|
}
|
|
56
57
|
}
|
|
57
58
|
},
|
|
@@ -64,14 +65,14 @@ export default function init(rta: RuntimeAuthoring): Promise<void> {
|
|
|
64
65
|
// For initOutline to complete the RTA needs to already running (to access RTA provided services).
|
|
65
66
|
// That can only happen if the plugin initialization has completed.
|
|
66
67
|
initOutline(rta, sendAction).catch((error) =>
|
|
67
|
-
Log.error('Error during initialization of Control Property Editor', error)
|
|
68
|
+
Log.error('Error during initialization of Control Property Editor', getError(error))
|
|
68
69
|
);
|
|
69
70
|
const icons = getIcons();
|
|
70
71
|
|
|
71
72
|
sendAction(iconsLoaded(icons));
|
|
72
73
|
sendAction(appLoaded());
|
|
73
74
|
} catch (error) {
|
|
74
|
-
Log.error('Error during initialization of Control Property Editor', error);
|
|
75
|
+
Log.error('Error during initialization of Control Property Editor', getError(error));
|
|
75
76
|
}
|
|
76
77
|
return Promise.resolve();
|
|
77
78
|
}
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
sap.ui.define([
|
|
3
3
|
'open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common',
|
|
4
4
|
'./nodes',
|
|
5
|
-
'sap/base/Log'
|
|
6
|
-
|
|
5
|
+
'sap/base/Log',
|
|
6
|
+
'../error-utils'
|
|
7
|
+
], function (___sap_ux_private_control_property_editor_common, ___nodes, Log, ___error_utils) {
|
|
7
8
|
'use strict';
|
|
8
9
|
const outlineChanged = ___sap_ux_private_control_property_editor_common['outlineChanged'];
|
|
9
10
|
const transformNodes = ___nodes['transformNodes'];
|
|
11
|
+
const getError = ___error_utils['getError'];
|
|
10
12
|
async function initOutline(rta, sendAction) {
|
|
11
13
|
const outline = await rta.getService('outline');
|
|
12
14
|
const scenario = rta.getFlexSettings().scenario;
|
|
@@ -16,7 +18,7 @@ sap.ui.define([
|
|
|
16
18
|
const outlineNodes = await transformNodes(viewNodes, scenario);
|
|
17
19
|
sendAction(outlineChanged(outlineNodes));
|
|
18
20
|
} catch (error) {
|
|
19
|
-
Log.error('Outline sync failed!', error);
|
|
21
|
+
Log.error('Outline sync failed!', getError(error));
|
|
20
22
|
}
|
|
21
23
|
}
|
|
22
24
|
await syncOutline();
|