add login components, create admin connect Guard, use env.properties
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-admin-portal/trunk@51057 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
0943d68297
commit
ead4fc6e33
|
@ -48,6 +48,7 @@ import {BottomModule} from './openaireLibrary/sharedComponents/bottom.module';
|
|||
import {FeedbackModule} from './openaireLibrary/sharedComponents/feedback/feedback.module';
|
||||
import {FreeGuard} from './openaireLibrary/login/freeGuard.guard';
|
||||
import { AdminLoginGuard} from './openaireLibrary/login/adminLoginGuard.guard';
|
||||
import { ConnectAdminLoginGuard} from './openaireLibrary/login/connectAdminLoginGuard.guard';
|
||||
import { EnvironmentSpecificResolver} from './openaireLibrary/utils/properties/environmentSpecificResolver';
|
||||
import { EnvironmentSpecificService} from './openaireLibrary/utils/properties/environment-specific.service';
|
||||
import{ClaimsAdminModule} from './openaireLibrary/claims/claimsAdmin/claimsAdmin.module';
|
||||
|
@ -102,7 +103,8 @@ import {StatsComponent} from "./pages/stats/stats.component";
|
|||
FAQService,
|
||||
HelpContentService,
|
||||
appRoutingProviders,
|
||||
FreeGuard, AdminLoginGuard, EnvironmentSpecificResolver,EnvironmentSpecificService, Meta
|
||||
FreeGuard, AdminLoginGuard,ConnectAdminLoginGuard,
|
||||
EnvironmentSpecificResolver,EnvironmentSpecificService, Meta
|
||||
],
|
||||
bootstrap: [ AppComponent ]
|
||||
})
|
||||
|
|
|
@ -20,12 +20,15 @@ import {ClaimsComponent} from './pages/claims/claims.component';
|
|||
import {FreeGuard} from './openaireLibrary/login/freeGuard.guard';
|
||||
|
||||
import { AdminLoginGuard} from './openaireLibrary/login/adminLoginGuard.guard';
|
||||
import { ConnectAdminLoginGuard} from './openaireLibrary/login/connectAdminLoginGuard.guard';
|
||||
|
||||
import { EnvironmentSpecificResolver} from './openaireLibrary/utils/properties/environmentSpecificResolver';
|
||||
import { EnvironmentSpecificService} from './openaireLibrary/utils/properties/environment-specific.service';
|
||||
import{ClaimsAdminComponent} from './openaireLibrary/claims/claimsAdmin/claimsAdmin.component';
|
||||
|
||||
import {StatsComponent} from "./pages/stats/stats.component";
|
||||
|
||||
|
||||
//TODO replace FreeGuard with ConnectAdminLoginGuard
|
||||
|
||||
const appRoutes: Routes = [
|
||||
{
|
||||
|
@ -96,6 +99,9 @@ const appRoutes: Routes = [
|
|||
path: 'claims',
|
||||
component: ClaimsComponent,canActivate: [FreeGuard],resolve: { envSpecific: EnvironmentSpecificResolver }
|
||||
},
|
||||
{ path: 'reload', loadChildren: './reload/libReload.module#LibReloadModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
|
||||
{ path: 'user-info', loadChildren: './login/libUser.module#LibUserModule', resolve: { envSpecific: EnvironmentSpecificResolver }},
|
||||
|
||||
{
|
||||
path: 'stats',
|
||||
component: StatsComponent,canActivate: [FreeGuard],resolve: { envSpecific: EnvironmentSpecificResolver }
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
import { NgModule} from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
|
||||
import {ConnectUserComponent } from './user.component';
|
||||
import { UserRoutingModule } from './user-routing.module';
|
||||
import { UserModule} from '../openaireLibrary/login/user.module';
|
||||
|
||||
import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule, FormsModule,
|
||||
UserRoutingModule, UserModule
|
||||
|
||||
],
|
||||
providers:[PreviousRouteRecorder],
|
||||
declarations: [ConnectUserComponent]
|
||||
})
|
||||
export class LibUserModule { }
|
|
@ -0,0 +1,15 @@
|
|||
import { NgModule } from '@angular/core';
|
||||
import { RouterModule } from '@angular/router';
|
||||
|
||||
import {ConnectUserComponent } from './user.component';
|
||||
import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
RouterModule.forChild([
|
||||
{ path: '', component: ConnectUserComponent, canDeactivate: [PreviousRouteRecorder]},
|
||||
|
||||
])
|
||||
]
|
||||
})
|
||||
export class UserRoutingModule { }
|
|
@ -0,0 +1,11 @@
|
|||
import {Component, ElementRef} from '@angular/core';
|
||||
import {Observable} from 'rxjs/Observable';
|
||||
|
||||
@Component({
|
||||
selector: 'openaire-user',
|
||||
template: `<user></user>`
|
||||
})
|
||||
|
||||
export class ConnectUserComponent {
|
||||
|
||||
}
|
|
@ -9,6 +9,7 @@ import { ModalFormComponent } from "../modal-form.component";
|
|||
import { DeleteConfirmationDialogComponent } from "../delete-confirmation-dialog.component";
|
||||
import { CommunityFormComponent } from "./community-form.component";
|
||||
import { CheckCommunity, Community } from "../../domain/community";
|
||||
import { EnvProperties } from '../../openaireLibrary/utils/properties/env-properties';
|
||||
|
||||
@Component({
|
||||
selector: 'communities',
|
||||
|
@ -39,23 +40,28 @@ export class CommunitiesComponent implements OnInit {
|
|||
public formGroup : FormGroup;
|
||||
|
||||
private searchText : RegExp = new RegExp('');
|
||||
|
||||
public properties:EnvProperties = null;
|
||||
ngOnInit() {
|
||||
this.formGroup = this.formComponent.form;
|
||||
this.route.queryParams.subscribe(params => {
|
||||
if(params['community']) {
|
||||
this.getCommunity(params['community']);
|
||||
} else {
|
||||
this.getCommunities();
|
||||
}
|
||||
});
|
||||
|
||||
this.route.data
|
||||
.subscribe((data: { envSpecific: EnvProperties }) => {
|
||||
this.properties = data.envSpecific;
|
||||
this.route.queryParams.subscribe(params => {
|
||||
if(params['community']) {
|
||||
this.getCommunity(params['community']);
|
||||
} else {
|
||||
this.getCommunities();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
constructor(private route: ActivatedRoute, private _helpContentService: HelpContentService) {}
|
||||
|
||||
getCommunity(community_pid: string) {
|
||||
let self = this;
|
||||
this._helpContentService.getCommunityFull(community_pid).subscribe(
|
||||
this._helpContentService.getCommunityFull(community_pid, this.properties.adminToolsAPIURL).subscribe(
|
||||
community => {
|
||||
self.communities = [community];
|
||||
this.checkboxes.push(<CheckCommunity>{community : community, checked : false});
|
||||
|
@ -65,7 +71,7 @@ export class CommunitiesComponent implements OnInit {
|
|||
|
||||
getCommunities() {
|
||||
let self = this;
|
||||
this._helpContentService.getCommunitiesFull().subscribe(
|
||||
this._helpContentService.getCommunitiesFull(this.properties.adminToolsAPIURL).subscribe(
|
||||
communities => {
|
||||
self.communities = communities;
|
||||
|
||||
|
@ -111,7 +117,7 @@ export class CommunitiesComponent implements OnInit {
|
|||
}
|
||||
|
||||
public confirmedDeleteCommunities(ids : string[]) {
|
||||
this._helpContentService.deleteCommunities(ids).subscribe(
|
||||
this._helpContentService.deleteCommunities(ids, this.properties.adminToolsAPIURL).subscribe(
|
||||
_ => this.deleteCommunitiesFromArray(ids),
|
||||
error => this.handleError('System error deleting the selected communities', error)
|
||||
);
|
||||
|
|
|
@ -8,6 +8,7 @@ import { DivIdFormComponent } from "./divId-form.component";
|
|||
import { CheckDivId, DivId } from "../../domain/divId";
|
||||
import { Community } from "../../domain/community";
|
||||
import { Page } from "../../domain/page";
|
||||
import { EnvProperties } from '../../openaireLibrary/utils/properties/env-properties';
|
||||
|
||||
@Component({
|
||||
selector: 'divIds',
|
||||
|
@ -42,17 +43,22 @@ export class DivIdsComponent implements OnInit {
|
|||
public selectedCommunityPid: string;
|
||||
public communities: Community[] = [];
|
||||
public pages: Page[] = [];
|
||||
public properties:EnvProperties = null;
|
||||
public formPages: Page[] = [];
|
||||
|
||||
ngOnInit() {
|
||||
this.formGroup = this.formComponent.form;
|
||||
this.route.queryParams.subscribe(params => {
|
||||
// if(params['community']) {
|
||||
// this.getCommunity(params['community']);
|
||||
// } else {
|
||||
this.getCommunities();
|
||||
//}
|
||||
});
|
||||
this.route.data
|
||||
.subscribe((data: { envSpecific: EnvProperties }) => {
|
||||
this.properties = data.envSpecific;
|
||||
this.formGroup = this.formComponent.form;
|
||||
this.route.queryParams.subscribe(params => {
|
||||
// if(params['community']) {
|
||||
// this.getCommunity(params['community']);
|
||||
// } else {
|
||||
this.getCommunities();
|
||||
//}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
constructor(private route: ActivatedRoute, private _helpContentService: HelpContentService) {}
|
||||
|
@ -69,7 +75,7 @@ export class DivIdsComponent implements OnInit {
|
|||
*/
|
||||
getCommunities() {
|
||||
let self = this;
|
||||
this._helpContentService.getCommunities().subscribe(
|
||||
this._helpContentService.getCommunities(this.properties.adminToolsAPIURL).subscribe(
|
||||
communities => {
|
||||
self.communities = communities;
|
||||
self.selectedCommunityPid = self.communities[0].pid;
|
||||
|
@ -83,14 +89,14 @@ export class DivIdsComponent implements OnInit {
|
|||
}
|
||||
|
||||
getPages(community_pid: string) {
|
||||
this._helpContentService.getCommunityPages(community_pid).subscribe(
|
||||
this._helpContentService.getCommunityPages(community_pid, this.properties.adminToolsAPIURL).subscribe(
|
||||
pages => this.pages = pages,
|
||||
error => this.handleError('System error retrieving pages', error));
|
||||
}
|
||||
|
||||
getDivIds(community_pid: string) {
|
||||
let self = this;
|
||||
this._helpContentService.getDivIdsFull(community_pid, null).subscribe(
|
||||
this._helpContentService.getDivIdsFull(community_pid, null, this.properties.adminToolsAPIURL).subscribe(
|
||||
divIds => {
|
||||
self.divIds = divIds;
|
||||
|
||||
|
@ -137,7 +143,7 @@ export class DivIdsComponent implements OnInit {
|
|||
}
|
||||
|
||||
public confirmedDeleteDivIds(ids : string[]) {
|
||||
this._helpContentService.deleteDivIds(ids).subscribe(
|
||||
this._helpContentService.deleteDivIds(ids, this.properties.adminToolsAPIURL).subscribe(
|
||||
_ => this.deleteDivIdsFromArray(ids),
|
||||
error => this.handleError('System error deleting the selected classes', error)
|
||||
);
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
import { Component, OnInit, Input } from '@angular/core';
|
||||
import { ActivatedRoute } from "@angular/router";
|
||||
import { FormGroup, FormBuilder, Validators } from "@angular/forms";
|
||||
import { Page } from "../../domain/page";
|
||||
import { DivId } from "../../domain/divId";
|
||||
import { HelpContentService } from "../../services/help-content.service";
|
||||
import { EnvProperties } from '../../openaireLibrary/utils/properties/env-properties';
|
||||
|
||||
|
||||
@Component({
|
||||
|
@ -28,19 +30,25 @@ export class DivContentFormComponent implements OnInit{
|
|||
|
||||
private ckeditorContent : string;
|
||||
|
||||
constructor(private _fb: FormBuilder, private _helpContentService: HelpContentService){}
|
||||
constructor(private route: ActivatedRoute, private _fb: FormBuilder, private _helpContentService: HelpContentService){}
|
||||
public properties:EnvProperties = null;
|
||||
|
||||
ngOnInit() {
|
||||
this.myForm = this.form;
|
||||
this.myForm = this.form;
|
||||
this.route.data
|
||||
.subscribe((data: { envSpecific: EnvProperties }) => {
|
||||
this.properties = data.envSpecific;
|
||||
if(this.pageId) {
|
||||
this.showPageSelect = false;
|
||||
this.getDivs(this.pageId);
|
||||
} else {
|
||||
this._helpContentService.getCommunityPagesWithDivId(this.communityPid, this.properties.adminToolsAPIURL).subscribe(
|
||||
pages => this.availablePages = pages,
|
||||
error => this.handleError('System error retrieving pages', error));
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
if(this.pageId) {
|
||||
this.showPageSelect = false;
|
||||
this.getDivs(this.pageId);
|
||||
} else {
|
||||
this._helpContentService.getCommunityPagesWithDivId(this.communityPid).subscribe(
|
||||
pages => this.availablePages = pages,
|
||||
error => this.handleError('System error retrieving pages', error));
|
||||
}
|
||||
}
|
||||
|
||||
public pageSelected(event) {
|
||||
|
@ -49,7 +57,7 @@ export class DivContentFormComponent implements OnInit{
|
|||
|
||||
public getDivs(pageId: string) {
|
||||
console.info(pageId);
|
||||
this._helpContentService.getDivIdsFull(this.communityPid, pageId).subscribe(
|
||||
this._helpContentService.getDivIdsFull(this.communityPid, pageId, this.properties.adminToolsAPIURL).subscribe(
|
||||
divs => {
|
||||
this.availableDivs = divs;
|
||||
this.pageId = pageId;
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
import { Component, ViewChild, OnInit } from '@angular/core';
|
||||
import { Router } from "@angular/router";
|
||||
import { Router, ActivatedRoute } from "@angular/router";
|
||||
import { FormGroup } from "@angular/forms";
|
||||
import { ActivatedRoute } from "@angular/router";
|
||||
import { DeleteConfirmationDialogComponent } from "../delete-confirmation-dialog.component";
|
||||
import { HelpContentService } from "../../services/help-content.service";
|
||||
import { DivHelpContent, CheckDivHelpContent, DivHelpContentFilterOptions } from "../../domain/div-help-content";
|
||||
import { Page } from "../../domain/page";
|
||||
import { Community } from "../../domain/community";
|
||||
import { DivId } from "../../domain/divId";
|
||||
import { EnvProperties } from '../../openaireLibrary/utils/properties/env-properties';
|
||||
|
||||
@Component({
|
||||
selector: 'div-help-contents',
|
||||
|
@ -54,22 +54,28 @@ export class DivHelpContentsComponent implements OnInit {
|
|||
public community: Community;
|
||||
|
||||
public page: Page;
|
||||
public properties:EnvProperties = null;
|
||||
|
||||
ngOnInit() {
|
||||
this.route.queryParams.subscribe(params => {
|
||||
this.route.data
|
||||
.subscribe((data: { envSpecific: EnvProperties }) => {
|
||||
this.properties = data.envSpecific;
|
||||
|
||||
this.selectedCommunityPid = params['community'];
|
||||
this.selectedPageId = params['page'];
|
||||
this.route.queryParams.subscribe(params => {
|
||||
|
||||
if(this.selectedCommunityPid && this.selectedPageId) {
|
||||
this.getDivHelpContents(this.selectedCommunityPid);
|
||||
this.getPage(this.selectedPageId);
|
||||
this.getCommunity(this.selectedCommunityPid);
|
||||
} else {
|
||||
this.selectedPageId = "";
|
||||
this.getCommunities();
|
||||
}
|
||||
});
|
||||
this.selectedCommunityPid = params['community'];
|
||||
this.selectedPageId = params['page'];
|
||||
|
||||
if(this.selectedCommunityPid && this.selectedPageId) {
|
||||
this.getDivHelpContents(this.selectedCommunityPid);
|
||||
this.getPage(this.selectedPageId);
|
||||
this.getCommunity(this.selectedCommunityPid);
|
||||
} else {
|
||||
this.selectedPageId = "";
|
||||
this.getCommunities();
|
||||
}
|
||||
});
|
||||
});
|
||||
// this.formGroup = this.formComponent.form;
|
||||
}
|
||||
|
||||
|
@ -77,7 +83,7 @@ export class DivHelpContentsComponent implements OnInit {
|
|||
|
||||
getPage(pageId: string) {
|
||||
let self = this;
|
||||
this._helpService.getPage(pageId).subscribe(
|
||||
this._helpService.getPage(pageId, this.properties.adminToolsAPIURL).subscribe(
|
||||
page => {
|
||||
self.page = page;
|
||||
}
|
||||
|
@ -86,7 +92,7 @@ export class DivHelpContentsComponent implements OnInit {
|
|||
|
||||
getCommunity(communityPid: string) {
|
||||
let self = this;
|
||||
this._helpService.getCommunity(communityPid).subscribe(
|
||||
this._helpService.getCommunity(communityPid, this.properties.adminToolsAPIURL).subscribe(
|
||||
community => {
|
||||
self.community = community;
|
||||
}
|
||||
|
@ -95,7 +101,7 @@ export class DivHelpContentsComponent implements OnInit {
|
|||
|
||||
getCommunities() {
|
||||
let self = this;
|
||||
this._helpService.getCommunitiesWithDivId().subscribe(
|
||||
this._helpService.getCommunitiesWithDivId(this.properties.adminToolsAPIURL).subscribe(
|
||||
communities => {
|
||||
self.communities = communities;
|
||||
self.selectedCommunityPid = self.communities[0].pid;
|
||||
|
@ -106,7 +112,7 @@ export class DivHelpContentsComponent implements OnInit {
|
|||
}
|
||||
|
||||
getPages(community_pid: string) {
|
||||
this._helpService.getCommunityPagesWithDivId(community_pid).subscribe(
|
||||
this._helpService.getCommunityPagesWithDivId(community_pid, this.properties.adminToolsAPIURL).subscribe(
|
||||
pages => this.pages = pages,
|
||||
error => this.handleError('System error retrieving pages', error));
|
||||
}
|
||||
|
@ -126,7 +132,7 @@ export class DivHelpContentsComponent implements OnInit {
|
|||
|
||||
getDivHelpContents(community_pid: string) {
|
||||
let self = this;
|
||||
this._helpService.getCommunityDivHelpContents(community_pid).subscribe(
|
||||
this._helpService.getCommunityDivHelpContents(community_pid, this.properties.adminToolsAPIURL).subscribe(
|
||||
divHelpContents => {
|
||||
self.divHelpContents = divHelpContents as Array<DivHelpContent>;
|
||||
self.counter.all = self.divHelpContents.length;
|
||||
|
@ -184,7 +190,7 @@ export class DivHelpContentsComponent implements OnInit {
|
|||
}
|
||||
|
||||
public confirmedDeleteDivHelpContents(ids : string[]) {
|
||||
this._helpService.deleteDivHelpContents(ids).subscribe(
|
||||
this._helpService.deleteDivHelpContents(ids, this.properties.adminToolsAPIURL).subscribe(
|
||||
_ => this.deleteDivHelpContentsFromArray(ids),
|
||||
error => this.handleError('System error deleting the selected class content(s)', error)
|
||||
);
|
||||
|
@ -210,7 +216,7 @@ export class DivHelpContentsComponent implements OnInit {
|
|||
}
|
||||
|
||||
public toggleDivHelpContents(status : boolean, ids : string[]) {
|
||||
this._helpService.toggleDivHelpContents(ids,status).subscribe(
|
||||
this._helpService.toggleDivHelpContents(ids,status, this.properties.adminToolsAPIURL).subscribe(
|
||||
() => {
|
||||
for(let id of ids) {
|
||||
let i = this.checkboxes.findIndex(_ => _.divHelpContent._id == id);
|
||||
|
@ -224,7 +230,7 @@ export class DivHelpContentsComponent implements OnInit {
|
|||
}
|
||||
|
||||
public saveDivHelpContent(data : any):void {
|
||||
this._helpService.insertOrUpdateDivHelpContent(data).subscribe(
|
||||
this._helpService.insertOrUpdateDivHelpContent(data, this.properties.adminToolsAPIURL).subscribe(
|
||||
divHelpContent => this.divHelpContentSavedSuccessfully(divHelpContent),
|
||||
error => this.handleError('System error saving the specified help content', error)
|
||||
);
|
||||
|
|
|
@ -4,6 +4,7 @@ import { Subscription } from "rxjs/Subscription";
|
|||
import { HelpContentService } from "../../services/help-content.service";
|
||||
import { DivHelpContent } from "../../domain/div-help-content";
|
||||
import { ActivatedRoute, Router } from "@angular/router";
|
||||
import { EnvProperties } from '../../openaireLibrary/utils/properties/env-properties';
|
||||
|
||||
@Component({
|
||||
selector: 'edit-div-help-content',
|
||||
|
@ -24,6 +25,7 @@ export class EditDivHelpContentComponent implements OnInit, OnDestroy{
|
|||
private divHelpContent: DivHelpContent;
|
||||
|
||||
private errorMessage : string = null;
|
||||
public properties:EnvProperties = null;
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
|
@ -31,16 +33,19 @@ export class EditDivHelpContentComponent implements OnInit, OnDestroy{
|
|||
private _helpContentService: HelpContentService) {}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
this.route.data
|
||||
.subscribe((data: { envSpecific: EnvProperties }) => {
|
||||
this.properties = data.envSpecific;
|
||||
this.sub = this.route.queryParams.subscribe(params => {
|
||||
//let id = params['id'];
|
||||
let divContentId = params['classContentId'];
|
||||
this.communityPid = params['community'];
|
||||
this.pageId = params['pageId'];
|
||||
this._helpContentService.getDivHelpContent(divContentId as string).subscribe(
|
||||
this._helpContentService.getDivHelpContent(divContentId as string, this.properties.adminToolsAPIURL).subscribe(
|
||||
divHelpContent => this.updateForm(divHelpContent),
|
||||
error => this.handleError('System error retrieving class help content', error));
|
||||
});
|
||||
});
|
||||
}
|
||||
ngOnDestroy() {
|
||||
this.sub.unsubscribe();
|
||||
|
@ -51,7 +56,7 @@ export class EditDivHelpContentComponent implements OnInit, OnDestroy{
|
|||
}
|
||||
|
||||
getDivId(divId: string) {
|
||||
this._helpContentService.getDivId(divId).subscribe(
|
||||
this._helpContentService.getDivId(divId, this.properties.adminToolsAPIURL).subscribe(
|
||||
divId => {
|
||||
this.formComponent.pageId = divId.page;
|
||||
this.formComponent.getDivs(this.formComponent.pageId);
|
||||
|
@ -74,7 +79,7 @@ export class EditDivHelpContentComponent implements OnInit, OnDestroy{
|
|||
private saveCustom() {
|
||||
if(this.formComponent.myForm.valid) {
|
||||
let divHelpContent : DivHelpContent = this.formComponent.myForm.value;
|
||||
this._helpContentService.insertOrUpdateDivHelpContent(divHelpContent).subscribe(
|
||||
this._helpContentService.insertOrUpdateDivHelpContent(divHelpContent, this.properties.adminToolsAPIURL).subscribe(
|
||||
_ => {
|
||||
if(this.pageId) {
|
||||
this.router.navigate( ['/classContents/'], { queryParams: { "community": this.communityPid, "page": this.pageId } } );
|
||||
|
|
|
@ -3,6 +3,7 @@ import { ActivatedRoute, Router } from "@angular/router";
|
|||
import { DivContentFormComponent } from "./div-help-content-form.component";
|
||||
import { DivHelpContent } from "../../domain/div-help-content";
|
||||
import { HelpContentService } from "../../services/help-content.service";
|
||||
import { EnvProperties } from '../../openaireLibrary/utils/properties/env-properties';
|
||||
|
||||
@Component({
|
||||
selector: 'new-div-help-content',
|
||||
|
@ -19,6 +20,7 @@ export class NewDivHelpContentComponent {
|
|||
private communityPid: string;
|
||||
|
||||
private pageId: string;
|
||||
public properties:EnvProperties = null;
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
|
@ -26,10 +28,14 @@ export class NewDivHelpContentComponent {
|
|||
private _helpContentService: HelpContentService) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.data
|
||||
.subscribe((data: { envSpecific: EnvProperties }) => {
|
||||
this.properties = data.envSpecific;
|
||||
this.route.queryParams.subscribe(params => {
|
||||
this.communityPid = params['community'];
|
||||
this.pageId = params['pageId'];
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private saveCustom() {
|
||||
|
@ -39,7 +45,7 @@ export class NewDivHelpContentComponent {
|
|||
if(this.formComponent.myForm.valid) {
|
||||
let divHelpContent : DivHelpContent = this.formComponent.myForm.value;
|
||||
|
||||
this._helpContentService.insertOrUpdateDivHelpContent(divHelpContent).subscribe(
|
||||
this._helpContentService.insertOrUpdateDivHelpContent(divHelpContent, this.properties.adminToolsAPIURL).subscribe(
|
||||
_ => {
|
||||
if(this.pageId) {
|
||||
this.router.navigate( ['/classContents/'], { queryParams: { "community": this.communityPid, "page": this.pageId } } );
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { Component, ViewChild, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute } from "@angular/router";
|
||||
import { HelpContentService } from "../../services/help-content.service";
|
||||
import { FormGroup } from "@angular/forms";
|
||||
import { ModalFormComponent } from "../modal-form.component";
|
||||
|
@ -6,6 +7,7 @@ import { DeleteConfirmationDialogComponent } from "../delete-confirmation-dialog
|
|||
import { EntityFormComponent } from "./entity-form.component";
|
||||
import { CheckEntity, Entity } from "../../domain/entity";
|
||||
import { Community } from "../../domain/community";
|
||||
import { EnvProperties } from '../../openaireLibrary/utils/properties/env-properties';
|
||||
|
||||
@Component({
|
||||
selector: 'entities',
|
||||
|
@ -44,18 +46,23 @@ export class EntitiesComponent implements OnInit {
|
|||
public okModal:ModalFormComponent;
|
||||
public toggleIds: string[];
|
||||
public toggleStatus: boolean;
|
||||
public properties:EnvProperties = null;
|
||||
|
||||
ngOnInit() {
|
||||
this.getCommunities();
|
||||
this.formGroup = this.formComponent.form;
|
||||
this.route.data
|
||||
.subscribe((data: { envSpecific: EnvProperties }) => {
|
||||
this.properties = data.envSpecific;
|
||||
this.getCommunities();
|
||||
});
|
||||
|
||||
this.formGroup = this.formComponent.form;
|
||||
}
|
||||
|
||||
constructor(private _helpContentService: HelpContentService) {}
|
||||
constructor(private route: ActivatedRoute, private _helpContentService: HelpContentService) {}
|
||||
|
||||
getCommunities() {
|
||||
let self = this;
|
||||
this._helpContentService.getCommunities().subscribe(
|
||||
this._helpContentService.getCommunities(this.properties.adminToolsAPIURL).subscribe(
|
||||
communities => {
|
||||
self.communities = communities;
|
||||
self.selectedCommunityPid = self.communities[0].pid;
|
||||
|
@ -66,7 +73,7 @@ public toggleStatus: boolean;
|
|||
|
||||
getEntities(community_pid: string) {
|
||||
let self = this;
|
||||
this._helpContentService.getCommunityEntities(community_pid).subscribe(
|
||||
this._helpContentService.getCommunityEntities(community_pid, this.properties.adminToolsAPIURL).subscribe(
|
||||
entities => {
|
||||
self.entities = entities;
|
||||
self.checkboxes = [];
|
||||
|
@ -113,7 +120,7 @@ public toggleStatus: boolean;
|
|||
}
|
||||
|
||||
public confirmedDeleteEntities(ids : string[]) {
|
||||
this._helpContentService.deleteEntities(ids).subscribe(
|
||||
this._helpContentService.deleteEntities(ids, this.properties.adminToolsAPIURL).subscribe(
|
||||
_ => this.deleteEntitiesFromArray(ids),
|
||||
error => this.handleError('System error deleting the selected entities', error)
|
||||
);
|
||||
|
@ -177,7 +184,7 @@ public toggleStatus: boolean;
|
|||
}
|
||||
|
||||
public continueToggling(event: any) {
|
||||
this._helpContentService.toggleEntities(this.selectedCommunityPid,this.toggleIds,this.toggleStatus).subscribe(
|
||||
this._helpContentService.toggleEntities(this.selectedCommunityPid,this.toggleIds,this.toggleStatus, this.properties.adminToolsAPIURL).subscribe(
|
||||
() => {
|
||||
for(let id of this.toggleIds) {
|
||||
let i = this.checkboxes.findIndex(_ => _.entity._id == id);
|
||||
|
|
|
@ -7,6 +7,7 @@ import { Subscription } from "rxjs/Subscription";
|
|||
import { HelpContentService } from "../../services/help-content.service";
|
||||
import { PageHelpContent } from "../../domain/page-help-content";
|
||||
import { ActivatedRoute, Router } from "@angular/router";
|
||||
import { EnvProperties } from '../../openaireLibrary/utils/properties/env-properties';
|
||||
|
||||
@Component({
|
||||
selector: 'edit-page-help-content',
|
||||
|
@ -27,6 +28,7 @@ export class EditPageHelpContentComponent implements OnInit, OnDestroy{
|
|||
private pageHelpContent: PageHelpContent;
|
||||
|
||||
private errorMessage : string = null;
|
||||
public properties:EnvProperties = null;
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
|
@ -34,16 +36,19 @@ export class EditPageHelpContentComponent implements OnInit, OnDestroy{
|
|||
private _helpContentService: HelpContentService) {}
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
this.sub = this.route.queryParams.subscribe(params => {
|
||||
//let id = params['id'];
|
||||
let pageContentId = params['pageContentId'];
|
||||
this.communityPid = params['community'];
|
||||
this.pageId = params['pageId'];
|
||||
this._helpContentService.getPageHelpContent(pageContentId as string).subscribe(
|
||||
pageHelpContent => this.updateForm(pageHelpContent),
|
||||
error => this.handleError('System error retrieving page help content', error));
|
||||
});
|
||||
this.route.data
|
||||
.subscribe((data: { envSpecific: EnvProperties }) => {
|
||||
this.properties = data.envSpecific;
|
||||
this.sub = this.route.queryParams.subscribe(params => {
|
||||
//let id = params['id'];
|
||||
let pageContentId = params['pageContentId'];
|
||||
this.communityPid = params['community'];
|
||||
this.pageId = params['pageId'];
|
||||
this._helpContentService.getPageHelpContent(pageContentId as string, this.properties.adminToolsAPIURL).subscribe(
|
||||
pageHelpContent => this.updateForm(pageHelpContent),
|
||||
error => this.handleError('System error retrieving page help content', error));
|
||||
});
|
||||
});
|
||||
}
|
||||
ngOnDestroy() {
|
||||
this.sub.unsubscribe();
|
||||
|
@ -64,7 +69,7 @@ export class EditPageHelpContentComponent implements OnInit, OnDestroy{
|
|||
if(this.formComponent.myForm.valid) {
|
||||
let pageHelpContent : PageHelpContent = this.formComponent.myForm.value;
|
||||
console.info(pageHelpContent.community);
|
||||
this._helpContentService.updatePageHelpContent(pageHelpContent).subscribe(
|
||||
this._helpContentService.updatePageHelpContent(pageHelpContent, this.properties.adminToolsAPIURL).subscribe(
|
||||
_ => {
|
||||
if(this.pageId) {
|
||||
this.router.navigate( ['/pageContents/'], { queryParams: { "community": this.communityPid, "page": this.pageId } } );
|
||||
|
|
|
@ -6,6 +6,7 @@ import { ActivatedRoute, Router } from "@angular/router";
|
|||
import { PageContentFormComponent } from "./page-help-content-form.component";
|
||||
import { PageHelpContent } from "../../domain/page-help-content";
|
||||
import { HelpContentService } from "../../services/help-content.service";
|
||||
import { EnvProperties } from '../../openaireLibrary/utils/properties/env-properties';
|
||||
|
||||
@Component({
|
||||
selector: 'new-page-help-content',
|
||||
|
@ -22,6 +23,7 @@ export class NewPageHelpContentComponent {
|
|||
private communityPid: string;
|
||||
|
||||
private pageId: string;
|
||||
public properties:EnvProperties = null;
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
|
@ -29,10 +31,14 @@ export class NewPageHelpContentComponent {
|
|||
private _helpContentService: HelpContentService) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.queryParams.subscribe(params => {
|
||||
this.communityPid = params['community'];
|
||||
this.pageId = params['pageId'];
|
||||
});
|
||||
this.route.data
|
||||
.subscribe((data: { envSpecific: EnvProperties }) => {
|
||||
this.properties = data.envSpecific;
|
||||
this.route.queryParams.subscribe(params => {
|
||||
this.communityPid = params['community'];
|
||||
this.pageId = params['pageId'];
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private saveCustom() {
|
||||
|
@ -42,7 +48,7 @@ export class NewPageHelpContentComponent {
|
|||
if(this.formComponent.myForm.valid) {
|
||||
let pageHelpContent : PageHelpContent = this.formComponent.myForm.value;
|
||||
|
||||
this._helpContentService.savePageHelpContent(pageHelpContent).subscribe(
|
||||
this._helpContentService.savePageHelpContent(pageHelpContent, this.properties.adminToolsAPIURL).subscribe(
|
||||
_ => {
|
||||
if(this.pageId) {
|
||||
this.router.navigate( ['/pageContents/'], { queryParams: { "community": this.communityPid, "page": this.pageId } } );
|
||||
|
|
|
@ -2,9 +2,11 @@
|
|||
* Created by stefania on 7/14/17.
|
||||
*/
|
||||
import { Component, OnInit, Input } from '@angular/core';
|
||||
import { ActivatedRoute } from "@angular/router";
|
||||
import { FormGroup, FormBuilder, Validators } from "@angular/forms";
|
||||
import { Page } from "../../domain/page";
|
||||
import { HelpContentService } from "../../services/help-content.service";
|
||||
import { EnvProperties } from '../../openaireLibrary/utils/properties/env-properties';
|
||||
|
||||
|
||||
@Component({
|
||||
|
@ -25,14 +27,19 @@ export class PageContentFormComponent implements OnInit{
|
|||
private errorMessage: string;
|
||||
|
||||
private ckeditorContent : string;
|
||||
public properties:EnvProperties = null;
|
||||
|
||||
constructor(private _fb: FormBuilder, private _helpContentService: HelpContentService){}
|
||||
constructor(private route: ActivatedRoute,private _fb: FormBuilder, private _helpContentService: HelpContentService){}
|
||||
|
||||
ngOnInit() {
|
||||
this.myForm = this.form;
|
||||
this._helpContentService.getCommunityPages(this.communityPid).subscribe(
|
||||
pages => this.availablePages = pages,
|
||||
error => this.handleError('System error retrieving pages', error));
|
||||
this.route.data
|
||||
.subscribe((data: { envSpecific: EnvProperties }) => {
|
||||
this.properties = data.envSpecific;
|
||||
this._helpContentService.getCommunityPages(this.communityPid, this.properties.adminToolsAPIURL).subscribe(
|
||||
pages => this.availablePages = pages,
|
||||
error => this.handleError('System error retrieving pages', error));
|
||||
});
|
||||
}
|
||||
|
||||
public get form() {
|
||||
|
|
|
@ -10,6 +10,7 @@ import { PageHelpContent, CheckPageHelpContent, PageHelpContentFilterOptions } f
|
|||
import { Page } from "../../domain/page";
|
||||
import {Router} from "@angular/router";
|
||||
import { Community } from "../../domain/community";
|
||||
import { EnvProperties } from '../../openaireLibrary/utils/properties/env-properties';
|
||||
|
||||
@Component({
|
||||
selector: 'page-help-contents',
|
||||
|
@ -56,21 +57,26 @@ export class PageHelpContentsComponent implements OnInit {
|
|||
public community: Community;
|
||||
|
||||
public page: Page;
|
||||
public properties:EnvProperties = null;
|
||||
|
||||
ngOnInit() {
|
||||
this.route.queryParams.subscribe(params => {
|
||||
this.route.data
|
||||
.subscribe((data: { envSpecific: EnvProperties }) => {
|
||||
this.properties = data.envSpecific;
|
||||
this.route.queryParams.subscribe(params => {
|
||||
|
||||
this.selectedCommunityPid = params['community'];
|
||||
this.selectedPageId = params['page'];
|
||||
this.selectedCommunityPid = params['community'];
|
||||
this.selectedPageId = params['page'];
|
||||
|
||||
if(this.selectedCommunityPid && this.selectedPageId) {
|
||||
this.getPageHelpContents(this.selectedCommunityPid);
|
||||
this.getPage(this.selectedPageId);
|
||||
this.getCommunity(this.selectedCommunityPid);
|
||||
} else {
|
||||
this.selectedPageId = "";
|
||||
this.getCommunities();
|
||||
}
|
||||
if(this.selectedCommunityPid && this.selectedPageId) {
|
||||
this.getPageHelpContents(this.selectedCommunityPid);
|
||||
this.getPage(this.selectedPageId);
|
||||
this.getCommunity(this.selectedCommunityPid);
|
||||
} else {
|
||||
this.selectedPageId = "";
|
||||
this.getCommunities();
|
||||
}
|
||||
});
|
||||
});
|
||||
// this.formGroup = this.formComponent.form;
|
||||
}
|
||||
|
@ -79,7 +85,7 @@ export class PageHelpContentsComponent implements OnInit {
|
|||
|
||||
getPage(pageId: string) {
|
||||
let self = this;
|
||||
this._helpService.getPage(pageId).subscribe(
|
||||
this._helpService.getPage(pageId, this.properties.adminToolsAPIURL).subscribe(
|
||||
page => {
|
||||
self.page = page;
|
||||
}
|
||||
|
@ -88,7 +94,7 @@ export class PageHelpContentsComponent implements OnInit {
|
|||
|
||||
getCommunity(communityPid: string) {
|
||||
let self = this;
|
||||
this._helpService.getCommunity(communityPid).subscribe(
|
||||
this._helpService.getCommunity(communityPid, this.properties.adminToolsAPIURL).subscribe(
|
||||
community => {
|
||||
self.community = community;
|
||||
}
|
||||
|
@ -97,7 +103,7 @@ export class PageHelpContentsComponent implements OnInit {
|
|||
|
||||
getCommunities() {
|
||||
let self = this;
|
||||
this._helpService.getCommunities().subscribe(
|
||||
this._helpService.getCommunities(this.properties.adminToolsAPIURL).subscribe(
|
||||
communities => {
|
||||
self.communities = communities;
|
||||
self.selectedCommunityPid = self.communities[0].pid;
|
||||
|
@ -108,7 +114,7 @@ export class PageHelpContentsComponent implements OnInit {
|
|||
}
|
||||
|
||||
getPages(community_pid: string) {
|
||||
this._helpService.getCommunityPages(community_pid).subscribe(
|
||||
this._helpService.getCommunityPages(community_pid, this.properties.adminToolsAPIURL).subscribe(
|
||||
pages => this.pages = pages,
|
||||
error => this.handleError('System error retrieving pages', error));
|
||||
}
|
||||
|
@ -128,7 +134,7 @@ export class PageHelpContentsComponent implements OnInit {
|
|||
|
||||
getPageHelpContents(community_pid: string) {
|
||||
let self = this;
|
||||
this._helpService.getCommunityPageHelpContents(community_pid).subscribe(
|
||||
this._helpService.getCommunityPageHelpContents(community_pid, this.properties.adminToolsAPIURL).subscribe(
|
||||
pageHelpContents => {
|
||||
self.pageHelpContents = pageHelpContents as Array<PageHelpContent>;
|
||||
self.counter.all = self.pageHelpContents.length;
|
||||
|
@ -183,7 +189,7 @@ export class PageHelpContentsComponent implements OnInit {
|
|||
}
|
||||
|
||||
public confirmedDeletePageHelpContents(ids : string[]) {
|
||||
this._helpService.deletePageHelpContents(ids).subscribe(
|
||||
this._helpService.deletePageHelpContents(ids, this.properties.adminToolsAPIURL).subscribe(
|
||||
_ => this.deletePageHelpContentsFromArray(ids),
|
||||
error => this.handleError('System error deleting the selected page content(s)', error)
|
||||
);
|
||||
|
@ -209,7 +215,7 @@ export class PageHelpContentsComponent implements OnInit {
|
|||
}
|
||||
|
||||
public togglePageHelpContents(status : boolean, ids : string[]) {
|
||||
this._helpService.togglePageHelpContents(ids,status).subscribe(
|
||||
this._helpService.togglePageHelpContents(ids,status, this.properties.adminToolsAPIURL).subscribe(
|
||||
() => {
|
||||
for(let id of ids) {
|
||||
let i = this.checkboxes.findIndex(_ => _.pageHelpContent._id == id);
|
||||
|
@ -225,7 +231,7 @@ export class PageHelpContentsComponent implements OnInit {
|
|||
|
||||
public savePageHelpContent(data : any):void {
|
||||
console.log(data);
|
||||
this._helpService.savePageHelpContent(data).subscribe(
|
||||
this._helpService.savePageHelpContent(data, this.properties.adminToolsAPIURL).subscribe(
|
||||
pageHelpContent => this.pageHelpContentSavedSuccessfully(pageHelpContent),
|
||||
error => this.handleError('System error saving the specified help content', error)
|
||||
);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
*/
|
||||
import { Component, ViewChild, Input, Output, EventEmitter, OnInit } from '@angular/core';
|
||||
import { ModalDirective } from 'ngx-bootstrap/modal';
|
||||
import { ActivatedRoute } from "@angular/router";
|
||||
import { FormGroup } from "@angular/forms";
|
||||
import { FAQService } from "../services/faq.service";
|
||||
import { Topic } from "../domain/topic";
|
||||
|
@ -12,6 +13,7 @@ import { Page } from "../domain/page";
|
|||
import { Entity } from "../domain/entity";
|
||||
import { Community } from "../domain/community";
|
||||
import { DivId } from "../domain/divId";
|
||||
import { EnvProperties } from '../openaireLibrary/utils/properties/env-properties';
|
||||
|
||||
@Component({
|
||||
selector: 'modal-form',
|
||||
|
@ -19,7 +21,7 @@ import { DivId } from "../domain/divId";
|
|||
})
|
||||
export class ModalFormComponent {
|
||||
|
||||
constructor(private _faqService : FAQService, private _helpService: HelpContentService){
|
||||
constructor(private route: ActivatedRoute, private _faqService : FAQService, private _helpService: HelpContentService){
|
||||
}
|
||||
|
||||
@ViewChild('autoShownModal')
|
||||
|
@ -45,6 +47,15 @@ export class ModalFormComponent {
|
|||
@Output() emmitObject: EventEmitter<any> = new EventEmitter();
|
||||
|
||||
@Output() emmitError: EventEmitter<any> = new EventEmitter();
|
||||
public properties:EnvProperties = null;
|
||||
|
||||
ngOnInit() {
|
||||
|
||||
this.route.data
|
||||
.subscribe((data: { envSpecific: EnvProperties }) => {
|
||||
this.properties = data.envSpecific;
|
||||
});
|
||||
}
|
||||
|
||||
public showModal():void {
|
||||
this.isModalShown = true;
|
||||
|
@ -81,14 +92,14 @@ export class ModalFormComponent {
|
|||
);
|
||||
} else if (this.type == 'community') {
|
||||
if(this.saveText == 'Update') {
|
||||
this._helpService.updateCommunity(<Community> obj).subscribe(
|
||||
this._helpService.updateCommunity(<Community> obj, this.properties.adminToolsAPIURL).subscribe(
|
||||
data => this.emmitObject.emit(data),
|
||||
error => this.emmitError.emit(error)
|
||||
);
|
||||
console.info(<Community> obj);
|
||||
|
||||
} else if(this.saveText == 'Save') {
|
||||
this._helpService.saveCommunity(<Community> obj).subscribe(
|
||||
this._helpService.saveCommunity(<Community> obj, this.properties.adminToolsAPIURL).subscribe(
|
||||
data => this.emmitObject.emit(data),
|
||||
error => this.emmitError.emit(error)
|
||||
);
|
||||
|
@ -96,37 +107,36 @@ export class ModalFormComponent {
|
|||
}
|
||||
} else if (this.type == 'page') {
|
||||
if(this.saveText == 'Update') {
|
||||
this._helpService.updatePage(<Page> obj).subscribe(
|
||||
this._helpService.updatePage(<Page> obj, this.properties.adminToolsAPIURL).subscribe(
|
||||
data => this.emmitObject.emit(data),
|
||||
error => this.emmitError.emit(error)
|
||||
);
|
||||
} else if(this.saveText == 'Save') {
|
||||
this._helpService.savePage(<Page> obj).subscribe(
|
||||
this._helpService.savePage(<Page> obj, this.properties.adminToolsAPIURL).subscribe(
|
||||
data => this.emmitObject.emit(data),
|
||||
error => this.emmitError.emit(error)
|
||||
);
|
||||
}
|
||||
} else if (this.type == 'entity') {
|
||||
if(this.saveText == 'Update') {
|
||||
this._helpService.updateEntity(<Entity> obj).subscribe(
|
||||
this._helpService.updateEntity(<Entity> obj, this.properties.adminToolsAPIURL).subscribe(
|
||||
data => this.emmitObject.emit(data),
|
||||
error => this.emmitError.emit(error)
|
||||
);
|
||||
} else if(this.saveText == 'Save') {
|
||||
this._helpService.saveEntity(<Entity> obj).subscribe(
|
||||
this._helpService.saveEntity(<Entity> obj, this.properties.adminToolsAPIURL).subscribe(
|
||||
data => this.emmitObject.emit(data),
|
||||
error => this.emmitError.emit(error)
|
||||
);
|
||||
}
|
||||
} else if (this.type == 'divId') {
|
||||
if(this.saveText == 'Update') {
|
||||
this._helpService.updateDivId(<DivId> obj).subscribe(
|
||||
this._helpService.updateDivId(<DivId> obj, this.properties.adminToolsAPIURL).subscribe(
|
||||
data => this.emmitObject.emit(data),
|
||||
error => this.emmitError.emit(error)
|
||||
);
|
||||
} else if(this.saveText == 'Save') {
|
||||
//console.info(<DivId> obj);
|
||||
this._helpService.saveDivId(<DivId> obj).subscribe(
|
||||
this._helpService.saveDivId(<DivId> obj, this.properties.adminToolsAPIURL).subscribe(
|
||||
data => this.emmitObject.emit(data),
|
||||
error => this.emmitError.emit(error)
|
||||
);
|
||||
|
|
|
@ -2,9 +2,11 @@
|
|||
* Created by stefania on 7/13/17.
|
||||
*/
|
||||
import {Component, OnInit, Input} from '@angular/core';
|
||||
import { ActivatedRoute } from "@angular/router";
|
||||
import {FormGroup, FormArray, FormBuilder, Validators} from "@angular/forms";
|
||||
import {Entity} from '../../domain/entity';
|
||||
import { HelpContentService } from "../../services/help-content.service";
|
||||
import { EnvProperties } from '../../openaireLibrary/utils/properties/env-properties';
|
||||
|
||||
@Component({
|
||||
selector: 'page-form',
|
||||
|
@ -22,10 +24,16 @@ export class PageFormComponent implements OnInit{
|
|||
|
||||
public allEntities: Map<Entity, boolean> = new Map<Entity, boolean>();
|
||||
private gotEntities: boolean = false;
|
||||
public properties:EnvProperties = null;
|
||||
|
||||
constructor(public _fb: FormBuilder, private _helpContentService: HelpContentService){}
|
||||
constructor(private route: ActivatedRoute,public _fb: FormBuilder, private _helpContentService: HelpContentService){}
|
||||
|
||||
ngOnInit(): void {}
|
||||
ngOnInit(): void {
|
||||
this.route.data
|
||||
.subscribe((data: { envSpecific: EnvProperties }) => {
|
||||
this.properties = data.envSpecific;
|
||||
});
|
||||
}
|
||||
|
||||
public toggle() {
|
||||
this.myForm.value.isCollapsed = !this.myForm.value.isCollapsed;
|
||||
|
@ -57,7 +65,7 @@ export class PageFormComponent implements OnInit{
|
|||
|
||||
public getEntities(includedEntities: Set<String>) {
|
||||
let self = this;
|
||||
this._helpContentService.getEntities().subscribe(
|
||||
this._helpContentService.getEntities(this.properties.adminToolsAPIURL).subscribe(
|
||||
entities => {
|
||||
for(let entity of entities) {
|
||||
if(includedEntities.has(entity._id)) {
|
||||
|
|
|
@ -11,6 +11,7 @@ import { PageFormComponent } from "./page-form.component";
|
|||
import { CheckPage, Page } from "../../domain/page";
|
||||
import { Community } from "../../domain/community";
|
||||
import { Entity } from "../../domain/entity";
|
||||
import { EnvProperties } from '../../openaireLibrary/utils/properties/env-properties';
|
||||
|
||||
@Component({
|
||||
selector: 'pages',
|
||||
|
@ -48,17 +49,22 @@ export class PagesComponent implements OnInit {
|
|||
public selectedCommunityPid: string;
|
||||
|
||||
public pagesType: string;
|
||||
public properties:EnvProperties = null;
|
||||
|
||||
ngOnInit() {
|
||||
this.formGroup = this.formComponent.form;
|
||||
// this.getCommunities();
|
||||
this.route.data
|
||||
.subscribe((data: { envSpecific: EnvProperties }) => {
|
||||
this.properties = data.envSpecific;
|
||||
// this.getCommunities();
|
||||
|
||||
this.route.queryParams.subscribe(params => {
|
||||
this.pagesType = "";
|
||||
if(params['type']) {
|
||||
this.pagesType = params['type'];
|
||||
}
|
||||
this.getCommunities();
|
||||
this.route.queryParams.subscribe(params => {
|
||||
this.pagesType = "";
|
||||
if(params['type']) {
|
||||
this.pagesType = params['type'];
|
||||
}
|
||||
this.getCommunities();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -68,13 +74,13 @@ export class PagesComponent implements OnInit {
|
|||
let self = this;
|
||||
|
||||
if(this.pagesType) {
|
||||
this._helpContentService.getCommunityPagesByType(community_pid, "?page_type="+this.pagesType).subscribe(
|
||||
this._helpContentService.getCommunityPagesByType(community_pid, "?page_type="+this.pagesType, this.properties.adminToolsAPIURL).subscribe(
|
||||
pages => {
|
||||
self.pagesReturned(pages);
|
||||
},
|
||||
error => this.handleError('System error retrieving pages', error));
|
||||
} else {
|
||||
this._helpContentService.getCommunityPages(community_pid).subscribe(
|
||||
this._helpContentService.getCommunityPages(community_pid, this.properties.adminToolsAPIURL).subscribe(
|
||||
pages => {
|
||||
self.pagesReturned(pages);
|
||||
},
|
||||
|
@ -84,7 +90,7 @@ export class PagesComponent implements OnInit {
|
|||
|
||||
getPagesWithDivIds(community_pid: string) {
|
||||
let self = this;
|
||||
this._helpContentService.getPagesWithDivIds(community_pid).subscribe(
|
||||
this._helpContentService.getPagesWithDivIds(community_pid, this.properties.adminToolsAPIURL).subscribe(
|
||||
pages => {
|
||||
self.pageWithDivIds = pages[community_pid];
|
||||
},
|
||||
|
@ -102,7 +108,7 @@ export class PagesComponent implements OnInit {
|
|||
|
||||
getCommunities() {
|
||||
let self = this;
|
||||
this._helpContentService.getCommunities().subscribe(
|
||||
this._helpContentService.getCommunities(this.properties.adminToolsAPIURL).subscribe(
|
||||
communities => {
|
||||
self.communities = communities;
|
||||
self.selectedCommunityPid = self.communities[0].pid;
|
||||
|
@ -147,7 +153,7 @@ export class PagesComponent implements OnInit {
|
|||
}
|
||||
|
||||
public confirmedDeletePages(ids : string[]) {
|
||||
this._helpContentService.deletePages(ids).subscribe(
|
||||
this._helpContentService.deletePages(ids, this.properties.adminToolsAPIURL).subscribe(
|
||||
_ => this.deletePagesFromArray(ids),
|
||||
error => this.handleError('System error deleting the selected pages', error)
|
||||
);
|
||||
|
@ -214,7 +220,7 @@ export class PagesComponent implements OnInit {
|
|||
}
|
||||
|
||||
public togglePages(status : boolean, ids : string[]) {
|
||||
this._helpContentService.togglePages(this.selectedCommunityPid,ids,status).subscribe(
|
||||
this._helpContentService.togglePages(this.selectedCommunityPid,ids,status, this.properties.adminToolsAPIURL).subscribe(
|
||||
() => {
|
||||
for(let id of ids) {
|
||||
// let i = this.checkboxes.findIndex(_ => _.page._id == id);
|
||||
|
|
|
@ -19,7 +19,7 @@ export class StatsComponent implements OnInit {
|
|||
}
|
||||
|
||||
getStatistics() {
|
||||
this.contentService.getStatistics('egi').subscribe(
|
||||
this.contentService.getStatistics('egi',"").subscribe(
|
||||
stats => this.stats = stats,
|
||||
error => console.log(error),
|
||||
() => {
|
||||
|
@ -32,4 +32,4 @@ export class StatsComponent implements OnInit {
|
|||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
import { NgModule} from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { RouterModule } from '@angular/router';
|
||||
|
||||
import{ReloadModule} from '../openaireLibrary/reload/reload.module';
|
||||
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule, FormsModule, RouterModule, ReloadModule
|
||||
],
|
||||
declarations: [
|
||||
|
||||
],
|
||||
providers:[
|
||||
|
||||
],
|
||||
exports: [
|
||||
|
||||
]
|
||||
})
|
||||
export class LibReloadModule { }
|
|
@ -10,6 +10,8 @@ import { Community } from "../domain/community";
|
|||
import { Entity } from "../domain/entity";
|
||||
import { DivId } from "../domain/divId";
|
||||
import { DivHelpContent } from "../domain/div-help-content";
|
||||
import {COOKIE} from "../openaireLibrary/login/utils/helper.class"
|
||||
|
||||
import {CommunityStatistics} from "../domain/statistics-classes";
|
||||
|
||||
@Injectable()
|
||||
|
@ -18,8 +20,6 @@ export class HelpContentService {
|
|||
constructor(private http:Http) {
|
||||
}
|
||||
|
||||
private _helpContentUrl = process.env.API_ENDPOINT;
|
||||
|
||||
static removeNulls(obj){
|
||||
var isArray = obj instanceof Array;
|
||||
for (var k in obj){
|
||||
|
@ -28,222 +28,222 @@ export class HelpContentService {
|
|||
}
|
||||
}
|
||||
|
||||
getDivIdsFull(community_pid: string, page_id: string) {
|
||||
getDivIdsFull(community_pid: string, page_id: string, helpContentUrl:string) {
|
||||
if(page_id) {
|
||||
return this.http.get(this._helpContentUrl + 'divFull?community='+community_pid+'&page='+page_id)
|
||||
return this.http.get(helpContentUrl + 'divFull?community='+community_pid+'&page='+page_id)
|
||||
.map(res => <Array<DivId>> res.json())
|
||||
.catch(this.handleError);
|
||||
} else {
|
||||
return this.http.get(this._helpContentUrl + 'divFull?community='+community_pid)
|
||||
return this.http.get(helpContentUrl + 'divFull?community='+community_pid)
|
||||
.map(res => <Array<DivId>> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
}
|
||||
|
||||
updateDivId(divId: DivId) {
|
||||
updateDivId(divId: DivId, helpContentUrl:string) {
|
||||
let headers = new Headers({'Content-Type': 'application/json'});
|
||||
let options = new RequestOptions({headers: headers});
|
||||
|
||||
HelpContentService.removeNulls(divId);
|
||||
|
||||
return this.http.post(this._helpContentUrl + 'div/update', JSON.stringify(divId), options)
|
||||
return this.http.post(helpContentUrl + 'div/update', JSON.stringify(divId), options)
|
||||
.map(res => <DivId> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
getDivId(divId: string) {
|
||||
return this.http.get(this._helpContentUrl + 'div/'+divId)
|
||||
getDivId(divId: string, helpContentUrl:string) {
|
||||
return this.http.get(helpContentUrl + 'div/'+divId)
|
||||
.map(res => <DivId> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
saveDivId(divId: DivId) {
|
||||
saveDivId(divId: DivId, helpContentUrl:string) {
|
||||
let headers = new Headers({'Content-Type': 'application/json'});
|
||||
let options = new RequestOptions({headers: headers});
|
||||
|
||||
HelpContentService.removeNulls(divId);
|
||||
|
||||
return this.http.post(this._helpContentUrl + 'div/save', JSON.stringify(divId), options)
|
||||
return this.http.post(helpContentUrl + 'div/save', JSON.stringify(divId), options)
|
||||
.map(res => <DivId> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
getCommunitiesWithDivId() {
|
||||
return this.http.get(this._helpContentUrl + 'community?div=true')
|
||||
getCommunitiesWithDivId(helpContentUrl:string) {
|
||||
return this.http.get(helpContentUrl + 'community?div=true')
|
||||
.map(res => <Array<Community>> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
getCommunityPagesWithDivId(community_pid: string) {
|
||||
return this.http.get(this._helpContentUrl + 'community/'+community_pid+'/pages?div=true')
|
||||
getCommunityPagesWithDivId(community_pid: string, helpContentUrl:string) {
|
||||
return this.http.get(helpContentUrl + 'community/'+community_pid+'/pages?div=true')
|
||||
.map(res => <Array<Page>> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
getCommunityDivHelpContents(community_pid: string) {
|
||||
return this.http.get(this._helpContentUrl + 'divhelpcontent?community='+community_pid)
|
||||
getCommunityDivHelpContents(community_pid: string, helpContentUrl:string) {
|
||||
return this.http.get(helpContentUrl + 'divhelpcontent?community='+community_pid)
|
||||
.map(res => <Array<DivHelpContent>> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
getDivHelpContent(id : string) {
|
||||
return this.http.get(this._helpContentUrl + 'divhelpcontent/' + id)
|
||||
getDivHelpContent(id : string, helpContentUrl:string) {
|
||||
return this.http.get(helpContentUrl + 'divhelpcontent/' + id)
|
||||
.map(res => <DivHelpContent> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
insertOrUpdateDivHelpContent(divHelpContent: DivHelpContent) {
|
||||
insertOrUpdateDivHelpContent(divHelpContent: DivHelpContent, helpContentUrl:string) {
|
||||
|
||||
let headers = new Headers({'Content-Type': 'application/json'});
|
||||
let options = new RequestOptions({headers: headers});
|
||||
|
||||
HelpContentService.removeNulls(divHelpContent);
|
||||
|
||||
return this.http.post(this._helpContentUrl + 'divhelpcontent', JSON.stringify(divHelpContent), options)
|
||||
return this.http.post(helpContentUrl + 'divhelpcontent', JSON.stringify(divHelpContent), options)
|
||||
.map(res => <DivHelpContent> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
deleteDivIds(ids : string[]) {
|
||||
deleteDivIds(ids : string[], helpContentUrl:string) {
|
||||
let headers = new Headers({'Content-Type': 'application/json'});
|
||||
let options = new RequestOptions({headers: headers});
|
||||
|
||||
return this.http.post(this._helpContentUrl + 'div/delete',JSON.stringify(ids), options)
|
||||
return this.http.post(helpContentUrl + 'div/delete',JSON.stringify(ids), options)
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
deleteDivHelpContents(ids : string[]) {
|
||||
deleteDivHelpContents(ids : string[], helpContentUrl:string) {
|
||||
let headers = new Headers({'Content-Type': 'application/json'});
|
||||
let options = new RequestOptions({headers: headers});
|
||||
|
||||
return this.http.post(this._helpContentUrl + 'divhelpcontent/delete',JSON.stringify(ids), options)
|
||||
return this.http.post(helpContentUrl + 'divhelpcontent/delete',JSON.stringify(ids), options)
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
toggleDivHelpContents(ids : string[],status : boolean) {
|
||||
toggleDivHelpContents(ids : string[],status : boolean, helpContentUrl:string) {
|
||||
let headers = new Headers({'Content-Type': 'application/json'});
|
||||
let options = new RequestOptions({headers: headers});
|
||||
|
||||
return this.http.post(this._helpContentUrl + 'divhelpcontent/toggle?status='+ status.toString(), JSON.stringify(ids), options)
|
||||
return this.http.post(helpContentUrl + 'divhelpcontent/toggle?status='+ status.toString(), JSON.stringify(ids), options)
|
||||
//.map( res => <string[]> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
getPagesWithDivIds(community_pid: string) {
|
||||
return this.http.get(this._helpContentUrl + 'div/pages?communtity='+community_pid)
|
||||
getPagesWithDivIds(community_pid: string, helpContentUrl:string) {
|
||||
return this.http.get(helpContentUrl + 'div/pages?communtity='+community_pid)
|
||||
.map(res => <Map<string, Set<string>>> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
getPages() {
|
||||
return this.http.get(this._helpContentUrl + 'page')
|
||||
getPages(helpContentUrl:string) {
|
||||
return this.http.get(helpContentUrl + 'page')
|
||||
.map(res => <Array<Page>> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
getPage(pageId:string) {
|
||||
return this.http.get(this._helpContentUrl + 'page/'+pageId)
|
||||
getPage(pageId:string, helpContentUrl:string) {
|
||||
return this.http.get(helpContentUrl + 'page/'+pageId)
|
||||
.map(res => <Page> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
getCommunities() {
|
||||
return this.http.get(this._helpContentUrl + 'community')
|
||||
getCommunities( helpContentUrl:string) {
|
||||
return this.http.get(helpContentUrl + 'community')
|
||||
.map(res => <Array<Community>> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
getCommunity(community_pid: string) {
|
||||
return this.http.get(this._helpContentUrl + 'community/'+community_pid)
|
||||
getCommunity(community_pid: string, helpContentUrl:string) {
|
||||
return this.http.get(helpContentUrl + 'community/'+community_pid)
|
||||
.map(res => <Community> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
getCommunitiesFull() {
|
||||
return this.http.get(this._helpContentUrl + 'communityFull')
|
||||
getCommunitiesFull( helpContentUrl:string) {
|
||||
return this.http.get(helpContentUrl + 'communityFull')
|
||||
.map(res => <Array<Community>> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
getCommunityFull(community_pid: string) {
|
||||
return this.http.get(this._helpContentUrl + 'communityFull/'+community_pid)
|
||||
getCommunityFull(community_pid: string, helpContentUrl:string) {
|
||||
return this.http.get(helpContentUrl + 'communityFull/'+community_pid)
|
||||
.map(res => <Community> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
saveCommunity(community: Community) {
|
||||
let headers = new Headers({'Content-Type': 'application/json'});
|
||||
let options = new RequestOptions({headers: headers});
|
||||
saveCommunity(community: Community, helpContentUrl:string) {
|
||||
// let headers = new Headers({'Content-Type': 'application/json'});
|
||||
// let options = new RequestOptions({headers: headers});
|
||||
|
||||
HelpContentService.removeNulls(community);
|
||||
|
||||
return this.http.post(this._helpContentUrl + 'community/save', JSON.stringify(community), options)
|
||||
return this.http.post(helpContentUrl + 'community/save', JSON.stringify(community), this.getAuthOptionsWithBody())
|
||||
.map(res => <Community> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
updateCommunity(community: Community) {
|
||||
let headers = new Headers({'Content-Type': 'application/json'});
|
||||
let options = new RequestOptions({headers: headers});
|
||||
updateCommunity(community: Community, helpContentUrl:string) {
|
||||
// let headers = new Headers({'Content-Type': 'application/json'});
|
||||
// let options = new RequestOptions({headers: headers});
|
||||
|
||||
HelpContentService.removeNulls(community);
|
||||
|
||||
return this.http.post(this._helpContentUrl + 'community/update', JSON.stringify(community), options)
|
||||
return this.http.post(helpContentUrl + 'community/update', JSON.stringify(community), this.getAuthOptionsWithBody())
|
||||
.map(res => <Community> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
deleteCommunities(ids : string[]) {
|
||||
let headers = new Headers({'Content-Type': 'application/json'});
|
||||
let options = new RequestOptions({headers: headers});
|
||||
deleteCommunities(ids : string[], helpContentUrl:string) {
|
||||
// let headers = new Headers({'Content-Type': 'application/json'});
|
||||
// let options = new RequestOptions({headers: headers});
|
||||
|
||||
return this.http.post(this._helpContentUrl + 'community/delete',JSON.stringify(ids), options)
|
||||
return this.http.post(helpContentUrl + 'community/delete',JSON.stringify(ids), this.getAuthOptionsWithBody())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
getCommunityPages(community_pid: string) {
|
||||
return this.http.get(this._helpContentUrl + 'community/'+community_pid+'/pages')
|
||||
getCommunityPages(community_pid: string, helpContentUrl:string) {
|
||||
return this.http.get(helpContentUrl + 'community/'+community_pid+'/pages')
|
||||
.map(res => <Array<Page>> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
getCommunityPagesByType(community_pid: string, params: string) {
|
||||
return this.http.get(this._helpContentUrl + 'community/'+community_pid+'/pages'+params)
|
||||
getCommunityPagesByType(community_pid: string, params: string, helpContentUrl:string) {
|
||||
return this.http.get(helpContentUrl + 'community/'+community_pid+'/pages'+params)
|
||||
.map(res => <Array<Page>> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
getEntities() {
|
||||
return this.http.get(this._helpContentUrl + 'entity')
|
||||
getEntities(helpContentUrl:string) {
|
||||
return this.http.get(helpContentUrl + 'entity')
|
||||
.map(res => <Array<Entity>> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
getCommunityEntities(community_pid: string) {
|
||||
return this.http.get(this._helpContentUrl + 'community/'+community_pid+'/entities')
|
||||
getCommunityEntities(community_pid: string, helpContentUrl:string) {
|
||||
return this.http.get(helpContentUrl + 'community/'+community_pid+'/entities')
|
||||
.map(res => <Array<Entity>> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
|
||||
saveEntity(entity: Entity) {
|
||||
saveEntity(entity: Entity, helpContentUrl:string) {
|
||||
let headers = new Headers({'Content-Type': 'application/json'});
|
||||
let options = new RequestOptions({headers: headers});
|
||||
|
||||
HelpContentService.removeNulls(entity);
|
||||
|
||||
return this.http.post(this._helpContentUrl + 'entity/save', JSON.stringify(entity), options)
|
||||
return this.http.post(helpContentUrl + 'entity/save', JSON.stringify(entity), options)
|
||||
.map(res => <Entity> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
updateEntity(entity: Entity) {
|
||||
updateEntity(entity: Entity, helpContentUrl:string) {
|
||||
let headers = new Headers({'Content-Type': 'application/json'});
|
||||
let options = new RequestOptions({headers: headers});
|
||||
|
||||
HelpContentService.removeNulls(entity);
|
||||
|
||||
return this.http.post(this._helpContentUrl + 'entity/update', JSON.stringify(entity), options)
|
||||
return this.http.post(helpContentUrl + 'entity/update', JSON.stringify(entity), options)
|
||||
.map(res => <Entity> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
@ -252,128 +252,128 @@ export class HelpContentService {
|
|||
// let headers = new Headers({'Content-Type': 'application/json'});
|
||||
// let options = new RequestOptions({headers: headers});
|
||||
//
|
||||
// return this.http.post(this._helpContentUrl + 'community/'+selectedCommunityId+'/entity/toggle?status='+ status.toString()+'&entityId='+id.toString(), options)
|
||||
// return this.http.post(helpContentUrl + 'community/'+selectedCommunityId+'/entity/toggle?status='+ status.toString()+'&entityId='+id.toString(), options)
|
||||
// .catch(this.handleError);
|
||||
// }
|
||||
|
||||
toggleEntities(selectedCommunityPid: string, ids : string[],status : boolean) {
|
||||
toggleEntities(selectedCommunityPid: string, ids : string[],status : boolean, helpContentUrl:string) {
|
||||
let headers = new Headers({'Content-Type': 'application/json'});
|
||||
let options = new RequestOptions({headers: headers});
|
||||
|
||||
return this.http.post(this._helpContentUrl +'community/'+selectedCommunityPid+ '/entity/toggle?status='+ status.toString(), JSON.stringify(ids), options)
|
||||
return this.http.post(helpContentUrl +'community/'+selectedCommunityPid+ '/entity/toggle?status='+ status.toString(), JSON.stringify(ids), options)
|
||||
//.map( res => <string[]> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
deleteEntities(ids : string[]) {
|
||||
deleteEntities(ids : string[], helpContentUrl:string) {
|
||||
let headers = new Headers({'Content-Type': 'application/json'});
|
||||
let options = new RequestOptions({headers: headers});
|
||||
|
||||
return this.http.post(this._helpContentUrl + 'entity/delete',JSON.stringify(ids), options)
|
||||
return this.http.post(helpContentUrl + 'entity/delete',JSON.stringify(ids), options)
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
|
||||
toggleEntityOfPage(pageId: string, entityId : string,status : boolean) {
|
||||
toggleEntityOfPage(pageId: string, entityId : string,status : boolean, helpContentUrl:string) {
|
||||
let headers = new Headers({'Content-Type': 'application/json'});
|
||||
let options = new RequestOptions({headers: headers});
|
||||
|
||||
return this.http.post(this._helpContentUrl + 'page/'+pageId+'/entity/toggle?status='+ status.toString()+'&entityId='+entityId.toString(), options)
|
||||
return this.http.post(helpContentUrl + 'page/'+pageId+'/entity/toggle?status='+ status.toString()+'&entityId='+entityId.toString(), options)
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
savePage(page: Page) {
|
||||
savePage(page: Page, helpContentUrl:string) {
|
||||
let headers = new Headers({'Content-Type': 'application/json'});
|
||||
let options = new RequestOptions({headers: headers});
|
||||
|
||||
HelpContentService.removeNulls(page);
|
||||
|
||||
return this.http.post(this._helpContentUrl + 'page/save', JSON.stringify(page), options)
|
||||
return this.http.post(helpContentUrl + 'page/save', JSON.stringify(page), options)
|
||||
.map(res => <Page> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
updatePage(page: Page) {
|
||||
updatePage(page: Page, helpContentUrl:string) {
|
||||
let headers = new Headers({'Content-Type': 'application/json'});
|
||||
let options = new RequestOptions({headers: headers});
|
||||
|
||||
HelpContentService.removeNulls(page);
|
||||
|
||||
return this.http.post(this._helpContentUrl + 'page/update', JSON.stringify(page), options)
|
||||
return this.http.post(helpContentUrl + 'page/update', JSON.stringify(page), options)
|
||||
.map(res => <Page> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
togglePages(selectedCommunityPid: string, ids : string[],status : boolean) {
|
||||
togglePages(selectedCommunityPid: string, ids : string[],status : boolean, helpContentUrl:string) {
|
||||
let headers = new Headers({'Content-Type': 'application/json'});
|
||||
let options = new RequestOptions({headers: headers});
|
||||
|
||||
return this.http.post(this._helpContentUrl + 'community/'+selectedCommunityPid+'/page/toggle?status='+ status.toString(),JSON.stringify(ids), options)
|
||||
return this.http.post(helpContentUrl + 'community/'+selectedCommunityPid+'/page/toggle?status='+ status.toString(),JSON.stringify(ids), options)
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
deletePages(ids : string[]) {
|
||||
deletePages(ids : string[], helpContentUrl:string) {
|
||||
let headers = new Headers({'Content-Type': 'application/json'});
|
||||
let options = new RequestOptions({headers: headers});
|
||||
|
||||
return this.http.post(this._helpContentUrl + 'page/delete',JSON.stringify(ids), options)
|
||||
return this.http.post(helpContentUrl + 'page/delete',JSON.stringify(ids), options)
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
getPageHelpContents() {
|
||||
return this.http.get(this._helpContentUrl + 'pagehelpcontent')
|
||||
getPageHelpContents(helpContentUrl:string) {
|
||||
return this.http.get(helpContentUrl + 'pagehelpcontent')
|
||||
.map(res => <Array<PageHelpContent>> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
getCommunityPageHelpContents(community_pid: string) {
|
||||
return this.http.get(this._helpContentUrl + 'pagehelpcontent?community='+community_pid)
|
||||
getCommunityPageHelpContents(community_pid: string, helpContentUrl:string) {
|
||||
return this.http.get(helpContentUrl + 'pagehelpcontent?community='+community_pid)
|
||||
.map(res => <Array<PageHelpContent>> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
getPageHelpContent(id : string) {
|
||||
return this.http.get(this._helpContentUrl + 'pagehelpcontent/' + id)
|
||||
getPageHelpContent(id : string, helpContentUrl:string) {
|
||||
return this.http.get(helpContentUrl + 'pagehelpcontent/' + id)
|
||||
.map(res => <PageHelpContent> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
savePageHelpContent(pageHelpContent: PageHelpContent) {
|
||||
savePageHelpContent(pageHelpContent: PageHelpContent, helpContentUrl:string) {
|
||||
|
||||
let headers = new Headers({'Content-Type': 'application/json'});
|
||||
let options = new RequestOptions({headers: headers});
|
||||
|
||||
HelpContentService.removeNulls(pageHelpContent);
|
||||
|
||||
return this.http.post(this._helpContentUrl + 'pagehelpcontent/save', JSON.stringify(pageHelpContent), options)
|
||||
return this.http.post(helpContentUrl + 'pagehelpcontent/save', JSON.stringify(pageHelpContent), options)
|
||||
.map(res => <PageHelpContent> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
updatePageHelpContent(pageHelpContent: PageHelpContent) {
|
||||
updatePageHelpContent(pageHelpContent: PageHelpContent, helpContentUrl:string) {
|
||||
let headers = new Headers({'Content-Type': 'application/json'});
|
||||
let options = new RequestOptions({headers: headers});
|
||||
|
||||
HelpContentService.removeNulls(pageHelpContent);
|
||||
|
||||
return this.http.post(this._helpContentUrl + 'pagehelpcontent/update', JSON.stringify(pageHelpContent), options)
|
||||
return this.http.post(helpContentUrl + 'pagehelpcontent/update', JSON.stringify(pageHelpContent), options)
|
||||
.map(res => <PageHelpContent> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
deletePageHelpContents(ids : string[]) {
|
||||
deletePageHelpContents(ids : string[], helpContentUrl:string) {
|
||||
let headers = new Headers({'Content-Type': 'application/json'});
|
||||
let options = new RequestOptions({headers: headers});
|
||||
|
||||
return this.http.post(this._helpContentUrl + 'pagehelpcontent/delete',JSON.stringify(ids), options)
|
||||
return this.http.post(helpContentUrl + 'pagehelpcontent/delete',JSON.stringify(ids), options)
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
||||
togglePageHelpContents(ids : string[],status : boolean) {
|
||||
togglePageHelpContents(ids : string[],status : boolean, helpContentUrl:string) {
|
||||
let headers = new Headers({'Content-Type': 'application/json'});
|
||||
let options = new RequestOptions({headers: headers});
|
||||
|
||||
return this.http.post(this._helpContentUrl + 'pagehelpcontent/toggle?status='+ status.toString(), JSON.stringify(ids), options)
|
||||
return this.http.post(helpContentUrl + 'pagehelpcontent/toggle?status='+ status.toString(), JSON.stringify(ids), options)
|
||||
//.map( res => <string[]> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
@ -384,13 +384,20 @@ export class HelpContentService {
|
|||
console.error(error);
|
||||
return Observable.throw(error.json().error || 'Server error');
|
||||
}
|
||||
public getAuthOptionsWithBody():RequestOptions{
|
||||
let headers = new Headers();
|
||||
headers.append('Content-Type', 'application/json');
|
||||
headers.append('X-XSRF-TOKEN', COOKIE.getCookie(COOKIE.cookieName_id));
|
||||
let options = new RequestOptions({ headers: headers, withCredentials:true });
|
||||
return options;
|
||||
}
|
||||
|
||||
getDataProviders() {
|
||||
return this.http.get('https://beta.services.openaire.eu/search/v2/api/datasources?format=json').map(res => <any> res.json()).map(res => res.results).do(res => {console.log(res)}).catch(this.handleError);
|
||||
}
|
||||
|
||||
getStatistics(community_pid: string) {
|
||||
return this.http.get(this._helpContentUrl + 'statistics/'+community_pid)
|
||||
getStatistics(community_pid: string, helpContentUrl:string) {
|
||||
return this.http.get(helpContentUrl + 'statistics/'+community_pid)
|
||||
.map(res => <CommunityStatistics> res.json())
|
||||
.catch(this.handleError);
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
|
||||
"cacheUrl" :"http://scoobydoo.di.uoa.gr:3000/get?url=",
|
||||
|
||||
"adminToolsAPIURL" :"http://duffy.di.uoa.gr:8080/uoa-admin-tools",
|
||||
"adminToolsAPIURL" :"http://scoobydoo.di.uoa.gr:8080/uoa-admin-tools/",
|
||||
|
||||
"adminToolsCommunity" :"openaire",
|
||||
|
||||
|
|
Loading…
Reference in New Issue