[Connect|Trunk]

-completing commit 61006  + clean up code
fixing issues with private/ hidden communities
show modal for verification code

- remove preload modules
- community home page - add check for community status before load it





git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-connect-portal/trunk@61012 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2021-05-18 07:29:16 +00:00
parent df1d14502e
commit 63c4309c58
6 changed files with 23 additions and 25 deletions

View File

@ -1,5 +1,5 @@
import {NgModule} from '@angular/core';
import {PreloadAllModules, RouterModule, Routes} from '@angular/router';
import { RouterModule, Routes} from '@angular/router';
import {OpenaireErrorPageComponent} from './error/errorPage.component';
import {PageURLResolverComponent} from "./openaireLibrary/utils/pageURLResolver.component";
import {IsCommunity} from "./openaireLibrary/connect/communityGuard/isCommunity.guard";
@ -214,7 +214,6 @@ const routes: Routes = [
@NgModule({
imports: [RouterModule.forRoot(routes, {
preloadingStrategy: PreloadAllModules,
onSameUrlNavigation: "reload",
relativeLinkResolution: 'corrected'
})],

View File

@ -120,7 +120,6 @@ export class AppComponent {
}
ngOnInit() {
console.log("aaap init")
if (this.properties.environment == "production" || this.properties.environment == "development") {
this.subscriptions.push(this.route.queryParams.subscribe(data => {
this._meta.updateTag({content: 'all', name: 'robots'});
@ -135,10 +134,8 @@ export class AppComponent {
}
this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => {
this.user = user;
console.log(user, "call init")
this.init();
}, error => {
console.log(" user error call init")
this.init()}));
}
@ -191,9 +188,7 @@ export class AppComponent {
}
public buildMenu(communityId: string) {
if (communityId) {
console.log(communityId)
if (!this.community || this.communityId !== communityId) {
console.log("new")
this.subscriptions.push(this._communityService.getCommunity(communityId).subscribe(community => {
if (community) {
/* this.community = {
@ -211,7 +206,6 @@ export class AppComponent {
this.buildCommunityMenu();
}));
} else {
console.log("same")
this.buildCommunityMenu();
}
} else {
@ -290,7 +284,6 @@ export class AppComponent {
}
this.showMenu = true;
} else {
console.log(this.community && this.community.status?this.community.status:"no community");
this.communityId = null;
this.properties.adminToolsPortalType = "connect";
this.configurationService.initCommunityInformation(this.properties, "connect");
@ -298,14 +291,15 @@ export class AppComponent {
this.buildConnectMenu(true);
if (this.community && this.community.status == "manager") {
if (!this.user && typeof location !== 'undefined') {
console.log("no user")
this.router.navigate(['/user-info'], {
queryParams: {
"errorCode": LoginErrorCodes.NOT_LOGIN,
"redirectUrl": location.pathname+ location.search + location.hash
}, queryParamsHandling: "merge"
});
} else {
if(location.pathname.indexOf("user-info") == -1) {
this.router.navigate(['/user-info'], {
queryParams: {
"errorCode": LoginErrorCodes.NOT_LOGIN,
"redirectUrl": location.pathname + location.search + location.hash
}
});
}
} else {
this.router.navigate(['/'], { queryParamsHandling: "merge" });
}
}else if (this.community && this.community.status == "hidden") {

View File

@ -190,6 +190,7 @@
</ng-template>
<div *ngIf="communityInfo && community && !isPrivate()" >
<div *ngIf="communityInfo && community" class="generalSearchForm ">
<div class="uk-container uk-container-large">
<div class="uk-margin-large-top">
@ -633,4 +634,8 @@
</div>
</div>
</div>
<error *ngIf="communityInfo && community && isPrivate()" [page]="community.status == 'manager'?'-1':null">
</error>
</div>

View File

@ -146,15 +146,12 @@ export class CommunityComponent {
this._meta.updateTag({content: this.url}, "property='og:url'");
this.subs.push(this.userManagementService.getUserInfo().subscribe(user => {
this.user = user;
if(this.community && ConnectHelper.isPrivate(this.community, this.user)){
this.community = null;
}
}));
this.customFilter = new SearchCustomFilter("Community", "communityId", this.communityId, "");
this.subs.push(this._communityService.getCommunityAsObservable().subscribe(
community => {
this.community = community;
if(community && !ConnectHelper.isPrivate(community, this.user)) {
this.community = community;
if (community.description != null && (community.description.length - this.thresholdDescription <= this.descriptionDiff)) {
this.thresholdDescription = community.description.length;
}
@ -540,4 +537,7 @@ export class CommunityComponent {
}
}
}
isPrivate(){
return ConnectHelper.isPrivate(this.community, this.user);
}
}

View File

@ -28,6 +28,7 @@ import {TabsModule} from "../openaireLibrary/utils/tabs/tabs.module";
import {SearchTabModule} from "../openaireLibrary/utils/tabs/contents/search-tab.module";
import {ErrorMessagesModule} from "../openaireLibrary/utils/errorMessages.module";
import {SafeHtmlPipeModule} from '../openaireLibrary/utils/pipes/safeHTMLPipe.module';
import {ErrorModule} from "../openaireLibrary/error/error.module";
@NgModule({
imports: [
@ -37,7 +38,7 @@ import {SafeHtmlPipeModule} from '../openaireLibrary/utils/pipes/safeHTMLPipe.mo
SearchResearchResultsServiceModule, SearchResultsModule, CuratorsModule, AffiliationsModule,
SEOServiceModule, MatSelectModule, EntitiesSelectionModule,
TabsModule, SearchTabModule, ErrorMessagesModule
, SafeHtmlPipeModule
, SafeHtmlPipeModule, ErrorModule
],
declarations: [
CommunityComponent

View File

@ -1,12 +1,11 @@
import {Component, Input} from '@angular/core';
import {Component} from '@angular/core';
@Component({
selector: 'openaire-error',
template: `
<error [page]="page"></error>
<error></error>
`
})
export class OpenaireErrorPageComponent {
@Input() public page: string;
}