[plugins-functionality | DONE | FIXED ] plugins minor fixes

This commit is contained in:
argirok 2024-05-23 12:55:45 +03:00
parent 8ee93a7239
commit ec980e1b87
9 changed files with 37 additions and 32 deletions

View File

@ -88,19 +88,22 @@ export class PluginSearchBarComponent extends PluginBaseComponent<PluginSearchBa
this.subscriptions.push(this.communityService.getCommunityAsObservable().subscribe( this.subscriptions.push(this.communityService.getCommunityAsObservable().subscribe(
community => { community => {
this.community = community; this.community = community;
this.subscriptions.push(this.communityService.getCommunityAsObservable().subscribe( if(community) {
community => { this.subscriptions.push(this.communityService.getCommunityAsObservable().subscribe(
this.getLayout(community.communityId); community => {
this.getLayout(community.communityId);
})); }));
}
} }
)); ));
} }
ngOnInit() { ngOnInit() {
this.subscriptions.push(this.communityService.getCommunityAsObservable().subscribe( this.subscriptions.push(this.communityService.getCommunityAsObservable().subscribe(
community => { community => {
this.getLayout(community.communityId); if(community) {
this.getLayout(community.communityId);
}
})); }));
} }

View File

@ -41,8 +41,9 @@ export class PluginSearchDepositLinkComponent extends PluginBaseComponent<Plugin
ngOnInit() { ngOnInit() {
this.subscriptions.push(this.communityService.getCommunityAsObservable().subscribe( this.subscriptions.push(this.communityService.getCommunityAsObservable().subscribe(
community => { community => {
this.getLayout(community.communityId); if(community) {
this.getLayout(community.communityId);
}
})); }));
} }

View File

@ -86,7 +86,7 @@
</div> </div>
</aside> </aside>
<div page-content class="uk-width-1-1"> <div page-content [fullWidth]="true" >
<div inner> <div inner>
<div> <!--class="uk-section uk-section-small uk-position-relative" style="min-height: 60vh">--> <div> <!--class="uk-section uk-section-small uk-position-relative" style="min-height: 60vh">-->

View File

