From 3311e3f193f24f89761cff1e3179b4db475cda46 Mon Sep 17 00:00:00 2001 From: "k.triantafyllou" Date: Mon, 8 Apr 2019 14:56:09 +0000 Subject: [PATCH] [Trunk|Connect]: 1. Changes from library git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-connect-portal/trunk@55235 d315682c-612b-4755-9ff5-7f18f6832af3 --- src/app/communities/communities.module.ts | 2 +- src/app/community/community.module.ts | 2 +- .../searchCommunities.component.ts | 19 ++++++++++++++++--- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/app/communities/communities.module.ts b/src/app/communities/communities.module.ts index b30a34b..56d2725 100644 --- a/src/app/communities/communities.module.ts +++ b/src/app/communities/communities.module.ts @@ -5,7 +5,7 @@ import {RouterModule} from '@angular/router'; // import {CommunitiesRoutingModule} from './communities-routing.module'; import {SubscribeModule} from '../utils/subscribe/subscribe.module'; -import {ManageModule} from '../utils/manage/manage.module'; +import {ManageModule} from '../openaireLibrary/utils/manage/manage.module'; import {CommunitiesComponent} from './communities.component'; diff --git a/src/app/community/community.module.ts b/src/app/community/community.module.ts index c72a838..68fbe77 100644 --- a/src/app/community/community.module.ts +++ b/src/app/community/community.module.ts @@ -16,7 +16,7 @@ import {FreeGuard} from '../openaireLibrary/login/freeGuard.guard'; import {PreviousRouteRecorder} from '../openaireLibrary/utils/piwik/previousRouteRecorder.guard'; import {SubscribeModule} from '../utils/subscribe/subscribe.module'; import {InviteModule} from '../utils/subscribe/invite/invite.module'; -import {ManageModule} from '../utils/manage/manage.module'; +import {ManageModule} from '../openaireLibrary/utils/manage/manage.module'; import {StatisticsModule} from "../statistics/statistics.module"; import {SearchZenodoCommunitiesServiceModule} from '../openaireLibrary/connect/zenodoCommunities/searchZenodoCommunitiesService.module'; diff --git a/src/app/searchPages/communities/searchCommunities.component.ts b/src/app/searchPages/communities/searchCommunities.component.ts index c54633c..7874a86 100644 --- a/src/app/searchPages/communities/searchCommunities.component.ts +++ b/src/app/searchPages/communities/searchCommunities.component.ts @@ -1,4 +1,4 @@ -import {Component, ViewChild} from "@angular/core"; +import {Component, ElementRef, ViewChild} from "@angular/core"; import {SearchUtilsClass} from "../../openaireLibrary/searchPages/searchUtils/searchUtils.class"; import {ErrorMessagesComponent} from "../../openaireLibrary/utils/errorMessages.component"; import {ErrorCodes} from "../../openaireLibrary/utils/properties/errorCodes"; @@ -44,7 +44,10 @@ export class SearchCommunitiesComponent { properties:EnvProperties; @ViewChild (SearchPageComponent) searchPage : SearchPageComponent ; - constructor (private route: ActivatedRoute, private _communitiesService: CommunitiesService, private _subscribeService: SubscribeService) { + constructor (private route: ActivatedRoute, + private _communitiesService: CommunitiesService, + private _subscribeService: SubscribeService, + private element: ElementRef) { this.errorCodes = new ErrorCodes(); this.errorMessages = new ErrorMessagesComponent(); this.searchUtils.status = this.errorCodes.LOADING; @@ -127,6 +130,8 @@ export class SearchCommunitiesComponent { for(let i = 0; i < data.length; i++) { this.results[i] = new SearchResult(); this.results[i].community = data[i]; + // For Test do not delete them. + //this.results[i].community.description = "EGI is a federated e-Infrastructure set up to provide advanced computing services for research and innovation.EGI is a federated e-Infrastructure set up to provide advanced computing services for research and innovation.EGI is a federated e-Infrastructure set up to provide advanced computing services for research and innovation." //this.results[i].community.date = new Date(new Date(2012, 0, 1).getTime() + Math.random() * (new Date().getTime() - new Date(2012, 0, 1).getTime())); observables.push(this._subscribeService.isSubscribedToCommunity(this.results[i].community.communityId, Session.getUserEmail(), this.properties["adminToolsAPIURL"])); this.results[i].isManager = this.isCommunityManager(this.results[i].community); @@ -162,11 +167,13 @@ export class SearchCommunitiesComponent { this.searchUtils.status = this.errorCodes.OUT_OF_BOUND; } } + this.scroll(); }, err => { this.handleError('Error getting if user is subscribed', err); this.searchUtils.status = this.errorMessages.getErrorCode(err.status); this.disableForms = false; + this.scroll(); } ); }, @@ -175,7 +182,7 @@ export class SearchCommunitiesComponent { this.handleError('Error getting communities', err); this.searchUtils.status = this.errorMessages.getErrorCode(err.status); this.disableForms = false; - + this.scroll(); } ); } @@ -394,4 +401,10 @@ export class SearchCommunitiesComponent { private handleError(message: string, error) { console.error('Communities Search Page: ' + message, error); } + + public scroll() { + if (typeof document !== 'undefined') { + this.element.nativeElement.scrollIntoView(); + } + } }