@sap-ux/preview-middleware 0.20.73 → 0.20.74
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/client/adp/api-handler.js +2 -2
- package/dist/client/adp/api-handler.ts +2 -2
- package/dist/client/adp/command-executor.js +66 -76
- package/dist/client/adp/command-executor.ts +28 -13
- package/dist/client/adp/controllers/AddCustomFragment.controller.js +22 -8
- package/dist/client/adp/controllers/AddCustomFragment.controller.ts +16 -6
- package/dist/client/adp/controllers/AddFragment.controller.js +32 -18
- package/dist/client/adp/controllers/AddFragment.controller.ts +23 -13
- package/dist/client/adp/controllers/AddTableColumnFragments.controller.js +35 -19
- package/dist/client/adp/controllers/AddTableColumnFragments.controller.ts +26 -20
- package/dist/client/adp/controllers/BaseDialog.controller.js +1 -9
- package/dist/client/adp/controllers/BaseDialog.controller.ts +0 -14
- package/dist/client/adp/controllers/ControllerExtension.controller.js +252 -267
- package/dist/client/adp/controllers/ControllerExtension.controller.ts +61 -17
- package/dist/client/adp/controllers/ExtensionPoint.controller.js +115 -140
- package/dist/client/adp/controllers/ExtensionPoint.controller.ts +17 -5
- package/dist/client/adp/init.js +22 -10
- package/dist/client/adp/init.ts +31 -13
- package/dist/client/adp/quick-actions/common/add-controller-to-page.js +4 -4
- package/dist/client/adp/quick-actions/common/add-controller-to-page.ts +6 -4
- package/dist/client/adp/quick-actions/common/add-new-annotation-file.js +29 -14
- package/dist/client/adp/quick-actions/common/add-new-annotation-file.ts +22 -9
- package/dist/client/adp/quick-actions/fe-v2/create-table-custom-column.js +100 -98
- package/dist/client/adp/quick-actions/fe-v2/create-table-custom-column.ts +8 -8
- package/dist/client/adp/sync-views-utils.js +11 -13
- package/dist/client/adp/sync-views-utils.ts +10 -12
- package/dist/client/adp/utils.js +1 -15
- package/dist/client/adp/utils.ts +0 -14
- package/dist/client/cpe/changes/service.js +26 -16
- package/dist/client/cpe/changes/service.ts +28 -21
- package/dist/client/cpe/documentation.js +125 -159
- package/dist/client/cpe/documentation.ts +16 -2
- package/dist/client/cpe/init.js +27 -5
- package/dist/client/cpe/init.ts +29 -4
- package/dist/client/cpe/outline/service.js +12 -3
- package/dist/client/cpe/outline/service.ts +10 -8
- package/dist/client/cpe/quick-actions/quick-action-service.ts +0 -1
- package/dist/client/cpe/selection.js +16 -4
- package/dist/client/cpe/selection.ts +14 -3
- package/dist/client/flp/init.js +28 -11
- package/dist/client/flp/init.ts +36 -19
- package/dist/client/messagebundle.properties +34 -1
- package/dist/client/thirdparty/@sap-ux-private/control-property-editor-common.js +2 -2
- package/dist/client/utils/info-center-message.js +33 -0
- package/dist/client/utils/info-center-message.ts +60 -0
- package/dist/client/utils/version.js +69 -104
- package/dist/client/utils/version.ts +25 -14
- package/package.json +5 -5
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
/** sap.m */
|
|
2
|
-
import Input from 'sap/m/Input';
|
|
3
2
|
import Button from 'sap/m/Button';
|
|
4
3
|
import type Dialog from 'sap/m/Dialog';
|
|
5
|
-
import
|
|
4
|
+
import Input from 'sap/m/Input';
|
|
6
5
|
|
|
7
6
|
/** sap.ui.core */
|
|
8
|
-
import { ValueState } from 'sap/ui/core/library';
|
|
9
7
|
import type UI5Element from 'sap/ui/core/Element';
|
|
8
|
+
import { ValueState } from 'sap/ui/core/library';
|
|
10
9
|
|
|
11
10
|
/** sap.ui.base */
|
|
12
11
|
import type Event from 'sap/ui/base/Event';
|
|
@@ -20,16 +19,19 @@ import type RuntimeAuthoring from 'sap/ui/rta/RuntimeAuthoring';
|
|
|
20
19
|
/** sap.ui.dt */
|
|
21
20
|
import type ElementOverlay from 'sap/ui/dt/ElementOverlay';
|
|
22
21
|
|
|
23
|
-
import
|
|
24
|
-
import { getExistingController, readControllers, writeChange, writeController } from '../api-handler';
|
|
25
|
-
import BaseDialog from './BaseDialog.controller';
|
|
26
|
-
import type { ExtendControllerData, DeferredExtendControllerData } from '../extend-controller';
|
|
22
|
+
import { MessageBarType } from '@sap-ux-private/control-property-editor-common';
|
|
27
23
|
import { QuickActionTelemetryData } from '../../cpe/quick-actions/quick-action-definition';
|
|
28
24
|
import { getResourceModel, getTextBundle, TextBundle } from '../../i18n';
|
|
29
|
-
import {
|
|
25
|
+
import { getControlById } from '../../utils/core';
|
|
26
|
+
import { getError } from '../../utils/error';
|
|
27
|
+
import { sendInfoCenterMessage } from '../../utils/info-center-message';
|
|
30
28
|
import { getUi5Version, isLowerThanMinimalUi5Version } from '../../utils/version';
|
|
29
|
+
import type { CodeExtResponse, ControllersResponse } from '../api-handler';
|
|
30
|
+
import { getExistingController, readControllers, writeChange, writeController } from '../api-handler';
|
|
31
31
|
import CommandExecutor from '../command-executor';
|
|
32
|
-
import {
|
|
32
|
+
import type { DeferredExtendControllerData, ExtendControllerData } from '../extend-controller';
|
|
33
|
+
import { checkForExistingChange, getControllerInfo } from '../utils';
|
|
34
|
+
import BaseDialog from './BaseDialog.controller';
|
|
33
35
|
|
|
34
36
|
interface ControllerExtensionService {
|
|
35
37
|
add: (codeRef: string, viewId: string) => Promise<{ creation: string }>;
|
|
@@ -55,6 +57,8 @@ type ControllerModel = JSONModel & {
|
|
|
55
57
|
* @namespace open.ux.preview.client.adp.controllers
|
|
56
58
|
*/
|
|
57
59
|
export default class ControllerExtension extends BaseDialog<ControllerModel> {
|
|
60
|
+
/* The minimum version of UI5 framework which supports controller extensions. */
|
|
61
|
+
private static readonly CONTROLLER_EXT_MIN_UI5_VERSION = { major: 1, minor: 135 };
|
|
58
62
|
public readonly data?: ExtendControllerData;
|
|
59
63
|
private bundle: TextBundle;
|
|
60
64
|
|
|
@@ -185,10 +189,17 @@ export default class ControllerExtension extends BaseDialog<ControllerModel> {
|
|
|
185
189
|
|
|
186
190
|
if (this.data) {
|
|
187
191
|
this.data.deferred.resolve(controllerRef);
|
|
188
|
-
notifyUser(this.bundle.getText('ADP_CREATE_CONTROLLER_EXTENSION', [controllerName]), 8000);
|
|
189
192
|
} else {
|
|
190
193
|
await this.createNewController(controllerName, controllerRef);
|
|
191
194
|
}
|
|
195
|
+
|
|
196
|
+
if (this.data && (await this.isControllerExtensionSupported())) {
|
|
197
|
+
await sendInfoCenterMessage({
|
|
198
|
+
title: { key: 'ADP_CREATE_CONTROLLER_EXTENSION_TITLE' },
|
|
199
|
+
description: { key: 'ADP_CREATE_CONTROLLER_EXTENSION', params: [controllerName] },
|
|
200
|
+
type: MessageBarType.info
|
|
201
|
+
});
|
|
202
|
+
}
|
|
192
203
|
} else {
|
|
193
204
|
const controllerPath = this.model.getProperty('/controllerPath');
|
|
194
205
|
window.open(`vscode://file${controllerPath}`);
|
|
@@ -286,7 +297,13 @@ export default class ControllerExtension extends BaseDialog<ControllerModel> {
|
|
|
286
297
|
try {
|
|
287
298
|
data = await getExistingController(controllerName);
|
|
288
299
|
} catch (e) {
|
|
289
|
-
|
|
300
|
+
const error = getError(e);
|
|
301
|
+
await sendInfoCenterMessage({
|
|
302
|
+
title: { key: 'ADP_CONTROLLER_ERROR_TITLE' },
|
|
303
|
+
description: error.message,
|
|
304
|
+
type: MessageBarType.error
|
|
305
|
+
});
|
|
306
|
+
throw error;
|
|
290
307
|
}
|
|
291
308
|
|
|
292
309
|
return data;
|
|
@@ -300,7 +317,13 @@ export default class ControllerExtension extends BaseDialog<ControllerModel> {
|
|
|
300
317
|
const { controllers } = await readControllers<ControllersResponse>();
|
|
301
318
|
this.model.setProperty('/controllersList', controllers);
|
|
302
319
|
} catch (e) {
|
|
303
|
-
|
|
320
|
+
const error = getError(e);
|
|
321
|
+
await sendInfoCenterMessage({
|
|
322
|
+
title: { key: 'ADP_CONTROLLER_ERROR_TITLE' },
|
|
323
|
+
description: error.message,
|
|
324
|
+
type: MessageBarType.error
|
|
325
|
+
});
|
|
326
|
+
throw error;
|
|
304
327
|
}
|
|
305
328
|
}
|
|
306
329
|
|
|
@@ -314,8 +337,7 @@ export default class ControllerExtension extends BaseDialog<ControllerModel> {
|
|
|
314
337
|
controllerName: string,
|
|
315
338
|
controllerRef: DeferredExtendControllerData
|
|
316
339
|
): Promise<void> {
|
|
317
|
-
|
|
318
|
-
if (!isLowerThanMinimalUi5Version(ui5Version, { major: 1, minor: 135 })) {
|
|
340
|
+
if (await this.isControllerExtensionSupported()) {
|
|
319
341
|
await this.createControllerCommand(controllerName, controllerRef);
|
|
320
342
|
return;
|
|
321
343
|
}
|
|
@@ -328,12 +350,25 @@ export default class ControllerExtension extends BaseDialog<ControllerModel> {
|
|
|
328
350
|
change.creation = new Date().toISOString();
|
|
329
351
|
|
|
330
352
|
await writeChange(change);
|
|
331
|
-
|
|
353
|
+
await sendInfoCenterMessage({
|
|
354
|
+
title: { key: 'ADP_CREATE_CONTROLLER_EXTENSION_TITLE' },
|
|
355
|
+
description: {
|
|
356
|
+
key: 'ADP_CREATE_CONTROLLER_EXTENSION_DESCRIPTION',
|
|
357
|
+
params: [controllerName]
|
|
358
|
+
},
|
|
359
|
+
type: MessageBarType.info
|
|
360
|
+
});
|
|
332
361
|
} catch (e) {
|
|
362
|
+
const error = getError(e);
|
|
363
|
+
await sendInfoCenterMessage({
|
|
364
|
+
title: { key: 'ADP_CONTROLLER_ERROR_TITLE' },
|
|
365
|
+
description: error.message,
|
|
366
|
+
type: MessageBarType.error
|
|
367
|
+
});
|
|
333
368
|
// We want to update the model incase we have already created a controller file but failed when creating a change file,
|
|
334
369
|
// so when the user types the same controller name again he does not get 409 from the server, instead an error is shown in the UI
|
|
335
370
|
await this.getControllers();
|
|
336
|
-
|
|
371
|
+
throw error;
|
|
337
372
|
}
|
|
338
373
|
}
|
|
339
374
|
|
|
@@ -359,6 +394,15 @@ export default class ControllerExtension extends BaseDialog<ControllerModel> {
|
|
|
359
394
|
|
|
360
395
|
await commandExecutor.pushAndExecuteCommand(command);
|
|
361
396
|
|
|
362
|
-
|
|
397
|
+
await sendInfoCenterMessage({
|
|
398
|
+
title: { key: 'ADP_CREATE_CONTROLLER_EXTENSION_TITLE' },
|
|
399
|
+
description: { key: 'ADP_CREATE_CONTROLLER_EXTENSION', params: [controllerName] },
|
|
400
|
+
type: MessageBarType.info
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
private async isControllerExtensionSupported(): Promise<boolean> {
|
|
405
|
+
const ui5Version = await getUi5Version();
|
|
406
|
+
return !isLowerThanMinimalUi5Version(ui5Version, ControllerExtension.CONTROLLER_EXT_MIN_UI5_VERSION);
|
|
363
407
|
}
|
|
364
408
|
}
|
|
@@ -1,141 +1,116 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
sap
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
* @namespace open.ux.preview.client.adp.controllers
|
|
14
|
-
*/
|
|
15
|
-
const ExtensionPoint = BaseDialog.extend("open.ux.preview.client.adp.controllers.ExtensionPoint", {
|
|
16
|
-
constructor: function _constructor(name, _overlays, rta, data) {
|
|
17
|
-
BaseDialog.prototype.constructor.call(this, name);
|
|
18
|
-
this.model = new JSONModel();
|
|
19
|
-
this.data = data;
|
|
20
|
-
this.rta = rta;
|
|
21
|
-
},
|
|
22
|
-
/**
|
|
23
|
-
* Setups the Dialog and the JSON Model
|
|
24
|
-
*
|
|
25
|
-
* @param {Dialog} dialog - Dialog instance
|
|
26
|
-
*/
|
|
27
|
-
setup: async function _setup(dialog) {
|
|
28
|
-
this.dialog = dialog;
|
|
29
|
-
this.setEscapeHandler();
|
|
30
|
-
await this.buildDialogData();
|
|
31
|
-
this.dialog.setModel(this.model);
|
|
32
|
-
this.dialog.open();
|
|
33
|
-
},
|
|
34
|
-
/**
|
|
35
|
-
* Handles create button press
|
|
36
|
-
*
|
|
37
|
-
* @param event Event
|
|
38
|
-
*/
|
|
39
|
-
onCreateBtnPress: async function _onCreateBtnPress(event) {
|
|
40
|
-
const source = event.getSource();
|
|
41
|
-
source.setEnabled(false);
|
|
42
|
-
await BaseDialog.prototype.onCreateBtnPressHandler.call(this);
|
|
43
|
-
const fragmentName = this.model.getProperty('/newFragmentName');
|
|
44
|
-
this.createExtensionPointFragmentChange(fragmentName);
|
|
45
|
-
notifyUser(`Note: The '${fragmentName}.fragment.xml' fragment will be created once you save the change.`, 8000);
|
|
46
|
-
this.handleDialogClose();
|
|
47
|
-
},
|
|
48
|
-
/**
|
|
49
|
-
* Handler for extension point select control
|
|
50
|
-
*
|
|
51
|
-
* @param event Select control change event
|
|
52
|
-
*/
|
|
53
|
-
onExtensionPointHandler: function _onExtensionPointHandler(event) {
|
|
54
|
-
const source = event.getSource();
|
|
55
|
-
const selectedItem = source.getSelectedItem();
|
|
56
|
-
let extensionPointName = '';
|
|
57
|
-
if (selectedItem) {
|
|
58
|
-
extensionPointName = selectedItem.getText();
|
|
59
|
-
}
|
|
60
|
-
this.model.setProperty('/extensionPointName', extensionPointName);
|
|
61
|
-
const hasDefaultContent = this.hasDefaultContentForName(extensionPointName);
|
|
62
|
-
this.model.setProperty('/hasDefaultContent', hasDefaultContent);
|
|
63
|
-
},
|
|
64
|
-
/**
|
|
65
|
-
* Determines whether there is default content associated with the given name.
|
|
66
|
-
*
|
|
67
|
-
* @param {string} name - The name to check for associated default content.
|
|
68
|
-
* @returns {boolean} - True if there is non-empty default content associated with the name, false otherwise.
|
|
69
|
-
*/
|
|
70
|
-
hasDefaultContentForName: function _hasDefaultContentForName(name) {
|
|
71
|
-
const defaultContent = this.data?.info.find(v => v.name === name)?.defaultContent;
|
|
72
|
-
return defaultContent ? defaultContent.length > 0 : false;
|
|
73
|
-
},
|
|
74
|
-
/**
|
|
75
|
-
* Builds data that is used in the dialog
|
|
76
|
-
*/
|
|
77
|
-
buildDialogData: async function _buildDialogData() {
|
|
78
|
-
const name = this.data?.name;
|
|
79
|
-
if (name) {
|
|
80
|
-
const hasDefaultContent = this.hasDefaultContentForName(name);
|
|
81
|
-
const extensionPointList = [{
|
|
82
|
-
key: 0,
|
|
83
|
-
value: name
|
|
84
|
-
}];
|
|
85
|
-
this.updateModel(name, 0, extensionPointList, false, hasDefaultContent);
|
|
86
|
-
} else {
|
|
87
|
-
// In this case we are selecting from the application. There can be many extension points under one control.
|
|
88
|
-
const extensionPointList = this.data.info.map((v, idx) => {
|
|
89
|
-
return {
|
|
90
|
-
key: idx,
|
|
91
|
-
value: v.name
|
|
92
|
-
};
|
|
93
|
-
});
|
|
94
|
-
const firstElName = extensionPointList[0].value;
|
|
95
|
-
const enabled = extensionPointList.length > 1;
|
|
96
|
-
const hasDefaultContent = this.hasDefaultContentForName(firstElName);
|
|
97
|
-
this.updateModel(firstElName, 0, extensionPointList, enabled, hasDefaultContent);
|
|
98
|
-
}
|
|
99
|
-
try {
|
|
100
|
-
const {
|
|
101
|
-
fragments
|
|
102
|
-
} = await getFragments();
|
|
103
|
-
this.model.setProperty('/fragmentList', fragments);
|
|
104
|
-
} catch (e) {
|
|
105
|
-
this.handleError(e);
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
/**
|
|
109
|
-
* Updates the Select control according to provided values
|
|
110
|
-
*
|
|
111
|
-
* @param name Extension point name
|
|
112
|
-
* @param key Selected extension point key
|
|
113
|
-
* @param list All of the extension points that are under a view
|
|
114
|
-
* @param enabled Enables the select control
|
|
115
|
-
* @param hasDefaultContent Whether there is default content associated with the extension name
|
|
116
|
-
*/
|
|
117
|
-
updateModel: function _updateModel(name, key, list, enabled, hasDefaultContent) {
|
|
118
|
-
this.model.setProperty('/extensionPointName', name);
|
|
119
|
-
this.model.setProperty('/extensionPointKey', key);
|
|
120
|
-
this.model.setProperty('/extensionPointList', list);
|
|
121
|
-
this.model.setProperty('/extensionListEnabled', enabled);
|
|
122
|
-
this.model.setProperty('/hasDefaultContent', hasDefaultContent);
|
|
123
|
-
},
|
|
124
|
-
/**
|
|
125
|
-
* Creates add xml at extension point changes
|
|
126
|
-
*
|
|
127
|
-
* @param fragmentName Fragment name
|
|
128
|
-
*/
|
|
129
|
-
createExtensionPointFragmentChange: function _createExtensionPointFragmentChange(fragmentName) {
|
|
130
|
-
const extensionPointName = this.model.getProperty('/extensionPointName');
|
|
131
|
-
const modifiedValue = {
|
|
132
|
-
fragment: `<core:FragmentDefinition xmlns:core='sap.ui.core'></core:FragmentDefinition>`,
|
|
133
|
-
fragmentPath: `fragments/${fragmentName}.fragment.xml`,
|
|
134
|
-
extensionPointName
|
|
135
|
-
};
|
|
136
|
-
this.data.deferred.resolve(modifiedValue);
|
|
1
|
+
'use strict';
|
|
2
|
+
sap.ui.define([
|
|
3
|
+
'sap/ui/model/json/JSONModel',
|
|
4
|
+
'open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common',
|
|
5
|
+
'../../utils/error',
|
|
6
|
+
'../../utils/info-center-message',
|
|
7
|
+
'../api-handler',
|
|
8
|
+
'./BaseDialog.controller'
|
|
9
|
+
], function (JSONModel, ___sap_ux_private_control_property_editor_common, ____utils_error, ____utils_info_center_message, ___api_handler, __BaseDialog) {
|
|
10
|
+
'use strict';
|
|
11
|
+
function _interopRequireDefault(obj) {
|
|
12
|
+
return obj && obj.__esModule && typeof obj.default !== 'undefined' ? obj.default : obj;
|
|
137
13
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
14
|
+
const MessageBarType = ___sap_ux_private_control_property_editor_common['MessageBarType'];
|
|
15
|
+
const getError = ____utils_error['getError'];
|
|
16
|
+
const sendInfoCenterMessage = ____utils_info_center_message['sendInfoCenterMessage'];
|
|
17
|
+
const getFragments = ___api_handler['getFragments'];
|
|
18
|
+
const BaseDialog = _interopRequireDefault(__BaseDialog);
|
|
19
|
+
const ExtensionPoint = BaseDialog.extend('open.ux.preview.client.adp.controllers.ExtensionPoint', {
|
|
20
|
+
constructor: function _constructor(name, _overlays, rta, data) {
|
|
21
|
+
BaseDialog.prototype.constructor.call(this, name);
|
|
22
|
+
this.model = new JSONModel();
|
|
23
|
+
this.data = data;
|
|
24
|
+
this.rta = rta;
|
|
25
|
+
},
|
|
26
|
+
setup: async function _setup(dialog) {
|
|
27
|
+
this.dialog = dialog;
|
|
28
|
+
this.setEscapeHandler();
|
|
29
|
+
await this.buildDialogData();
|
|
30
|
+
this.dialog.setModel(this.model);
|
|
31
|
+
this.dialog.open();
|
|
32
|
+
},
|
|
33
|
+
onCreateBtnPress: async function _onCreateBtnPress(event) {
|
|
34
|
+
const source = event.getSource();
|
|
35
|
+
source.setEnabled(false);
|
|
36
|
+
await BaseDialog.prototype.onCreateBtnPressHandler.call(this);
|
|
37
|
+
const fragmentName = this.model.getProperty('/newFragmentName');
|
|
38
|
+
this.createExtensionPointFragmentChange(fragmentName);
|
|
39
|
+
await sendInfoCenterMessage({
|
|
40
|
+
title: { key: 'ADP_CREATE_XML_FRAGMENT_TITLE' },
|
|
41
|
+
description: {
|
|
42
|
+
key: 'ADP_CREATE_XML_FRAGMENT_DESCRIPTION',
|
|
43
|
+
params: [fragmentName]
|
|
44
|
+
},
|
|
45
|
+
type: MessageBarType.info
|
|
46
|
+
});
|
|
47
|
+
this.handleDialogClose();
|
|
48
|
+
},
|
|
49
|
+
onExtensionPointHandler: function _onExtensionPointHandler(event) {
|
|
50
|
+
const source = event.getSource();
|
|
51
|
+
const selectedItem = source.getSelectedItem();
|
|
52
|
+
let extensionPointName = '';
|
|
53
|
+
if (selectedItem) {
|
|
54
|
+
extensionPointName = selectedItem.getText();
|
|
55
|
+
}
|
|
56
|
+
this.model.setProperty('/extensionPointName', extensionPointName);
|
|
57
|
+
const hasDefaultContent = this.hasDefaultContentForName(extensionPointName);
|
|
58
|
+
this.model.setProperty('/hasDefaultContent', hasDefaultContent);
|
|
59
|
+
},
|
|
60
|
+
hasDefaultContentForName: function _hasDefaultContentForName(name) {
|
|
61
|
+
const defaultContent = this.data?.info.find(v => v.name === name)?.defaultContent;
|
|
62
|
+
return defaultContent ? defaultContent.length > 0 : false;
|
|
63
|
+
},
|
|
64
|
+
buildDialogData: async function _buildDialogData() {
|
|
65
|
+
const name = this.data?.name;
|
|
66
|
+
if (name) {
|
|
67
|
+
const hasDefaultContent = this.hasDefaultContentForName(name);
|
|
68
|
+
const extensionPointList = [{
|
|
69
|
+
key: 0,
|
|
70
|
+
value: name
|
|
71
|
+
}];
|
|
72
|
+
this.updateModel(name, 0, extensionPointList, false, hasDefaultContent);
|
|
73
|
+
} else {
|
|
74
|
+
const extensionPointList = this.data.info.map((v, idx) => {
|
|
75
|
+
return {
|
|
76
|
+
key: idx,
|
|
77
|
+
value: v.name
|
|
78
|
+
};
|
|
79
|
+
});
|
|
80
|
+
const firstElName = extensionPointList[0].value;
|
|
81
|
+
const enabled = extensionPointList.length > 1;
|
|
82
|
+
const hasDefaultContent = this.hasDefaultContentForName(firstElName);
|
|
83
|
+
this.updateModel(firstElName, 0, extensionPointList, enabled, hasDefaultContent);
|
|
84
|
+
}
|
|
85
|
+
try {
|
|
86
|
+
const {fragments} = await getFragments();
|
|
87
|
+
this.model.setProperty('/fragmentList', fragments);
|
|
88
|
+
} catch (e) {
|
|
89
|
+
const error = getError(e);
|
|
90
|
+
await sendInfoCenterMessage({
|
|
91
|
+
title: { key: 'ADP_EXTENSION_POINT_ERROR_TITLE' },
|
|
92
|
+
description: error.message,
|
|
93
|
+
type: MessageBarType.error
|
|
94
|
+
});
|
|
95
|
+
throw error;
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
updateModel: function _updateModel(name, key, list, enabled, hasDefaultContent) {
|
|
99
|
+
this.model.setProperty('/extensionPointName', name);
|
|
100
|
+
this.model.setProperty('/extensionPointKey', key);
|
|
101
|
+
this.model.setProperty('/extensionPointList', list);
|
|
102
|
+
this.model.setProperty('/extensionListEnabled', enabled);
|
|
103
|
+
this.model.setProperty('/hasDefaultContent', hasDefaultContent);
|
|
104
|
+
},
|
|
105
|
+
createExtensionPointFragmentChange: function _createExtensionPointFragmentChange(fragmentName) {
|
|
106
|
+
const extensionPointName = this.model.getProperty('/extensionPointName');
|
|
107
|
+
const modifiedValue = {
|
|
108
|
+
fragment: `<core:FragmentDefinition xmlns:core='sap.ui.core'></core:FragmentDefinition>`,
|
|
109
|
+
fragmentPath: `fragments/${ fragmentName }.fragment.xml`,
|
|
110
|
+
extensionPointName
|
|
111
|
+
};
|
|
112
|
+
this.data.deferred.resolve(modifiedValue);
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
return ExtensionPoint;
|
|
116
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** sap.m */
|
|
2
2
|
import type Button from 'sap/m/Button';
|
|
3
|
-
import type Select from 'sap/m/Select';
|
|
4
3
|
import type Dialog from 'sap/m/Dialog';
|
|
4
|
+
import type Select from 'sap/m/Select';
|
|
5
5
|
|
|
6
6
|
/** sap.ui.core */
|
|
7
7
|
import type UI5Element from 'sap/ui/core/Element';
|
|
@@ -15,10 +15,12 @@ import JSONModel from 'sap/ui/model/json/JSONModel';
|
|
|
15
15
|
/** sap.ui.rta */
|
|
16
16
|
import type RuntimeAuthoring from 'sap/ui/rta/RuntimeAuthoring';
|
|
17
17
|
|
|
18
|
+
import { MessageBarType } from '@sap-ux-private/control-property-editor-common';
|
|
19
|
+
import { getError } from '../../utils/error';
|
|
20
|
+
import { sendInfoCenterMessage } from '../../utils/info-center-message';
|
|
18
21
|
import { getFragments } from '../api-handler';
|
|
19
|
-
import BaseDialog from './BaseDialog.controller';
|
|
20
22
|
import { ExtensionPointData, ExtensionPointInfo } from '../extension-point';
|
|
21
|
-
import
|
|
23
|
+
import BaseDialog from './BaseDialog.controller';
|
|
22
24
|
|
|
23
25
|
type ExtensionPointModel = JSONModel & {
|
|
24
26
|
getProperty(sPath: '/newFragmentName'): string;
|
|
@@ -70,7 +72,11 @@ export default class ExtensionPoint extends BaseDialog<ExtensionPointModel> {
|
|
|
70
72
|
|
|
71
73
|
this.createExtensionPointFragmentChange(fragmentName);
|
|
72
74
|
|
|
73
|
-
|
|
75
|
+
await sendInfoCenterMessage({
|
|
76
|
+
title: { key: 'ADP_CREATE_XML_FRAGMENT_TITLE' },
|
|
77
|
+
description: { key: 'ADP_CREATE_XML_FRAGMENT_DESCRIPTION', params: [fragmentName] },
|
|
78
|
+
type: MessageBarType.info
|
|
79
|
+
});
|
|
74
80
|
|
|
75
81
|
this.handleDialogClose();
|
|
76
82
|
}
|
|
@@ -138,7 +144,13 @@ export default class ExtensionPoint extends BaseDialog<ExtensionPointModel> {
|
|
|
138
144
|
|
|
139
145
|
this.model.setProperty('/fragmentList', fragments);
|
|
140
146
|
} catch (e) {
|
|
141
|
-
|
|
147
|
+
const error = getError(e);
|
|
148
|
+
await sendInfoCenterMessage({
|
|
149
|
+
title: { key: 'ADP_EXTENSION_POINT_ERROR_TITLE' },
|
|
150
|
+
description: error.message,
|
|
151
|
+
type: MessageBarType.error
|
|
152
|
+
});
|
|
153
|
+
throw error;
|
|
142
154
|
}
|
|
143
155
|
}
|
|
144
156
|
|
package/dist/client/adp/init.js
CHANGED
|
@@ -3,13 +3,14 @@ sap.ui.define([
|
|
|
3
3
|
'sap/base/Log',
|
|
4
4
|
'open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common',
|
|
5
5
|
'../utils/version',
|
|
6
|
-
'../cpe/communication-service',
|
|
7
6
|
'../cpe/init',
|
|
8
7
|
'./sync-views-utils',
|
|
9
8
|
'../utils/application',
|
|
10
9
|
'./quick-actions/load',
|
|
11
|
-
'./init-dialogs'
|
|
12
|
-
|
|
10
|
+
'./init-dialogs',
|
|
11
|
+
'../utils/info-center-message',
|
|
12
|
+
'../cpe/communication-service'
|
|
13
|
+
], function (log, ___sap_ux_private_control_property_editor_common, ___utils_version, __init, ___sync_views_utils, ___utils_application, ___quick_actions_load, ___init_dialogs, ___utils_info_center_message, ___cpe_communication_service) {
|
|
13
14
|
'use strict';
|
|
14
15
|
function _interopRequireDefault(obj) {
|
|
15
16
|
return obj && obj.__esModule && typeof obj.default !== 'undefined' ? obj.default : obj;
|
|
@@ -27,18 +28,21 @@ sap.ui.define([
|
|
|
27
28
|
});
|
|
28
29
|
});
|
|
29
30
|
}
|
|
30
|
-
const showMessage = ___sap_ux_private_control_property_editor_common['showMessage'];
|
|
31
31
|
const enableTelemetry = ___sap_ux_private_control_property_editor_common['enableTelemetry'];
|
|
32
|
+
const MessageBarType = ___sap_ux_private_control_property_editor_common['MessageBarType'];
|
|
33
|
+
const toggleAppPreviewVisibility = ___sap_ux_private_control_property_editor_common['toggleAppPreviewVisibility'];
|
|
34
|
+
const getFullyQualifiedUi5Version = ___utils_version['getFullyQualifiedUi5Version'];
|
|
32
35
|
const getUi5Version = ___utils_version['getUi5Version'];
|
|
33
|
-
const getUI5VersionValidationMessage = ___utils_version['getUI5VersionValidationMessage'];
|
|
34
36
|
const isLowerThanMinimalUi5Version = ___utils_version['isLowerThanMinimalUi5Version'];
|
|
35
|
-
const
|
|
37
|
+
const minVersionInfo = ___utils_version['minVersionInfo'];
|
|
36
38
|
const init = _interopRequireDefault(__init);
|
|
37
39
|
const updateSyncViewsIds = ___sync_views_utils['updateSyncViewsIds'];
|
|
38
40
|
const showSyncViewsWarning = ___sync_views_utils['showSyncViewsWarning'];
|
|
39
41
|
const getApplicationType = ___utils_application['getApplicationType'];
|
|
40
42
|
const loadDefinitions = ___quick_actions_load['loadDefinitions'];
|
|
41
43
|
const initDialogs = ___init_dialogs['initDialogs'];
|
|
44
|
+
const sendInfoCenterMessage = ___utils_info_center_message['sendInfoCenterMessage'];
|
|
45
|
+
const CommunicationService = ___cpe_communication_service['CommunicationService'];
|
|
42
46
|
var __exports = async function (rta) {
|
|
43
47
|
const flexSettings = rta.getFlexSettings();
|
|
44
48
|
if (flexSettings.telemetry === true) {
|
|
@@ -77,10 +81,18 @@ sap.ui.define([
|
|
|
77
81
|
log.error('Failed to attach update event to outline service', error);
|
|
78
82
|
});
|
|
79
83
|
if (isLowerThanMinimalUi5Version(ui5VersionInfo)) {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
+
await sendInfoCenterMessage({
|
|
85
|
+
title: { key: 'FLP_UI5_VERSION_WARNING_TITLE' },
|
|
86
|
+
description: {
|
|
87
|
+
key: 'FLP_UI5_VERSION_WARNING_DESCRIPTION',
|
|
88
|
+
params: [
|
|
89
|
+
getFullyQualifiedUi5Version(ui5VersionInfo),
|
|
90
|
+
getFullyQualifiedUi5Version(minVersionInfo)
|
|
91
|
+
]
|
|
92
|
+
},
|
|
93
|
+
type: MessageBarType.error
|
|
94
|
+
});
|
|
95
|
+
CommunicationService.sendAction(toggleAppPreviewVisibility(false));
|
|
84
96
|
return;
|
|
85
97
|
}
|
|
86
98
|
log.debug('ADP init executed.');
|
package/dist/client/adp/init.ts
CHANGED
|
@@ -2,17 +2,27 @@ import log from 'sap/base/Log';
|
|
|
2
2
|
import type RuntimeAuthoring from 'sap/ui/rta/RuntimeAuthoring';
|
|
3
3
|
import type RTAOutlineService from 'sap/ui/rta/command/OutlineService';
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
enableTelemetry,
|
|
7
|
+
MessageBarType,
|
|
8
|
+
toggleAppPreviewVisibility
|
|
9
|
+
} from '@sap-ux-private/control-property-editor-common';
|
|
6
10
|
|
|
7
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
getFullyQualifiedUi5Version,
|
|
13
|
+
getUi5Version,
|
|
14
|
+
isLowerThanMinimalUi5Version,
|
|
15
|
+
minVersionInfo
|
|
16
|
+
} from '../utils/version';
|
|
8
17
|
|
|
9
|
-
import { CommunicationService } from '../cpe/communication-service';
|
|
10
18
|
import init from '../cpe/init';
|
|
11
19
|
import { updateSyncViewsIds, showSyncViewsWarning } from './sync-views-utils';
|
|
12
20
|
import { getApplicationType } from '../utils/application';
|
|
13
21
|
|
|
14
22
|
import { loadDefinitions } from './quick-actions/load';
|
|
15
23
|
import { initDialogs } from './init-dialogs';
|
|
24
|
+
import { sendInfoCenterMessage } from '../utils/info-center-message';
|
|
25
|
+
import { CommunicationService } from '../cpe/communication-service';
|
|
16
26
|
|
|
17
27
|
export default async function (rta: RuntimeAuthoring) {
|
|
18
28
|
const flexSettings = rta.getFlexSettings();
|
|
@@ -47,19 +57,27 @@ export default async function (rta: RuntimeAuthoring) {
|
|
|
47
57
|
|
|
48
58
|
// Register synchronious views detection and warning
|
|
49
59
|
// This is not awaited to prevent deadlock in the initialization
|
|
50
|
-
rta.getService<RTAOutlineService>('outline')
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
60
|
+
rta.getService<RTAOutlineService>('outline')
|
|
61
|
+
.then((outlineService) => {
|
|
62
|
+
outlineService.attachEvent('update', async () => {
|
|
63
|
+
await updateSyncViewsIds(ui5VersionInfo);
|
|
64
|
+
await showSyncViewsWarning();
|
|
65
|
+
});
|
|
66
|
+
})
|
|
67
|
+
.catch((error) => {
|
|
68
|
+
log.error('Failed to attach update event to outline service', error);
|
|
54
69
|
});
|
|
55
|
-
}).catch((error) => {
|
|
56
|
-
log.error('Failed to attach update event to outline service', error);
|
|
57
|
-
});
|
|
58
70
|
|
|
59
71
|
if (isLowerThanMinimalUi5Version(ui5VersionInfo)) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
72
|
+
await sendInfoCenterMessage({
|
|
73
|
+
title: { key: 'FLP_UI5_VERSION_WARNING_TITLE' },
|
|
74
|
+
description: {
|
|
75
|
+
key: 'FLP_UI5_VERSION_WARNING_DESCRIPTION',
|
|
76
|
+
params: [getFullyQualifiedUi5Version(ui5VersionInfo), getFullyQualifiedUi5Version(minVersionInfo)]
|
|
77
|
+
},
|
|
78
|
+
type: MessageBarType.error
|
|
79
|
+
});
|
|
80
|
+
CommunicationService.sendAction(toggleAppPreviewVisibility(false));
|
|
63
81
|
return;
|
|
64
82
|
}
|
|
65
83
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
sap.ui.define(["sap/ui/dt/OverlayRegistry", "../../../utils/version", "../../utils", "../../../cpe/quick-actions/utils", "
|
|
3
|
+
sap.ui.define(["sap/ui/dt/OverlayRegistry", "../../../utils/version", "../../utils", "../../../cpe/quick-actions/utils", "../../../i18n", "../../api-handler", "../../dialog-factory", "../../init-dialogs", "../dialog-enablement-validator", "../simple-quick-action-base"], function (OverlayRegistry, _____utils_version, ____utils, _____cpe_quick_actions_utils, _____i18n, ____api_handler, ____dialog_factory, ____init_dialogs, ___dialog_enablement_validator, ___simple_quick_action_base) {
|
|
4
4
|
"use strict";
|
|
5
5
|
|
|
6
6
|
const getUi5Version = _____utils_version["getUi5Version"];
|
|
@@ -8,13 +8,13 @@ sap.ui.define(["sap/ui/dt/OverlayRegistry", "../../../utils/version", "../../uti
|
|
|
8
8
|
const getReuseComponentChecker = ____utils["getReuseComponentChecker"];
|
|
9
9
|
const checkForExistingChange = ____utils["checkForExistingChange"];
|
|
10
10
|
const getRelevantControlFromActivePage = _____cpe_quick_actions_utils["getRelevantControlFromActivePage"];
|
|
11
|
+
const getTextBundle = _____i18n["getTextBundle"];
|
|
12
|
+
const getExistingController = ____api_handler["getExistingController"];
|
|
11
13
|
const DialogFactory = ____dialog_factory["DialogFactory"];
|
|
12
14
|
const DialogNames = ____dialog_factory["DialogNames"];
|
|
13
15
|
const isControllerExtensionEnabledForControl = ____init_dialogs["isControllerExtensionEnabledForControl"];
|
|
14
|
-
const getExistingController = ____api_handler["getExistingController"];
|
|
15
|
-
const SimpleQuickActionDefinitionBase = ___simple_quick_action_base["SimpleQuickActionDefinitionBase"];
|
|
16
16
|
const DIALOG_ENABLEMENT_VALIDATOR = ___dialog_enablement_validator["DIALOG_ENABLEMENT_VALIDATOR"];
|
|
17
|
-
const
|
|
17
|
+
const SimpleQuickActionDefinitionBase = ___simple_quick_action_base["SimpleQuickActionDefinitionBase"];
|
|
18
18
|
const ADD_CONTROLLER_TO_PAGE_TYPE = 'add-controller-to-page';
|
|
19
19
|
const CONTROL_TYPES = ['sap.f.DynamicPage', 'sap.uxap.ObjectPageLayout'];
|
|
20
20
|
|
|
@@ -8,13 +8,13 @@ import type {
|
|
|
8
8
|
QuickActionContext,
|
|
9
9
|
SimpleQuickActionDefinition
|
|
10
10
|
} from '../../../cpe/quick-actions/quick-action-definition';
|
|
11
|
+
import { getTextBundle } from '../../../i18n';
|
|
12
|
+
import { getExistingController } from '../../api-handler';
|
|
11
13
|
import { DialogFactory, DialogNames } from '../../dialog-factory';
|
|
12
14
|
import { isControllerExtensionEnabledForControl } from '../../init-dialogs';
|
|
13
|
-
import { getExistingController } from '../../api-handler';
|
|
14
|
-
import { SimpleQuickActionDefinitionBase } from '../simple-quick-action-base';
|
|
15
15
|
import { DIALOG_ENABLEMENT_VALIDATOR } from '../dialog-enablement-validator';
|
|
16
16
|
import type { EnablementValidatorResult } from '../enablement-validator';
|
|
17
|
-
import {
|
|
17
|
+
import { SimpleQuickActionDefinitionBase } from '../simple-quick-action-base';
|
|
18
18
|
|
|
19
19
|
export const ADD_CONTROLLER_TO_PAGE_TYPE = 'add-controller-to-page';
|
|
20
20
|
const CONTROL_TYPES = ['sap.f.DynamicPage', 'sap.uxap.ObjectPageLayout'];
|
|
@@ -33,7 +33,9 @@ export class AddControllerToPageQuickAction
|
|
|
33
33
|
run: async (): Promise<EnablementValidatorResult> => {
|
|
34
34
|
const controllerName = getControllerInfoForControl(this.context.view).controllerName;
|
|
35
35
|
const i18n = await getTextBundle();
|
|
36
|
-
if (
|
|
36
|
+
if (
|
|
37
|
+
checkForExistingChange(this.context.rta, 'codeExt', 'selector.controllerName', controllerName)
|
|
38
|
+
) {
|
|
37
39
|
return {
|
|
38
40
|
type: 'error',
|
|
39
41
|
message: i18n.getText('ADP_QUICK_ACTION_CONTROLLER_PENDING_CHANGE_EXISTS')
|