[Trunk | Connect]:

1. subscribe.component.ts: Remove unnecessary prints.
2. searchCommunities.component.ts: 
	a. [Bug fix - sometimes on 1st load] Remove data binding for 'sort' in <new-search-page>.
	b. [Bug fix - no results on 1st load] Remove data binding for 'filters' in <new-search-page>.
	c. Add field 'private userFilterLoaded:boolean = false;' to init all filters correctly when user is logged in.


git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-connect-portal/trunk@58595 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
konstantina.galouni 2020-05-05 08:52:11 +00:00
parent d1f67d2cb8
commit 19fb5141f4
2 changed files with 7 additions and 11 deletions

View File

@ -24,11 +24,11 @@ import {NewSearchPageComponent} from "../../openaireLibrary/searchPages/searchUt
[hasPrefix]=false [piwikSiteId]="piwikSiteId"
searchFormClass="communitiesSearchForm"
[formPlaceholderText]="'Search for Research Gateways…'"
type="communities" entityType="community" [filters]="filters"
type="communities" entityType="community"
[results]="results" [searchUtils]="searchUtils"
[showResultCount]=true
[disableForms]="disableForms"
[lastIndex]=false [sort]=true
[lastIndex]=false
[simpleView]="true"
[fieldIds]="fieldIds" [fieldIdsMap]="fieldIdsMap" [selectedFields]="selectedFields"
[simpleSearchLink]="searchLink" [entitiesSelection]="false" [showBreadcrumb]="true"
@ -62,6 +62,7 @@ export class SearchCommunitiesComponent {
properties:EnvProperties;
@ViewChild (NewSearchPageComponent) searchPage : NewSearchPageComponent ;
private user: User;
private userFilterLoaded:boolean = false;
constructor (private route: ActivatedRoute,
private _communitiesService: CommunitiesService,
@ -177,7 +178,7 @@ export class SearchCommunitiesComponent {
this.searchUtils.status = this.errorCodes.LOADING;
this.disableForms = true;
this.results = this.totalResults;
if(this.filters.length === 0) {
if(this.filters.length === 0 || (this.user && !this.userFilterLoaded)) {
this.filters = this.createFilters();
}
this.searchUtils.totalResults = 0;
@ -226,7 +227,7 @@ export class SearchCommunitiesComponent {
// this.searchPage.checkSelectedFilters(this.filters);
// this.searchPage.updateBaseUrlWithParameters(this.filters);
// this.searchPage.buildPageURLParameters(this.filters, [], false);
// this.filters =
//this.filters =
this.searchPage.prepareFiltersToShow(this.filters,this.searchUtils.totalResults);
this.results = this.results.slice((this.searchUtils.page-1)*this.searchUtils.size, (this.searchUtils.page*this.searchUtils.size));
@ -493,6 +494,7 @@ export class SearchCommunitiesComponent {
filter_ids.push("role");
value_names.push([ "Manager"]);
value_original_ids.push(["manager"]);
this.userFilterLoaded = true;
}
let filters: Filter[] = [];
for(let i =0 ; i < filter_names.length; i++){

View File

@ -78,16 +78,13 @@ export class SubscribeComponent {
private _communityService: CommunityService,
private router: Router,
private userManagementService: UserManagementService
) {
console.log("subscribe constructor");
}
) {}
public ngOnInit() {
this.route.data.subscribe((data: { envSpecific: EnvProperties }) => {
if(!this.properties) {
this.properties = data.envSpecific;
}
console.log(this.properties);
if(!this.showNumbers) {
this.userManagementService.getUserInfo().subscribe(
user => {
@ -109,7 +106,6 @@ export class SubscribeComponent {
private isSubscribed() {
this._subscribeService.isSubscribed.subscribe(
res => {
console.log("Subscribe component: isSubscribed: "+res);
this.subscribed = res;
if (this.subscribed) {
this.subscribeEvent.emit({
@ -175,7 +171,6 @@ export class SubscribeComponent {
if (email == null) {
this.subscribed = false;
// this.showLoginAlert = true;
console.log("subscribe before navigate");
this.router.navigate(['/user-info'], {
queryParams: {
"errorCode": LoginErrorCodes.ACTION_REQUIRES_LOGIN,
@ -253,7 +248,6 @@ export class SubscribeComponent {
} else {
//console.log(res);
if (this.subscribed) {
console.log('here')
this.subscribed = false;
}
}