@sap-ux/preview-middleware 0.18.19 → 0.18.22
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.
|
@@ -38,11 +38,11 @@ export interface CodeExtResponse {
|
|
|
38
38
|
export interface AnnotationFileDetails {
|
|
39
39
|
annotationExistsInWS: boolean;
|
|
40
40
|
annotationPath: string;
|
|
41
|
-
annotationPathFromRoot: string;
|
|
41
|
+
annotationPathFromRoot: string | undefined;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
export interface AnnotationDataSourceMap {
|
|
45
|
-
[key: string]: { serviceUrl: string; annotationDetails: AnnotationFileDetails };
|
|
45
|
+
[key: string]: { serviceUrl: string; annotationDetails: AnnotationFileDetails, metadataReadErrorMsg: string };
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
export interface AnnotationDataSourceResponse {
|
|
@@ -7,8 +7,11 @@ sap.ui.define([
|
|
|
7
7
|
'../quick-action-base',
|
|
8
8
|
'../dialog-enablement-validator',
|
|
9
9
|
'sap/ui/rta/command/CommandFactory',
|
|
10
|
-
'../../../utils/version'
|
|
11
|
-
|
|
10
|
+
'../../../utils/version',
|
|
11
|
+
'../fe-v2/utils',
|
|
12
|
+
'../../../utils/fe-v4',
|
|
13
|
+
'../../../utils/application'
|
|
14
|
+
], function (____api_handler, ___sap_ux_private_control_property_editor_common, ____dialog_factory, OverlayRegistry, ___quick_action_base, ___dialog_enablement_validator, CommandFactory, _____utils_version, ___fe_v2_utils, _____utils_fe_v4, _____utils_application) {
|
|
12
15
|
'use strict';
|
|
13
16
|
const getDataSourceAnnotationFileMap = ____api_handler['getDataSourceAnnotationFileMap'];
|
|
14
17
|
const NESTED_QUICK_ACTION_KIND = ___sap_ux_private_control_property_editor_common['NESTED_QUICK_ACTION_KIND'];
|
|
@@ -18,6 +21,9 @@ sap.ui.define([
|
|
|
18
21
|
const DIALOG_ENABLEMENT_VALIDATOR = ___dialog_enablement_validator['DIALOG_ENABLEMENT_VALIDATOR'];
|
|
19
22
|
const getUi5Version = _____utils_version['getUi5Version'];
|
|
20
23
|
const isLowerThanMinimalUi5Version = _____utils_version['isLowerThanMinimalUi5Version'];
|
|
24
|
+
const getV2AppComponent = ___fe_v2_utils['getV2AppComponent'];
|
|
25
|
+
const getV4AppComponent = _____utils_fe_v4['getV4AppComponent'];
|
|
26
|
+
const getApplicationType = _____utils_application['getApplicationType'];
|
|
21
27
|
const ADD_NEW_ANNOTATION_FILE = 'add-new-annotation-file';
|
|
22
28
|
const ADD_NEW_ANNOTATION_FILE_TITLE = 'QUICK_ACTION_ADD_NEW_ANNOTATION_FILE';
|
|
23
29
|
class AddNewAnnotationFile extends QuickActionDefinitionBase {
|
|
@@ -52,11 +58,20 @@ sap.ui.define([
|
|
|
52
58
|
if (Object.prototype.hasOwnProperty.call(annotationDataSourceMap, key)) {
|
|
53
59
|
const source = annotationDataSourceMap[key];
|
|
54
60
|
const {annotationExistsInWS} = source.annotationDetails;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
61
|
+
if (source.metadataReadErrorMsg) {
|
|
62
|
+
this.children.push({
|
|
63
|
+
enabled: false,
|
|
64
|
+
tooltip: source.metadataReadErrorMsg,
|
|
65
|
+
label: this.context.resourceBundle.getText('ADD_ANNOTATION_FILE', [key]),
|
|
66
|
+
children: []
|
|
67
|
+
});
|
|
68
|
+
} else {
|
|
69
|
+
this.children.push({
|
|
70
|
+
enabled: true,
|
|
71
|
+
label: annotationExistsInWS ? this.context.resourceBundle.getText('SHOW_ANNOTATION_FILE', [key]) : this.context.resourceBundle.getText('ADD_ANNOTATION_FILE', [key]),
|
|
72
|
+
children: []
|
|
73
|
+
});
|
|
74
|
+
}
|
|
60
75
|
}
|
|
61
76
|
}
|
|
62
77
|
}
|
|
@@ -73,6 +88,7 @@ sap.ui.define([
|
|
|
73
88
|
}
|
|
74
89
|
async execute(path) {
|
|
75
90
|
const {annotationDataSourceMap, isRunningInBAS} = this.annotationDataSourceData;
|
|
91
|
+
const appType = getApplicationType(this.context.rta.getRootControlInstance().getManifest());
|
|
76
92
|
const index = Number(path);
|
|
77
93
|
if (index >= 0) {
|
|
78
94
|
const dataSourceId = Object.keys(annotationDataSourceMap)[index];
|
|
@@ -103,6 +119,7 @@ sap.ui.define([
|
|
|
103
119
|
};
|
|
104
120
|
const modifiedValue = {
|
|
105
121
|
changeType: 'appdescr_app_addAnnotationsToOData',
|
|
122
|
+
appComponent: appType === 'fe-v4' ? getV4AppComponent(this.context.view) : getV2AppComponent(this.context.view),
|
|
106
123
|
generator: this.context.flexSettings.generator,
|
|
107
124
|
reference: this.context.flexSettings.projectId,
|
|
108
125
|
parameters,
|
|
@@ -14,6 +14,9 @@ import { QuickActionDefinitionBase } from '../quick-action-base';
|
|
|
14
14
|
import { DIALOG_ENABLEMENT_VALIDATOR } from '../dialog-enablement-validator';
|
|
15
15
|
import CommandFactory from 'sap/ui/rta/command/CommandFactory';
|
|
16
16
|
import { getUi5Version, isLowerThanMinimalUi5Version } from '../../../utils/version';
|
|
17
|
+
import { getV2AppComponent } from '../fe-v2/utils';
|
|
18
|
+
import { getV4AppComponent } from '../../../utils/fe-v4';
|
|
19
|
+
import { getApplicationType } from '../../../utils/application';
|
|
17
20
|
|
|
18
21
|
export const ADD_NEW_ANNOTATION_FILE = 'add-new-annotation-file';
|
|
19
22
|
const ADD_NEW_ANNOTATION_FILE_TITLE = 'QUICK_ACTION_ADD_NEW_ANNOTATION_FILE';
|
|
@@ -49,17 +52,27 @@ export class AddNewAnnotationFile
|
|
|
49
52
|
if (!Object.keys(this.annotationDataSourceData.annotationDataSourceMap).length) {
|
|
50
53
|
throw new Error('No data sources found in the manifest');
|
|
51
54
|
}
|
|
55
|
+
|
|
52
56
|
for (const key in annotationDataSourceMap) {
|
|
53
57
|
if (Object.prototype.hasOwnProperty.call(annotationDataSourceMap, key)) {
|
|
54
58
|
const source = annotationDataSourceMap[key];
|
|
55
59
|
const { annotationExistsInWS } = source.annotationDetails;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
: this.context.resourceBundle.getText('ADD_ANNOTATION_FILE', [key]),
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
if (source.metadataReadErrorMsg) {
|
|
61
|
+
this.children.push({
|
|
62
|
+
enabled: false,
|
|
63
|
+
tooltip: source.metadataReadErrorMsg,
|
|
64
|
+
label: this.context.resourceBundle.getText('ADD_ANNOTATION_FILE', [key]),
|
|
65
|
+
children: []
|
|
66
|
+
});
|
|
67
|
+
} else {
|
|
68
|
+
this.children.push({
|
|
69
|
+
enabled: true,
|
|
70
|
+
label: annotationExistsInWS
|
|
71
|
+
? this.context.resourceBundle.getText('SHOW_ANNOTATION_FILE', [key])
|
|
72
|
+
: this.context.resourceBundle.getText('ADD_ANNOTATION_FILE', [key]),
|
|
73
|
+
children: []
|
|
74
|
+
});
|
|
75
|
+
}
|
|
63
76
|
}
|
|
64
77
|
}
|
|
65
78
|
}
|
|
@@ -76,6 +89,7 @@ export class AddNewAnnotationFile
|
|
|
76
89
|
}
|
|
77
90
|
async execute(path: string): Promise<FlexCommand[]> {
|
|
78
91
|
const { annotationDataSourceMap, isRunningInBAS } = this.annotationDataSourceData;
|
|
92
|
+
const appType = getApplicationType(this.context.rta.getRootControlInstance().getManifest());
|
|
79
93
|
const index = Number(path);
|
|
80
94
|
if (index >= 0) {
|
|
81
95
|
const dataSourceId = Object.keys(annotationDataSourceMap)[index];
|
|
@@ -117,6 +131,10 @@ export class AddNewAnnotationFile
|
|
|
117
131
|
};
|
|
118
132
|
const modifiedValue = {
|
|
119
133
|
changeType: 'appdescr_app_addAnnotationsToOData',
|
|
134
|
+
appComponent:
|
|
135
|
+
appType === 'fe-v4'
|
|
136
|
+
? getV4AppComponent(this.context.view)
|
|
137
|
+
: getV2AppComponent(this.context.view),
|
|
120
138
|
generator: this.context.flexSettings.generator,
|
|
121
139
|
reference: this.context.flexSettings.projectId,
|
|
122
140
|
parameters,
|
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.18.
|
|
12
|
+
"version": "0.18.22",
|
|
13
13
|
"license": "Apache-2.0",
|
|
14
14
|
"author": "@SAP/ux-tools-team",
|
|
15
15
|
"main": "dist/index.js",
|
|
@@ -25,12 +25,12 @@
|
|
|
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
|
+
"@sap-ux/adp-tooling": "0.13.17",
|
|
29
29
|
"@sap-ux/btp-utils": "1.0.2",
|
|
30
30
|
"@sap-ux/control-property-editor-sources": "npm:@sap-ux/control-property-editor@0.6.1",
|
|
31
|
-
"@sap-ux/logger": "0.6.0",
|
|
32
31
|
"@sap-ux/feature-toggle": "0.2.3",
|
|
33
|
-
"@sap-ux/
|
|
32
|
+
"@sap-ux/logger": "0.6.0",
|
|
33
|
+
"@sap-ux/project-access": "1.29.18",
|
|
34
34
|
"@sap-ux/system-access": "0.5.33"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
@@ -49,11 +49,11 @@
|
|
|
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.6",
|
|
52
53
|
"@sap-ux/axios-extension": "1.19.1",
|
|
53
|
-
"@sap-ux/store": "1.0.0",
|
|
54
54
|
"@sap-ux/i18n": "0.2.3",
|
|
55
|
-
"@sap-ux/
|
|
56
|
-
"@
|
|
55
|
+
"@sap-ux/store": "1.0.0",
|
|
56
|
+
"@sap-ux/ui5-info": "0.9.1"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
59
|
"express": "4"
|