[plugins-functionality | DONE | CHANGED ] create validateEnabledPage.component.ts include it in manage pages
This commit is contained in:
parent
99758d7319
commit
a9945d5da4
|
@ -2,10 +2,6 @@
|
||||||
<div actions>
|
<div actions>
|
||||||
<div class="uk-section-xsmall uk-margin-top">
|
<div class="uk-section-xsmall uk-margin-top">
|
||||||
<div class="uk-flex uk-flex-center uk-flex-right@m">
|
<div class="uk-flex uk-flex-center uk-flex-right@m">
|
||||||
<button *ngIf="!organizationsEnabled" class="uk-button uk-button-default uk-margin-right" [class.uk-disabled]="loading"
|
|
||||||
[disabled]="loading"
|
|
||||||
(click)="enableAffiliations()">Enable Organizations Page
|
|
||||||
</button>
|
|
||||||
<button class="uk-button uk-button-default uk-flex uk-flex-middle"
|
<button class="uk-button uk-button-default uk-flex uk-flex-middle"
|
||||||
[disabled]="loading" [class.uk-disabled]="loading"
|
[disabled]="loading" [class.uk-disabled]="loading"
|
||||||
(click)="editAffiliationOpen()">
|
(click)="editAffiliationOpen()">
|
||||||
|
@ -20,6 +16,7 @@
|
||||||
<div *ngIf="loading" class="uk-position-center">
|
<div *ngIf="loading" class="uk-position-center">
|
||||||
<loading></loading>
|
<loading></loading>
|
||||||
</div>
|
</div>
|
||||||
|
<validate-page-enabled pageRoute="/organizations"></validate-page-enabled>
|
||||||
<div *ngIf="!loading">
|
<div *ngIf="!loading">
|
||||||
<div *ngIf="affiliations.length == 0"
|
<div *ngIf="affiliations.length == 0"
|
||||||
class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">
|
class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">
|
||||||
|
|
|
@ -54,7 +54,6 @@ export class AffiliationsComponent implements OnInit, OnDestroy {
|
||||||
if (this.community) {
|
if (this.community) {
|
||||||
this.title.setTitle(this.community.shortTitle.toUpperCase() + ' | Organizations');
|
this.title.setTitle(this.community.shortTitle.toUpperCase() + ' | Organizations');
|
||||||
this.getAffiliations();
|
this.getAffiliations();
|
||||||
this.organizationsPageStatus();
|
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
@ -80,11 +79,7 @@ export class AffiliationsComponent implements OnInit, OnDestroy {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public get organizationsEnabled(): boolean {
|
|
||||||
return !this.organizationsPage || this.organizationsPage.isEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
editAffiliationOpen(index: number = -1) {
|
editAffiliationOpen(index: number = -1) {
|
||||||
let affiliation: Affiliation;
|
let affiliation: Affiliation;
|
||||||
this.index = index;
|
this.index = index;
|
||||||
|
@ -179,13 +174,6 @@ export class AffiliationsComponent implements OnInit, OnDestroy {
|
||||||
this.handleUpdateError('An error has been occurred. Try again later!');
|
this.handleUpdateError('An error has been occurred. Try again later!');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private organizationsPageStatus() {
|
|
||||||
this.helpContentService.getCommunityPagesByRoute(this.community.communityId, '/organizations', this.properties.adminToolsAPIURL).subscribe((page) => {
|
|
||||||
this.organizationsPage = page;
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
handleUpdateError(message: string) {
|
handleUpdateError(message: string) {
|
||||||
NotificationHandler.rise(message, "danger");
|
NotificationHandler.rise(message, "danger");
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
|
@ -195,14 +183,5 @@ export class AffiliationsComponent implements OnInit, OnDestroy {
|
||||||
NotificationHandler.rise(message);
|
NotificationHandler.rise(message);
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
enableAffiliations() {
|
|
||||||
this.helpContentService.togglePages(this.community.communityId, [this.organizationsPage._id], true, this.properties.adminToolsAPIURL).subscribe(() => {
|
|
||||||
this.organizationsPage.isEnabled = true;
|
|
||||||
this._clearCacheService.purgeBrowserCache("Organizations Page enabled", this.community.communityId);
|
|
||||||
NotificationHandler.rise('Organizations Page has been <b>enabled successfully</b>');
|
|
||||||
}, error => {
|
|
||||||
this.handleUpdateError('An error has been occurred. Try again later!');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,11 +17,12 @@ import {LoadingModule} from "../../openaireLibrary/utils/loading/loading.module"
|
||||||
import {UrlPrefixModule} from "../../openaireLibrary/utils/pipes/url-prefix.module";
|
import {UrlPrefixModule} from "../../openaireLibrary/utils/pipes/url-prefix.module";
|
||||||
import {HelpContentService} from "../../services/help-content.service";
|
import {HelpContentService} from "../../services/help-content.service";
|
||||||
import {PagingModule} from "../../openaireLibrary/utils/paging.module";
|
import {PagingModule} from "../../openaireLibrary/utils/paging.module";
|
||||||
|
import {ValidateEnabledPageModule} from "../../utils/validateEnabledPage.module";
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
AffiliationsRoutingModule, CommonModule, FormsModule, RouterModule,
|
AffiliationsRoutingModule, CommonModule, FormsModule, RouterModule,
|
||||||
AlertModalModule, ReactiveFormsModule, InputModule, PageContentModule, IconsModule, NoLoadPaging, LoadingModule, UrlPrefixModule, PagingModule
|
AlertModalModule, ReactiveFormsModule, InputModule, PageContentModule, IconsModule, NoLoadPaging, LoadingModule, UrlPrefixModule, PagingModule, ValidateEnabledPageModule
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
AffiliationsComponent
|
AffiliationsComponent
|
||||||
|
|
|
@ -30,6 +30,7 @@ import {SearchDataprovidersService} from "../../openaireLibrary/services/searchD
|
||||||
import {CriteriaModule} from "./criteria/criteria.module";
|
import {CriteriaModule} from "./criteria/criteria.module";
|
||||||
import {MatSlideToggleModule} from "@angular/material/slide-toggle";
|
import {MatSlideToggleModule} from "@angular/material/slide-toggle";
|
||||||
import {CKEditorModule} from "ng2-ckeditor";
|
import {CKEditorModule} from "ng2-ckeditor";
|
||||||
|
import {ValidateEnabledPageModule} from "../../utils/validateEnabledPage.module";
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
|
@ -50,7 +51,7 @@ import {CKEditorModule} from "ng2-ckeditor";
|
||||||
path: '', component: ManageContentProvidersComponent
|
path: '', component: ManageContentProvidersComponent
|
||||||
}
|
}
|
||||||
]),
|
]),
|
||||||
NoLoadPaging, LoadingModule, IconsModule, FullScreenModalModule, ResultPreviewModule, CriteriaModule, MatSlideToggleModule, CKEditorModule, ReactiveFormsModule
|
NoLoadPaging, LoadingModule, IconsModule, FullScreenModalModule, ResultPreviewModule, CriteriaModule, MatSlideToggleModule, CKEditorModule, ReactiveFormsModule, ValidateEnabledPageModule
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
ManageContentProvidersComponent,
|
ManageContentProvidersComponent,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<div class="uk-position-relative" style="min-height: 60vh">
|
<div class="uk-position-relative" [style]=" height == -1?'': 'min-height:60vh'">
|
||||||
<div *ngIf="loading" class="uk-position-center">
|
<div *ngIf="loading" class="uk-position-center">
|
||||||
<loading></loading>
|
<loading></loading>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -35,27 +35,19 @@ import {UntypedFormBuilder} from "@angular/forms";
|
||||||
<fs-modal #filtersModal (okEmitter)="saveCriteria()" (cancelEmitter)="criteria.reset(); depositReset();"
|
<fs-modal #filtersModal (okEmitter)="saveCriteria()" (cancelEmitter)="criteria.reset(); depositReset();"
|
||||||
[okButtonDisabled]="(criteria && criteria.disabled && !depositInfoChanged)">
|
[okButtonDisabled]="(criteria && criteria.disabled && !depositInfoChanged)">
|
||||||
<div class="uk-container uk-container-large">
|
<div class="uk-container uk-container-large">
|
||||||
<mat-slide-toggle [checked]="enabled" (change)="enabled = !enabled; depositInfoChanged = true;"></mat-slide-toggle>
|
<div class="uk-flex uk-flex-center">
|
||||||
<label class="uk-margin-medium-top uk-margin-small-left ">Content source</label>
|
<div>
|
||||||
<br>
|
<mat-slide-toggle [checked]="enabled" (change)="enabled = !enabled; depositInfoChanged = true;"></mat-slide-toggle>
|
||||||
<mat-slide-toggle [checked]="deposit" (change)="deposit = !deposit; depositInfoChanged = true;"></mat-slide-toggle>
|
<label class="uk-margin-medium-top uk-margin-small-left ">Content source</label>
|
||||||
<label class="uk-margin-medium-top uk-margin-small-left ">Suggest for deposit</label>
|
</div>
|
||||||
<!--<div class="uk-width-1-1 uk-margin-medium-top" input placeholder="Type a message or instruction for researchers about deposition in this datasource"
|
<div class="uk-margin-small-left">
|
||||||
[value]="message" (valueChange)="message=$event; depositInfoChanged = true;">
|
<mat-slide-toggle [checked]="deposit" (change)="deposit = !deposit; depositInfoChanged = true;"></mat-slide-toggle>
|
||||||
</div>-->
|
<label class="uk-margin-medium-top uk-margin-small-left ">Suggest for deposit</label>
|
||||||
<div class="uk-margin-top uk-text-meta">Type a message or instruction for researchers about deposition in this datasource</div>
|
</div>
|
||||||
<ckeditor [readonly]="false"
|
</div>
|
||||||
debounce="500"
|
<div *ngIf="enabled" class="uk-hr">
|
||||||
[formControl]="messageForm" (change)="messageChanged()"
|
<div class="uk-text-center uk-text-bold uk-text-large uk-margin-top ">Content filters</div>
|
||||||
[config]="{ extraAllowedContent: '* [uk-*](*) ; span', disallowedContent: 'script; *[on*]',
|
<criteria #criteria *ngIf="dataProvider" [height]="'-1'"
|
||||||
removeButtons: 'Save,NewPage,DocProps,Preview,Print,' +
|
|
||||||
'Form,Checkbox,Radio,TextField,Textarea,Select,Button,ImageButton,HiddenField,' +
|
|
||||||
'CreateDiv,Flash,PageBreak,' +
|
|
||||||
'Subscript,Superscript,Anchor,Smiley,Iframe,Styles,Font,About,Language,JustifyLeft,JustifyRight,JustifyCenter,JustifyBlock,FontSize,TextColor,BGColor',
|
|
||||||
extraPlugins: 'divarea'}">
|
|
||||||
</ckeditor>
|
|
||||||
<div class="uk-text-center uk-text-bold uk-text-large uk-margin-medium-top">Content filters</div>
|
|
||||||
<criteria #criteria *ngIf="dataProvider" [height]="filtersModal.bodyHeight - 200"
|
|
||||||
[selectionCriteria]="dataProvider.selectioncriteria">
|
[selectionCriteria]="dataProvider.selectioncriteria">
|
||||||
<div no-criteria>
|
<div no-criteria>
|
||||||
<h5 class="uk-margin-small-bottom">No Filters for {{dataProvider.officialname}} yet</h5>
|
<h5 class="uk-margin-small-bottom">No Filters for {{dataProvider.officialname}} yet</h5>
|
||||||
|
@ -64,6 +56,24 @@ import {UntypedFormBuilder} from "@angular/forms";
|
||||||
</i>
|
</i>
|
||||||
</div>
|
</div>
|
||||||
</criteria>
|
</criteria>
|
||||||
|
</div>
|
||||||
|
<div *ngIf="deposit" class="uk-hr">
|
||||||
|
|
||||||
|
<!--<div class="uk-width-1-1 uk-margin-medium-top" input placeholder="Type a message or instruction for researchers about deposition in this datasource"
|
||||||
|
[value]="message" (valueChange)="message=$event; depositInfoChanged = true;">
|
||||||
|
</div>-->
|
||||||
|
<div class="uk-margin-top uk-text-meta">Type a message or instruction for researchers about deposition in this datasource</div>
|
||||||
|
<ckeditor [readonly]="false"
|
||||||
|
debounce="500"
|
||||||
|
[formControl]="messageForm" (change)="messageChanged()"
|
||||||
|
[config]="{ extraAllowedContent: '* [uk-*](*) ; span', disallowedContent: 'script; *[on*]',
|
||||||
|
removeButtons: 'Save,NewPage,DocProps,Preview,Print,' +
|
||||||
|
'Form,Checkbox,Radio,TextField,Textarea,Select,Button,ImageButton,HiddenField,' +
|
||||||
|
'CreateDiv,Flash,PageBreak,' +
|
||||||
|
'Subscript,Superscript,Anchor,Smiley,Iframe,Styles,Font,About,Language,JustifyLeft,JustifyRight,JustifyCenter,JustifyBlock,FontSize,TextColor,BGColor',
|
||||||
|
extraPlugins: 'divarea'}">
|
||||||
|
</ckeditor>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</fs-modal>
|
</fs-modal>
|
||||||
`
|
`
|
||||||
|
|
|
@ -22,6 +22,8 @@
|
||||||
<loading></loading>
|
<loading></loading>
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="!loading">
|
<div *ngIf="!loading">
|
||||||
|
<validate-page-enabled pageRoute="/search/find/dataproviders"></validate-page-enabled>
|
||||||
|
<validate-page-enabled pageRoute="/participate/deposit/suggested"></validate-page-enabled>
|
||||||
<div *ngIf="previewCommunityContentProviders.length == 0"
|
<div *ngIf="previewCommunityContentProviders.length == 0"
|
||||||
class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">
|
class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">
|
||||||
<div>No <span class="uk-text-lowercase">{{openAIREEntities.DATASOURCES}} </span>
|
<div>No <span class="uk-text-lowercase">{{openAIREEntities.DATASOURCES}} </span>
|
||||||
|
|
|
@ -24,6 +24,7 @@ import {ResultPreviewModule} from "../../openaireLibrary/utils/result-preview/re
|
||||||
import {ErrorMessagesModule} from "../../openaireLibrary/utils/errorMessages.module";
|
import {ErrorMessagesModule} from "../../openaireLibrary/utils/errorMessages.module";
|
||||||
import {DropdownFilterModule} from "../../openaireLibrary/utils/dropdown-filter/dropdown-filter.module";
|
import {DropdownFilterModule} from "../../openaireLibrary/utils/dropdown-filter/dropdown-filter.module";
|
||||||
import {SearchFilterModule} from "../../openaireLibrary/searchPages/searchUtils/searchFilter.module";
|
import {SearchFilterModule} from "../../openaireLibrary/searchPages/searchUtils/searchFilter.module";
|
||||||
|
import {ValidateEnabledPageModule} from "../../utils/validateEnabledPage.module";
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
|
@ -44,7 +45,7 @@ import {SearchFilterModule} from "../../openaireLibrary/searchPages/searchUtils/
|
||||||
path: '', component: ManageProjectsComponent
|
path: '', component: ManageProjectsComponent
|
||||||
}
|
}
|
||||||
]),
|
]),
|
||||||
NoLoadPaging, LoadingModule, IconsModule, FullScreenModalModule, ResultPreviewModule, DropdownFilterModule, SearchFilterModule
|
NoLoadPaging, LoadingModule, IconsModule, FullScreenModalModule, ResultPreviewModule, DropdownFilterModule, SearchFilterModule, ValidateEnabledPageModule
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
ManageProjectsComponent,
|
ManageProjectsComponent,
|
||||||
|
|
|
@ -67,6 +67,7 @@
|
||||||
<div *ngIf="loading" class="uk-position-center">
|
<div *ngIf="loading" class="uk-position-center">
|
||||||
<loading></loading>
|
<loading></loading>
|
||||||
</div>
|
</div>
|
||||||
|
<validate-page-enabled pageRoute="/search/find/projects"></validate-page-enabled>
|
||||||
<div *ngIf="!loading">
|
<div *ngIf="!loading">
|
||||||
<div class="uk-margin-medium-bottom">
|
<div class="uk-margin-medium-bottom">
|
||||||
<div *ngIf="previewCommunityProjects.length == 0"
|
<div *ngIf="previewCommunityProjects.length == 0"
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
<div *ngIf="loading" class="uk-position-center">
|
<div *ngIf="loading" class="uk-position-center">
|
||||||
<loading></loading>
|
<loading></loading>
|
||||||
</div>
|
</div>
|
||||||
|
<validate-page-enabled pageRoute="/subjects"></validate-page-enabled>
|
||||||
<div *ngIf="!loading">
|
<div *ngIf="!loading">
|
||||||
<div *ngIf="displayedSubjects?.length == 0 && displayedSdg?.length == 0 && displayedFos?.length == 0"
|
<div *ngIf="displayedSubjects?.length == 0 && displayedSdg?.length == 0 && displayedFos?.length == 0"
|
||||||
class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">
|
class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold">
|
||||||
|
|
|
@ -18,12 +18,13 @@ import {FullScreenModalModule} from 'src/app/openaireLibrary/utils/modal/full-sc
|
||||||
import {PagingModule} from "../../../openaireLibrary/utils/paging.module";
|
import {PagingModule} from "../../../openaireLibrary/utils/paging.module";
|
||||||
import {SdgSelectionModule} from '../../../openaireLibrary/sdg/sdg-selection/sdg-selection.module';
|
import {SdgSelectionModule} from '../../../openaireLibrary/sdg/sdg-selection/sdg-selection.module';
|
||||||
import {FosSelectionModule} from '../../../openaireLibrary/fos/fos-selection/fos-selection.module';
|
import {FosSelectionModule} from '../../../openaireLibrary/fos/fos-selection/fos-selection.module';
|
||||||
|
import {ValidateEnabledPageModule} from "../../../utils/validateEnabledPage.module";
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
SubjectsEditFormRoutingModule, CommonModule, FormsModule, RouterModule,
|
SubjectsEditFormRoutingModule, CommonModule, FormsModule, RouterModule,
|
||||||
PageContentModule, IconsModule, AlertModalModule, NoLoadPaging, LoadingModule, InputModule,
|
PageContentModule, IconsModule, AlertModalModule, NoLoadPaging, LoadingModule, InputModule,
|
||||||
SearchInputModule, FullScreenModalModule, PagingModule, SdgSelectionModule, FosSelectionModule
|
SearchInputModule, FullScreenModalModule, PagingModule, SdgSelectionModule, FosSelectionModule, ValidateEnabledPageModule
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
SubjectsEditFormComponent
|
SubjectsEditFormComponent
|
||||||
|
|
|
@ -0,0 +1,93 @@
|
||||||
|
import {Component, Input, OnDestroy, OnInit, ViewChild} from "@angular/core";
|
||||||
|
import {EnvProperties} from "../openaireLibrary/utils/properties/env-properties";
|
||||||
|
import {UntypedFormBuilder} from "@angular/forms";
|
||||||
|
import {CommunityInfo} from "../openaireLibrary/connect/community/communityInfo";
|
||||||
|
import {Page} from "../openaireLibrary/utils/entities/adminTool/page";
|
||||||
|
import {AlertModal} from "../openaireLibrary/utils/modal/alert";
|
||||||
|
import {ActivatedRoute, Router} from "@angular/router";
|
||||||
|
import {Title} from "@angular/platform-browser";
|
||||||
|
import {CommunityService} from "../openaireLibrary/connect/community/community.service";
|
||||||
|
import {AffiliationService} from "../openaireLibrary/connect/affiliations/affiliation.service";
|
||||||
|
import {HelpContentService} from "../services/help-content.service";
|
||||||
|
import {ClearCacheService} from "../openaireLibrary/services/clear-cache.service";
|
||||||
|
import {Subscription} from "rxjs";
|
||||||
|
import {HelperFunctions} from "../openaireLibrary/utils/HelperFunctions.class";
|
||||||
|
import {NotificationHandler} from "../openaireLibrary/utils/notification-handler";
|
||||||
|
import {properties} from "src/environments/environment";
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'validate-page-enabled',
|
||||||
|
template: `
|
||||||
|
<div *ngIf="page && !pageEnabled" class="uk-width-1-1 uk-alert uk-alert-warning">
|
||||||
|
<b>{{page.name}}</b> page is not enabled. Manage pages <a [href]="community.communityId + '/admin-tools/pages'" target="_blank">here</a> or
|
||||||
|
<a *ngIf="!pageEnabled" class=" uk-margin-right" [class.uk-disabled]="loading" [disabled]="loading"
|
||||||
|
(click)="enablePage()">enable it now</a>
|
||||||
|
</div>
|
||||||
|
`
|
||||||
|
})
|
||||||
|
export class ValidateEnabledPageComponent implements OnInit, OnDestroy {
|
||||||
|
@Input() pageRoute:string;
|
||||||
|
public properties: EnvProperties = properties;
|
||||||
|
|
||||||
|
|
||||||
|
public community: CommunityInfo;
|
||||||
|
public page: Page;
|
||||||
|
loading;
|
||||||
|
private subs: any[] = [];
|
||||||
|
@ViewChild('affiliationModal') affiliationModal: AlertModal;
|
||||||
|
@ViewChild('removeAffiliationModal') removeAffiliationModal: AlertModal;
|
||||||
|
|
||||||
|
constructor(private route: ActivatedRoute,
|
||||||
|
private router: Router,
|
||||||
|
private title: Title,
|
||||||
|
private fb: UntypedFormBuilder,
|
||||||
|
private communityService: CommunityService,
|
||||||
|
private helpContentService: HelpContentService,
|
||||||
|
private _clearCacheService: ClearCacheService) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this.subs.push(this.communityService.getCommunityAsObservable().subscribe( community => {
|
||||||
|
this.community = community;
|
||||||
|
this.getPageStatus();
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnDestroy() {
|
||||||
|
this.subs.forEach(sub => {
|
||||||
|
if (sub instanceof Subscription) {
|
||||||
|
sub.unsubscribe();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
public get pageEnabled(): boolean {
|
||||||
|
return !this.page || this.page.isEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public updatePage(event) {
|
||||||
|
HelperFunctions.scroll();
|
||||||
|
this.page = event.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private getPageStatus() {
|
||||||
|
this.helpContentService.getCommunityPagesByRoute(this.community.communityId, this.pageRoute, this.properties.adminToolsAPIURL).subscribe((page) => {
|
||||||
|
this.page = page;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
enablePage() {
|
||||||
|
this.loading = true;
|
||||||
|
this.helpContentService.togglePages(this.community.communityId, [this.page._id], true, this.properties.adminToolsAPIURL).subscribe(() => {
|
||||||
|
this.page.isEnabled = true;
|
||||||
|
this._clearCacheService.purgeBrowserCache("Page enabled", this.community.communityId);
|
||||||
|
NotificationHandler.rise(this.page.name + ' has been <b>enabled successfully</b>');
|
||||||
|
this.loading = false;
|
||||||
|
}, error => {
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
import {NgModule} from '@angular/core';
|
||||||
|
import {CommonModule} from '@angular/common';
|
||||||
|
import {RouterModule} from "@angular/router";
|
||||||
|
import {ValidateEnabledPageComponent} from "./validateEnabledPage.component";
|
||||||
|
import {AdminToolServiceModule} from "../openaireLibrary/services/adminToolService.module";
|
||||||
|
import {HelpContentService} from "../services/help-content.service";
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [ValidateEnabledPageComponent],
|
||||||
|
imports: [
|
||||||
|
CommonModule, RouterModule, AdminToolServiceModule
|
||||||
|
],
|
||||||
|
exports:[ValidateEnabledPageComponent],
|
||||||
|
providers:[HelpContentService]
|
||||||
|
})
|
||||||
|
export class ValidateEnabledPageModule {
|
||||||
|
}
|
Loading…
Reference in New Issue