When Mesh initially creates the mesh-ui2-config.js, it uses a very outdated format which does not work with the UI:
/**
* Within the node editor in UI the feature "Preview" of a node will open a new tab to a defined frontend app.
* Here a function can be provided returning the URL which will be called by that component.
*
* @example:
* ```javascript
* previewUrls: [
* {
* label: 'Gentics Mesh Angular Demo',
* urlResolver: function (node) { return 'http://test.myapp/category/' + node.uuid + '?preview=true'; }
* }
* ]
* ```
*/
previewUrls: [
{
/** display name to see within preview url selection in frontend */
label: 'Gentics Mesh Angular Demo',
/**
* Function to be called in frontend to get url
* @param nodeUuid unique Mesh node
*/
// adopt to angular demo
urlResolver: function (node) {
// custom route mapping
var segmentParent;
switch (node.schema.name) {
case 'category':
segmentParent = 'category';
break;
case 'vehicle':
segmentParent = 'product';
break;
default:
throw new Error('No existing app route preview mapping configured for node of schema: ' + node.schema.name);
}
// return app preview URL
return '/demo/' + segmentParent + '/' + node.uuid + '?preview=true';
}
}
]
When Mesh initially creates the
mesh-ui2-config.js
, it uses a very outdated format which does not work with the UI:However, the correct format would be like this: