diff --git a/claims/claim-utils/displayClaims/displayClaims.component.html b/claims/claim-utils/displayClaims/displayClaims.component.html index a417d5ed..48898a09 100644 --- a/claims/claim-utils/displayClaims/displayClaims.component.html +++ b/claims/claim-utils/displayClaims/displayClaims.component.html @@ -1,174 +1,100 @@ -
- -
-
-
-
- - -
-
-
-
-
-
Filter by:
-
+
+
+
+ +
+
+
-
Sort by:
-
+
+
-
- -
- -
-
-
- - - - - - Delete {{selected.length | number}} all links - - - +
+
+ +
Type of Entity
+ +
+
+
+
+
+
- -
-
- - - - - - - - - -
-
-
- - -
-
- An Error occured. -
-
- You are not authorized to view the results. -
-
- User session is not valid. Please login again. -
-
-
No entries found.
-
- -
- -
-
-
- -
-
-
- -
-
+ +
+
+
No links found
+
+
    +
  • +
    +
    +
    +
    + +
    +
    available - pending -
    + pending +
    -
    Claimed by: - {{claim.userMail}} - Claimed date: {{claim.date}}
    -
    - - +
    Claimed by: + {{claim.userMail}} + Claimed date: {{claim.date}}
    +
    + + +
    +
    -
- + + + +
+
- -
-
- - - - - - - - - - - - - - -
-
-
- - -
- - - -

- You are about to delete {{this.selected.length}} link(s) you selected.
- - Usually it takes 2-4 weeks for the links to permanently disappear from the Openaire platfrom. - -

- -

Do you want to delete the link(s)?

