2024-02-02 08:33:01 +01:00
|
|
|
import {Option} from "../../../sharedComponents/input/input.component";
|
2024-02-22 10:09:20 +01:00
|
|
|
import {PluginOpenAIREProducts} from "../components/openaireProducts/plugin-openaire-products.component";
|
|
|
|
import {PluginDiscoverBySubcommunity} from "../components/discover-by-subcommunity/plugin-discover-by-subcommunity.component";
|
2024-03-01 09:32:38 +01:00
|
|
|
import {PluginBaseInfo} from "./base-plugin.component";
|
2024-02-22 10:09:20 +01:00
|
|
|
import {PluginGatewayInformation} from "../components/gateway-information/plugin-gateway-information.component";
|
|
|
|
import {PluginLearnAndConnect} from "../components/learn-and-connect/plugin-learn-and-connect.component";
|
|
|
|
import {PluginFeaturedDatasets} from "../components/featured-datasets/plugin-featured-datasets.component";
|
|
|
|
import {PluginHowToUse} from "../components/how-to-use/plugin-how-to-use.component";
|
2024-02-22 11:15:21 +01:00
|
|
|
import {PluginSearchDepositLink} from "../components/search-deposit-link/plugin-search-deposit-link.component";
|
2024-02-28 12:07:31 +01:00
|
|
|
import {PluginOrganizations} from "../components/organizations/plugin-organizations.component";
|
2024-02-02 08:33:01 +01:00
|
|
|
|
|
|
|
export class PluginUtils{
|
|
|
|
public attrTypeOptions: Option[] = [
|
|
|
|
{label:"Text", value:"text"},
|
|
|
|
{label:"HTML", value:"HTML"},
|
|
|
|
{label:"Boolean", value:"boolean"},
|
|
|
|
{label:"URL", value:"URL"},
|
|
|
|
];
|
|
|
|
|
|
|
|
public availablePluginCodes: Option[] = [
|
2024-03-01 09:32:38 +01:00
|
|
|
{label:"OpenAIRE products", value:"openaire-products"},
|
2024-02-28 12:07:31 +01:00
|
|
|
{label:"Discover by subcommunity", value:"discover-by-subcommunity"},
|
|
|
|
{label:"Gateway information", value:"gateway-information"},
|
|
|
|
{label:"Search/ deposit/ link", value:"search-deposit-link"},
|
|
|
|
{label:"Learn and Connect", value:"learn-and-connect"},
|
|
|
|
{label:"How to use", value:"how-to-use"},
|
|
|
|
{label:"Suggested Repositories", value:"suggested-repositories"},
|
|
|
|
{label:"Featured Datasets", value:"featured-datasets"},
|
|
|
|
{label:"Organizations", value:"organizations"},
|
|
|
|
{label:"Fos / SDGs", value:"fos-sdgs"},
|
|
|
|
{label:"Graph info", value:"graph-info"},
|
|
|
|
{label:"Social", value:"social"},
|
|
|
|
{label:"Contact us", value:"organizations"},
|
2024-02-02 08:33:01 +01:00
|
|
|
|
|
|
|
|
|
|
|
];
|
|
|
|
public placementsOptions: Option[] = [
|
2024-02-28 12:07:31 +01:00
|
|
|
{label:"Right", value:"right"},
|
2024-02-02 08:33:01 +01:00
|
|
|
{label:"Top", value:"top"},
|
|
|
|
// {label:"Top Right", value:"top-right"},
|
|
|
|
// {label:"Center", value:"center"},
|
2024-02-28 12:07:31 +01:00
|
|
|
{label:"Bottom", value:"bottom"},
|
2024-02-02 08:33:01 +01:00
|
|
|
{label:"Left", value:"left"},
|
|
|
|
];
|
|
|
|
public planOptions: Option[] = [
|
|
|
|
{value: 'starter', label: 'Starter'},
|
|
|
|
{value: 'extended', label: 'Extended'}
|
|
|
|
];
|
2024-02-22 10:09:20 +01:00
|
|
|
|
2024-02-28 12:07:31 +01:00
|
|
|
|
|
|
|
public static initializeObjectAndCompare(code, oldObject = null){
|
2024-02-22 10:09:20 +01:00
|
|
|
switch(code) {
|
|
|
|
case 'openaire-products': {
|
2024-02-28 12:07:31 +01:00
|
|
|
return (new PluginOpenAIREProducts()).compare(oldObject);
|
2024-02-22 10:09:20 +01:00
|
|
|
}
|
|
|
|
case 'discover-by-subcommunity': {
|
2024-02-28 12:07:31 +01:00
|
|
|
return (new PluginDiscoverBySubcommunity()).compare(oldObject);
|
2024-02-22 10:09:20 +01:00
|
|
|
}
|
|
|
|
case 'gateway-information': {
|
2024-02-28 12:07:31 +01:00
|
|
|
return (new PluginGatewayInformation()).compare(oldObject);
|
2024-02-22 10:09:20 +01:00
|
|
|
}
|
|
|
|
case 'search-deposit-link': {
|
2024-02-28 12:07:31 +01:00
|
|
|
return (new PluginSearchDepositLink()).compare(oldObject);
|
2024-02-22 10:09:20 +01:00
|
|
|
}
|
|
|
|
case 'learn-and-connect': {
|
2024-02-28 12:07:31 +01:00
|
|
|
return (new PluginLearnAndConnect()).compare(oldObject);
|
2024-02-22 10:09:20 +01:00
|
|
|
}
|
|
|
|
case 'how-to-use': {
|
2024-02-28 12:07:31 +01:00
|
|
|
return (new PluginHowToUse()).compare(oldObject);
|
2024-02-22 10:09:20 +01:00
|
|
|
}
|
|
|
|
case 'suggested-repositories': {
|
2024-02-28 12:07:31 +01:00
|
|
|
return (new PluginBaseInfo()).compare(oldObject);
|
2024-02-22 10:09:20 +01:00
|
|
|
}
|
|
|
|
case 'featured-datasets': {
|
2024-02-28 12:07:31 +01:00
|
|
|
return (new PluginFeaturedDatasets()).compare(oldObject);
|
|
|
|
}
|
|
|
|
case 'organizations': {
|
|
|
|
return (new PluginOrganizations()).compare(oldObject);
|
2024-02-22 10:09:20 +01:00
|
|
|
}
|
|
|
|
default: {
|
2024-02-28 12:07:31 +01:00
|
|
|
return (new PluginBaseInfo()).compare(oldObject);
|
2024-02-22 10:09:20 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-02-28 12:07:31 +01:00
|
|
|
//
|
2024-02-22 10:09:20 +01:00
|
|
|
public static updateExistingObject(oldObject, object ){
|
|
|
|
if(!oldObject) {
|
|
|
|
oldObject = Object.assign(object)
|
|
|
|
}else{
|
|
|
|
for (let attrKey of Object.keys(object)) {
|
|
|
|
if (!oldObject[attrKey] && oldObject[attrKey] != false) {
|
|
|
|
oldObject[attrKey] = Object.assign(object[attrKey])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return oldObject;
|
|
|
|
}
|
2024-02-02 08:33:01 +01:00
|
|
|
}
|