@sap-ux/preview-middleware 0.13.4 → 0.13.6

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.
@@ -28,6 +28,7 @@ export interface CodeExtResponse {
28
28
  controllerExists: boolean;
29
29
  controllerPath: string;
30
30
  controllerPathFromRoot: string;
31
+ isRunningInBAS: boolean;
31
32
  }
32
33
 
33
34
  export interface ControllersResponse {
@@ -88,10 +88,11 @@ sap.ui.define(["sap/m/MessageToast", "sap/ui/core/library", "sap/ui/model/json/J
88
88
  const {
89
89
  controllerExists,
90
90
  controllerPath,
91
- controllerPathFromRoot
91
+ controllerPathFromRoot,
92
+ isRunningInBAS
92
93
  } = await this.getExistingController(controllerName);
93
94
  if (controllerExists) {
94
- this.updateModelForExistingController(controllerExists, controllerPath, controllerPathFromRoot);
95
+ this.updateModelForExistingController(controllerExists, controllerPath, controllerPathFromRoot, isRunningInBAS);
95
96
  } else {
96
97
  this.updateModelForNewController(viewId);
97
98
  await this.getControllers();
@@ -107,7 +108,7 @@ sap.ui.define(["sap/m/MessageToast", "sap/ui/core/library", "sap/ui/model/json/J
107
108
  viewId
108
109
  };
109
110
  },
110
- updateModelForExistingController: function _updateModelForExistingController(controllerExists, controllerPath, controllerPathFromRoot) {
111
+ updateModelForExistingController: function _updateModelForExistingController(controllerExists, controllerPath, controllerPathFromRoot, isRunningInBAS) {
111
112
  this.model.setProperty('/controllerExists', controllerExists);
112
113
  this.model.setProperty('/controllerPath', controllerPath);
113
114
  this.model.setProperty('/controllerPathFromRoot', controllerPathFromRoot);
@@ -116,7 +117,11 @@ sap.ui.define(["sap/m/MessageToast", "sap/ui/core/library", "sap/ui/model/json/J
116
117
  form.setVisible(false);
117
118
  const messageForm = content[1];
118
119
  messageForm.setVisible(true);
119
- this.dialog.getBeginButton().setText('Open in VS Code').setEnabled(true);
120
+ if (isRunningInBAS) {
121
+ this.dialog.getBeginButton().setVisible(false);
122
+ } else {
123
+ this.dialog.getBeginButton().setText('Open in VS Code').setEnabled(true);
124
+ }
120
125
  this.dialog.getEndButton().setText('Close');
121
126
  },
122
127
  updateModelForNewController: function _updateModelForNewController(viewId) {
@@ -158,12 +158,16 @@ export default class ControllerExtension extends BaseDialog {
158
158
 
159
159
  const { controllerName, viewId } = this.getControllerInfo(overlayControl);
160
160
 
161
- const { controllerExists, controllerPath, controllerPathFromRoot } = await this.getExistingController(
162
- controllerName
163
- );
161
+ const { controllerExists, controllerPath, controllerPathFromRoot, isRunningInBAS } =
162
+ await this.getExistingController(controllerName);
164
163
 
165
164
  if (controllerExists) {
166
- this.updateModelForExistingController(controllerExists, controllerPath, controllerPathFromRoot);
165
+ this.updateModelForExistingController(
166
+ controllerExists,
167
+ controllerPath,
168
+ controllerPathFromRoot,
169
+ isRunningInBAS
170
+ );
167
171
  } else {
168
172
  this.updateModelForNewController(viewId);
169
173
 
@@ -188,14 +192,16 @@ export default class ControllerExtension extends BaseDialog {
188
192
  /**
189
193
  * Updates the model properties for an existing controller.
190
194
  *
191
- * @param controllerExists Whether the controller exists
192
- * @param controllerPath The controller path
193
- * @param controllerPathFromRoot The controller path from the project root
195
+ * @param {boolean} controllerExists - Whether the controller exists.
196
+ * @param {string} controllerPath - The controller path.
197
+ * @param {string} controllerPathFromRoot - The controller path from the project root.
198
+ * @param {boolean} isRunningInBAS - Whether the environment is BAS or VS Code.
194
199
  */
195
200
  private updateModelForExistingController(
196
201
  controllerExists: boolean,
197
202
  controllerPath: string,
198
- controllerPathFromRoot: string
203
+ controllerPathFromRoot: string,
204
+ isRunningInBAS: boolean
199
205
  ): void {
200
206
  this.model.setProperty('/controllerExists', controllerExists);
201
207
  this.model.setProperty('/controllerPath', controllerPath);
@@ -209,7 +215,11 @@ export default class ControllerExtension extends BaseDialog {
209
215
  const messageForm = content[1] as SimpleForm;
210
216
  messageForm.setVisible(true);
211
217
 
212
- this.dialog.getBeginButton().setText('Open in VS Code').setEnabled(true);
218
+ if (isRunningInBAS) {
219
+ this.dialog.getBeginButton().setVisible(false);
220
+ } else {
221
+ this.dialog.getBeginButton().setText('Open in VS Code').setEnabled(true);
222
+ }
213
223
  this.dialog.getEndButton().setText('Close');
214
224
  }
215
225
 
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.13.4",
12
+ "version": "0.13.6",
13
13
  "license": "Apache-2.0",
14
14
  "author": "@SAP/ux-tools-team",
15
15
  "main": "dist/index.js",
@@ -24,9 +24,9 @@
24
24
  "dependencies": {
25
25
  "ejs": "3.1.9",
26
26
  "@sap-ux/logger": "0.5.1",
27
- "@sap-ux/adp-tooling": "0.9.7",
27
+ "@sap-ux/adp-tooling": "0.9.9",
28
28
  "@sap-ux/control-property-editor-sources": "npm:@sap-ux/control-property-editor@0.4.17",
29
- "@sap-ux/project-access": "1.19.5"
29
+ "@sap-ux/project-access": "1.19.6"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@types/ejs": "3.1.2",
@@ -40,7 +40,7 @@
40
40
  "supertest": "6.3.3",
41
41
  "@sap-ux-private/playwright": "0.0.3",
42
42
  "dotenv": "16.3.1",
43
- "@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.9.3",
43
+ "@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.9.4",
44
44
  "@sap-ux/axios-extension": "1.11.4",
45
45
  "@sap-ux/store": "0.5.0",
46
46
  "@sap-ux/i18n": "0.0.5"