-
- +
+ +
+ + + diff --git a/claims/claim-utils/displayClaims/displayClaims.component.ts b/claims/claim-utils/displayClaims/displayClaims.component.ts index f35d3bfe..b502e4cf 100644 --- a/claims/claim-utils/displayClaims/displayClaims.component.ts +++ b/claims/claim-utils/displayClaims/displayClaims.component.ts @@ -4,11 +4,8 @@ import {ActivatedRoute, Router} from '@angular/router'; import {Subject, Subscriber} from 'rxjs'; import {debounceTime, distinctUntilChanged} from 'rxjs/operators'; import {ClaimsService} from '../service/claims.service'; -import {ModalLoading} from '../../../utils/modal/loading.component'; -import {AlertModal} from '../../../utils/modal/alert'; -import {Session, User} from '../../../login/utils/helper.class'; +import {User} from '../../../login/utils/helper.class'; import {EnvProperties} from '../../../utils/properties/env-properties'; -import {LoginErrorCodes} from '../../../login/utils/guardHelper.class'; import {SEOService} from '../../../sharedComponents/SEO/SEO.service'; import {IndexInfoService} from '../../../utils/indexInfo.service'; import {ClaimDBRecord} from '../claimHelper.class'; @@ -17,18 +14,16 @@ import {HelperService} from '../../../utils/helper/helper.service'; import {Meta, Title} from '@angular/platform-browser'; import {PiwikService} from '../../../utils/piwik/piwik.service'; import {properties} from '../../../../../environments/environment'; -import {FormArray, FormBuilder, FormControl, FormGroup} from '@angular/forms'; +import {FormBuilder, FormGroup} from '@angular/forms'; import {Option} from '../../../sharedComponents/input/input.component'; -import {SearchInputComponent} from '../../../sharedComponents/search-input/search-input.component'; import {OpenaireEntities} from "../../../utils/properties/searchFields"; import {HelperFunctions} from "../../../utils/HelperFunctions.class"; +import {NotificationHandler} from "../../../utils/notification-handler"; +import {DropdownFilterComponent} from "../../../utils/dropdown-filter/dropdown-filter.component"; -declare var UIkit; @Component({ selector: 'displayClaims', templateUrl: 'displayClaims.component.html', - // providers: [ClaimsService] - }) export class DisplayClaimsComponent { @Input() piwikSiteId = null; @@ -44,74 +39,63 @@ export class DisplayClaimsComponent { @Input() isAdmin: boolean = false; page: number = 1; size: number = 50; - defaultSize:number = 50; - sizes = [10, 20, 30, 50]; keyword: string; // the keyword string to give to the request as parameter - inputkeyword: string; // the string written in the input field (keyword=inputkeyword when its length is bigger than 3 and the user stops typing) - @ViewChild('searchInputComponent') searchInputComponent: SearchInputComponent; types = ["All", "Project", "Context", "Result", "User"]; - pageLoading:boolean = false; + loading: boolean = false; @Input() fetchBy: string; @Input() fetchId: string; @Input() user: User; - resultsNum: number; + resultsNum: number = 0; claims: ClaimDBRecord[]; @Input() externalPortalUrl: string = null; @Input() claimsInfoURL: string;// ="https://www.openaire.eu/linking"; lastIndexDate = null; - - @ViewChild(ModalLoading) loading: ModalLoading; public filterForm: FormGroup; - public entitiesCtrl: FormArray; - - allOptions: Option[] = [{label: OpenaireEntities.PROJECTS, value: "project"},{label: OpenaireEntities.PUBLICATIONS, value:"publication"},{label: OpenaireEntities.DATASETS, value: "dataset"}, - {label: OpenaireEntities.SOFTWARE, value: "software"},{label: OpenaireEntities.OTHER, value: "other"},{label: OpenaireEntities.COMMUNITIES, value: "context"}]; + public entities: string[] = []; + + allOptions: Option[] = [ + {label: OpenaireEntities.PUBLICATIONS, value: "publication"}, + {label: OpenaireEntities.DATASETS, value: "dataset"}, + {label: OpenaireEntities.SOFTWARE, value: "software"}, + {label: OpenaireEntities.OTHER, value: "other"}, + {label: OpenaireEntities.PROJECTS, value: "project"}, + {label: OpenaireEntities.COMMUNITIES, value: "context"}]; + sortOptions: Option[] = [ - {label:"Date (recent) ", value:{ sort: "date", descending: true }}, {label:"Date (oldest) ", value:{ sort: "date",descending:false }}, - // {label:"User (desc) ", value:{ sort: "user",descending: true }}, {label:"User (asc) ", value:{ sort: "user",descending:false }}, - // {label:"Title (desc) ", value:{ sort: "source",descending: true }}, {label:"Title (asc) ", value:{ sort: "source",descending:false }}, - {label:"Title (desc) ", value:{ sort: "target",descending: true }}, {label:"Title (asc) ", value: { sort: "target",descending:false }}, + {label: "Date (recent) ", value: {sort: "date", descending: true}}, + {label: "Date (oldest) ", value: {sort: "date", descending: false}}, + {label: "Title (desc) ", value: {sort: "target", descending: true}}, + {label: "Title (asc) ", value: {sort: "target", descending: false}}, ]; - entityTypes: string[] = []; - - // descending = true; - // sortby = "date"; - - selected = []; - // deleteMessage: string = ""; - showErrorMessage: boolean = false; - showForbiddenMessage: boolean = false; - userValidMessage: string = ""; - - //params for pagingFormatter to use when navigate to page + index: number; params; - @ViewChild(AlertModal) alert; - + @ViewChild("deleteModal") deleteModal; + claimsDeleted: number = 0; @Input() communityId: string = null; - + url = null; public pageContents = null; - + constructor(private _claimService: ClaimsService, private route: ActivatedRoute, private _router: Router, private location: Location, private _meta: Meta, private _title: Title, private _piwikService: PiwikService, private seoService: SEOService, private indexInfoService: IndexInfoService, private helper: HelperService, private _fb: FormBuilder) { } - + ngOnInit() { - this.entitiesCtrl = this._fb.array([]); + this.entities = []; this.filterForm = this._fb.group({ keyword: [''], - entities: this.entitiesCtrl, + entities: this._fb.control(this.entities), sort: this._fb.control(this.sortOptions[0].value) }); - + this.properties = properties; this.url = properties.domain + properties.baseLink + this._router.url; - if(!this.myClaims){ - this.sortOptions.push({label:"User (desc) ", value:{ sort: "user",descending: true }}); - this.sortOptions.push( {label:"User (asc) ", value:{ sort: "user",descending:false }}) + if (!this.myClaims) { + this.sortOptions.push({label: "User (desc) ", value: {sort: "user", descending: true}}); + this.sortOptions.push({label: "User (asc) ", value: {sort: "user", descending: false}}) } var description = "Openaire, linking, claim, publication, research data, software, other research product, project, community"; this.updateTitle(this.pageTitle); @@ -120,7 +104,7 @@ export class DisplayClaimsComponent { if (this.properties.enablePiwikTrack && (typeof document !== 'undefined')) { this.subscriptions.push(this._piwikService.trackView(this.properties, this.pageTitle, this.piwikSiteId).subscribe()); } - + this.subscriptions.push(this.helper.getPageHelpContents(this.properties, this.communityId, this._router.url).subscribe(contents => { this.pageContents = contents; })); @@ -129,7 +113,7 @@ export class DisplayClaimsComponent { })); this.subscriptions.push(this.route.queryParams.subscribe(params => { this.seoService.createLinkForCanonicalURL(this.url, false); - + if (this.myClaims) { this.fetchBy = "User"; this.fetchId = this.user.email; @@ -139,18 +123,13 @@ export class DisplayClaimsComponent { this.fetchId = (this.fetchId) ? this.fetchId : params['fetchId']; this.fetchId = this.fetchId ? this.fetchId : ''; } - let page = (params['page'] === undefined) ? 1 : +params['page']; - let size = (params['size'] === undefined) ? this.defaultSize : +params['size']; - this.keyword = (params['keyword'] ? params['keyword'] : ""); this.filterForm.get('keyword').setValue(this.keyword); - this.inputkeyword = this.keyword; this.page = (page <= 0) ? 1 : page; - this.size = (size <= 0) ? this.defaultSize : size; this.entityTypes = [];//(params['types']?params['types']:[]); this.setTypes(params['types']); // check the appropriate checkboxes - this.setSortby(params['sort']); + this.setSortBy(params['sort']); this.getClaims(); this.subscriptions.push(this.searchTermStream .pipe(debounceTime(300), distinctUntilChanged()) @@ -167,323 +146,194 @@ export class DisplayClaimsComponent { })); })); } - + ngOnDestroy() { this.subscriptions.forEach(subscription => { if (subscription instanceof Subscriber) { subscription.unsubscribe(); } }); - if(this.subResults){ + if (this.subResults) { this.subResults.unsubscribe(); } } - + getClaims() { - if (!Session.isLoggedIn()) { - this.userValidMessage = "User session has expired. Please login again."; - this._router.navigate(['/user-info'], { - queryParams: { - "errorCode": LoginErrorCodes.NOT_VALID, - "redirectUrl": this._router.url + let types = ''; + for (let type of this.entities) { + types += (types.length > 0 ? '&' : '') + "types=" + type; + } + this.loading = true; + if (this.subResults) { + this.subResults.unsubscribe(); + } + if (this.fetchBy == "Project") { + this.subResults = this._claimService.getClaimsByProject(this.size, this.page, this.fetchId, this.keyword, this.filterForm.get("sort").value.sort, this.filterForm.get("sort").value.descending, types, this.properties.claimsAPIURL).subscribe( + data => { + this.manageAPIData(data); + this.loading = false; + }, + err => { + this.handleErrors(err, "Error getting claims for project with id: " + this.fetchId); } - }); + ); + } else if (this.fetchBy == "User") { + this.subResults = this._claimService.getClaimsByUser(this.size, this.page, this.fetchId, this.keyword, this.filterForm.get("sort").value.sort, this.filterForm.get("sort").value.descending, types, this.properties.claimsAPIURL).subscribe( + data => { + this.manageAPIData(data); + this.loading = false; + }, + err => { + this.handleErrors(err, "Error getting claims for user with id: " + this.fetchId); + this.loading = false; + } + ); + } else if (this.fetchBy == "Result") { + this.subResults = this._claimService.getClaimsByResult(this.size, this.page, this.fetchId, this.keyword, this.filterForm.get("sort").value.sort, this.filterForm.get("sort").value.descending, types, this.properties.claimsAPIURL).subscribe( + data => { + this.manageAPIData(data); + this.loading = false; + }, + err => { + this.handleErrors(err, "Error getting claims for entity with id: " + this.fetchId); + this.loading = false; + } + ); + } else if (this.fetchBy == "Context") { + this.subResults = this._claimService.getClaimsBycontext(this.size, this.page, this.fetchId, this.keyword, this.filterForm.get("sort").value.sort, this.filterForm.get("sort").value.descending, types, this.properties.claimsAPIURL).subscribe( + data => { + this.manageAPIData(data); + this.loading = false; + }, + err => { + this.handleErrors(err, "Error getting claims for context with id: " + this.fetchId); + this.loading = false; + } + ); } else { - this.selected = []; - let types = ''; - this.showErrorMessage = false; - this.showForbiddenMessage = false; - for (let type of this.entitiesCtrl.getRawValue()) { - types += (types.length > 0 ? '&' : '') + "types=" + type; - } - this.pageLoading = true; - if(this.subResults){ - this.subResults.unsubscribe(); - } - if (this.fetchBy == "Project") { - this.subResults = this._claimService.getClaimsByProject(this.size, this.page, this.fetchId, this.keyword, this.filterForm.get("sort").value.sort, this.filterForm.get("sort").value.descending, types, this.properties.claimsAPIURL).subscribe( - data => { - this.manageAPIData(data); - this.pageLoading = false; - }, - err => { - this.handleErrors(err, "Error getting claims for project with id: " + this.fetchId); - } - ); - } else if (this.fetchBy == "User") { - this.subResults = this._claimService.getClaimsByUser(this.size, this.page, this.fetchId, this.keyword, this.filterForm.get("sort").value.sort, this.filterForm.get("sort").value.descending, types, this.properties.claimsAPIURL).subscribe( - data => { - this.manageAPIData(data); - this.pageLoading = false; - }, - err => { - this.handleErrors(err, "Error getting claims for user with id: " + this.fetchId); - this.pageLoading = false; - } - ); - } else if (this.fetchBy == "Result") { - this.subResults = this._claimService.getClaimsByResult(this.size, this.page, this.fetchId, this.keyword, this.filterForm.get("sort").value.sort, this.filterForm.get("sort").value.descending, types, this.properties.claimsAPIURL).subscribe( - data => { - this.manageAPIData(data); - this.pageLoading = false; - }, - err => { - this.handleErrors(err, "Error getting claims for entity with id: " + this.fetchId); - this.pageLoading = false; - } - ); - } else if (this.fetchBy == "Context") { - this.subResults = this._claimService.getClaimsBycontext(this.size, this.page, this.fetchId, this.keyword, this.filterForm.get("sort").value.sort, this.filterForm.get("sort").value.descending, types, this.properties.claimsAPIURL).subscribe( - data => { - this.manageAPIData(data); - this.pageLoading = false; - }, - err => { - this.handleErrors(err, "Error getting claims for context with id: " + this.fetchId); - this.pageLoading = false; - } - ); - } else { - this.subResults = this._claimService.getClaims(this.size, this.page, this.keyword, this.filterForm.get("sort").value.sort, this.filterForm.get("sort").value.descending, types, this.properties.claimsAPIURL).subscribe( - data => { - this.manageAPIData(data); - this.pageLoading = false; - }, - err => { - this.handleErrors(err, "Error getting claims"); - this.pageLoading = false; - } - ); - } + this.subResults = this._claimService.getClaims(this.size, this.page, this.keyword, this.filterForm.get("sort").value.sort, this.filterForm.get("sort").value.descending, types, this.properties.claimsAPIURL).subscribe( + data => { + this.manageAPIData(data); + this.loading = false; + }, + err => { + this.handleErrors(err, "Error getting claims"); + this.loading = false; + } + ); } } - + manageAPIData(data) { this.claims = data.data; - this.resultsNum = data.total; - - + this.resultsNum = +data.total; } - + handleErrors(err, message) { - - this.showErrorMessage = true; - console.error("Dispaly Claims (component): " + message +" " + (err && err.error?err.error:'')); - try { - let error = err && err.error?err.error:err; - if (error.code && error.code == 403) { - this.showErrorMessage = false; - this.showForbiddenMessage = true; - if(!Session.isLoggedIn()) { - - this._router.navigate(['/user-info'], { - queryParams: { - "errorCode": LoginErrorCodes.NOT_VALID, - "redirectUrl": this._router.url - } - }); - } - - } - } catch (e) { - - } - + NotificationHandler.rise(message, "danger"); + console.error("Dispaly Claims (component): " + message + " " + (err && err.error ? err.error : '')); } - + goTo(page: number = 1) { this.page = page; this.location.go(location.pathname, this.getParametersString()); HelperFunctions.scroll(); this.getClaims(); } - + getParametersString() { let params = ''; params += (this.page == 1 ? "" : (params.length > 0 ? '&' : '') + "page=" + this.page); params += (this.size == 10 ? "" : (params.length > 0 ? '&' : '') + "size=" + this.size); let types = ""; - for (let type of this.entitiesCtrl.getRawValue()) { + for (let type of this.entities) { types += (types.length > 0 ? ',' : '') + type; } - params += (this.entitiesCtrl.getRawValue().length > 0) ? (params.length > 0 ? '&' : '') + "types=" + types : ""; + params += (this.entities.length > 0) ? (params.length > 0 ? '&' : '') + "types=" + types : ""; if (this.isAdmin) { params += (this.fetchBy == 'All' ? "" : (params.length > 0 ? '&' : '') + "fetchBy=" + this.fetchBy); params += (this.fetchId == '' ? "" : (params.length > 0 ? '&' : '') + "fetchId=" + this.fetchId); } - params += (this.filterForm.get("sort").value.sort == 'date' && this.filterForm.get("sort").value.descending ? "" : (params.length > 0 ? '&' : '') + "sort=" +this.filterForm.get("sort").value.sort + "-" + this.filterForm.get("sort").value.descending); + params += (this.filterForm.get("sort").value.sort == 'date' && this.filterForm.get("sort").value.descending ? "" : (params.length > 0 ? '&' : '') + "sort=" + this.filterForm.get("sort").value.sort + "-" + this.filterForm.get("sort").value.descending); params += (this.keyword == '' ? "" : (params.length > 0 ? '&' : '') + "keyword=" + this.keyword); if (this.communityId != null) { params += "&communityId=" + this.communityId; } return params; } - - setSortby(sortby: string) { + + setSortBy(sortby: string) { let sort = "date"; let desc = "desc"; - if(sortby && sortby.split("-").length == 2){ + if (sortby && sortby.split("-").length == 2) { sort = sortby.split("-")[0]; desc = sortby.split("-")[1]; } - - let option = this.sortOptions.find( option => option.value.sort == sort && ((option.value.descending && desc=="desc") || (!option.value.descending && desc=="asc"))); - this.filterForm.get("sort").setValue(option?option.value:this.sortOptions[0].value); + + let option = this.sortOptions.find(option => option.value.sort == sort && ((option.value.descending && desc == "desc") || (!option.value.descending && desc == "asc"))); + this.filterForm.get("sort").setValue(option ? option.value : this.sortOptions[0].value); } - + setTypes(typesParam: string) { - for(let type of typesParam?typesParam.split(','):[]){ - this.entitiesCtrl.push(new FormControl(type)); + for (let type of typesParam ? typesParam.split(',') : []) { + this.entities.push(type); } } - - changekeyword() { + + changeKeyword() { if (this.filterForm.get("keyword") && (this.filterForm.get("keyword").value.length >= 3 || this.filterForm.get("keyword").value.length == 0)) { this.searchTermStream.next(this.filterForm.get("keyword").value); } } - - select(item: any, event) { - let value = event.currentTarget.checked; - if (value) { - this.selected.push(item); - } else { - for (var _i = 0; _i < this.selected.length; _i++) { - let claim = this.selected[_i]; - if (claim['id'] == item.id) { - this.selected.splice(_i, 1); + + select(value: string, event, dropdownFilter: DropdownFilterComponent) { + if(event.target instanceof HTMLInputElement) { + dropdownFilter.closeDropdown(); + if(event.target.checked && !this.entities.find(entity => value === entity)) { + this.entities.push(value); + } else if(!event.target.checked) { + let index = this.entities.indexOf(value); + if(index !== -1) { + this.entities.splice(index, 1); } } - - + this.filterForm.get('entities').setValue(this.entities); } } - - selectAll(event) { - let value = event.currentTarget.checked; - if (value) { - this.selected = []; - for (let _i = 0; _i < this.claims.length; _i++) { - let claim = this.claims[_i]; - this.selected.push(claim); - } - } else { - this.selected = []; - } + + isSelected(value: string) { + return this.filterForm && this.filterForm.get('entities').value.find(entity => entity === value) } - - isSelected(id: string) { - for (let _i = 0; _i < this.selected.length; _i++) { - let claim = this.selected[_i]; - if (claim['id'] == id) { - return true; - } - } - return false; + + deleteOpen(index: number) { + this.index = index; + this.deleteModal.alertTitle = 'Delete Confirmation'; + this.deleteModal.message = 'Are you sure you want to delete this link?'; + this.deleteModal.okButtonText = 'Yes'; + this.deleteModal.open(); } - - - confirmOpen() { - if (this.selected.length <= 0) { - - } else { - this.alert.cancelButton = true; - this.alert.okButton = true; - this.alert.alertTitle = "";// "Delete " + this.selected.length + " links(s)"; - this.alert.okButtonLeft = false; - // this.alert.message = this.selected.length + " links will be deleted. Do you want to proceed? "; - this.alert.okButtonText = "Delete"; - this.alert.cancelButtonText = "Cancel"; - this.alert.open(); - } - } - - confirmClose() { - this.delete(); - } - + delete() { - this.loading.open(); - this.claimsDeleted = 0; - let ids = []; - for (let i = 0; i < this.selected.length; i++) { - let id = this.selected[i].id; - ids.push(id); - - } - this.batchDeleteById(ids); - } - - batchDeleteById(ids: string[]) { - if (!this.user) { - this.userValidMessage = "User session has expired. Please login again."; - this._router.navigate(['/user-info'], { - queryParams: { - "errorCode": LoginErrorCodes.NOT_VALID, - "redirectUrl": this._router.url + this.subscriptions.push(this._claimService.deleteBulk([this.claims[this.index].id], this.properties.claimsAPIURL).subscribe( + res => { + this.claims.splice(this.index, 1); + this.resultsNum = this.resultsNum - 1; + NotificationHandler.rise('Link has been deleted successfully'); + let goToPage = this.page; + if (this.totalPages(this.resultsNum) < this.page && this.page > 0) { + goToPage = this.page - 1; } - }); - } else { - //console.warn("Deleting claim with ids:"+ids); - this.subscriptions.push(this._claimService.deleteBulk(ids, this.properties.claimsAPIURL).subscribe( - res => { - //console.info('Delete response'+res.code ); - //console.warn("Deleted ids:"+ res.deletedIds); - //console.warn("Not found ids:"+ res.notFoundIds); - //remove this claim from the - let newClaims = this.claims; - for (let id of res.deletedIds) { - for (let _i = 0; _i < this.claims.length; _i++) { - let claim = this.claims[_i]; - if (claim['id'] == id) { - newClaims.splice(_i, 1); - } - } - for (let _i = 0; _i < this.selected.length; _i++) { - let claim = this.selected[_i]; - if (claim['id'] == id) { - this.selected.splice(_i, 1); - } - } - } - this.claims = newClaims; - this.resultsNum = this.resultsNum - res.deletedIds.length; - this.loading.close(); - if (res.deletedIds.length > 0) { - UIkit.notification('
' + res.deletedIds.length + ' link(s) successfully deleted.
', { - status: 'success', - timeout: 6000, - pos: 'bottom-right' - }); - } - if (res.notFoundIds.length > 0) { - UIkit.notification('
' + res.notFoundIds.length + ' link(s) couldn\'t be deleted.
', { - status: 'danger', - timeout: 6000, - pos: 'bottom-right' - }); - } - - let goToPage = this.page; - if (this.totalPages(this.resultsNum) < this.page && this.page > 0) { - goToPage = this.page - 1; - } - this.goTo(goToPage); - }, err => { - //console.log(err); - this.handleErrors(err,"Error deleting claims with ids: " + ids); - this.showErrorMessage = true; - this.loading.close(); - - })); - } + this.goTo(goToPage); + }, err => { + this.handleErrors(err, "Error deleting claim with id: " + this.claims[this.index].id); + })); } - + pageChange($event) { let page: number = +$event.value; this.goTo(page); } - + isClaimAvailable(claim: ClaimDBRecord): boolean { //claim.target.collectedFrom == "infrastruct_::openaire" && let lastUpdateDate = new Date((this.lastIndexDate != null) ? this.lastIndexDate : this.properties.lastIndexUpdate); @@ -493,14 +343,10 @@ export class DisplayClaimsComponent { if (claimDateStr < lastUpdateDateStr) { return true; } else { - if (claim.target.collectedFrom != "infrastruct_::openaire" && claim.indexed) { - // check if direct index succeded - return true - } + return claim.target.collectedFrom != "infrastruct_::openaire" && claim.indexed; } - return false; } - + totalPages(totalResults: number): number { let totalPages: any = totalResults / (this.size); if (!(Number.isInteger(totalPages))) { @@ -508,33 +354,25 @@ export class DisplayClaimsComponent { } return totalPages; } - + private updateDescription(description: string) { this._meta.updateTag({content: description}, "name='description'"); this._meta.updateTag({content: description}, "property='og:description'"); } - + private updateTitle(title: string) { var _prefix = ""; if (!this.communityId) { _prefix = "OpenAIRE | "; } var _title = _prefix + ((title.length > 50) ? title.substring(0, 50) : title); - if(this.myClaims) { + if (this.myClaims) { this._title.setTitle(_title); } this._meta.updateTag({content: _title}, "property='og:title'"); } - + private updateUrl(url: string) { this._meta.updateTag({content: url}, "property='og:url'"); } - public onSearchClose() { - this.inputkeyword = this.filterForm.get('keyword').value; - } - - public resetInput() { - this.inputkeyword = null; - this.searchInputComponent.reset() - } } diff --git a/claims/claim-utils/displayClaims/displayClaims.module.ts b/claims/claim-utils/displayClaims/displayClaims.module.ts index ec5d411b..d1a53541 100644 --- a/claims/claim-utils/displayClaims/displayClaims.module.ts +++ b/claims/claim-utils/displayClaims/displayClaims.module.ts @@ -22,13 +22,15 @@ import {SearchInputModule} from '../../../sharedComponents/search-input/search-i import {InputModule} from '../../../sharedComponents/input/input.module'; import {LoadingModule} from '../../../utils/loading/loading.module'; import {NoLoadPaging} from "../../../searchPages/searchUtils/no-load-paging.module"; +import {IconsModule} from "../../../utils/icons/icons.module"; +import {DropdownFilterModule} from "../../../utils/dropdown-filter/dropdown-filter.module"; @NgModule({ imports: [ CommonModule, FormsModule, RouterModule, ClaimServiceModule, LoadingModalModule, AlertModalModule, ClaimEntityFormatterModule, PagingModule, HelperModule, Schema2jsonldModule, SEOServiceModule, PiwikServiceModule, - IndexInfoServiceModule, MatSelectModule, SearchInputModule, MatAutocompleteModule, MatChipsModule, MatFormFieldModule, MatSlideToggleModule, InputModule, LoadingModule, NoLoadPaging - + IndexInfoServiceModule, MatSelectModule, SearchInputModule, MatAutocompleteModule, MatChipsModule, MatFormFieldModule, MatSlideToggleModule, InputModule, LoadingModule, NoLoadPaging, IconsModule, DropdownFilterModule + ], declarations: [ DisplayClaimsComponent diff --git a/claims/claimsAdmin/claimsAdmin.component.ts b/claims/claimsAdmin/claimsAdmin.component.ts index 34735396..20f8fc6a 100644 --- a/claims/claimsAdmin/claimsAdmin.component.ts +++ b/claims/claimsAdmin/claimsAdmin.component.ts @@ -10,7 +10,6 @@ import {Subscriber} from "rxjs"; @Component({ selector: 'claims-admin', template: ` -
@@ -30,9 +29,7 @@ import {Subscriber} from "rxjs";
- `, - }) export class ClaimsAdminComponent { @Input() fetchBy: string; diff --git a/dashboard/divhelpcontent/class-help-content-form.component.html b/dashboard/divhelpcontent/class-help-content-form.component.html index cbffeb41..f5023b86 100644 --- a/dashboard/divhelpcontent/class-help-content-form.component.html +++ b/dashboard/divhelpcontent/class-help-content-form.component.html @@ -43,8 +43,8 @@
- -
+
Content
+
Select Status (Enable/ disable)
- -
+
Content
+
- diff --git a/dashboard/page/pages.component.ts b/dashboard/page/pages.component.ts index 28f50784..9a1f62d6 100644 --- a/dashboard/page/pages.component.ts +++ b/dashboard/page/pages.component.ts @@ -242,7 +242,7 @@ export class PagesComponent implements OnInit { this.deleteModal.open(); } - public confirmedDeletePages(data: any) { + public confirmedDeletePages() { this.showLoading = true; this.subscriptions.push(this._helpContentService.deletePages(this.selectedPages, this.properties.adminToolsAPIURL).subscribe( _ => { diff --git a/dashboard/users/subscribers/subscribers.component.html b/dashboard/users/subscribers/subscribers.component.html index c939b4e0..6d34db62 100644 --- a/dashboard/users/subscribers/subscribers.component.html +++ b/dashboard/users/subscribers/subscribers.component.html @@ -54,7 +54,6 @@
diff --git a/searchPages/searchUtils/newSearchPage.component.html b/searchPages/searchUtils/newSearchPage.component.html index 2f9495bb..d8d2803e 100644 --- a/searchPages/searchUtils/newSearchPage.component.html +++ b/searchPages/searchUtils/newSearchPage.component.html @@ -238,7 +238,7 @@
+ class="uk-alert uk-margin-small-top "> The following results are related to {{customFilter.valueName}}. Are you interested to view more results? Visit diff --git a/sharedComponents/subscriber-invite/subscriber-invite.component.ts b/sharedComponents/subscriber-invite/subscriber-invite.component.ts index 9a391afd..6aa44e24 100644 --- a/sharedComponents/subscriber-invite/subscriber-invite.component.ts +++ b/sharedComponents/subscriber-invite/subscriber-invite.component.ts @@ -50,7 +50,7 @@ declare var UIkit;
-
+
`, styleUrls: ['subscriber-invite.component.css'] diff --git a/utils/dropdown-filter/dropdown-filter.component.ts b/utils/dropdown-filter/dropdown-filter.component.ts new file mode 100644 index 00000000..dc18d62c --- /dev/null +++ b/utils/dropdown-filter/dropdown-filter.component.ts @@ -0,0 +1,33 @@ +import {Component, Input, ViewChild} from "@angular/core"; + +declare var UIkit; + +@Component({ + selector: 'dropdown-filter', + template: ` + +
+ +
+ ` +}) +export class DropdownFilterComponent { + @Input() + public name; + @Input() + public count: number = 0; + @Input() + public dropdownClass: string; + @ViewChild("dropdown") dropdown; + + isOpen(element) { + return UIkit.dropdown(element).isActive(); + } + + closeDropdown() { + UIkit.dropdown(this.dropdown).hide(); + } +} diff --git a/utils/dropdown-filter/dropdown-filter.module.ts b/utils/dropdown-filter/dropdown-filter.module.ts new file mode 100644 index 00000000..801ac9c3 --- /dev/null +++ b/utils/dropdown-filter/dropdown-filter.module.ts @@ -0,0 +1,11 @@ +import {NgModule} from "@angular/core"; +import {CommonModule} from "@angular/common"; +import {DropdownFilterComponent} from "./dropdown-filter.component"; +import {IconsModule} from "../icons/icons.module"; + +@NgModule({ + imports: [CommonModule, IconsModule], + declarations: [DropdownFilterComponent], + exports: [DropdownFilterComponent] +}) +export class DropdownFilterModule {} diff --git a/utils/pagingFormatter.component.ts b/utils/pagingFormatter.component.ts index 1e151d0a..2f532e8a 100644 --- a/utils/pagingFormatter.component.ts +++ b/utils/pagingFormatter.component.ts @@ -6,8 +6,8 @@ import {properties} from "../../../environments/environment"; @Component({ selector: 'paging', template: ` -