@ -36,7 +36,6 @@
</div> </div>
</div> </div>
<div inner> <div inner>
<div>
<div *ngIf="showLoading" class="uk-position-center"> <div *ngIf="showLoading" class="uk-position-center">
<loading></loading> <loading></loading>
</div> </div>
@ -74,11 +73,12 @@
<ng-container *ngIf="selectedPlacementView == placement.value || selectedPlacementView == 'all'"> <ng-container *ngIf="selectedPlacementView == placement.value || selectedPlacementView == 'all'">
<div *ngIf="pluginsByPlacement.get(placement.value).length >0 && page && !sinlgePlacementAvailable" <div *ngIf="pluginsByPlacement.get(placement.value).length >0 && page && !sinlgePlacementAvailable"
class="uk-heading-divider uk-h6 uk-margin-left uk-padding-remove-left uk-text-capitalize ">{{placement.value}}</div> class="uk-heading-divider uk-h6 uk-margin-left uk-padding-remove-left uk-text-capitalize ">{{placement.value}}</div>
<div class="uk-animation-toggle">
<ng-container *ngFor="let pluginGroup of pluginsByPlacement.get(placement.value) ; let i=index"> <ng-container *ngFor="let pluginGroup of pluginsByPlacement.get(placement.value) ; let i=index">
<ng-container *ngIf="(pluginGroup.template.portalSpecific.length == 0 || pluginGroup.template.portalSpecific.indexOf(communityInfo.communityId) != -1 ) && <ng-container *ngIf="(pluginGroup.template.portalSpecific.length == 0 || pluginGroup.template.portalSpecific.indexOf(communityInfo.communityId) != -1 ) &&
(pluginGroup.template.plan == 'Standard' || pluginGroup.template.plan == 'Default' || pluginGroup.template.plan == communityInfo.plan ) (pluginGroup.template.plan == 'Standard' || pluginGroup.template.plan == 'Default' || pluginGroup.template.plan == communityInfo.plan )
&& ( !filterActive || (filterActive && pluginGroup.plugin.active))"> && ( !filterActive || (filterActive && pluginGroup.plugin.active))">
<div class="uk-card uk-card-default uk-margin-bottom"> <div class="uk-card uk-card-default uk-margin-bottom uk-animation-fade" >
<div class="uk-card-body uk-flex"> <div class="uk-card-body uk-flex">
<div class="uk-width-expand uk-text-small"> <div class="uk-width-expand uk-text-small">
<ng-container *ngIf="pluginGroup.template && !templateView"> <ng-container *ngIf="pluginGroup.template && !templateView">
@ -157,7 +157,7 @@
<div *ngIf="i >0"> <div *ngIf="i >0">
<div class="uk-padding-small uk-padding-remove-horizontal"> <div class="uk-padding-small uk-padding-remove-horizontal">
<button <button
class="uk-button uk-button-link uk-flex uk-flex-middle" class="uk-button uk-button-link uk-flex uk-flex-middle" [class.uk-disabled]="filterActive" [title]="filterActive?'Move is disabled when plugins are filtered':''"
(click)="swap(i, i-1, placement.value)"> (click)="swap(i, i-1, placement.value)">
<icon name="arrow_upward" [flex]="true"></icon> <icon name="arrow_upward" [flex]="true"></icon>
<span class="uk-margin-xsmall-left"> Up</span> <span class="uk-margin-xsmall-left"> Up</span>
@ -167,7 +167,7 @@
<div *ngIf="i < pluginsByPlacement.get(placement.value).length -1 "> <div *ngIf="i < pluginsByPlacement.get(placement.value).length -1 ">
<div class="uk-padding-small uk-padding-remove-horizontal"> <div class="uk-padding-small uk-padding-remove-horizontal">
<button <button
class="uk-button uk-button-link uk-flex uk-flex-middle" class="uk-button uk-button-link uk-flex uk-flex-middle" [class.uk-disabled]="filterActive" [title]="filterActive?'Move is disabled when plugins are filtered':''"
(click)="swap(i+1, i, placement.value)"> (click)="swap(i+1, i, placement.value)">
<icon name="arrow_downward" [flex]="true"></icon> <icon name="arrow_downward" [flex]="true"></icon>
<span class="uk-margin-xsmall-left">Down</span> <span class="uk-margin-xsmall-left">Down</span>
@ -189,13 +189,13 @@
</div> </div>
</ng-container> </ng-container>
</ng-container> </ng-container>
</div>
</ng-container> </ng-container>
</ng-container> </ng-container>
</ng-container> </ng-container>
</div> </div>
</div> </div>
</div>
<!--</div>--> <!--</div>-->
<modal-alert #deleteModal [overflowBody]="false" (alertOutput)="confirmDelete()" <modal-alert #deleteModal [overflowBody]="false" (alertOutput)="confirmDelete()"
classTitle="uk-background-primary uk-light"></modal-alert> classTitle="uk-background-primary uk-light"></modal-alert>

View File

