[angular-16-community-projects-availableSince | DONE | UPDATE] : show project link only when it is available before the db update date #5

Merged
k.triantafyllou merged 1 commits from angular-16-community-projects-availableSince into angular-16 2023-10-26 15:48:01 +02:00
2 changed files with 10 additions and 4 deletions

View File

@ -82,14 +82,14 @@
<div class="uk-card uk-card-default"> <div class="uk-card uk-card-default">
<div class="uk-card-body"> <div class="uk-card-body">
<h6 class="uk-margin-bottom"> <h6 class="uk-margin-bottom">
<a *ngIf="item.openaireId || (item.grantId && item.funder)" <a *ngIf="(item.openaireId || (item.grantId && item.funder)) && (!item['availableSince'] || !lastDBLoadDate || item['availableSince']<lastDBLoadDate)"
target="_blank" class="custom-external uk-link-text" target="_blank" class="custom-external uk-link-text"
[href]="projectUrl+'?' + ((item.openaireId) ? 'projectId='+item.openaireId : 'grantId='+item.grantId+'&funder='+item.funder)"> [href]="projectUrl+'?' + ((item.openaireId) ? 'projectId='+item.openaireId : 'grantId='+item.grantId+'&funder='+item.funder)">
<span *ngIf="item.name">{{item.name}}</span> <span *ngIf="item.name">{{item.name}}</span>
<span *ngIf="item.name && item.acronym"> (</span><span *ngIf="item.acronym">{{item.acronym}}</span><span *ngIf="item.name && item.acronym">)</span> <span *ngIf="item.name && item.acronym"> (</span><span *ngIf="item.acronym">{{item.acronym}}</span><span *ngIf="item.name && item.acronym">)</span>
<span *ngIf="!item.name && !item.acronym">[no title available]</span> <span *ngIf="!item.name && !item.acronym">[no title available]</span>
</a> </a>
<span *ngIf="!item.openaireId && !(item.grantId && item.funder)"> <span *ngIf="(!item.openaireId && !(item.grantId && item.funder) || (item['availableSince'] && lastDBLoadDate && item['availableSince'] >= lastDBLoadDate))">
<span *ngIf="item.name">{{item.name}}</span> <span *ngIf="item.name">{{item.name}}</span>
<span *ngIf="item.name && item.acronym"> (</span><span *ngIf="item.acronym">{{item.acronym}}</span><span *ngIf="item.name && item.acronym">)</span> <span *ngIf="item.name && item.acronym"> (</span><span *ngIf="item.acronym">{{item.acronym}}</span><span *ngIf="item.name && item.acronym">)</span>
<span *ngIf="!item.name && !item.acronym">[no title available]</span> <span *ngIf="!item.name && !item.acronym">[no title available]</span>

View File

@ -20,6 +20,7 @@ import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class
import {NotificationHandler} from "../../openaireLibrary/utils/notification-handler"; import {NotificationHandler} from "../../openaireLibrary/utils/notification-handler";
import {ClearCacheService} from "../../openaireLibrary/services/clear-cache.service"; import {ClearCacheService} from "../../openaireLibrary/services/clear-cache.service";
import {debounceTime, distinctUntilChanged} from "rxjs/operators"; import {debounceTime, distinctUntilChanged} from "rxjs/operators";
import {IndexInfoService} from "../../openaireLibrary/utils/indexInfo.service";
@Component({ @Component({
selector: 'remove-projects', selector: 'remove-projects',
@ -63,18 +64,21 @@ export class RemoveProjectsComponent implements OnInit {
]; ];
public openaireEntiites = OpenaireEntities; public openaireEntiites = OpenaireEntities;
lastDBLoadDate = null;
constructor(private route: ActivatedRoute, private _router: Router, constructor(private route: ActivatedRoute, private _router: Router,
private _fb: UntypedFormBuilder, private _fb: UntypedFormBuilder,
private communityService: CommunityService, private communityService: CommunityService,
private _manageCommunityProjectsService: ManageCommunityProjectsService, private _manageCommunityProjectsService: ManageCommunityProjectsService,
private _searchCommunityProjectsService: SearchCommunityProjectsService, private _searchCommunityProjectsService: SearchCommunityProjectsService,
private _clearCacheService: ClearCacheService) { private _clearCacheService: ClearCacheService, private indexInfoService: IndexInfoService) {
this.errorCodes = new ErrorCodes(); this.errorCodes = new ErrorCodes();
this.communitySearchUtils.status = this.errorCodes.LOADING; this.communitySearchUtils.status = this.errorCodes.LOADING;
} }
ngOnInit() { ngOnInit() {
this.subscriptions.push(this.indexInfoService.getDBLoadLastDate(this.properties).subscribe(res => {
this.lastDBLoadDate = res;
}));
this.communitySearchUtils.keyword = ""; this.communitySearchUtils.keyword = "";
this.filterForm = this._fb.group({ this.filterForm = this._fb.group({
@ -254,4 +258,6 @@ export class RemoveProjectsComponent implements OnInit {
isSelected(value: string) { isSelected(value: string) {
return this.filterForm && this.filterForm.get('funder').value && this.filterForm.get('funder').value.id === value; return this.filterForm && this.filterForm.get('funder').value && this.filterForm.get('funder').value.id === value;
} }
} }