cluedin-widget
Version:
This project contains all the pages needed for browsing entities and searching them. The aim is to replace the CluedIn.Webapp project with this one when all the pages ( including the Admin page ) will be ported to REACT.
58 lines (52 loc) • 1.54 kB
JavaScript
var iso = require('../iso');
var layoutsConfig = __cluedIn.layouts;
var entitiesConfig = __cluedIn.widgetConfiguration;
const defaultEntityConfig = {
entityType: 'default',
isDefault: true,
includeSuggestedSearches: true,
placeSuggestedSearches: 'main',
layout: {
name: 'Standard'
},
widgets: [
{name: 'EntityHeader', place: 'header'},
{name: 'EntityProperty', place: 'main'/*, size: '8'*/},
{name: 'EntitySourceAndProfile', place: 'main'}
]
};
const defaultLayoutConfig = {
code: 'Default',
isDefault: true,
layout: {
children: [
{
type: 'grid',
size: 4,
name: 'main'
}
]
}
};
module.exports = {
getAllWidgetConfiguration: () => {
return entitiesConfig;
},
getWidgetConfiguration: (entityType, org) => {
let widgetConfigForOrg = iso.collection.find(entitiesConfig, (entityConfig)=> {
return (entityConfig.entityType.toLowerCase() === entityType.toLowerCase() && entityConfig.owner === org);
});
if (!widgetConfigForOrg) {
widgetConfigForOrg = iso.collection.find(entitiesConfig, (entityConfig)=> {
return entityConfig.entityType.toLowerCase() === entityType.toLowerCase();
});
}
return (widgetConfigForOrg) ? widgetConfigForOrg : defaultEntityConfig;
},
getLayout: (layoutCode) => {
let layoutConfig = iso.collection.find(layoutsConfig, (layoutConfig) => {
return layoutConfig.code === layoutCode;
});
return (layoutConfig) ? layoutConfig : defaultLayoutConfig;
}
};