@ -467,7 +467,7 @@ export class PluginsComponent implements OnInit {
this.pluginsByPlacement.get(placement)[index].plugin = saved; this.pluginsByPlacement.get(placement)[index].plugin = saved;
this.clearCache(); this.clearCache();
}, },
error => this.handleUpdateError("System error creating template", error) error => this.handleUpdateError("System error saving plugin", error)
)); ));
} else { } else {

View File

@ -26,6 +26,7 @@ import {MatSlideToggleModule} from "@angular/material/slide-toggle";
import {PluginWrapperModule} from "./wrapper/plugin-wrapper.module"; import {PluginWrapperModule} from "./wrapper/plugin-wrapper.module";
import {SideBarModule} from "../sharedComponents/sidebar/sideBar.module"; import {SideBarModule} from "../sharedComponents/sidebar/sideBar.module";
import {PluginEditWrapperModule} from "./wrapper/plugin-edit-wrapper.module"; import {PluginEditWrapperModule} from "./wrapper/plugin-edit-wrapper.module";
import {TransitionGroupModule} from "../../utils/transition-group/transition-group.module";
@NgModule({ @NgModule({
@ -33,7 +34,7 @@ import {PluginEditWrapperModule} from "./wrapper/plugin-edit-wrapper.module";
CommonModule, RouterModule, FormsModule, CommonModule, RouterModule, FormsModule,
AlertModalModule, ReactiveFormsModule, AdminToolServiceModule, InputModule, MatAutocompleteModule, MatFormFieldModule, MatChipsModule, AlertModalModule, ReactiveFormsModule, AdminToolServiceModule, InputModule, MatAutocompleteModule, MatFormFieldModule, MatChipsModule,
MatCheckboxModule, AdminTabsModule, PageContentModule, PluginsRoutingModule, SearchInputModule, IconsModule, LoadingModule, CKEditorModule, MatCheckboxModule, AdminTabsModule, PageContentModule, PluginsRoutingModule, SearchInputModule, IconsModule, LoadingModule, CKEditorModule,
MatSlideToggleModule, PluginWrapperModule, SideBarModule, PluginEditWrapperModule MatSlideToggleModule, PluginWrapperModule, SideBarModule, PluginEditWrapperModule, TransitionGroupModule
], ],
providers:[PluginsService], providers:[PluginsService],
declarations: [PluginsComponent], declarations: [PluginsComponent],

View File

@ -52,7 +52,7 @@
*ngIf="templatesByPlacement.get(placement.value) && templatesByPlacement.get(placement.value).length >0 && page" *ngIf="templatesByPlacement.get(placement.value) && templatesByPlacement.get(placement.value).length >0 && page"
class="uk-heading-divider uk-h6 uk-margin-left uk-padding-remove-left uk-text-capitalize ">{{placement.value}}</div> class="uk-heading-divider uk-h6 uk-margin-left uk-padding-remove-left uk-text-capitalize ">{{placement.value}}</div>
<div *ngFor="let template of templatesByPlacement.get(placement.value) ; let i=index"> <div *ngFor="let template of templatesByPlacement.get(placement.value) ; let i=index">
<div class="uk-card uk-card-default uk-margin-bottom"> <div class="uk-card uk-card-default uk-margin-bottom uk-animation-fade" >
<div class="uk-card-body uk-flex"> <div class="uk-card-body uk-flex">
<div class="uk-width-expand uk-text-small"> <div class="uk-width-expand uk-text-small">
<h6>{{template.name}}</h6> <h6>{{template.name}}</h6>
@ -90,23 +90,23 @@
<div class="uk-card-footer uk-padding-remove-vertical"> <div class="uk-card-footer uk-padding-remove-vertical">
<div class="uk-grid uk-grid-small uk-flex-nowrap uk-grid-divider uk-flex-right" uk-grid> <div class="uk-grid uk-grid-small uk-flex-nowrap uk-grid-divider uk-flex-right" uk-grid>
<ng-container *ngIf="page"> <ng-container>
<div *ngIf="template.order>0"> <div *ngIf="i>0">
<div class="uk-padding-small uk-padding-remove-horizontal"> <div class="uk-padding-small uk-padding-remove-horizontal">
<button <button
class="uk-button uk-button-link uk-flex uk-flex-middle" class="uk-button uk-button-link uk-flex uk-flex-middle"
(click)="swap(i, i-1, template.placement)"> (click)="swap(i, i-1, template.placement)">
<!-- <icon name="" [flex]="true"></icon>--> <icon name="arrow_upward" [flex]="true"></icon>
<span class="uk-margin-xsmall-left"> Up</span> <span class="uk-margin-xsmall-left"> Up</span>
</button> </button>
</div> </div>
</div> </div>
<div *ngIf="template.order < templatesByPlacement.get(placement.value).length -1 "> <div *ngIf="i < templatesByPlacement.get(placement.value).length -1 ">
<div class="uk-padding-small uk-padding-remove-horizontal"> <div class="uk-padding-small uk-padding-remove-horizontal">
<button <button
class="uk-button uk-button-link uk-flex uk-flex-middle" class="uk-button uk-button-link uk-flex uk-flex-middle"
(click)="swap(i+1, i, template.placement)"> (click)="swap(i+1, i, template.placement)">
<!-- <icon name="" [flex]="true"></icon>--> <icon name="arrow_downward" [flex]="true"></icon>
<span class="uk-margin-xsmall-left"> Down</span> <span class="uk-margin-xsmall-left"> Down</span>
</button> </button>
</div> </div>

View File

@ -221,19 +221,18 @@ export class PluginTemplatesComponent implements OnInit {
} }
public swap(templateToMoveUp, templateToMoveDown, placement) { public swap(templateToMoveUp, templateToMoveDown, placement) {
let moveUpTemplate = this.templatesByPlacement.get(placement)[templateToMoveUp];
this.move(this.templatesByPlacement.get(placement)[templateToMoveUp], true); let moveDownTemplate = this.templatesByPlacement.get(placement)[templateToMoveDown];
this.move(this.templatesByPlacement.get(placement)[templateToMoveDown], false); this.templatesByPlacement.get(placement)[templateToMoveUp] = moveDownTemplate;
this.templatesByPlacement.get(placement)[templateToMoveDown] = moveUpTemplate;
this.move(moveUpTemplate, true, templateToMoveDown, placement);
this.move(moveDownTemplate, false, templateToMoveUp, placement);
} }
public move(template: PluginTemplate, up: boolean) { public move(template: PluginTemplate, up: boolean, index, placement) {
this.showLoading = true;
this.subscriptions.push(this._pluginsService.updatePluginTemplateOrder(template, this.properties.adminToolsAPIURL, up ? -1 : 1).subscribe( this.subscriptions.push(this._pluginsService.updatePluginTemplateOrder(template, this.properties.adminToolsAPIURL, up ? -1 : 1).subscribe(
saved => { saved => {
this.savedSuccessfully(saved, true); this.templatesByPlacement.get(placement)[index] = saved;
// this._clearCacheService.clearCache("Template updates");
}, },
error => this.handleUpdateError("System error creating template", error) error => this.handleUpdateError("System error creating template", error)
)); ));

View File

@ -14,11 +14,12 @@ import {PluginStatsModule} from "../components/stats/plugin-stats.module";
import {PluginSearchBarModule} from "../components/search-bar/plugin-search-bar.module"; import {PluginSearchBarModule} from "../components/search-bar/plugin-search-bar.module";
import {PluginCardInfoModule} from "../components/card-info/plugin-card-info.module"; import {PluginCardInfoModule} from "../components/card-info/plugin-card-info.module";
import {PluginHtmlSectionModule} from "../components/html-section/plugin-html-section.module"; import {PluginHtmlSectionModule} from "../components/html-section/plugin-html-section.module";
import {PluginGraphInfoModule} from "../components/paragraph-info/plugin-graph-info.module";
@NgModule({ @NgModule({
imports: [ imports: [
CommonModule, RouterModule, FormsModule, PluginOpenaireProductsModule, CommonModule, RouterModule, FormsModule, PluginOpenaireProductsModule,
PluginDiscoverBySubcommunityModule, PluginSearchDepositLinkModule, PluginSuggestedRepositoriesModule, PluginFeaturedDatasetsModule, PluginGatewayInformationModule, PluginOrganizationsModule, PluginHtmlSectionModule, PluginStatsModule, PluginSearchBarModule, PluginCardInfoModule PluginDiscoverBySubcommunityModule, PluginSearchDepositLinkModule, PluginSuggestedRepositoriesModule, PluginFeaturedDatasetsModule, PluginGatewayInformationModule, PluginOrganizationsModule, PluginHtmlSectionModule, PluginStatsModule, PluginSearchBarModule, PluginCardInfoModule, PluginGraphInfoModule
], ],
declarations: [PluginWrapperComponent], declarations: [PluginWrapperComponent],
exports: [PluginWrapperComponent] exports: [PluginWrapperComponent]