Revision 55566
Added by Argiro Kokogiannaki over 5 years ago
modules/uoa-services-library/branches/newlinking/ng-openaire-library/src/app/claims/claim-utils/displayClaims/displayClaims.component.html | ||
---|---|---|
1 |
<schema2jsonld *ngIf="url" [URL]="url" name="Manage links" type="other"></schema2jsonld>
|
|
1 |
<schema2jsonld *ngIf="url" [URL]="url" name="Manage links" type="other"></schema2jsonld>
|
|
2 | 2 |
<div class="uk-width-1-1"> |
3 | 3 |
<helper position="top"></helper> |
4 | 4 |
</div> |
... | ... | |
10 | 10 |
Newly added links for OpenAIRE research results will be available on the next run of our algorithms. |
11 | 11 |
<div class="uk-margin-left">Links to external results (Crossref, Datacite, Orcid) are automatically added in OpenAIRE information space.</div> |
12 | 12 |
</div> --> |
13 |
<!-- <div *ngIf="showLatestClaims && recentClaims.length > 0" class="uk-section uk-section-muted uk-padding-small uk-padding-right uk-padding-left"> |
|
14 |
<div *ngIf="showLatestClaims && recentClaims.length > 0" class="uk-h5"> |
|
15 |
<span uk-tooltip="title:<div class='uk-margin-small'> Claims created during the last 24 hours</div>"> |
|
16 |
Recent links |
|
17 |
</span> |
|
18 |
</div> |
|
19 |
<table *ngIf="showLatestClaims && recentClaims.length > 0" class="uk-table uk-table-small uk-table-striped"> |
|
20 |
<thead> |
|
21 |
<tr> |
|
22 |
<th><a (click)="changeOrderby('target')" >Research Result</a> </th> |
|
23 |
<th><a (click)="changeOrderby('source')" >Link to</a> </th> |
|
24 |
<th *ngIf="showUserEmail"><a (click)="changeOrderby('user')" >Claimed by</a> </th> |
|
25 |
<th><a (click)="changeOrderby('date')"> Claimed Date</a></th> |
|
26 |
<th *ngIf="showLatestClaims">Status</th> |
|
27 |
</tr> |
|
28 |
</thead> |
|
29 |
<tbody> |
|
30 |
<tr *ngFor="let claim of recentClaims " > |
|
31 |
<td><claim-entity [entity]="claim.target" [type]="claim.targetType" [(properties)]=properties> </claim-entity></td> |
|
32 |
<td><claim-entity [entity]="claim.source" [type]="claim.sourceType" [(properties)]=properties> </claim-entity></td> |
|
33 |
<td *ngIf="showUserEmail">{{claim.userMail}}</td> |
|
34 |
<td>{{claim.date}}</td> |
|
35 |
<td *ngIf="showLatestClaims"> |
|
13 |
<!-- <div *ngIf="showLatestClaims && recentClaims.length > 0" class="uk-section uk-section-muted uk-padding-small uk-padding-right uk-padding-left">
|
|
14 |
<div *ngIf="showLatestClaims && recentClaims.length > 0" class="uk-h5">
|
|
15 |
<span uk-tooltip="title:<div class='uk-margin-small'> Claims created during the last 24 hours</div>">
|
|
16 |
Recent links
|
|
17 |
</span>
|
|
18 |
</div>
|
|
19 |
<table *ngIf="showLatestClaims && recentClaims.length > 0" class="uk-table uk-table-small uk-table-striped">
|
|
20 |
<thead>
|
|
21 |
<tr>
|
|
22 |
<th><a (click)="changeOrderby('target')" >Research Result</a> </th>
|
|
23 |
<th><a (click)="changeOrderby('source')" >Link to</a> </th>
|
|
24 |
<th *ngIf="showUserEmail"><a (click)="changeOrderby('user')" >Claimed by</a> </th>
|
|
25 |
<th><a (click)="changeOrderby('date')"> Claimed Date</a></th>
|
|
26 |
<th *ngIf="showLatestClaims">Status</th>
|
|
27 |
</tr>
|
|
28 |
</thead>
|
|
29 |
<tbody>
|
|
30 |
<tr *ngFor="let claim of recentClaims " >
|
|
31 |
<td><claim-entity [entity]="claim.target" [type]="claim.targetType" [(properties)]=properties> </claim-entity></td>
|
|
32 |
<td><claim-entity [entity]="claim.source" [type]="claim.sourceType" [(properties)]=properties> </claim-entity></td>
|
|
33 |
<td *ngIf="showUserEmail">{{claim.userMail}}</td>
|
|
34 |
<td>{{claim.date}}</td>
|
|
35 |
<td *ngIf="showLatestClaims">
|
|
36 | 36 |
|
37 |
<span class="uk-icon" [attr.uk-tooltip]="'title:<div class=\'uk-margin-small\'>'+getclaimStatus(claim)+'</div>'"> |
|
38 |
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="question" ratio="1"> |
|
39 |
<circle fill="none" stroke="#000" stroke-width="1.1" cx="10" cy="10" r="9"></circle><circle cx="10.44" cy="14.42" r="1.05"></circle><path fill="none" stroke="#000" stroke-width="1.2" d="M8.17,7.79 C8.17,4.75 12.72,4.73 12.72,7.72 C12.72,8.67 11.81,9.15 11.23,9.75 C10.75,10.24 10.51,10.73 10.45,11.4 C10.44,11.53 10.43,11.64 10.43,11.75"></path></svg> |
|
40 |
</span> |
|
41 |
</td> |
|
42 |
</tr> |
|
43 |
</tbody> |
|
44 |
</table> |
|
45 |
</div> --> |
|
37 |
<span class="uk-icon" [attr.uk-tooltip]="'title:<div class=\'uk-margin-small\'>'+getclaimStatus(claim)+'</div>'">
|
|
38 |
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="question" ratio="1">
|
|
39 |
<circle fill="none" stroke="#000" stroke-width="1.1" cx="10" cy="10" r="9"></circle><circle cx="10.44" cy="14.42" r="1.05"></circle><path fill="none" stroke="#000" stroke-width="1.2" d="M8.17,7.79 C8.17,4.75 12.72,4.73 12.72,7.72 C12.72,8.67 11.81,9.15 11.23,9.75 C10.75,10.24 10.51,10.73 10.45,11.4 C10.44,11.53 10.43,11.64 10.43,11.75"></path></svg>
|
|
40 |
</span>
|
|
41 |
</td>
|
|
42 |
</tr>
|
|
43 |
</tbody>
|
|
44 |
</table>
|
|
45 |
</div> -->
|
|
46 | 46 |
|
47 | 47 |
<form class=""> |
48 | 48 |
|
49 |
<div class="-row"> |
|
50 |
<span class="uk-text-bold">Filter By:</span> |
|
51 |
<input type="text" class=" uk-input form-control" placeholder="Search for keywords in titles ..." aria-describedby="sizing-addon2" [(ngModel)]="inputkeyword" (keyup)="changekeyword()" name="claims-keyword" ></div> |
|
52 |
<div class="uk-margin-small-top"> |
|
53 |
<label class="uk-margin-small-right"> <input [(ngModel)]="projectCB" type="checkbox" (ngModelChange)="changeType()" name="project" /> |
|
54 |
<span class="uk-icon" ><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><rect x="5" y="2" width="10" height="1"></rect><rect x="3" y="4" width="14" height="1"></rect><rect fill="none" stroke="#000" x="1.5" y="6.5" width="17" height="11"></rect></svg></span> |
|
55 |
Project </label> |
|
56 |
<label class="uk-margin-small-right"> <input [(ngModel)]="publicationCB" type="checkbox" (ngModelChange)="changeType()" name="publication" /> |
|
57 |
<span class="uk-icon" ><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><rect fill="none" stroke="#000" x="3.5" y="2.5" width="12" height="16"></rect><polyline fill="none" stroke="#000" points="5 0.5 17.5 0.5 17.5 17"></polyline></svg></span> |
|
58 |
Publication </label> |
|
59 |
<label class="uk-margin-small-right"> <input [(ngModel)]="datasetCB" type="checkbox" (ngModelChange)="changeType()" name="dataset" /> |
|
60 |
<span class="uk-icon" ><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><ellipse fill="none" stroke="#000" cx="10" cy="4.64" rx="7.5" ry="3.14"></ellipse><path fill="none" stroke="#000" d="M17.5,8.11 C17.5,9.85 14.14,11.25 10,11.25 C5.86,11.25 2.5,9.84 2.5,8.11"></path><path fill="none" stroke="#000" d="M17.5,11.25 C17.5,12.99 14.14,14.39 10,14.39 C5.86,14.39 2.5,12.98 2.5,11.25"></path><path fill="none" stroke="#000" d="M17.49,4.64 L17.5,14.36 C17.5,16.1 14.14,17.5 10,17.5 C5.86,17.5 2.5,16.09 2.5,14.36 L2.5,4.64"></path></svg></span> |
|
61 |
Research Data </label> |
|
62 |
<label class="uk-margin-small-right"> <input [(ngModel)]="softwareCB" type="checkbox" (ngModelChange)="changeType()" name="software" /> |
|
63 |
<span class="uk-icon" > |
|
64 |
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"> <circle fill="none" stroke="#000" cx="9.997" cy="10" r="3.31"></circle> <path fill="none" stroke="#000" d="M18.488,12.285 L16.205,16.237 C15.322,15.496 14.185,15.281 13.303,15.791 C12.428,16.289 12.047,17.373 12.246,18.5 L7.735,18.5 C7.938,17.374 7.553,16.299 6.684,15.791 C5.801,15.27 4.655,15.492 3.773,16.237 L1.5,12.285 C2.573,11.871 3.317,10.999 3.317,9.991 C3.305,8.98 2.573,8.121 1.5,7.716 L3.765,3.784 C4.645,4.516 5.794,4.738 6.687,4.232 C7.555,3.722 7.939,2.637 7.735,1.5 L12.263,1.5 C12.072,2.637 12.441,3.71 13.314,4.22 C14.206,4.73 15.343,4.516 16.225,3.794 L18.487,7.714 C17.404,8.117 16.661,8.988 16.67,10.009 C16.672,11.018 17.415,11.88 18.488,12.285 L18.488,12.285 Z"></path></svg> |
|
65 |
</span> |
|
66 |
Software |
|
67 |
</label> |
|
68 |
<label class="uk-margin-small-right"> <input [(ngModel)]="otherCB" type="checkbox" (ngModelChange)="changeType()" name="other" /> |
|
69 |
<span class="uk-icon" > |
|
70 |
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"> <polygon fill="none" stroke="#000" points="2.5,5.7 10,1.3 17.5,5.7 17.5,14.3 10,18.7 2.5,14.3"></polygon> <circle fill="none" stroke="#000" cx="10" cy="10" r="3.5"></circle></svg> |
|
71 |
</span> |
|
72 |
Other product |
|
73 |
</label> |
|
74 |
<label class="uk-margin-small-right"> <input [(ngModel)]="contextCB" type="checkbox" (ngModelChange)="changeType()" name="context" /> |
|
75 |
<span class="uk-icon" ><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"><circle fill="none" stroke="#000" stroke-width="1.1" cx="7.7" cy="8.6" r="3.5"></circle><path fill="none" stroke="#000" stroke-width="1.1" d="M1,18.1 C1.7,14.6 4.4,12.1 7.6,12.1 C10.9,12.1 13.7,14.8 14.3,18.3"></path><path fill="none" stroke="#000" stroke-width="1.1" d="M11.4,4 C12.8,2.4 15.4,2.8 16.3,4.7 C17.2,6.6 15.7,8.9 13.6,8.9 C16.5,8.9 18.8,11.3 19.2,14.1"></path></svg></span> |
|
76 |
Community </label> |
|
49 |
<div class=" "> |
|
50 |
<span class="uk-text-muted">Filter by</span> |
|
51 |
|
|
77 | 52 |
</div> |
53 |
<div class="uk-margin-small-top "> |
|
54 |
<label class="uk-margin-small-right"> <input [(ngModel)]="projectCB" type="checkbox" |
|
55 |
(ngModelChange)="changeType()" name="project"/> |
|
56 |
<!--<span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" |
|
57 |
ratio="1"><rect x="5" y="2" width="10" height="1"></rect><rect x="3" y="4" |
|
58 |
width="14" |
|
59 |
height="1"></rect><rect |
|
60 |
fill="none" stroke="#000" x="1.5" y="6.5" width="17" height="11"></rect></svg></span>--> |
|
61 |
Projects </label> |
|
62 |
<label class="uk-margin-small-right"> <input [(ngModel)]="publicationCB" type="checkbox" |
|
63 |
(ngModelChange)="changeType()" name="publication"/> |
|
64 |
<!-- <span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" |
|
65 |
ratio="1"><rect fill="none" stroke="#000" x="3.5" y="2.5" width="12" |
|
66 |
height="16"></rect><polyline fill="none" stroke="#000" |
|
67 |
points="5 0.5 17.5 0.5 17.5 17"></polyline></svg></span>--> |
|
68 |
Publications </label> |
|
69 |
<label class="uk-margin-small-right"> <input [(ngModel)]="datasetCB" type="checkbox" |
|
70 |
(ngModelChange)="changeType()" name="dataset"/> |
|
71 |
<!-- <span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" |
|
72 |
ratio="1"><ellipse fill="none" stroke="#000" cx="10" cy="4.64" rx="7.5" |
|
73 |
ry="3.14"></ellipse><path fill="none" stroke="#000" |
|
74 |
d="M17.5,8.11 C17.5,9.85 14.14,11.25 10,11.25 C5.86,11.25 2.5,9.84 2.5,8.11"></path><path |
|
75 |
fill="none" stroke="#000" |
|
76 |
d="M17.5,11.25 C17.5,12.99 14.14,14.39 10,14.39 C5.86,14.39 2.5,12.98 2.5,11.25"></path><path fill="none" |
|
77 |
stroke="#000" |
|
78 |
d="M17.49,4.64 L17.5,14.36 C17.5,16.1 14.14,17.5 10,17.5 C5.86,17.5 2.5,16.09 2.5,14.36 L2.5,4.64"></path></svg></span>--> |
|
79 |
Research Data </label> |
|
80 |
<label class="uk-margin-small-right"> <input [(ngModel)]="softwareCB" type="checkbox" |
|
81 |
(ngModelChange)="changeType()" name="software"/> |
|
82 |
<!--<span class="uk-icon"> |
|
83 |
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" ratio="1"> <circle |
|
84 |
fill="none" stroke="#000" cx="9.997" cy="10" r="3.31"></circle> <path fill="none" stroke="#000" |
|
85 |
d="M18.488,12.285 L16.205,16.237 C15.322,15.496 14.185,15.281 13.303,15.791 C12.428,16.289 12.047,17.373 12.246,18.5 L7.735,18.5 C7.938,17.374 7.553,16.299 6.684,15.791 C5.801,15.27 4.655,15.492 3.773,16.237 L1.5,12.285 C2.573,11.871 3.317,10.999 3.317,9.991 C3.305,8.98 2.573,8.121 1.5,7.716 L3.765,3.784 C4.645,4.516 5.794,4.738 6.687,4.232 C7.555,3.722 7.939,2.637 7.735,1.5 L12.263,1.5 C12.072,2.637 12.441,3.71 13.314,4.22 C14.206,4.73 15.343,4.516 16.225,3.794 L18.487,7.714 C17.404,8.117 16.661,8.988 16.67,10.009 C16.672,11.018 17.415,11.88 18.488,12.285 L18.488,12.285 Z"></path></svg> |
|
86 |
</span>--> |
|
87 |
Software |
|
88 |
</label> |
|
89 |
<label class="uk-margin-small-right"> <input [(ngModel)]="otherCB" type="checkbox" |
|
90 |
(ngModelChange)="changeType()" name="other"/> |
|
91 |
<!--<span class="uk-icon"> |
|
92 |
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"> <polygon |
|
93 |
fill="none" stroke="#000" points="2.5,5.7 10,1.3 17.5,5.7 17.5,14.3 10,18.7 2.5,14.3"></polygon> <circle |
|
94 |
fill="none" stroke="#000" cx="10" cy="10" r="3.5"></circle></svg> |
|
95 |
</span>--> |
|
96 |
Other products |
|
97 |
</label> |
|
98 |
<label class="uk-margin-small-right"> <input [(ngModel)]="contextCB" type="checkbox" |
|
99 |
(ngModelChange)="changeType()" name="context"/> |
|
100 |
<!--<span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" |
|
101 |
ratio="1"><circle fill="none" stroke="#000" stroke-width="1.1" cx="7.7" cy="8.6" |
|
102 |
r="3.5"></circle><path fill="none" stroke="#000" |
|
103 |
stroke-width="1.1" |
|
104 |
d="M1,18.1 C1.7,14.6 4.4,12.1 7.6,12.1 C10.9,12.1 13.7,14.8 14.3,18.3"></path><path |
|
105 |
fill="none" stroke="#000" stroke-width="1.1" |
|
106 |
d="M11.4,4 C12.8,2.4 15.4,2.8 16.3,4.7 C17.2,6.6 15.7,8.9 13.6,8.9 C16.5,8.9 18.8,11.3 19.2,14.1"></path></svg></span>--> |
|
107 |
Communities </label> |
|
108 |
<input type="text" class=" uk-input form-control" placeholder="Search for links..." |
|
109 |
aria-describedby="sizing-addon2" [(ngModel)]="inputkeyword" (keyup)="changekeyword()" |
|
110 |
name="claims-keyword"> |
|
111 |
</div> |
|
78 | 112 |
|
79 | 113 |
</form> |
80 |
<div class="searchPaging uk-panel uk-margin-top" data-uk-grid-margin=""> |
|
81 |
|
|
82 |
<div *ngIf="resultsNum" class="uk-float-right"> |
|
83 |
<paging-no-load [currentPage]="page" [totalResults]="resultsNum" [size]="size" (pageChange)="pageChange($event)"> </paging-no-load> |
|
84 |
</div> |
|
85 |
|
|
86 |
<div *ngIf="resultsNum>0" class="uk-width-1-2"> |
|
87 |
<span > Show |
|
88 |
<select *ngIf="resultsNum>10" class="uk-width-small uk-select" [(ngModel)]="size" name="select_size" (ngModelChange)="changeSize(size)" > |
|
89 |
<option *ngFor="let size of sizes" [value]="size">{{size}}</option> |
|
114 |
<div *ngIf="resultsNum>0 && selected.length == 0" |
|
115 |
class="searchPaging uk-panel uk-margin-top portal-hr uk-margin-small-bottom" |
|
116 |
data-uk-grid-margin=""> |
|
117 |
<div class="uk-width-1-2 uk-margin-top uk-margin-bottom"> |
|
118 |
<span> Results per page |
|
119 |
<select *ngIf="resultsNum>10" class="uk-width-1-5 uk-select" [(ngModel)]="size" name="select_size" |
|
120 |
(ngModelChange)="changeSize()"> |
|
121 |
<option *ngFor="let size of sizes" [value]="size">{{size}}</option> |
|
90 | 122 |
</select> |
91 | 123 |
</span> |
92 |
<span >Showing {{(size*page - size +1) | number}} to {{(size*page>resultsNum)?(resultsNum | number):((size*page) | number)}} of {{resultsNum | number}} claims </span> |
|
93 |
|
|
94 | 124 |
</div> |
95 |
</div> |
|
125 |
<div class="uk-grid"> |
|
126 |
<div *ngIf="resultsNum>0" class="uk-width-1-2"> |
|
96 | 127 |
|
128 |
<!-- <span>Showing {{(size * page - size + 1) | number}} to {{(size * page > resultsNum) ? (resultsNum | number) : ((size * page) | number)}} of {{resultsNum | number}} claims </span>--> |
|
129 |
<span class="portal-color">{{resultsNum|number}}</span> links, page <span |
|
130 |
class="portal-color">{{page | number}}</span> of <span |
|
131 |
class="portal-color">{{totalPages(resultsNum)|number}}</span> |
|
97 | 132 |
|
98 |
<div *ngIf="showErrorMessage " class = "uk-alert uk-alert-danger " > |
|
99 |
An Error occured. |
|
100 |
</div> |
|
101 |
<div *ngIf="showForbiddenMessage " class = "uk-alert uk-alert-danger " > |
|
102 |
You are not allowed to access this page. |
|
103 |
</div> |
|
104 |
<div *ngIf="userValidMessage.length > 0 " class = "uk-alert uk-alert-danger " > |
|
105 |
User session is not valid. Please login again. |
|
106 |
</div> |
|
107 |
|
|
108 |
|
|
109 |
<!-- Buttons for selecting and Delete Claims --> |
|
110 |
<div *ngIf="enableDelete"> |
|
111 |
<div *ngIf="selected.length>0 && resultsNum > 0 "> |
|
112 |
<div class = "uk-alert uk-alert-primary " > |
|
113 |
You have selected {{selected.length | number}} claim(s) |
|
114 | 133 |
</div> |
134 |
<div *ngIf="resultsNum" class="uk-width-1-2 "> |
|
135 |
<paging-no-load [currentPage]="page" [totalResults]="resultsNum" [size]="size" |
|
136 |
(pageChange)="pageChange($event)" class="uk-float-right"></paging-no-load> |
|
137 |
</div> |
|
115 | 138 |
</div> |
116 |
<div *ngIf="deleteMessage.length>0 " [innerHTML]="deleteMessage"> |
|
139 |
</div> |
|
140 |
<!-- Buttons for selecting and Delete Claims --> |
|
117 | 141 |
|
142 |
<div *ngIf="enableDelete && selected.length>0 && resultsNum > 0 " |
|
143 |
class="uk-margin-top portal-hr uk-margin-small-bottom uk-grid uk-margin-small-left"> |
|
144 |
<div class=" uk-width-1-2 uk-padding-remove-left"> |
|
145 |
{{selected.length | number}} link{{(selected.length > 1) ? 's' : ''}} selected |
|
118 | 146 |
</div> |
147 |
<div class=" uk-width-1-2"> |
|
148 |
<a [class]=" 'uk-text-danger uk-float-right '+(selected.length > 0?'':'uk-disabled')" (click)="confirmOpen()"> |
|
149 |
<span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" |
|
150 |
icon="trash" ratio="1"><polyline fill="none" stroke="#000" |
|
151 |
points="6.5 3 6.5 1.5 13.5 1.5 13.5 3"></polyline><polyline |
|
152 |
fill="none" stroke="#000" points="4.5 4 4.5 18.5 15.5 18.5 15.5 4"></polyline><rect x="8" y="7" |
|
153 |
width="1" |
|
154 |
height="9"></rect><rect |
|
155 |
x="11" y="7" width="1" height="9"></rect><rect x="2" y="3" width="16" height="1"></rect></svg></span> |
|
156 |
delete links |
|
157 |
</a> |
|
158 |
</div> |
|
159 |
</div> |
|
119 | 160 |
|
161 |
<div *ngIf="deleteMessage.length>0 " [innerHTML]="deleteMessage"> |
|
120 | 162 |
|
121 |
<!--button *ngIf="claims && claims.length > 0" class=" uk-button uk-button-default" (click)="confirmOpen()"> <span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="trash" ratio="1"><polyline fill="none" stroke="#000" points="6.5 3 6.5 1.5 13.5 1.5 13.5 3"></polyline><polyline fill="none" stroke="#000" points="4.5 4 4.5 18.5 15.5 18.5 15.5 4"></polyline><rect x="8" y="7" width="1" height="9"></rect><rect x="11" y="7" width="1" height="9"></rect><rect x="2" y="3" width="16" height="1"></rect></svg></span> Delete</button--> |
|
163 |
|
|
164 |
<!--button *ngIf="claims && claims.length > 0" class=" uk-button uk-button-default" (click)="confirmOpen()"> <span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="trash" ratio="1"><polyline fill="none" stroke="#000" points="6.5 3 6.5 1.5 13.5 1.5 13.5 3"></polyline><polyline fill="none" stroke="#000" points="4.5 4 4.5 18.5 15.5 18.5 15.5 4"></polyline><rect x="8" y="7" width="1" height="9"></rect><rect x="11" y="7" width="1" height="9"></rect><rect x="2" y="3" width="16" height="1"></rect></svg></span> Delete</button--> |
|
122 | 165 |
</div> |
123 |
<br> |
|
124 | 166 |
|
125 | 167 |
|
126 |
<div *ngIf=" claims && claims.length == 0" >
|
|
127 |
<div class = "uk-alert uk-alert-primary " >No entries found.</div>
|
|
168 |
<div *ngIf="showErrorMessage " class="uk-alert uk-alert-danger ">
|
|
169 |
An Error occured.
|
|
128 | 170 |
</div> |
171 |
<div *ngIf="showForbiddenMessage " class="uk-alert uk-alert-danger "> |
|
172 |
You are not allowed to access this page. |
|
173 |
</div> |
|
174 |
<div *ngIf="userValidMessage.length > 0 " class="uk-alert uk-alert-danger "> |
|
175 |
User session is not valid. Please login again. |
|
176 |
</div> |
|
129 | 177 |
|
178 |
|
|
179 |
<div *ngIf=" claims && claims.length == 0"> |
|
180 |
<div class="uk-alert uk-alert-primary ">No entries found.</div> |
|
181 |
</div> |
|
182 |
|
|
130 | 183 |
<div class=""> |
131 |
<table *ngIf="claims && claims.length > 0" class="uk-table uk-table-small uk-table-striped"> |
|
132 |
<thead> |
|
133 |
<tr> |
|
134 |
<th *ngIf="enableDelete" class="uk-padding-remove-right" title="Select all"> |
|
135 |
<input id="checkAll" type="checkbox" (click)="selectAll($event)" [ngModel]="selected.length==claims.length" /> |
|
136 |
</th> |
|
137 |
<th class="uk-padding-remove-right uk-padding-remove-left" title="Delete selected"> |
|
138 |
<a [class]=" 'uk-text-danger '+(selected.length > 0?'':'uk-disabled')" (click)="confirmOpen()" > |
|
139 |
<span class="uk-icon"><svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="trash" ratio="1"><polyline fill="none" stroke="#000" points="6.5 3 6.5 1.5 13.5 1.5 13.5 3"></polyline><polyline fill="none" stroke="#000" points="4.5 4 4.5 18.5 15.5 18.5 15.5 4"></polyline><rect x="8" y="7" width="1" height="9"></rect><rect x="11" y="7" width="1" height="9"></rect><rect x="2" y="3" width="16" height="1"></rect></svg></span> |
|
140 |
</a> |
|
141 |
</th> |
|
142 |
<!--<th>Id</th> |
|
143 |
<!-- <th>Target Type</th> --> |
|
144 |
<th><a (click)="changeOrderby('target')" >Research Result</a> </th> |
|
145 |
<!--<th>Source type</th> --> |
|
146 |
<th><a (click)="changeOrderby('source')" >Link to</a> </th> |
|
184 |
<table *ngIf="claims && claims.length > 0" class="uk-table uk-table-small uk-table-striped dataTable"> |
|
185 |
<thead class="uk-text-capitalize"> |
|
186 |
<tr> |
|
187 |
<th *ngIf="enableDelete" class="uk-padding-remove-right" title="Select all"> |
|
188 |
<input id="checkAll" type="checkbox" (click)="selectAll($event)" |
|
189 |
[ngModel]="selected.length==claims.length"/> |
|
190 |
</th> |
|
191 |
<th [class]="'uk-width-1-3 '+(sortby != 'target'?'sorting':(descending?'sorting_desc':'sorting_asc'))" |
|
192 |
(click)="changeOrderby('target')"> Source |
|
193 |
</th> |
|
147 | 194 |
|
148 |
<th *ngIf="showUserEmail"><a (click)="changeOrderby('user')" >Claimed by</a> </th> |
|
149 |
<th><a (click)="changeOrderby('date')"> Claimed Date</a></th> |
|
150 |
<th *ngIf="showLatestClaims">Status</th> |
|
151 |
</tr> |
|
152 |
</thead> |
|
153 |
<tbody> |
|
154 |
<tr *ngFor="let claim of claims " > |
|
155 |
<td *ngIf="enableDelete"><input [id]="claim.id" type="checkbox" (click)="select(claim,$event)" [ngModel]="isSelected(claim.id)"/></td> |
|
156 |
<td></td> |
|
157 |
<td><claim-entity [entity]="claim.target" [type]="claim.targetType" [(properties)]=properties [externalPortalUrl]=externalPortalUrl> </claim-entity></td> |
|
158 |
<td><claim-entity [entity]="claim.source" [type]="claim.sourceType" [(properties)]=properties [externalPortalUrl]=externalPortalUrl> </claim-entity></td> |
|
159 |
<td *ngIf="showUserEmail">{{claim.userMail}}</td> |
|
160 |
<td>{{claim.date}}</td> |
|
161 |
<td> |
|
195 |
<th [class]="'uk-width-1-3 '+(sortby != 'source'?'sorting':(descending?'sorting_desc':'sorting_asc'))" |
|
196 |
(click)="changeOrderby('source')"> |
|
197 |
Link to |
|
198 |
</th> |
|
199 |
<th *ngIf=" showUserEmail |
|
200 |
" [class]="sortby != 'user'?'sorting':(descending?'sorting_desc':'sorting_asc')" |
|
201 |
(click)="changeOrderby('user')"> |
|
202 |
Claimed by |
|
203 |
</th> |
|
204 |
<th [class]="sortby != 'date'?'sorting':(descending?'sorting_desc':'sorting_asc')" |
|
205 |
(click)="changeOrderby('date')"> |
|
206 |
Claim Date |
|
207 |
</th> |
|
208 |
<th *ngIf="showLatestClaims">Status</th> |
|
209 |
</tr> |
|
210 |
</thead> |
|
211 |
<tbody> |
|
212 |
<tr *ngFor="let claim of claims "> |
|
213 |
<td *ngIf="enableDelete"><input [id]="claim.id" type="checkbox" (click)="select(claim,$event)" |
|
214 |
[ngModel]="isSelected(claim.id)"/></td> |
|
215 |
<!-- <td></td>--> |
|
216 |
<td> |
|
217 |
<claim-entity [entity]="claim.target" [type]="claim.targetType" [properties]=properties |
|
218 |
[externalPortalUrl]=externalPortalUrl></claim-entity> |
|
219 |
</td> |
|
220 |
<td> |
|
221 |
<claim-entity [entity]="claim.source" [type]="claim.sourceType" [properties]=properties |
|
222 |
[externalPortalUrl]=externalPortalUrl></claim-entity> |
|
223 |
</td> |
|
224 |
<td *ngIf="showUserEmail">{{claim.userMail}}</td> |
|
225 |
<td>{{claim.date}}</td> |
|
226 |
<td> |
|
162 | 227 |
|
163 |
<span class="uk-icon" [attr.uk-tooltip]="'title:<div class=\'uk-margin-small\'>'+getclaimStatus(claim)+'</div>'"> |
|
164 |
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="question" ratio="1"> |
|
165 |
<circle fill="none" stroke="#000" stroke-width="1.1" cx="10" cy="10" r="9"></circle><circle cx="10.44" cy="14.42" r="1.05"></circle><path fill="none" stroke="#000" stroke-width="1.2" d="M8.17,7.79 C8.17,4.75 12.72,4.73 12.72,7.72 C12.72,8.67 11.81,9.15 11.23,9.75 C10.75,10.24 10.51,10.73 10.45,11.4 C10.44,11.53 10.43,11.64 10.43,11.75"></path></svg> |
|
228 |
<span class="uk-icon" |
|
229 |
[attr.uk-tooltip]="'title:<div class=\'uk-margin-small\'>'+getclaimStatus(claim)+'</div>'"> |
|
230 |
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="question" |
|
231 |
ratio="1"> |
|
232 |
<circle fill="none" stroke="#000" stroke-width="1.1" cx="10" cy="10" r="9"></circle><circle cx="10.44" |
|
233 |
cy="14.42" |
|
234 |
r="1.05"></circle><path |
|
235 |
fill="none" stroke="#000" stroke-width="1.2" |
|
236 |
d="M8.17,7.79 C8.17,4.75 12.72,4.73 12.72,7.72 C12.72,8.67 11.81,9.15 11.23,9.75 C10.75,10.24 10.51,10.73 10.45,11.4 C10.44,11.53 10.43,11.64 10.43,11.75"></path></svg> |
|
166 | 237 |
</span> |
167 |
</td>
|
|
168 |
</tr>
|
|
169 |
</tbody> |
|
170 |
</table> |
|
238 |
</td> |
|
239 |
</tr> |
|
240 |
</tbody>
|
|
241 |
</table>
|
|
171 | 242 |
</div> |
172 | 243 |
<helper position="bottom"></helper> |
173 | 244 |
|
174 |
</div> |
|
175 |
<div class="uk-width-1-5"> |
|
176 |
<div class="uk-card portal-card uk-padding" *ngIf="externalPortalUrl || claimsInfoURL"> |
|
177 |
<h6 *ngIf="!externalPortalUrl || externalPortalUrl.indexOf('http')==-1" class="uk-h6"> |
|
178 |
<a class="el-content uk-link-text" routerLink="/participate/claim">Claim more links?</a> |
|
179 |
</h6> |
|
180 |
<h6 *ngIf="externalPortalUrl && externalPortalUrl.indexOf('http')!=-1" class="uk-h6"> |
|
181 |
<a class="el-content uk-link-text" [href]="externalPortalUrl+'/participate/claim'" target="_blank">Claim more links?</a> |
|
182 |
</h6> |
|
183 |
<h6 *ngIf="claimsInfoURL" class="uk-h6 uk-margin-small-top"> |
|
184 |
<a class="el-content uk-link-text" [href]="claimsInfoURL" target="_blank">Learn more</a> |
|
185 |
</h6> |
|
186 | 245 |
</div> |
187 |
<helper position="right" styleName=" uk-width-1-5"></helper> |
|
246 |
<div class="uk-width-1-5"> |
|
247 |
<div class="uk-card portal-card uk-padding" *ngIf="externalPortalUrl || claimsInfoURL"> |
|
248 |
<h6 *ngIf="!externalPortalUrl || externalPortalUrl.indexOf('http')==-1" class="uk-h6"> |
|
249 |
<a class="el-content uk-link-text" routerLink="/participate/claim">Claim more links?</a> |
|
250 |
</h6> |
|
251 |
<h6 *ngIf="externalPortalUrl && externalPortalUrl.indexOf('http')!=-1" class="uk-h6"> |
|
252 |
<a class="el-content uk-link-text" [href]="externalPortalUrl+'/participate/claim'" |
|
253 |
target="_blank">Claim more links?</a> |
|
254 |
</h6> |
|
255 |
<h6 *ngIf="claimsInfoURL" class="uk-h6 uk-margin-small-top"> |
|
256 |
<a class="el-content uk-link-text" [href]="claimsInfoURL" target="_blank">Learn more</a> |
|
257 |
</h6> |
|
258 |
</div> |
|
259 |
<helper position="right" styleName=" uk-width-1-5"></helper> |
|
260 |
</div> |
|
188 | 261 |
</div> |
189 |
</div> |
|
190 |
<modal-alert (alertOutput)="confirmClose($event)"> |
|
262 |
<modal-alert (alertOutput)="confirmClose()"> |
|
263 |
<p> |
|
264 |
{{this.selected.length}}} links will be deleted. |
|
265 |
</p> |
|
266 |
<p> |
|
267 |
Notice that the final removal of the links from OpenAIRE will take more time. |
|
268 |
</p> |
|
269 |
<p>Do you want to proceed?</p> |
|
191 | 270 |
</modal-alert> |
192 |
<modal-loading [message]= "'Please wait...'"></modal-loading> |
|
271 |
<modal-loading [message]="'Please wait...'"></modal-loading> |
modules/uoa-services-library/branches/newlinking/ng-openaire-library/src/app/claims/claim-utils/displayClaims/displayClaims.component.ts | ||
---|---|---|
1 |
import {Component, ViewChild, Input} from '@angular/core';
|
|
1 |
import {Component, Input, ViewChild} from '@angular/core';
|
|
2 | 2 |
import {Location} from '@angular/common'; |
3 |
import {Observable} from 'rxjs/Observable'; |
|
4 | 3 |
import {ActivatedRoute, Router} from '@angular/router'; |
5 | 4 |
import {Subject} from 'rxjs/Subject'; |
6 | 5 |
import {ClaimsService} from '../service/claims.service'; |
7 | 6 |
import {ModalLoading} from '../../../utils/modal/loading.component'; |
8 | 7 |
import {AlertModal} from '../../../utils/modal/alert'; |
9 | 8 |
import {Session} from '../../../login/utils/helper.class'; |
10 |
import{EnvProperties} from '../../../utils/properties/env-properties'; |
|
9 |
import {EnvProperties} from '../../../utils/properties/env-properties';
|
|
11 | 10 |
import {LoginErrorCodes} from '../../../login/utils/guardHelper.class'; |
12 |
import { SEOService } from '../../../sharedComponents/SEO/SEO.service';
|
|
11 |
import {SEOService} from '../../../sharedComponents/SEO/SEO.service';
|
|
13 | 12 |
|
14 | 13 |
|
15 | 14 |
@Component({ |
16 |
selector: 'displayClaims',
|
|
17 |
templateUrl: 'displayClaims.component.html',
|
|
18 |
providers:[ ClaimsService]
|
|
15 |
selector: 'displayClaims', |
|
16 |
templateUrl: 'displayClaims.component.html', |
|
17 |
providers: [ClaimsService]
|
|
19 | 18 |
|
20 | 19 |
}) |
21 | 20 |
export class DisplayClaimsComponent { |
22 |
properties:EnvProperties; |
|
21 |
properties: EnvProperties;
|
|
23 | 22 |
public searchTermStream = new Subject<string>(); |
23 |
sub: any; |
|
24 |
//string because comes as input from component directive |
|
25 |
@Input() enableDelete: boolean = false; |
|
26 |
@Input() showUserEmail: boolean = true; |
|
27 |
@Input() myClaims: boolean = false; |
|
28 |
@Input() isAdmin: boolean = false; |
|
29 |
@Input() showLatestClaims: boolean = false; |
|
30 |
page: number=1; |
|
31 |
size: number=10; |
|
32 |
sizes = [10, 20, 30, 50]; |
|
33 |
keyword: string; // the keyword string to give to the request as parameter |
|
34 |
inputkeyword: string; // the string written in the input field (keyword=inputkeyword when its length is bigger than 3 and the user stops typing) |
|
35 |
lengths = [10, 20, 30, 50]; |
|
36 |
types = ["All", "Project", "Context", "Result", "User"]; |
|
37 |
@Input() fetchBy: string; |
|
38 |
@Input() fetchId: string; |
|
24 | 39 |
|
25 |
constructor (private _claimService: ClaimsService, private route: ActivatedRoute, private _router:Router, private location: Location, |
|
26 |
private seoService: SEOService) { |
|
27 |
} |
|
40 |
navigateTo: string = "Claims"; |
|
41 |
resultsNum: number; |
|
42 |
claims: any[]; |
|
43 |
@Input() externalPortalUrl: string = null; |
|
44 |
@Input() claimsInfoURL: string;// ="https://www.openaire.eu/linking"; |
|
28 | 45 |
|
46 |
@ViewChild(ModalLoading) loading: ModalLoading; |
|
47 |
|
|
48 |
//checkboxes: |
|
49 |
publicationCB = false; |
|
50 |
datasetCB = false; |
|
51 |
softwareCB = false; |
|
52 |
otherCB = false; |
|
53 |
contextCB = false; |
|
54 |
projectCB = false; |
|
55 |
entityTypes: string[] = []; |
|
56 |
|
|
57 |
descending = true; |
|
58 |
sortby = "date"; |
|
59 |
|
|
60 |
selected = []; |
|
61 |
deleteMessage: string = ""; |
|
62 |
showErrorMessage: boolean = false; |
|
63 |
showForbiddenMessage: boolean = false; |
|
64 |
userValidMessage: string = ""; |
|
65 |
|
|
66 |
//params for pagingFormatter to use when navigate to page |
|
67 |
params; |
|
68 |
@ViewChild(AlertModal) alert; |
|
69 |
|
|
70 |
claimsDeleted: number = 0; |
|
71 |
@Input() communityId: string = null; |
|
72 |
|
|
73 |
url = null; |
|
74 |
|
|
75 |
constructor(private _claimService: ClaimsService, private route: ActivatedRoute, private _router: Router, private location: Location, |
|
76 |
private seoService: SEOService) { |
|
77 |
} |
|
78 |
|
|
29 | 79 |
ngOnInit() { |
30 | 80 |
this.route.data |
31 | 81 |
.subscribe((data: { envSpecific: EnvProperties }) => { |
32 |
this.properties = data.envSpecific;
|
|
33 |
this.url = data.envSpecific.baseLink+this._router.url;
|
|
82 |
this.properties = data.envSpecific; |
|
83 |
this.url = data.envSpecific.baseLink + this._router.url;
|
|
34 | 84 |
|
35 | 85 |
}); |
36 |
this.sub = this.route.queryParams.subscribe(params => {
|
|
37 |
this.seoService.createLinkForCanonicalURL(this.properties.baseLink+this._router.url, false);
|
|
86 |
this.sub = this.route.queryParams.subscribe(params => { |
|
87 |
this.seoService.createLinkForCanonicalURL(this.properties.baseLink + this._router.url, false);
|
|
38 | 88 |
|
39 |
if( this.myClaims){
|
|
40 |
this.fetchBy = "User";
|
|
41 |
this.fetchId = Session.getUserEmail();
|
|
42 |
}else{
|
|
89 |
if (this.myClaims) {
|
|
90 |
this.fetchBy = "User"; |
|
91 |
this.fetchId = Session.getUserEmail(); |
|
92 |
} else {
|
|
43 | 93 |
|
44 |
this.fetchBy = (this.fetchBy)?this.fetchBy:params['fetchBy'];
|
|
45 |
this.fetchBy = (this.types.indexOf(this.fetchBy) != -1)? this.fetchBy:'All';
|
|
46 |
this.fetchId =(this.fetchId)?this.fetchId: params['fetchId'];
|
|
47 |
this.fetchId = this.fetchId?this.fetchId:'';
|
|
94 |
this.fetchBy = (this.fetchBy) ? this.fetchBy : params['fetchBy'];
|
|
95 |
this.fetchBy = (this.types.indexOf(this.fetchBy) != -1) ? this.fetchBy : 'All';
|
|
96 |
this.fetchId = (this.fetchId) ? this.fetchId : params['fetchId'];
|
|
97 |
this.fetchId = this.fetchId ? this.fetchId : '';
|
|
48 | 98 |
} |
49 | 99 |
|
50 |
let page = (params['page']=== undefined)?1:+params['page'];
|
|
51 |
let size = (params['size']=== undefined)?10:+params['size'];
|
|
100 |
let page = (params['page'] === undefined) ? 1 : +params['page'];
|
|
101 |
let size = (params['size'] === undefined) ? 10 : +params['size'];
|
|
52 | 102 |
|
53 |
this.keyword = (params['keyword']?params['keyword']:"");
|
|
103 |
this.keyword = (params['keyword'] ? params['keyword'] : "");
|
|
54 | 104 |
this.inputkeyword = this.keyword; |
55 |
this.page = ( page <= 0 ) ? 1 : page;
|
|
56 |
this.size = ( size <= 0 ) ? 10 : size;
|
|
105 |
this.page = (page <= 0) ? 1 : page;
|
|
106 |
this.size = (size <= 0) ? 10 : size;
|
|
57 | 107 |
this.entityTypes = []//(params['types']?params['types']:[]); |
58 | 108 |
this.setTypes(params['types']); // check the appropriate checkboxes |
59 | 109 |
this.setSortby(params['sort']); |
60 | 110 |
this.getClaims(); |
61 | 111 |
this.searchTermStream |
62 |
.debounceTime(300).distinctUntilChanged() |
|
63 |
.subscribe((term: string) => {
|
|
64 |
this.keyword = this.inputkeyword; |
|
65 |
//console.log("keyword: "+this.keyword + " VS inputkeyword: "+this.inputkeyword); |
|
66 |
this.page = 1; |
|
67 |
this.goTo(); |
|
68 |
}); |
|
112 |
.debounceTime(300).distinctUntilChanged()
|
|
113 |
.subscribe((term: string) => {
|
|
114 |
this.keyword = this.inputkeyword;
|
|
115 |
//console.log("keyword: "+this.keyword + " VS inputkeyword: "+this.inputkeyword);
|
|
116 |
this.page = 1;
|
|
117 |
this.goTo();
|
|
118 |
});
|
|
69 | 119 |
|
70 | 120 |
}); |
71 | 121 |
|
72 | 122 |
} |
123 |
|
|
73 | 124 |
ngOnDestroy() { |
74 | 125 |
this.sub.unsubscribe(); |
75 | 126 |
//this.searchTermStreamSub.unsubscribe(); |
76 | 127 |
} |
77 |
sub: any; |
|
78 |
//string because comes as input from component directive |
|
79 |
@Input() enableDelete: boolean = false; |
|
80 |
@Input() showUserEmail: boolean = true; |
|
81 |
@Input() myClaims: boolean= false ; |
|
82 |
@Input() isAdmin:boolean = false; |
|
83 |
@Input() showLatestClaims:boolean = false; |
|
84 |
// recentClaims = []; |
|
85 |
page : number; |
|
86 |
size:number; |
|
87 |
sizes = [10,20,30,50]; |
|
88 |
keyword:string; // the keyword string to give to the request as parameter |
|
89 |
inputkeyword:string; // the string written in the input field (keyword=inputkeyword when its length is bigger than 3 and the user stops typing) |
|
90 |
lengths = [10,20,30,50]; |
|
91 |
types = ["All","Project","Context","Result","User"]; |
|
92 |
@Input() fetchBy:string; |
|
93 |
@Input() fetchId:string; |
|
94 | 128 |
|
95 |
navigateTo: string = "Claims"; |
|
96 |
resultsNum: number ; |
|
97 |
claims: string[]; |
|
98 |
@Input() externalPortalUrl:string = null; |
|
99 |
@Input() claimsInfoURL:string;// ="https://www.openaire.eu/linking"; |
|
100 |
|
|
101 |
@ViewChild (ModalLoading) loading : ModalLoading ; |
|
102 |
|
|
103 |
//checkboxes: |
|
104 |
publicationCB = false; |
|
105 |
datasetCB = false; |
|
106 |
softwareCB = false; |
|
107 |
otherCB = false; |
|
108 |
contextCB = false; |
|
109 |
projectCB = false; |
|
110 |
entityTypes : string[] =[] ; |
|
111 |
|
|
112 |
descending = true; |
|
113 |
sortby = "date"; |
|
114 |
|
|
115 |
selected=[]; |
|
116 |
deleteMessage:string = ""; |
|
117 |
showErrorMessage:boolean = false; |
|
118 |
showForbiddenMessage:boolean = false; |
|
119 |
userValidMessage:string = ""; |
|
120 |
|
|
121 |
//params for pagingFormatter to use when navigate to page |
|
122 |
params; |
|
123 |
@ViewChild(AlertModal) alert; |
|
124 |
|
|
125 |
claimsDeleted:number = 0; |
|
126 |
@Input() communityId:string = null; |
|
127 |
|
|
128 |
url=null; |
|
129 |
|
|
130 |
getClaims () { |
|
131 |
if(!Session.isLoggedIn()){ |
|
129 |
getClaims() { |
|
130 |
if (!Session.isLoggedIn()) { |
|
132 | 131 |
this.userValidMessage = "User session has expired. Please login again."; |
133 |
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} }); |
|
134 |
}else{ |
|
135 |
this.selected=[]; |
|
136 |
var types = ''; |
|
137 |
this.showErrorMessage = false; |
|
138 |
this.showForbiddenMessage = false; |
|
139 |
for (var type of this.entityTypes){ |
|
140 |
types+=(types.length>0?'&':'')+"types="+type; |
|
141 |
} |
|
142 |
if(this.fetchBy =="Project" ){ |
|
143 |
this._claimService.getClaimsByProject(this.size,this.page,this.fetchId,this.keyword,this.sortby,this.descending, types, this.properties.claimsAPIURL).subscribe( |
|
144 |
data => { |
|
145 |
this.manageAPIData(data); |
|
146 |
}, |
|
147 |
err => { |
|
148 |
this.handleErrors(err); |
|
149 |
this.handleError("Error getting claims for project with id: "+this.fetchId, err); |
|
132 |
this._router.navigate(['/user-info'], { |
|
133 |
queryParams: { |
|
134 |
"errorCode": LoginErrorCodes.NOT_VALID, |
|
135 |
"redirectUrl": this._router.url |
|
150 | 136 |
} |
151 |
); |
|
152 |
}else if(this.fetchBy =="User"){ |
|
153 |
this._claimService.getClaimsByUser(this.size,this.page,this.fetchId,this.keyword,this.sortby,this.descending, types,this.properties.claimsAPIURL).subscribe( |
|
154 |
data => { |
|
155 |
this.manageAPIData(data); |
|
137 |
}); |
|
138 |
} else { |
|
139 |
this.selected = []; |
|
140 |
let types = ''; |
|
141 |
this.showErrorMessage = false; |
|
142 |
this.showForbiddenMessage = false; |
|
143 |
for (let type of this.entityTypes) { |
|
144 |
types += (types.length > 0 ? '&' : '') + "types=" + type; |
|
145 |
} |
|
146 |
if (this.fetchBy == "Project") { |
|
147 |
this._claimService.getClaimsByProject(this.size, this.page, this.fetchId, this.keyword, this.sortby, this.descending, types, this.properties.claimsAPIURL).subscribe( |
|
148 |
data => { |
|
149 |
this.manageAPIData(data); |
|
156 | 150 |
}, |
157 | 151 |
err => { |
158 | 152 |
this.handleErrors(err); |
159 |
this.handleError("Error getting claims for user with id: "+this.fetchId, err);
|
|
153 |
DisplayClaimsComponent.handleError("Error getting claims for project with id: " + this.fetchId, err);
|
|
160 | 154 |
} |
161 |
); |
|
162 |
}else if(this.fetchBy =="Result"){
|
|
163 |
this._claimService.getClaimsByResult(this.size,this.page,this.fetchId,this.keyword,this.sortby,this.descending, types, this.properties.claimsAPIURL).subscribe(
|
|
164 |
data => { |
|
165 |
this.manageAPIData(data); |
|
155 |
);
|
|
156 |
} else if (this.fetchBy == "User") {
|
|
157 |
this._claimService.getClaimsByUser(this.size, this.page, this.fetchId, this.keyword, this.sortby, this.descending, types, this.properties.claimsAPIURL).subscribe(
|
|
158 |
data => {
|
|
159 |
this.manageAPIData(data);
|
|
166 | 160 |
}, |
167 | 161 |
err => { |
168 | 162 |
this.handleErrors(err); |
169 |
this.handleError("Error getting claims for entity with id: "+this.fetchId, err);
|
|
163 |
DisplayClaimsComponent.handleError("Error getting claims for user with id: " + this.fetchId, err);
|
|
170 | 164 |
} |
171 |
); |
|
172 |
}else if(this.fetchBy =="Context"){
|
|
173 |
this._claimService.getClaimsBycontext(this.size,this.page,this.fetchId,this.keyword,this.sortby,this.descending, types, this.properties.claimsAPIURL).subscribe(
|
|
174 |
data => { |
|
175 |
this.manageAPIData(data); |
|
165 |
);
|
|
166 |
} else if (this.fetchBy == "Result") {
|
|
167 |
this._claimService.getClaimsByResult(this.size, this.page, this.fetchId, this.keyword, this.sortby, this.descending, types, this.properties.claimsAPIURL).subscribe(
|
|
168 |
data => {
|
|
169 |
this.manageAPIData(data);
|
|
176 | 170 |
}, |
177 | 171 |
err => { |
178 |
this.handleErrors(err);
|
|
179 |
this.handleError("Error getting claims for context with id: "+this.fetchId, err);
|
|
172 |
this.handleErrors(err); |
|
173 |
DisplayClaimsComponent.handleError("Error getting claims for entity with id: " + this.fetchId, err);
|
|
180 | 174 |
} |
181 |
); |
|
182 |
}else{
|
|
183 |
this._claimService.getClaims(this.size,this.page,this.keyword,this.sortby,this.descending, types, this.properties.claimsAPIURL).subscribe(
|
|
184 |
data => { |
|
185 |
this.manageAPIData(data); |
|
175 |
);
|
|
176 |
} else if (this.fetchBy == "Context") {
|
|
177 |
this._claimService.getClaimsBycontext(this.size, this.page, this.fetchId, this.keyword, this.sortby, this.descending, types, this.properties.claimsAPIURL).subscribe(
|
|
178 |
data => {
|
|
179 |
this.manageAPIData(data);
|
|
186 | 180 |
}, |
187 | 181 |
err => { |
188 | 182 |
this.handleErrors(err); |
189 |
this.handleError("Error getting claims", err);
|
|
183 |
DisplayClaimsComponent.handleError("Error getting claims for context with id: " + this.fetchId, err);
|
|
190 | 184 |
} |
191 |
); |
|
185 |
); |
|
186 |
} else { |
|
187 |
this._claimService.getClaims(this.size, this.page, this.keyword, this.sortby, this.descending, types, this.properties.claimsAPIURL).subscribe( |
|
188 |
data => { |
|
189 |
this.manageAPIData(data); |
|
190 |
}, |
|
191 |
err => { |
|
192 |
this.handleErrors(err); |
|
193 |
DisplayClaimsComponent.handleError("Error getting claims", err); |
|
194 |
} |
|
195 |
); |
|
196 |
} |
|
192 | 197 |
} |
193 | 198 |
} |
194 |
} |
|
195 |
manageAPIData(data){ |
|
196 |
var d = new Date(); |
|
197 |
var dateTomillis = d.getTime(); |
|
198 |
var millis24h:number = 24*3600000; |
|
199 |
// if(this.showLatestClaims && this.recentClaims.length == 0){ |
|
200 |
// this.recentClaims = []; |
|
201 |
// for(var i=0;i<data.data.length;i++){ |
|
202 |
// var claimDate = new Date(data.data[i].date); |
|
203 |
// var claimDateToMillis = claimDate.getTime() |
|
204 |
// // console.log("Claim Date is:"+claimDateToMillis + " "+(dateTomillis - claimDateToMillis)); |
|
205 |
// if((dateTomillis - claimDateToMillis)<millis24h){ |
|
206 |
// // console.log("Claim in:"+ " "+(dateTomillis - claimDateToMillis)+" < " +(millis24h)); |
|
207 |
// this.recentClaims.push(data.data[i]); |
|
208 |
// } |
|
209 |
// } |
|
210 |
// } |
|
211 |
this.claims = data.data; |
|
212 |
this.resultsNum= data.total; |
|
213 | 199 |
|
200 |
manageAPIData(data) { |
|
201 |
// let d = new Date(); |
|
202 |
// let dateTomillis = d.getTime(); |
|
203 |
// let millis24h: number = 24 * 3600000; |
|
204 |
// if(this.showLatestClaims && this.recentClaims.length == 0){ |
|
205 |
// this.recentClaims = []; |
|
206 |
// for(var i=0;i<data.data.length;i++){ |
|
207 |
// var claimDate = new Date(data.data[i].date); |
|
208 |
// var claimDateToMillis = claimDate.getTime() |
|
209 |
// // console.log("Claim Date is:"+claimDateToMillis + " "+(dateTomillis - claimDateToMillis)); |
|
210 |
// if((dateTomillis - claimDateToMillis)<millis24h){ |
|
211 |
// // console.log("Claim in:"+ " "+(dateTomillis - claimDateToMillis)+" < " +(millis24h)); |
|
212 |
// this.recentClaims.push(data.data[i]); |
|
213 |
// } |
|
214 |
// } |
|
215 |
// } |
|
216 |
this.claims = data.data; |
|
217 |
this.resultsNum = data.total; |
|
214 | 218 |
|
215 |
} |
|
216 |
handleErrors(err){ |
|
217 | 219 |
|
218 |
this.showErrorMessage = true; |
|
219 |
try{ |
|
220 |
var error = err.json() |
|
221 |
var code = error.code; |
|
222 |
if(code == 403){ |
|
220 |
} |
|
221 |
|
|
222 |
handleErrors(err) { |
|
223 |
|
|
224 |
this.showErrorMessage = true; |
|
225 |
try { |
|
226 |
let error = err.json(); |
|
227 |
let code = error.code; |
|
228 |
if (code == 403) { |
|
223 | 229 |
this.showErrorMessage = false; |
224 | 230 |
this.showForbiddenMessage = true; |
225 | 231 |
} |
226 |
}catch (e) { |
|
227 |
//console.log("Couldn't parse answer as json") |
|
228 |
this.handleError("Error parsing answer as json", e); |
|
229 |
this.showErrorMessage = true; |
|
232 |
} catch (e) { |
|
233 |
//console.log("Couldn't parse answer as json") |
|
234 |
DisplayClaimsComponent.handleError("Error parsing answer as json", e); |
|
235 |
this.showErrorMessage = true; |
|
236 |
} |
|
237 |
|
|
230 | 238 |
} |
231 | 239 |
|
232 |
} |
|
233 |
|
|
234 |
private handleError(message: string, error) { |
|
235 |
console.error("Dispaly Claims (component): "+message, error); |
|
240 |
private static handleError(message: string, error) { |
|
241 |
console.error("Dispaly Claims (component): " + message, error); |
|
236 | 242 |
} |
237 | 243 |
|
238 |
goTo(page:number = 1){
|
|
244 |
goTo(page: number = 1) {
|
|
239 | 245 |
|
240 | 246 |
this.page = page; |
241 | 247 |
|
242 |
this.location.go(location.pathname,this.getParametersString()); |
|
248 |
this.location.go(location.pathname, this.getParametersString());
|
|
243 | 249 |
this.getClaims(); |
244 | 250 |
} |
245 |
getParameters(){ |
|
251 |
/* |
|
252 |
getParameters() { |
|
246 | 253 |
var params = {} |
247 |
if(this.myClaims){ |
|
248 |
params={ page: this.page, size: this.size, types: this.entityTypes, keyword : this.keyword, sort: this.getSortby() }; |
|
249 |
}else{ |
|
250 |
params={ page: this.page, size: this.size, types: this.entityTypes, fetchBy: this.fetchBy, fetchId:this.fetchId, keyword : this.keyword, sort: this.getSortby() }; |
|
254 |
if (this.myClaims) { |
|
255 |
params = { |
|
256 |
page: this.page, |
|
257 |
size: this.size, |
|
258 |
types: this.entityTypes, |
|
259 |
keyword: this.keyword, |
|
260 |
sort: this.getSortby() |
|
261 |
}; |
|
262 |
} else { |
|
263 |
params = { |
|
264 |
page: this.page, |
|
265 |
size: this.size, |
|
266 |
types: this.entityTypes, |
|
267 |
fetchBy: this.fetchBy, |
|
268 |
fetchId: this.fetchId, |
|
269 |
keyword: this.keyword, |
|
270 |
sort: this.getSortby() |
|
271 |
}; |
|
251 | 272 |
} |
252 | 273 |
return params; |
253 |
} |
|
274 |
}*/
|
|
254 | 275 |
|
255 |
getParametersString(){ |
|
256 |
var params='';
|
|
257 |
params+=(this.page==1?"":(params.length>0?'&':'')+"page="+this.page);
|
|
258 |
params+=(this.size==10?"":(params.length>0?'&':'')+"size="+this.size);
|
|
276 |
getParametersString() {
|
|
277 |
let params = '';
|
|
278 |
params += (this.page == 1 ? "" : (params.length > 0 ? '&' : '') + "page=" + this.page);
|
|
279 |
params += (this.size == 10 ? "" : (params.length > 0 ? '&' : '') + "size=" + this.size);
|
|
259 | 280 |
// params+=(this.validEntityTypes==''?"":(params.length>0?'&':'')+"types="+this.validEntityTypes); |
260 |
var types="";
|
|
261 |
for (var type of this.entityTypes){
|
|
262 |
types+=(types.length>0?',':'')+type;
|
|
281 |
let types = "";
|
|
282 |
for (let type of this.entityTypes) {
|
|
283 |
types += (types.length > 0 ? ',' : '') + type;
|
|
263 | 284 |
} |
264 |
params+=(types.length>0)?"types="+types:"";
|
|
285 |
params += (types.length > 0) ? "types=" + types : "";
|
|
265 | 286 |
|
266 |
if(this.isAdmin ){
|
|
267 |
params+=(this.fetchBy=='All'?"":(params.length>0?'&':'')+"fetchBy="+this.fetchBy);
|
|
268 |
params+=(this.fetchId==''?"":(params.length>0?'&':'')+"fetchId="+this.fetchId);
|
|
287 |
if (this.isAdmin) {
|
|
288 |
params += (this.fetchBy == 'All' ? "" : (params.length > 0 ? '&' : '') + "fetchBy=" + this.fetchBy);
|
|
289 |
params += (this.fetchId == '' ? "" : (params.length > 0 ? '&' : '') + "fetchId=" + this.fetchId);
|
|
269 | 290 |
} |
270 |
params+=(this. getSortby()=='datedesc'?"":(params.length>0?'&':'')+"sort="+this. getSortby());
|
|
271 |
params+=(this.keyword==''?"":(params.length>0?'&':'')+"keyword="+this.keyword);
|
|
272 |
if(this.communityId !=null){
|
|
273 |
params+="&communityId="+this.communityId;
|
|
291 |
params += (this.getSortby() == 'datedesc' ? "" : (params.length > 0 ? '&' : '') + "sort=" + this.getSortby());
|
|
292 |
params += (this.keyword == '' ? "" : (params.length > 0 ? '&' : '') + "keyword=" + this.keyword);
|
|
293 |
if (this.communityId != null) {
|
|
294 |
params += "&communityId=" + this.communityId;
|
|
274 | 295 |
} |
275 | 296 |
return params; |
276 | 297 |
} |
277 |
changeSize(size: number ){ |
|
278 |
this.goTo(); |
|
298 |
|
|
299 |
changeSize() { |
|
300 |
this.goTo(); |
|
279 | 301 |
} |
280 | 302 |
|
281 |
clearFilters(){ |
|
303 |
/* |
|
304 |
clearFilters() { |
|
282 | 305 |
this.keyword = ''; |
283 | 306 |
this.inputkeyword = ''; |
284 | 307 |
this.publicationCB = false; |
... | ... | |
289 | 312 |
this.contextCB = false; |
290 | 313 |
this.entityTypes = []; |
291 | 314 |
this.goTo(); |
292 |
} |
|
315 |
} |
|
316 |
*/ |
|
293 | 317 |
|
294 |
changeOrderby(sortby:string){ |
|
295 |
if(sortby==this.sortby){ |
|
296 |
this.descending = !this.descending; |
|
297 |
}else{ |
|
298 |
this.sortby = sortby; |
|
299 |
this.descending = false; |
|
300 |
} |
|
301 |
this.goTo(); |
|
302 |
} |
|
303 |
setSortby(sortby:string){ |
|
304 |
if(!sortby|| sortby == "datedesc"){ |
|
305 |
this.descending = true; |
|
306 |
this.sortby = "date"; |
|
307 |
}else if(sortby == "dateasc"){ |
|
308 |
this.descending = false; |
|
309 |
this.sortby = "date"; |
|
310 |
}else if(sortby == "userasc"){ |
|
311 |
this.descending = false; |
|
312 |
this.sortby = "user"; |
|
313 |
}else if(sortby == "userdesc"){ |
|
314 |
this.descending = true; |
|
315 |
this.sortby = "user"; |
|
316 |
}if(sortby =="sourceasc"){ |
|
317 |
this.descending = false; |
|
318 |
this.sortby = "source"; |
|
319 |
}else if(sortby == "sourcedesc"){ |
|
320 |
this.descending = true; |
|
321 |
this.sortby = "source"; |
|
322 |
}else if(sortby == "targetasc"){ |
|
323 |
this.descending = false; |
|
324 |
this.sortby = "target"; |
|
325 |
}else if(sortby == "targetdesc"){ |
|
326 |
this.descending = true; |
|
327 |
this.sortby = "target"; |
|
328 |
} |
|
329 |
} |
|
330 |
getSortby():string{ |
|
331 |
if(this.descending){ |
|
332 |
return this.sortby+"desc"; |
|
333 |
}else{ |
|
334 |
return this.sortby+"asc"; |
|
335 |
} |
|
318 |
changeOrderby(sortby: string) { |
|
319 |
if (sortby == this.sortby) { |
|
320 |
this.descending = !this.descending; |
|
321 |
} else { |
|
322 |
this.sortby = sortby; |
|
323 |
this.descending = false; |
|
324 |
} |
|
325 |
this.goTo(); |
|
326 |
} |
|
336 | 327 |
|
337 |
} |
|
338 |
changeType(){ |
|
339 |
this.entityTypes = []; |
|
340 |
if(this.publicationCB){ |
|
341 |
this.entityTypes.push('publication'); |
|
342 |
} |
|
343 |
if(this.datasetCB){ |
|
344 |
this.entityTypes.push('dataset'); |
|
345 |
} |
|
346 |
if(this.softwareCB){ |
|
347 |
this.entityTypes.push('software'); |
|
348 |
} |
|
349 |
if(this.otherCB){ |
|
350 |
this.entityTypes.push('other'); |
|
351 |
} |
|
352 |
if(this.projectCB){ |
|
353 |
this.entityTypes.push('project'); |
|
354 |
} |
|
355 |
if(this.contextCB){ |
|
356 |
this.entityTypes.push('context'); |
|
357 |
} |
|
328 |
setSortby(sortby: string) { |
|
329 |
if (!sortby || sortby == "datedesc") { |
|
330 |
this.descending = true; |
|
331 |
this.sortby = "date"; |
|
332 |
} else if (sortby == "dateasc") { |
|
333 |
this.descending = false; |
|
334 |
this.sortby = "date"; |
|
335 |
} else if (sortby == "userasc") { |
|
336 |
this.descending = false; |
|
337 |
this.sortby = "user"; |
|
338 |
} else if (sortby == "userdesc") { |
|
339 |
this.descending = true; |
|
340 |
this.sortby = "user"; |
|
341 |
} |
|
342 |
if (sortby == "sourceasc") { |
|
343 |
this.descending = false; |
|
344 |
this.sortby = "source"; |
|
345 |
} else if (sortby == "sourcedesc") { |
|
346 |
this.descending = true; |
|
347 |
this.sortby = "source"; |
|
348 |
} else if (sortby == "targetasc") { |
|
349 |
this.descending = false; |
|
350 |
this.sortby = "target"; |
|
351 |
} else if (sortby == "targetdesc") { |
|
352 |
this.descending = true; |
|
353 |
this.sortby = "target"; |
|
354 |
} |
|
355 |
} |
|
358 | 356 |
|
359 |
this.goTo(); |
|
360 |
} |
|
361 |
setTypes(types:string){ |
|
362 |
if(!types){ |
|
363 |
return; |
|
364 |
} |
|
365 |
if(types.length > 0){ |
|
366 |
this.entityTypes = []; |
|
367 |
if(types.indexOf("publication")!=-1){ |
|
368 |
this.publicationCB = true; |
|
369 |
this.entityTypes.push("publication"); |
|
370 |
} |
|
371 |
if(types.indexOf("dataset")!=-1){ |
|
372 |
this.datasetCB = true; |
|
373 |
this.entityTypes.push("dataset"); |
|
374 |
} |
|
375 |
if(types.indexOf("software")!=-1){ |
|
376 |
this.softwareCB = true; |
|
377 |
this.entityTypes.push("software"); |
|
378 |
} |
|
379 |
if(types.indexOf("other")!=-1){ |
|
380 |
this.otherCB = true; |
|
381 |
this.entityTypes.push("other"); |
|
382 |
} |
|
383 |
if(types.indexOf("project")!=-1){ |
|
384 |
this.projectCB = true; |
|
385 |
this.entityTypes.push("project"); |
|
386 |
} |
|
387 |
if(types.indexOf("context")!=-1){ |
|
388 |
this.contextCB = true; |
|
389 |
this.entityTypes.push("context"); |
|
390 |
} |
|
391 |
} |
|
392 |
if(this.publicationCB && this.datasetCB && this.softwareCB && this.otherCB && this.contextCB && this.projectCB){ |
|
393 |
this.entityTypes=[]; |
|
394 |
} |
|
395 |
} |
|
396 |
changekeyword(){ |
|
397 |
if(this.inputkeyword.length >= 3 || this.inputkeyword.length == 0 ){ |
|
398 |
this.searchTermStream.next(this.inputkeyword); |
|
357 |
getSortby(): string { |
|
358 |
if (this.descending) { |
|
359 |
return this.sortby + "desc"; |
|
360 |
} else { |
|
361 |
return this.sortby + "asc"; |
|
362 |
} |
|
399 | 363 |
|
364 |
} |
|
400 | 365 |
|
401 |
} |
|
366 |
changeType() { |
|
367 |
this.entityTypes = []; |
|
368 |
if (this.publicationCB) { |
|
369 |
this.entityTypes.push('publication'); |
|
370 |
} |
|
371 |
if (this.datasetCB) { |
|
372 |
this.entityTypes.push('dataset'); |
|
373 |
} |
|
374 |
if (this.softwareCB) { |
|
375 |
this.entityTypes.push('software'); |
|
376 |
} |
|
377 |
if (this.otherCB) { |
|
378 |
this.entityTypes.push('other'); |
|
379 |
} |
|
380 |
if (this.projectCB) { |
|
381 |
this.entityTypes.push('project'); |
|
382 |
} |
|
383 |
if (this.contextCB) { |
|
384 |
this.entityTypes.push('context'); |
|
385 |
} |
|
402 | 386 |
|
403 |
} |
|
404 |
select(item:any,event){ |
|
405 |
this.deleteMessage=""; |
|
406 |
var value = event.currentTarget.checked; |
|
407 |
if(value){ |
|
408 |
this.selected.push(item); |
|
409 |
}else{ |
|
410 |
for (var _i = 0; _i < this.selected.length; _i++) { |
|
411 |
let claim = this.selected[_i]; |
|
412 |
if(claim['id'] == item.id){ |
|
413 |
this.selected.splice(_i, 1); |
|
414 |
} |
|
387 |
this.goTo(); |
|
388 |
} |
|
389 |
|
|
390 |
setTypes(types: string) { |
|
391 |
if (!types) { |
|
392 |
return; |
|
393 |
} |
|
394 |
if (types.length > 0) { |
|
395 |
this.entityTypes = []; |
|
396 |
if (types.indexOf("publication") != -1) { |
|
397 |
this.publicationCB = true; |
|
398 |
this.entityTypes.push("publication"); |
|
399 |
} |
|
400 |
if (types.indexOf("dataset") != -1) { |
|
401 |
this.datasetCB = true; |
|
402 |
this.entityTypes.push("dataset"); |
|
403 |
} |
|
404 |
if (types.indexOf("software") != -1) { |
|
405 |
this.softwareCB = true; |
|
406 |
this.entityTypes.push("software"); |
|
407 |
} |
|
408 |
if (types.indexOf("other") != -1) { |
|
409 |
this.otherCB = true; |
|
410 |
this.entityTypes.push("other"); |
|
411 |
} |
|
412 |
if (types.indexOf("project") != -1) { |
|
413 |
this.projectCB = true; |
|
414 |
this.entityTypes.push("project"); |
|
415 |
} |
|
416 |
if (types.indexOf("context") != -1) { |
|
417 |
this.contextCB = true; |
|
418 |
this.entityTypes.push("context"); |
|
419 |
} |
|
420 |
} |
|
421 |
if (this.publicationCB && this.datasetCB && this.softwareCB && this.otherCB && this.contextCB && this.projectCB) { |
|
422 |
this.entityTypes = []; |
|
423 |
} |
|
424 |
} |
|
425 |
|
|
426 |
changekeyword() { |
|
427 |
if (this.inputkeyword.length >= 3 || this.inputkeyword.length == 0) { |
|
428 |
this.searchTermStream.next(this.inputkeyword); |
|
429 |
|
|
430 |
|
|
431 |
} |
|
432 |
|
|
433 |
} |
|
434 |
|
|
435 |
select(item: any, event) { |
|
436 |
this.deleteMessage = ""; |
|
437 |
let value = event.currentTarget.checked; |
|
438 |
if (value) { |
|
439 |
this.selected.push(item); |
|
440 |
} else { |
|
441 |
for (var _i = 0; _i < this.selected.length; _i++) { |
|
442 |
let claim = this.selected[_i]; |
|
443 |
if (claim['id'] == item.id) { |
|
444 |
this.selected.splice(_i, 1); |
|
415 | 445 |
} |
446 |
} |
|
416 | 447 |
|
417 | 448 |
|
418 |
} |
|
419 |
} |
|
420 |
selectAll(event){ |
|
421 |
var value = event.currentTarget.checked; |
|
422 |
if(value){ |
|
423 |
this.selected = []; |
|
424 |
for (var _i = 0; _i < this.claims.length; _i++) { |
|
425 |
let claim = this.claims[_i]; |
|
426 |
this.selected.push(claim); |
|
427 |
} |
|
428 |
this.deleteMessage = ""; |
|
429 |
}else{ |
|
449 |
} |
|
450 |
} |
|
451 |
|
|
452 |
selectAll(event) { |
|
453 |
let value = event.currentTarget.checked; |
|
454 |
if (value) { |
|
430 | 455 |
this.selected = []; |
431 |
this.deleteMessage=""; |
|
456 |
for (let _i = 0; _i < this.claims.length; _i++) { |
|
457 |
let claim = this.claims[_i]; |
|
458 |
this.selected.push(claim); |
|
459 |
} |
|
460 |
this.deleteMessage = ""; |
|
461 |
} else { |
|
462 |
this.selected = []; |
|
463 |
this.deleteMessage = ""; |
|
432 | 464 |
} |
433 |
}
|
|
465 |
} |
|
434 | 466 |
|
435 |
isSelected(id:string){ |
|
436 |
for (var _i = 0; _i < this.selected.length; _i++) { |
|
437 |
let claim = this.selected[_i]; |
|
438 |
if(claim['id'] == id){ |
|
439 |
return true; |
|
440 |
} |
|
467 |
isSelected(id: string) { |
|
468 |
for (let _i = 0; _i < this.selected.length; _i++) { |
|
469 |
let claim = this.selected[_i]; |
|
470 |
if (claim['id'] == id) { |
|
471 |
return true; |
|
441 | 472 |
} |
442 |
return false; |
|
443 |
} |
|
473 |
} |
|
474 |
return false; |
|
475 |
} |
|
444 | 476 |
|
445 | 477 |
|
446 |
confirmOpen(){
|
|
447 |
if(this.selected.length <= 0){
|
|
478 |
confirmOpen() {
|
|
479 |
if (this.selected.length <= 0) {
|
|
448 | 480 |
|
449 |
}else{ |
|
450 |
this.alert.cancelButton = true; |
|
451 |
this.alert.okButton = true; |
|
452 |
this.alert.alertTitle = "Delete "+this.selected.length+" claim(s)"; |
|
453 |
this.alert.message = this.selected.length+" claims will be deleted. Do you want to proceed? "; |
|
454 |
this.alert.okButtonText = "Yes"; |
|
455 |
this.alert.cancelButtonText = "No"; |
|
456 |
this.alert.open(); |
|
457 |
} |
|
458 |
} |
|
459 |
confirmClose(data){ |
|
460 |
this.delete(); |
|
461 |
} |
|
462 |
delete(){ |
|
463 |
this.deleteMessage=""; |
|
464 |
this.loading.open(); |
|
465 |
this.claimsDeleted = 0; |
|
466 |
var ids = []; |
|
467 |
for (var i = 0; i < this.selected.length; i++){ |
|
468 |
var id =this.selected[i].id; |
|
469 |
ids.push(id); |
|
470 |
// var selected =this.selected[i].id; |
|
471 |
// console.warn("Deleting claim with id:"+id); |
|
472 |
// this.deleteById(id); |
|
473 |
//TODO for multiple concurrent |
|
474 |
} |
|
475 |
this.batchDeleteById(ids); |
|
481 |
} else { |
|
482 |
this.alert.cancelButton = true; |
|
483 |
this.alert.okButton = true; |
|
484 |
this.alert.alertTitle = "Delete " + this.selected.length + " links(s)"; |
|
485 |
// this.alert.message = this.selected.length + " links will be deleted. Do you want to proceed? "; |
|
486 |
this.alert.okButtonText = "Yes"; |
|
487 |
this.alert.cancelButtonText = "No"; |
|
488 |
this.alert.open(); |
|
476 | 489 |
} |
490 |
} |
|
477 | 491 |
|
478 |
deleteById(id:string){ |
|
479 |
if(!Session.isLoggedIn()){ |
|
480 |
this.userValidMessage = "User session has expired. Please login again."; |
|
481 |
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} }); |
|
492 |
confirmClose() { |
|
493 |
this.delete(); |
|
494 |
} |
|
482 | 495 |
|
483 |
}else{ |
|
484 |
//console.log("Deleting claim with id:"+id); |
|
485 |
// this._claimService.deleteClaimById(id); |
|
486 |
this._claimService.deleteClaimById(id, this.properties.claimsAPIURL).subscribe( |
|
487 |
res => { |
|
488 |
//console.log('Delete response'+res.code ); |
|
489 |
//console.log("Deleted claim with id:"+ id); |
|
490 |
//remove this claim from the |
|
491 |
let newClaims=this.claims; |
|
492 |
for (var _i = 0; _i < this.claims.length; _i++) { |
|
493 |
let claim = this.claims[_i]; |
|
494 |
if(claim['id'] == id){ |
|
495 |
newClaims.splice(_i, 1); |
|
496 |
} |
|
497 |
} |
|
498 |
//TODO should call getClaims??? |
|
499 |
this.claimsDeleted++; |
|
500 |
this.claims = newClaims; |
|
501 |
if(this.claimsDeleted == this.selected.length){ |
|
502 |
this.resultsNum = this.resultsNum - this.selected.length; |
|
503 |
this.loading.close(); |
|
504 |
this.selected = []; |
|
505 |
} |
|
496 |
delete() { |
|
497 |
this.deleteMessage = ""; |
|
498 |
this.loading.open(); |
|
499 |
this.claimsDeleted = 0; |
|
500 |
let ids = []; |
|
501 |
for (let i = 0; i < this.selected.length; i++) { |
|
502 |
let id = this.selected[i].id; |
|
503 |
ids.push(id); |
|
504 |
// var selected =this.selected[i].id; |
|
505 |
// console.warn("Deleting claim with id:"+id); |
|
506 |
// this.deleteById(id); |
|
507 |
//TODO for multiple concurrent |
|
508 |
} |
|
509 |
this.batchDeleteById(ids); |
|
510 |
} |
|
511 |
/* |
|
512 |
deleteById(id: string) { |
|
513 |
if (!Session.isLoggedIn()) { |
|
514 |
this.userValidMessage = "User session has expired. Please login again."; |
|
515 |
this._router.navigate(['/user-info'], { |
|
516 |
queryParams: { |
|
517 |
"errorCode": LoginErrorCodes.NOT_VALID, |
|
518 |
"redirectUrl": this._router.url |
|
519 |
} |
|
520 |
}); |
|
506 | 521 |
|
522 |
} else { |
|
523 |
//console.log("Deleting claim with id:"+id); |
|
524 |
// this._claimService.deleteClaimById(id); |
|
525 |
this._claimService.deleteClaimById(id, this.properties.claimsAPIURL).subscribe( |
|
526 |
res => { |
|
527 |
//console.log('Delete response'+res.code ); |
|
528 |
//console.log("Deleted claim with id:"+ id); |
|
529 |
//remove this claim from the |
|
530 |
let newClaims = this.claims; |
|
531 |
for (var _i = 0; _i < this.claims.length; _i++) { |
|
532 |
let claim = this.claims[_i]; |
|
533 |
if (claim['id'] == id) { |
|
534 |
newClaims.splice(_i, 1); |
|
535 |
} |
|
536 |
} |
|
537 |
//TODO should call getClaims??? |
|
538 |
this.claimsDeleted++; |
|
539 |
this.claims = newClaims; |
|
540 |
if (this.claimsDeleted == this.selected.length) { |
|
541 |
this.resultsNum = this.resultsNum - this.selected.length; |
|
542 |
this.loading.close(); |
|
543 |
this.selected = []; |
|
544 |
} |
|
507 | 545 |
|
508 |
}, |
|
509 |
error => {
|
|
510 |
this.handleError("Error deleting claim with id: "+id, error);
|
|
511 |
});
|
|
512 |
}
|
|
546 |
|
|
547 |
},
|
|
548 |
error => {
|
|
549 |
DisplayClaimsComponent.handleError("Error deleting claim with id: " + id, error);
|
|
550 |
});
|
|
513 | 551 |
} |
514 |
batchDeleteById(ids:string[]){ |
|
515 |
if(!Session.isLoggedIn()){ |
|
516 |
this.userValidMessage = "User session has expired. Please login again."; |
|
517 |
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} }); |
|
518 |
}else{ |
|
519 |
//console.warn("Deleting claim with ids:"+ids); |
|
520 |
this._claimService.deleteBulk(ids,this.properties.claimsAPIURL).subscribe( |
|
521 |
res => { |
|
522 |
//console.info('Delete response'+res.code ); |
|
523 |
//console.warn("Deleted ids:"+ res.deletedIds); |
|
524 |
//console.warn("Not found ids:"+ res.notFoundIds); |
|
525 |
//remove this claim from the |
|
526 |
let newClaims=this.claims; |
|
527 |
for(var id of res.deletedIds){ |
|
528 |
for (var _i = 0; _i < this.claims.length; _i++) { |
|
529 |
let claim = this.claims[_i]; |
|
530 |
if(claim['id'] == id){ |
|
531 |
newClaims.splice(_i, 1); |
|
532 |
} |
|
533 |
} |
|
534 |
for (var _i = 0; _i < this.selected.length; _i++) { |
|
535 |
let claim = this.selected[_i]; |
|
536 |
if(claim['id'] == id){ |
|
537 |
this.selected.splice(_i, 1); |
|
538 |
} |
|
539 |
} |
|
552 |
}*/ |
|
553 |
|
|
554 |
batchDeleteById(ids: string[]) { |
|
555 |
if (!Session.isLoggedIn()) { |
|
556 |
this.userValidMessage = "User session has expired. Please login again."; |
|
557 |
this._router.navigate(['/user-info'], { |
|
558 |
queryParams: { |
|
559 |
"errorCode": LoginErrorCodes.NOT_VALID, |
|
560 |
"redirectUrl": this._router.url |
|
561 |
} |
|
562 |
}); |
|
563 |
} else { |
|
564 |
//console.warn("Deleting claim with ids:"+ids); |
|
565 |
this._claimService.deleteBulk(ids, this.properties.claimsAPIURL).subscribe( |
|
566 |
res => { |
|
567 |
//console.info('Delete response'+res.code ); |
|
568 |
//console.warn("Deleted ids:"+ res.deletedIds); |
|
569 |
//console.warn("Not found ids:"+ res.notFoundIds); |
|
570 |
//remove this claim from the |
|
571 |
let newClaims = this.claims; |
|
572 |
for (let id of res.deletedIds) { |
|
573 |
for (let _i = 0; _i < this.claims.length; _i++) { |
|
574 |
let claim = this.claims[_i]; |
|
575 |
if (claim['id'] == id) { |
|
576 |
newClaims.splice(_i, 1); |
|
540 | 577 |
} |
541 |
this.claims = newClaims;
|
|
542 |
this.resultsNum = this.resultsNum - res.deletedIds.length;
|
|
543 |
this.loading.close();
|
|
544 |
if(res.deletedIds.length>0){
|
|
545 |
this.deleteMessage=this.deleteMessage+'<div class = "uk-alert uk-alert-primary " >'+res.deletedIds.length+' claim(s) successfully deleted.</div>';
|
|
578 |
}
|
|
579 |
for (let _i = 0; _i < this.selected.length; _i++) {
|
|
580 |
let claim = this.selected[_i];
|
|
581 |
if (claim['id'] == id) {
|
|
582 |
this.selected.splice(_i, 1);
|
|
546 | 583 |
} |
547 |
if(res.notFoundIds.length>0){ |
|
548 |
this.deleteMessage=this.deleteMessage+'<div class = "uk-alert uk-alert-warning " >'+res.notFoundIds.length+' claim(s) couldn\'t be deleted.</div>'; |
|
549 |
} |
|
550 |
}, err => { |
|
551 |
//console.log(err); |
|
552 |
this.handleError("Error deleting claims with ids: "+ids, err); |
|
553 |
this.showErrorMessage = true; |
|
554 |
this.loading.close(); |
|
584 |
} |
|
585 |
} |
|
586 |
this.claims = newClaims; |
|
587 |
this.resultsNum = this.resultsNum - res.deletedIds.length; |
|
588 |
this.loading.close(); |
|
589 |
if (res.deletedIds.length > 0) { |
|
590 |
this.deleteMessage = this.deleteMessage + '<div class = "uk-alert uk-alert-primary " >' + res.deletedIds.length + ' link(s) successfully deleted.</div>'; |
|
591 |
} |
|
592 |
if (res.notFoundIds.length > 0) { |
|
593 |
this.deleteMessage = this.deleteMessage + '<div class = "uk-alert uk-alert-warning " >' + res.notFoundIds.length + ' link(s) couldn\'t be deleted.</div>'; |
|
594 |
} |
|
595 |
let goToPage = this.page; |
|
596 |
if(this.totalPages(this.resultsNum)< this.page && this.page>0){ |
|
597 |
goToPage = this.page -1; |
|
598 |
} |
|
599 |
this.goTo(goToPage); |
|
600 |
}, err => { |
|
601 |
//console.log(err); |
|
602 |
DisplayClaimsComponent.handleError("Error deleting claims with ids: " + ids, err); |
|
603 |
this.showErrorMessage = true; |
|
604 |
this.loading.close(); |
|
555 | 605 |
|
556 |
}); |
|
557 |
} |
|
606 |
}); |
|
558 | 607 |
} |
559 |
pageChange($event) { |
|
560 |
var page:number = +$event.value |
|
561 |
this.goTo(page); |
|
562 |
} |
|
608 |
} |
|
563 | 609 |
|
564 |
getclaimStatus(claim):string{ |
|
565 |
if(claim.target.collectedFrom == "infrastruct_::openaire"){ |
|
566 |
return "The link information will be visible in the portal and the APIs after the next content provision workflow."; |
|
567 |
}else{ |
|
568 |
return "The link information is visible in the portal and the APIs."; |
|
569 |
} |
|
610 |
pageChange($event) { |
|
611 |
let page: number = +$event.value; |
|
612 |
this.goTo(page); |
|
613 |
} |
|
570 | 614 |
|
615 |
getclaimStatus(claim): string { |
|
616 |
if (claim.target.collectedFrom == "infrastruct_::openaire") { |
|
617 |
return "The link information will be visible in the portal and the APIs after the next content provision workflow."; |
|
618 |
} else { |
|
619 |
return "The link information is visible in the portal and the APIs."; |
|
571 | 620 |
} |
621 |
|
|
622 |
} |
|
623 |
totalPages(totalResults: number): number { |
|
624 |
let totalPages:any = totalResults/(this.size); |
|
625 |
if(!(Number.isInteger(totalPages))) { |
|
626 |
totalPages = (parseInt(totalPages, 10) + 1); |
|
627 |
} |
|
628 |
return totalPages; |
|
629 |
} |
|
572 | 630 |
} |
Also available in: Unified diff
[Library|newlinking]
Display claims:
change layout
on delete make the query again