@sap-ux/preview-middleware 0.16.117 → 0.16.118
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/flp/init.js
CHANGED
|
@@ -7,8 +7,10 @@ sap.ui.define([
|
|
|
7
7
|
'../adp/api-handler',
|
|
8
8
|
'../utils/error',
|
|
9
9
|
'./initConnectors',
|
|
10
|
-
'../utils/version'
|
|
11
|
-
|
|
10
|
+
'../utils/version',
|
|
11
|
+
'../cpe/communication-service',
|
|
12
|
+
'../i18n'
|
|
13
|
+
], function (Log, ___sap_ux_private_control_property_editor_common, IconPool, ResourceBundle, ___adp_api_handler, ___utils_error, __initConnectors, ___utils_version, ___cpe_communication_service, ___i18n) {
|
|
12
14
|
'use strict';
|
|
13
15
|
function _interopRequireDefault(obj) {
|
|
14
16
|
return obj && obj.__esModule && typeof obj.default !== 'undefined' ? obj.default : obj;
|
|
@@ -27,11 +29,14 @@ sap.ui.define([
|
|
|
27
29
|
});
|
|
28
30
|
}
|
|
29
31
|
const SCENARIO = ___sap_ux_private_control_property_editor_common['SCENARIO'];
|
|
32
|
+
const showMessage = ___sap_ux_private_control_property_editor_common['showMessage'];
|
|
30
33
|
const getManifestAppdescr = ___adp_api_handler['getManifestAppdescr'];
|
|
31
34
|
const getError = ___utils_error['getError'];
|
|
32
35
|
const initConnectors = _interopRequireDefault(__initConnectors);
|
|
33
36
|
const getUi5Version = ___utils_version['getUi5Version'];
|
|
34
37
|
const isLowerThanMinimalUi5Version = ___utils_version['isLowerThanMinimalUi5Version'];
|
|
38
|
+
const CommunicationService = ___cpe_communication_service['CommunicationService'];
|
|
39
|
+
const getTextBundle = ___i18n['getTextBundle'];
|
|
35
40
|
const UI5_LIBS = [
|
|
36
41
|
'sap.apf',
|
|
37
42
|
'sap.base',
|
|
@@ -202,7 +207,11 @@ sap.ui.define([
|
|
|
202
207
|
flexSettings
|
|
203
208
|
};
|
|
204
209
|
sap.ui.require(libs, async function (startAdaptation, pluginScript) {
|
|
205
|
-
|
|
210
|
+
try {
|
|
211
|
+
await startAdaptation(options, pluginScript);
|
|
212
|
+
} catch (error) {
|
|
213
|
+
await handleHigherLayerChanges(error, ui5VersionInfo);
|
|
214
|
+
}
|
|
206
215
|
});
|
|
207
216
|
});
|
|
208
217
|
});
|
|
@@ -234,6 +243,23 @@ sap.ui.define([
|
|
|
234
243
|
Log.error('Sandbox initialization failed: ' + error.message);
|
|
235
244
|
});
|
|
236
245
|
}
|
|
246
|
+
async function handleHigherLayerChanges(error, ui5VersionInfo) {
|
|
247
|
+
const err = getError(error);
|
|
248
|
+
if (err.message.includes('Reload triggered')) {
|
|
249
|
+
if (!isLowerThanMinimalUi5Version(ui5VersionInfo, {
|
|
250
|
+
major: 1,
|
|
251
|
+
minor: 84
|
|
252
|
+
})) {
|
|
253
|
+
const bundle = await getTextBundle();
|
|
254
|
+
const action = showMessage({
|
|
255
|
+
message: bundle.getText('HIGHER_LAYER_CHANGES_INFO_MESSAGE'),
|
|
256
|
+
shouldHideIframe: false
|
|
257
|
+
});
|
|
258
|
+
CommunicationService.sendAction(action);
|
|
259
|
+
}
|
|
260
|
+
window.location.reload();
|
|
261
|
+
}
|
|
262
|
+
}
|
|
237
263
|
var __exports = { __esModule: true };
|
|
238
264
|
__exports.resetAppState = resetAppState;
|
|
239
265
|
__exports.registerComponentDependencyPaths = registerComponentDependencyPaths;
|
|
@@ -241,5 +267,6 @@ sap.ui.define([
|
|
|
241
267
|
__exports.loadI18nResourceBundle = loadI18nResourceBundle;
|
|
242
268
|
__exports.setI18nTitle = setI18nTitle;
|
|
243
269
|
__exports.init = init;
|
|
270
|
+
__exports.handleHigherLayerChanges = handleHigherLayerChanges;
|
|
244
271
|
return __exports;
|
|
245
272
|
});
|
package/dist/client/flp/init.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Log from 'sap/base/Log';
|
|
2
2
|
import type AppLifeCycle from 'sap/ushell/services/AppLifeCycle';
|
|
3
3
|
import type { InitRtaScript, RTAPlugin, StartAdaptation } from 'sap/ui/rta/api/startAdaptation';
|
|
4
|
-
import { SCENARIO, type Scenario } from '@sap-ux-private/control-property-editor-common';
|
|
4
|
+
import { SCENARIO, showMessage, type Scenario } from '@sap-ux-private/control-property-editor-common';
|
|
5
5
|
import type { FlexSettings, RTAOptions } from 'sap/ui/rta/RuntimeAuthoring';
|
|
6
6
|
import IconPool from 'sap/ui/core/IconPool';
|
|
7
7
|
import ResourceBundle from 'sap/base/i18n/ResourceBundle';
|
|
@@ -9,7 +9,9 @@ import AppState from 'sap/ushell/services/AppState';
|
|
|
9
9
|
import { getManifestAppdescr } from '../adp/api-handler';
|
|
10
10
|
import { getError } from '../utils/error';
|
|
11
11
|
import initConnectors from './initConnectors';
|
|
12
|
-
import { getUi5Version, isLowerThanMinimalUi5Version } from '../utils/version';
|
|
12
|
+
import { getUi5Version, isLowerThanMinimalUi5Version, Ui5VersionInfo } from '../utils/version';
|
|
13
|
+
import { CommunicationService } from '../cpe/communication-service';
|
|
14
|
+
import { getTextBundle } from '../i18n';
|
|
13
15
|
|
|
14
16
|
/**
|
|
15
17
|
* SAPUI5 delivered namespaces from https://ui5.sap.com/#/api/sap
|
|
@@ -304,7 +306,11 @@ export async function init({
|
|
|
304
306
|
libs,
|
|
305
307
|
// eslint-disable-next-line no-shadow
|
|
306
308
|
async function (startAdaptation: StartAdaptation | InitRtaScript, pluginScript: RTAPlugin) {
|
|
307
|
-
|
|
309
|
+
try {
|
|
310
|
+
await startAdaptation(options, pluginScript);
|
|
311
|
+
} catch (error) {
|
|
312
|
+
await handleHigherLayerChanges(error, ui5VersionInfo);
|
|
313
|
+
}
|
|
308
314
|
}
|
|
309
315
|
);
|
|
310
316
|
});
|
|
@@ -318,7 +324,7 @@ export async function init({
|
|
|
318
324
|
|
|
319
325
|
// Load custom library paths if configured
|
|
320
326
|
if (appUrls) {
|
|
321
|
-
await registerComponentDependencyPaths(JSON.parse(appUrls) as string[] ?? [], urlParams);
|
|
327
|
+
await registerComponentDependencyPaths((JSON.parse(appUrls) as string[]) ?? [], urlParams);
|
|
322
328
|
}
|
|
323
329
|
|
|
324
330
|
// Load rta connector
|
|
@@ -351,3 +357,28 @@ if (bootstrapConfig) {
|
|
|
351
357
|
Log.error('Sandbox initialization failed: ' + error.message);
|
|
352
358
|
});
|
|
353
359
|
}
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* Handle higher layer changes when starting UI Adaptation.
|
|
363
|
+
* When RTA detects higher layer changes an error with Reload triggered text is thrown, the RTA instance is destroyed and the application is reloaded.
|
|
364
|
+
* For UI5 version lower than 1.84.0 RTA is showing a popup with notification text about the detection of higher layer changes.
|
|
365
|
+
*
|
|
366
|
+
* @param error the error thrown when there are higher layer changes when starting UI Adaptation.
|
|
367
|
+
* @param ui5VersionInfo ui5 version info
|
|
368
|
+
*/
|
|
369
|
+
export async function handleHigherLayerChanges(error: unknown, ui5VersionInfo: Ui5VersionInfo): Promise<void> {
|
|
370
|
+
const err = getError(error);
|
|
371
|
+
if (err.message.includes('Reload triggered')) {
|
|
372
|
+
if (!isLowerThanMinimalUi5Version(ui5VersionInfo, { major: 1, minor: 84 })) {
|
|
373
|
+
const bundle = await getTextBundle();
|
|
374
|
+
const action = showMessage({
|
|
375
|
+
message: bundle.getText('HIGHER_LAYER_CHANGES_INFO_MESSAGE'),
|
|
376
|
+
shouldHideIframe: false
|
|
377
|
+
});
|
|
378
|
+
CommunicationService.sendAction(action);
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
// eslint-disable-next-line fiori-custom/sap-no-location-reload
|
|
382
|
+
window.location.reload();
|
|
383
|
+
}
|
|
384
|
+
}
|
|
@@ -37,3 +37,5 @@ ADP_REUSE_COMPONENTS_MESSAGE = Reuse components are detected for some views in t
|
|
|
37
37
|
CPE_CHANGES_VISIBLE_AFTER_SAVE_AND_RELOAD_MESSAGE = Note: The change will be visible after save and reload.
|
|
38
38
|
|
|
39
39
|
TABLE_ROWS_NEEDED_TO_CREATE_CUSTOM_COLUMN=At least one table row is required to create new custom column. Make sure the table data is loaded and try again.
|
|
40
|
+
|
|
41
|
+
HIGHER_LAYER_CHANGES_INFO_MESSAGE=The preview of the project was reloaded due to detected changes in higher layer than the one used in your project.
|
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.16.
|
|
12
|
+
"version": "0.16.118",
|
|
13
13
|
"license": "Apache-2.0",
|
|
14
14
|
"author": "@SAP/ux-tools-team",
|
|
15
15
|
"main": "dist/index.js",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"supertest": "6.3.3",
|
|
47
47
|
"@sap-ux-private/playwright": "0.1.0",
|
|
48
48
|
"dotenv": "16.3.1",
|
|
49
|
-
"@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.11.
|
|
49
|
+
"@private/preview-middleware-client": "npm:@sap-ux-private/preview-middleware-client@0.11.31",
|
|
50
50
|
"@sap-ux/axios-extension": "1.17.2",
|
|
51
51
|
"@sap-ux/store": "0.9.3",
|
|
52
52
|
"@sap-ux/ui5-info": "0.8.3",
|