openaire-library/dashboard/plugins/wrapper/plugin-wrapper.component.ts

62 lines
3.5 KiB
TypeScript

import {Component, Input, OnInit} from '@angular/core';
import {Plugin} from "../../../utils/entities/adminTool/plugin";
import {PluginTemplate} from "../../../utils/entities/adminTool/pluginTemplate";
import {PluginUtils} from "../utils/pluginUtils";
@Component({
selector: 'plugin-wrapper',
template: `
<ng-container *ngIf="pluginTemplate && pluginObject">
<div *ngIf="pluginTemplate.code && pluginUtils.availablePluginCodes.indexOf(pluginTemplate.code) != -1; else noplugin">
<ng-container *ngIf="pluginTemplate.code == 'openaire-products'">
<plugin-openaire-products [plugin]="plugin" [pluginTemplate]="pluginTemplate" [pluginObject]="pluginObject" ></plugin-openaire-products>
</ng-container>
<ng-container *ngIf="pluginTemplate.code == 'discover-by-subcommunity'">
<plugin-discover-by-subcommunity [plugin]="plugin" [pluginTemplate]="pluginTemplate" [pluginObject]="pluginObject" ></plugin-discover-by-subcommunity>
</ng-container>
<ng-container *ngIf="pluginTemplate.code == 'gateway-information'">
<plugin-gateway-information [plugin]="plugin" [pluginTemplate]="pluginTemplate" [pluginObject]="pluginObject" ></plugin-gateway-information>
</ng-container>
<ng-container *ngIf="pluginTemplate.code == 'search-deposit-link'">
<plugin-search-deposit-link [plugin]="plugin" [pluginTemplate]="pluginTemplate" [pluginObject]="pluginObject" ></plugin-search-deposit-link>
</ng-container>
<ng-container *ngIf="pluginTemplate.code == 'learn-and-connect'">
<plugin-learn-and-connect [plugin]="plugin" [pluginTemplate]="pluginTemplate" [pluginObject]="pluginObject" ></plugin-learn-and-connect>
</ng-container>
<ng-container *ngIf="pluginTemplate.code == 'how-to-use'">
<plugin-how-to-use [plugin]="plugin" [pluginTemplate]="pluginTemplate" [pluginObject]="pluginObject" ></plugin-how-to-use>
</ng-container>
<ng-container *ngIf="pluginTemplate.code == 'suggested-repositories'">
<plugin-suggested-repositories [plugin]="plugin" [pluginTemplate]="pluginTemplate" [pluginObject]="pluginObject" ></plugin-suggested-repositories>
</ng-container>
<ng-container *ngIf="pluginTemplate.code == 'featured-datasets'">
<plugin-featured-datasets [plugin]="plugin" [pluginTemplate]="pluginTemplate" [pluginObject]="pluginObject" ></plugin-featured-datasets>
</ng-container>
<ng-container *ngIf="pluginTemplate.code == 'organizations'">
<plugin-organizations [plugin]="plugin" [pluginTemplate]="pluginTemplate" [pluginObject]="pluginObject" ></plugin-organizations>
</ng-container>
<ng-container *ngIf="pluginTemplate.code == 'graph-info'">
<plugin-graph-info [plugin]="plugin" [pluginTemplate]="pluginTemplate" [pluginObject]="pluginObject" ></plugin-graph-info>
</ng-container>
<ng-container *ngIf="pluginTemplate.code == 'stats'">
<plugin-stats [plugin]="plugin" [pluginTemplate]="pluginTemplate" [pluginObject]="pluginObject" ></plugin-stats>
</ng-container>
</div>
<ng-template #noplugin>
<div class="uk-text-muted uk-text-center">
No plugin available
</div>
</ng-template>
</ng-container>
`
})
export class PluginWrapperComponent implements OnInit {
@Input() plugin:Plugin;
@Input() pluginObject;
@Input() pluginTemplate:PluginTemplate;
pluginUtils = new PluginUtils();
ngOnInit(): void {
}
}