@sap-ux/preview-middleware 0.23.48 → 0.23.49
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/command-executor.js +99 -66
- package/dist/client/adp/controllers/AddCustomFragment.controller.js +120 -102
- package/dist/client/adp/controllers/AddFragment.controller.js +189 -163
- package/dist/client/adp/controllers/AddSubpage.controller.js +146 -137
- package/dist/client/adp/controllers/AddTableColumnFragments.controller.js +230 -188
- package/dist/client/adp/controllers/BaseDialog.controller.js +187 -164
- package/dist/client/adp/controllers/ControllerExtension.controller.js +329 -253
- package/dist/client/adp/controllers/ExtensionPoint.controller.js +158 -114
- package/dist/client/adp/extension-point.js +81 -60
- package/dist/client/adp/init.js +100 -99
- package/dist/client/adp/quick-actions/common/add-new-annotation-file.js +165 -147
- package/dist/client/adp/quick-actions/enablement-validator.js +0 -4
- package/dist/client/adp/quick-actions/fe-v2/create-table-custom-column.js +105 -100
- package/dist/client/adp/quick-actions/simple-quick-action-base.js +44 -40
- package/dist/client/adp/quick-actions/table-quick-action-base.js +309 -266
- package/dist/client/adp/sync-views-utils.js +119 -83
- package/dist/client/cpe/changes/flex-change.js +64 -48
- package/dist/client/cpe/changes/service.js +492 -367
- package/dist/client/cpe/communication-service.js +41 -29
- package/dist/client/cpe/connector-service.js +87 -64
- package/dist/client/cpe/context-menu-service.js +87 -74
- package/dist/client/cpe/control-data.js +353 -263
- package/dist/client/cpe/documentation.js +183 -126
- package/dist/client/cpe/init.js +69 -75
- package/dist/client/cpe/outline/service.js +60 -45
- package/dist/client/cpe/quick-actions/quick-action-definition.js +0 -4
- package/dist/client/cpe/quick-actions/quick-action-service.js +154 -129
- package/dist/client/cpe/rta-service.js +91 -69
- package/dist/client/cpe/selection.js +239 -187
- package/dist/client/cpe/types.js +0 -4
- package/dist/client/flp/init.js +403 -296
- package/dist/client/manifest.json +7 -4
- package/dist/client/thirdparty/@sap-ux-private/control-property-editor-common.js +444 -370
- package/dist/client/utils/info-center-message.js +59 -31
- package/dist/client/utils/version.js +128 -72
- package/package.json +2 -2
|
@@ -1,255 +1,331 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
sap.ui.define(["sap/ui/core/library", "sap/ui/model/json/JSONModel", "open/ux/preview/client/thirdparty/@sap-ux-private/control-property-editor-common", "../../i18n", "../../utils/core", "../../utils/error", "../../utils/info-center-message", "../../utils/version", "../api-handler", "../command-executor", "../utils", "./BaseDialog.controller"], function (sap_ui_core_library, JSONModel, ___sap_ux_private_control_property_editor_common, ____i18n, ____utils_core, ____utils_error, ____utils_info_center_message, ____utils_version, ___api_handler, __CommandExecutor, ___utils, __BaseDialog) {
|
|
4
|
+
"use strict";
|
|
5
|
+
|
|
6
|
+
function _interopRequireDefault(obj) {
|
|
7
|
+
return obj && obj.__esModule && typeof obj.default !== "undefined" ? obj.default : obj;
|
|
8
|
+
}
|
|
9
|
+
/** sap.m */
|
|
10
|
+
/** sap.ui.core */
|
|
11
|
+
const ValueState = sap_ui_core_library["ValueState"];
|
|
12
|
+
/** sap.ui.base */
|
|
13
|
+
const MessageBarType = ___sap_ux_private_control_property_editor_common["MessageBarType"];
|
|
14
|
+
const getResourceModel = ____i18n["getResourceModel"];
|
|
15
|
+
const getTextBundle = ____i18n["getTextBundle"];
|
|
16
|
+
const getControlById = ____utils_core["getControlById"];
|
|
17
|
+
const getError = ____utils_error["getError"];
|
|
18
|
+
const sendInfoCenterMessage = ____utils_info_center_message["sendInfoCenterMessage"];
|
|
19
|
+
const getUi5Version = ____utils_version["getUi5Version"];
|
|
20
|
+
const isLowerThanMinimalUi5Version = ____utils_version["isLowerThanMinimalUi5Version"];
|
|
21
|
+
const getExistingController = ___api_handler["getExistingController"];
|
|
22
|
+
const readControllers = ___api_handler["readControllers"];
|
|
23
|
+
const writeChange = ___api_handler["writeChange"];
|
|
24
|
+
const writeController = ___api_handler["writeController"];
|
|
25
|
+
const CommandExecutor = _interopRequireDefault(__CommandExecutor);
|
|
26
|
+
const checkForExistingChange = ___utils["checkForExistingChange"];
|
|
27
|
+
const getControllerInfo = ___utils["getControllerInfo"];
|
|
28
|
+
const BaseDialog = _interopRequireDefault(__BaseDialog);
|
|
29
|
+
/**
|
|
30
|
+
* @namespace open.ux.preview.client.adp.controllers
|
|
31
|
+
*/
|
|
32
|
+
const ControllerExtension = BaseDialog.extend("open.ux.preview.client.adp.controllers.ControllerExtension", {
|
|
33
|
+
constructor: function _constructor(name, overlays, rta, data, telemetryData) {
|
|
34
|
+
BaseDialog.prototype.constructor.call(this, name, telemetryData);
|
|
35
|
+
this.rta = rta;
|
|
36
|
+
this.overlays = overlays;
|
|
37
|
+
this.model = new JSONModel();
|
|
38
|
+
this.data = data;
|
|
39
|
+
},
|
|
40
|
+
/**
|
|
41
|
+
* Setups the Dialog and the JSON Model
|
|
42
|
+
*
|
|
43
|
+
* @param {Dialog} dialog - Dialog instance
|
|
44
|
+
*/
|
|
45
|
+
setup: async function _setup(dialog) {
|
|
46
|
+
this.dialog = dialog;
|
|
47
|
+
this.setEscapeHandler();
|
|
48
|
+
const resourceModel = await getResourceModel('open.ux.preview.client');
|
|
49
|
+
this.bundle = await getTextBundle();
|
|
50
|
+
await this.buildDialogData();
|
|
51
|
+
this.dialog.setModel(resourceModel, 'i18n');
|
|
52
|
+
this.dialog.setModel(this.model);
|
|
53
|
+
this.dialog.open();
|
|
54
|
+
},
|
|
55
|
+
/**
|
|
56
|
+
* Handles fragment name input change
|
|
57
|
+
*
|
|
58
|
+
* @param event Event
|
|
59
|
+
*/
|
|
60
|
+
onControllerNameInputChange: function _onControllerNameInputChange(event) {
|
|
61
|
+
const input = event.getSource();
|
|
62
|
+
const beginBtn = this.dialog.getBeginButton();
|
|
63
|
+
const controllerName = input.getValue();
|
|
64
|
+
const controllerList = this.model.getProperty('/controllersList');
|
|
65
|
+
const updateDialogState = function (valueState) {
|
|
66
|
+
let valueStateText = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
67
|
+
input.setValueState(valueState).setValueStateText(valueStateText);
|
|
68
|
+
beginBtn.setEnabled(valueState === ValueState.Success);
|
|
69
|
+
};
|
|
70
|
+
if (controllerName.length <= 0) {
|
|
71
|
+
updateDialogState(ValueState.None);
|
|
72
|
+
this.model.setProperty('/newControllerName', null);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
const fileExists = controllerList.some(f => f.controllerName === controllerName);
|
|
76
|
+
const pendingChangeExists = checkForExistingChange(this.rta, 'codeExt', 'content.codeRef', `${controllerName}.js`);
|
|
77
|
+
if (fileExists) {
|
|
78
|
+
updateDialogState(ValueState.Error, 'Enter a different name. The controller name that you entered already exists in your project.');
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
if (pendingChangeExists) {
|
|
82
|
+
updateDialogState(ValueState.Error, 'Enter a different name. The controller name that you entered already exists as a pending change.');
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const isValidName = /^[a-zA-Z_][a-zA-Z0-9_-]*$/.test(controllerName);
|
|
86
|
+
if (!isValidName) {
|
|
87
|
+
updateDialogState(ValueState.Error, 'The controller name cannot contain white spaces or special characters.');
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
if (controllerName.length > 64) {
|
|
91
|
+
updateDialogState(ValueState.Error, 'A controller file name cannot contain more than 64 characters.');
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
updateDialogState(ValueState.Success);
|
|
95
|
+
this.model.setProperty('/newControllerName', controllerName);
|
|
96
|
+
},
|
|
97
|
+
/**
|
|
98
|
+
* Handles create button press
|
|
99
|
+
*
|
|
100
|
+
* @param event Event
|
|
101
|
+
*/
|
|
102
|
+
onCreateBtnPress: async function _onCreateBtnPress(event) {
|
|
103
|
+
const source = event.getSource();
|
|
104
|
+
await BaseDialog.prototype.onCreateBtnPressHandler.call(this);
|
|
105
|
+
const controllerExists = this.model.getProperty('/controllerExists');
|
|
106
|
+
if (!controllerExists) {
|
|
107
|
+
source.setEnabled(false);
|
|
108
|
+
const controllerName = this.model.getProperty('/newControllerName');
|
|
109
|
+
const viewId = this.model.getProperty('/viewId');
|
|
110
|
+
const controllerRef = {
|
|
111
|
+
codeRef: `coding/${controllerName}.js`,
|
|
112
|
+
viewId
|
|
113
|
+
};
|
|
114
|
+
if (this.data) {
|
|
115
|
+
this.data.deferred.resolve(controllerRef);
|
|
116
|
+
} else {
|
|
117
|
+
await this.createNewController(controllerName, controllerRef);
|
|
118
|
+
}
|
|
119
|
+
if (this.data && (await this.isControllerExtensionSupported())) {
|
|
120
|
+
await sendInfoCenterMessage({
|
|
121
|
+
title: {
|
|
122
|
+
key: 'ADP_CREATE_CONTROLLER_EXTENSION_TITLE'
|
|
123
|
+
},
|
|
124
|
+
description: {
|
|
125
|
+
key: 'ADP_CREATE_CONTROLLER_EXTENSION',
|
|
126
|
+
params: [controllerName]
|
|
127
|
+
},
|
|
128
|
+
type: MessageBarType.info
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
} else {
|
|
132
|
+
const controllerPath = this.model.getProperty('/controllerPath');
|
|
133
|
+
window.open(`vscode://file${controllerPath}`);
|
|
134
|
+
}
|
|
135
|
+
this.handleDialogClose();
|
|
136
|
+
},
|
|
137
|
+
/**
|
|
138
|
+
* Builds data that is used in the dialog.
|
|
139
|
+
*/
|
|
140
|
+
buildDialogData: async function _buildDialogData() {
|
|
141
|
+
const selectorId = this.overlays.getId();
|
|
142
|
+
const overlayControl = sap.ui.getCore().byId(selectorId);
|
|
143
|
+
const {
|
|
144
|
+
controllerName,
|
|
145
|
+
viewId
|
|
146
|
+
} = getControllerInfo(overlayControl);
|
|
147
|
+
const data = await this.getExistingController(controllerName);
|
|
148
|
+
const hasPendingChangeForView = checkForExistingChange(this.rta, 'codeExt', 'selector.controllerName', controllerName);
|
|
149
|
+
if (data) {
|
|
150
|
+
if (hasPendingChangeForView) {
|
|
151
|
+
this.updateModelForExistingPendingChange();
|
|
152
|
+
} else if (data?.controllerExists) {
|
|
153
|
+
this.updateModelForExistingController(data);
|
|
154
|
+
} else {
|
|
155
|
+
this.updateModelForNewController(viewId, data.isTsSupported);
|
|
156
|
+
await this.getControllers();
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
/**
|
|
161
|
+
* Updates the model properties for an existing controller.
|
|
162
|
+
*
|
|
163
|
+
* @param {CodeExtResponse} data - Existing controller data from the server.
|
|
164
|
+
*/
|
|
165
|
+
updateModelForExistingController: function _updateModelForExistingController(data) {
|
|
166
|
+
const {
|
|
167
|
+
controllerExists,
|
|
168
|
+
controllerPath,
|
|
169
|
+
controllerPathFromRoot,
|
|
170
|
+
isRunningInBAS
|
|
171
|
+
} = data;
|
|
172
|
+
this.model.setProperty('/controllerExists', controllerExists);
|
|
173
|
+
this.model.setProperty('/controllerPath', controllerPath);
|
|
174
|
+
this.model.setProperty('/controllerPathFromRoot', controllerPathFromRoot);
|
|
175
|
+
this.model.setProperty('/inputFormVisibility', false);
|
|
176
|
+
this.model.setProperty('/pendingChangeFormVisibility', false);
|
|
177
|
+
this.model.setProperty('/existingControllerFormVisibility', true);
|
|
178
|
+
if (isRunningInBAS) {
|
|
179
|
+
this.dialog.getBeginButton().setVisible(false);
|
|
180
|
+
} else {
|
|
181
|
+
this.dialog.getBeginButton().setText('Open in VS Code').setEnabled(true);
|
|
182
|
+
}
|
|
183
|
+
this.dialog.getEndButton().setText('Close');
|
|
184
|
+
},
|
|
185
|
+
/**
|
|
186
|
+
* Updates the model properties for an existing controller in a pending change.
|
|
187
|
+
*/
|
|
188
|
+
updateModelForExistingPendingChange: function _updateModelForExistingPendingChange() {
|
|
189
|
+
this.model.setProperty('/inputFormVisibility', false);
|
|
190
|
+
this.model.setProperty('/existingControllerFormVisibility', false);
|
|
191
|
+
this.model.setProperty('/pendingChangeFormVisibility', true);
|
|
192
|
+
this.dialog.getBeginButton().setVisible(false);
|
|
193
|
+
this.dialog.getEndButton().setText('Close');
|
|
194
|
+
},
|
|
195
|
+
/**
|
|
196
|
+
* Updates the model property for a new controller.
|
|
197
|
+
*
|
|
198
|
+
* @param {string} viewId - The view ID.
|
|
199
|
+
* @param {boolean} isTsSupported - Whether TypeScript supported for the current project.
|
|
200
|
+
*/
|
|
201
|
+
updateModelForNewController: function _updateModelForNewController(viewId, isTsSupported) {
|
|
202
|
+
this.model.setProperty('/viewId', viewId);
|
|
203
|
+
this.model.setProperty('/controllerExtension', isTsSupported ? '.ts' : '.js');
|
|
204
|
+
this.model.setProperty('/existingControllerFormVisibility', false);
|
|
205
|
+
this.model.setProperty('/pendingChangeFormVisibility', false);
|
|
206
|
+
this.model.setProperty('/inputFormVisibility', true);
|
|
207
|
+
},
|
|
208
|
+
/**
|
|
209
|
+
* Retrieves existing controller data if found in the project's workspace.
|
|
210
|
+
*
|
|
211
|
+
* @param controllerName Controller name that exists in the view.
|
|
212
|
+
* @returns Returns existing controller data.
|
|
213
|
+
*/
|
|
214
|
+
getExistingController: async function _getExistingController(controllerName) {
|
|
215
|
+
let data;
|
|
216
|
+
try {
|
|
217
|
+
data = await getExistingController(controllerName);
|
|
218
|
+
} catch (e) {
|
|
219
|
+
const error = getError(e);
|
|
220
|
+
await sendInfoCenterMessage({
|
|
221
|
+
title: {
|
|
222
|
+
key: 'ADP_CONTROLLER_ERROR_TITLE'
|
|
223
|
+
},
|
|
224
|
+
description: error.message,
|
|
225
|
+
type: MessageBarType.error
|
|
226
|
+
});
|
|
227
|
+
throw error;
|
|
228
|
+
}
|
|
229
|
+
return data;
|
|
230
|
+
},
|
|
231
|
+
/**
|
|
232
|
+
* Retrieves controller files and fills the model with data
|
|
233
|
+
*/
|
|
234
|
+
getControllers: async function _getControllers() {
|
|
235
|
+
try {
|
|
236
|
+
const {
|
|
237
|
+
controllers
|
|
238
|
+
} = await readControllers();
|
|
239
|
+
this.model.setProperty('/controllersList', controllers);
|
|
240
|
+
} catch (e) {
|
|
241
|
+
const error = getError(e);
|
|
242
|
+
await sendInfoCenterMessage({
|
|
243
|
+
title: {
|
|
244
|
+
key: 'ADP_CONTROLLER_ERROR_TITLE'
|
|
245
|
+
},
|
|
246
|
+
description: error.message,
|
|
247
|
+
type: MessageBarType.error
|
|
248
|
+
});
|
|
249
|
+
throw error;
|
|
250
|
+
}
|
|
251
|
+
},
|
|
252
|
+
/**
|
|
253
|
+
* Creates a new fragment for the specified control
|
|
254
|
+
*
|
|
255
|
+
* @param controllerName Controller Name
|
|
256
|
+
* @param controllerRef Controller reference
|
|
257
|
+
*/
|
|
258
|
+
createNewController: async function _createNewController(controllerName, controllerRef) {
|
|
259
|
+
if (await this.isControllerExtensionSupported()) {
|
|
260
|
+
await this.createControllerCommand(controllerName, controllerRef);
|
|
261
|
+
return;
|
|
262
|
+
}
|
|
263
|
+
try {
|
|
264
|
+
await writeController({
|
|
265
|
+
controllerName
|
|
266
|
+
});
|
|
267
|
+
const service = await this.rta.getService('controllerExtension');
|
|
268
|
+
const change = await service.add(controllerRef.codeRef, controllerRef.viewId);
|
|
269
|
+
change.creation = new Date().toISOString();
|
|
270
|
+
await writeChange(change);
|
|
271
|
+
await sendInfoCenterMessage({
|
|
272
|
+
title: {
|
|
273
|
+
key: 'ADP_CREATE_CONTROLLER_EXTENSION_TITLE'
|
|
274
|
+
},
|
|
275
|
+
description: {
|
|
276
|
+
key: 'ADP_CREATE_CONTROLLER_EXTENSION_DESCRIPTION',
|
|
277
|
+
params: [controllerName]
|
|
278
|
+
},
|
|
279
|
+
type: MessageBarType.info
|
|
280
|
+
});
|
|
281
|
+
} catch (e) {
|
|
282
|
+
const error = getError(e);
|
|
283
|
+
await sendInfoCenterMessage({
|
|
284
|
+
title: {
|
|
285
|
+
key: 'ADP_CONTROLLER_ERROR_TITLE'
|
|
286
|
+
},
|
|
287
|
+
description: error.message,
|
|
288
|
+
type: MessageBarType.error
|
|
289
|
+
});
|
|
290
|
+
// We want to update the model incase we have already created a controller file but failed when creating a change file,
|
|
291
|
+
// 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
|
|
292
|
+
await this.getControllers();
|
|
293
|
+
throw error;
|
|
294
|
+
}
|
|
295
|
+
},
|
|
296
|
+
/**
|
|
297
|
+
* Creates a controller command and executes it.
|
|
298
|
+
*
|
|
299
|
+
* @param controllerName Controller name
|
|
300
|
+
* @param controllerRef Controller reference
|
|
301
|
+
*/
|
|
302
|
+
createControllerCommand: async function _createControllerCommand(controllerName, controllerRef) {
|
|
303
|
+
const flexSettings = this.rta.getFlexSettings();
|
|
304
|
+
const commandExecutor = new CommandExecutor(this.rta);
|
|
305
|
+
const view = getControlById(controllerRef.viewId);
|
|
306
|
+
const command = await commandExecutor.getCommand(view, 'codeExt', controllerRef, flexSettings);
|
|
307
|
+
await commandExecutor.pushAndExecuteCommand(command);
|
|
308
|
+
await sendInfoCenterMessage({
|
|
309
|
+
title: {
|
|
310
|
+
key: 'ADP_CREATE_CONTROLLER_EXTENSION_TITLE'
|
|
229
311
|
},
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
const view = getControlById(controllerRef.viewId);
|
|
234
|
-
const command = await commandExecutor.getCommand(view, 'codeExt', controllerRef, flexSettings);
|
|
235
|
-
await commandExecutor.pushAndExecuteCommand(command);
|
|
236
|
-
await sendInfoCenterMessage({
|
|
237
|
-
title: { key: 'ADP_CREATE_CONTROLLER_EXTENSION_TITLE' },
|
|
238
|
-
description: {
|
|
239
|
-
key: 'ADP_CREATE_CONTROLLER_EXTENSION',
|
|
240
|
-
params: [controllerName]
|
|
241
|
-
},
|
|
242
|
-
type: MessageBarType.info
|
|
243
|
-
});
|
|
312
|
+
description: {
|
|
313
|
+
key: 'ADP_CREATE_CONTROLLER_EXTENSION',
|
|
314
|
+
params: [controllerName]
|
|
244
315
|
},
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
316
|
+
type: MessageBarType.info
|
|
317
|
+
});
|
|
318
|
+
},
|
|
319
|
+
isControllerExtensionSupported: async function _isControllerExtensionSupported() {
|
|
320
|
+
const ui5Version = await getUi5Version();
|
|
321
|
+
return !isLowerThanMinimalUi5Version(ui5Version, ControllerExtension.CONTROLLER_EXT_MIN_UI5_VERSION);
|
|
322
|
+
}
|
|
323
|
+
});
|
|
324
|
+
/* The minimum version of UI5 framework which supports controller extensions. */
|
|
325
|
+
ControllerExtension.CONTROLLER_EXT_MIN_UI5_VERSION = {
|
|
326
|
+
major: 1,
|
|
327
|
+
minor: 135
|
|
328
|
+
};
|
|
329
|
+
return ControllerExtension;
|
|
330
|
+
});
|
|
331
|
+
//# sourceMappingURL=ControllerExtension.controller.js.map
|