[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
This commit is contained in:
parent
42306ce984
commit
3311e3f193
|
@ -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';
|
||||
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue