Revision 60693
Added by Konstantinos Triantafyllou about 3 years ago
modules/uoa-admin-portal/branches/new-UI/src/app/pages/mining/mining.component.ts | ||
---|---|---|
22 | 22 |
|
23 | 23 |
ngOnInit() { |
24 | 24 |
this.subs.push(this.route.params.subscribe(params => { |
25 |
this.title.setTitle(params['community'].toUpperCase() + ' | Organizations');
|
|
25 |
this.title.setTitle(params['community'].toUpperCase() + ' | Mining');
|
|
26 | 26 |
})); |
27 | 27 |
} |
28 | 28 |
|
modules/uoa-admin-portal/branches/new-UI/src/app/pages/subjects/subjects-edit-form/subjects-edit-form.module.ts | ||
---|---|---|
7 | 7 |
|
8 | 8 |
import {SubjectsService} from '../subjects.service'; |
9 | 9 |
import {SubjectsEditFormRoutingModule} from './subjects-edit-form-routing.module'; |
10 |
import {IsCommunity} from '../../../openaireLibrary/connect/communityGuard/isCommunity.guard'; |
|
11 |
import {ConnectAdminLoginGuard} from '../../../openaireLibrary/connect/communityGuard/connectAdminLoginGuard.guard'; |
|
12 |
import {ConnectCommunityGuard} from '../../../openaireLibrary/connect/communityGuard/connectCommunityGuard.guard'; |
|
13 | 10 |
import {PageContentModule} from '../../../openaireLibrary/dashboard/sharedComponents/page-content/page-content.module'; |
14 | 11 |
import {IconsModule} from '../../../openaireLibrary/utils/icons/icons.module'; |
15 | 12 |
import {IconsService} from '../../../openaireLibrary/utils/icons/icons.service'; |
... | ... | |
29 | 26 |
SubjectsEditFormComponent |
30 | 27 |
], |
31 | 28 |
providers: [ |
32 |
SubjectsService, IsCommunity, ConnectAdminLoginGuard, ConnectCommunityGuard
|
|
29 |
SubjectsService |
|
33 | 30 |
], |
34 | 31 |
exports: [ |
35 | 32 |
SubjectsEditFormComponent |
modules/uoa-admin-portal/branches/new-UI/src/app/pages/manage-communities/manage-communities.module.ts | ||
---|---|---|
7 | 7 |
import {PageContentModule} from "../../openaireLibrary/dashboard/sharedComponents/page-content/page-content.module"; |
8 | 8 |
import {LoadingModule} from "../../openaireLibrary/utils/loading/loading.module"; |
9 | 9 |
import {UrlPrefixModule} from "../../openaireLibrary/utils/pipes/url-prefix.module"; |
10 |
import {CommunitiesService} from "../../openaireLibrary/connect/communities/communities.service"; |
|
10 | 11 |
|
11 | 12 |
@NgModule({ |
12 | 13 |
imports: [ |
13 | 14 |
CommonModule, ManageCommunitiesRoutingModule, RouterModule, PageContentModule, LoadingModule, UrlPrefixModule |
14 | 15 |
], |
15 | 16 |
declarations: [ManageCommunitiesComponent], |
16 |
providers: [LoginGuard], |
|
17 |
providers: [LoginGuard, CommunitiesService],
|
|
17 | 18 |
exports: [ManageCommunitiesComponent] |
18 | 19 |
}) |
19 | 20 |
export class ManageCommunitiesModule { } |
modules/uoa-admin-portal/branches/new-UI/src/app/pages/community/projects/remove-projects.component.ts | ||
---|---|---|
1 |
import { Component, ViewChild, OnInit, ViewEncapsulation, Input, Output, EventEmitter } from '@angular/core'; |
|
2 |
import { ActivatedRoute, Router } from "@angular/router"; |
|
3 |
import { Subject } from 'rxjs'; |
|
4 |
import { DataTableDirective } from 'angular-datatables'; |
|
5 |
|
|
6 |
import {ErrorCodes} from '../../../openaireLibrary/utils/properties/errorCodes'; |
|
7 |
import {SearchUtilsClass } from '../../../openaireLibrary/searchPages/searchUtils/searchUtils.class'; |
|
8 |
import {EnvProperties} from '../../../openaireLibrary/utils/properties/env-properties'; |
|
9 |
import {ManageCommunityProjectsService} from '../../../services/manageProjects.service'; |
|
10 |
import {SearchCommunityProjectsService} from '../../../openaireLibrary/connect/projects/searchProjects.service'; |
|
11 |
import {RouterHelper} from '../../../openaireLibrary/utils/routerHelper.class'; |
|
12 |
import {DOI, StringUtils} from '../../../openaireLibrary/utils/string-utils.class'; |
|
13 |
|
|
14 |
import {Session} from '../../../openaireLibrary/login/utils/helper.class'; |
|
15 |
import {LoginErrorCodes} from '../../../openaireLibrary/login/utils/guardHelper.class'; |
|
16 |
|
|
17 |
@Component({ |
|
18 |
selector: 'remove-projects', |
|
19 |
templateUrl: './remove-projects.component.html', |
|
20 |
styles: [` |
|
21 |
#dpTable_info, #dpTable_paginate, #dpTable_length, #dpTable_filter{ |
|
22 |
display: none; |
|
23 |
} |
|
24 |
|
|
25 |
`], |
|
26 |
encapsulation: ViewEncapsulation.None // this used in order styles to work |
|
27 |
}) |
|
28 |
|
|
29 |
export class RemoveProjectsComponent implements OnInit { |
|
30 |
public routerHelper:RouterHelper = new RouterHelper(); |
|
31 |
|
|
32 |
private community: string = ''; |
|
33 |
private communityUrl = "https://beta.explore.openaire.eu"; |
|
34 |
|
|
35 |
public errorCodes: ErrorCodes; |
|
36 |
|
|
37 |
@Output() communityProjectsChanged = new EventEmitter(); |
|
38 |
public communityProjects = []; |
|
39 |
public communitySearchUtils:SearchUtilsClass = new SearchUtilsClass(); |
|
40 |
|
|
41 |
public sub: any; public subResults: any; subRemove: any; |
|
42 |
properties:EnvProperties; |
|
43 |
|
|
44 |
public disableForms: boolean = false; |
|
45 |
|
|
46 |
dtOptions: DataTables.Settings = {}; |
|
47 |
showTable = false; filteringAdded = false; |
|
48 |
@ViewChild(DataTableDirective) datatableElement: DataTableDirective; |
|
49 |
dtTrigger: Subject<any> = new Subject(); //necessary |
|
50 |
|
|
51 |
public rowsOnPage:number = 10; |
|
52 |
|
|
53 |
public queryParameters: string = ""; |
|
54 |
|
|
55 |
public query = ''; |
|
56 |
public selectedProjects=[] ; |
|
57 |
public elementRef; |
|
58 |
|
|
59 |
public funders:Set<string>; |
|
60 |
public selectedFunder:string =""; |
|
61 |
//@Output() projectSelected = new EventEmitter(); |
|
62 |
//@Input() public properties:EnvProperties; |
|
63 |
|
|
64 |
public projects:string[]; |
|
65 |
private triggered: boolean = false; |
|
66 |
|
|
67 |
private selectedCommunityProject: any; |
|
68 |
|
|
69 |
@ViewChild('AlertModalDeleteCommunity') alertModalDeleteCommunity; |
|
70 |
|
|
71 |
ngOnInit() { |
|
72 |
this.route.data.subscribe((data: { envSpecific: EnvProperties }) => { |
|
73 |
this.properties = data.envSpecific; |
|
74 |
}); |
|
75 |
|
|
76 |
this.route.queryParams.subscribe(params => { |
|
77 |
if(params['communityId']) { |
|
78 |
this.community = params['communityId']; |
|
79 |
this.communityUrl = "https://beta."+this.community+".openaire.eu"; |
|
80 |
|
|
81 |
this._getCommunityProjects(); |
|
82 |
//this.getFunders(); |
|
83 |
//this._getOpenaireProjects("", 1, 10); |
|
84 |
} |
|
85 |
}); |
|
86 |
|
|
87 |
this.dtOptions = { |
|
88 |
// "paging": true, |
|
89 |
// "searching": true, |
|
90 |
// "lengthChange": false, |
|
91 |
"pageLength": this.rowsOnPage, |
|
92 |
"language": { |
|
93 |
"search": "", |
|
94 |
"searchPlaceholder": "Search projects..." |
|
95 |
} |
|
96 |
}; |
|
97 |
|
|
98 |
this.communitySearchUtils.keyword = ""; |
|
99 |
} |
|
100 |
|
|
101 |
constructor(private route: ActivatedRoute, private _router: Router, private _manageCommunityProjectsService: ManageCommunityProjectsService, private _searchCommunityProjectsService: SearchCommunityProjectsService) { |
|
102 |
this.errorCodes = new ErrorCodes(); |
|
103 |
this.communitySearchUtils.status = this.errorCodes.LOADING; |
|
104 |
} |
|
105 |
|
|
106 |
public ngOnDestroy() { |
|
107 |
if(this.sub){ |
|
108 |
this.sub.unsubscribe(); |
|
109 |
} |
|
110 |
if(this.subResults){ |
|
111 |
this.subResults.unsubscribe(); |
|
112 |
} |
|
113 |
if(this.subRemove){ |
|
114 |
this.subRemove.unsubscribe(); |
|
115 |
} |
|
116 |
|
|
117 |
$.fn['dataTable'].ext.search.pop(); |
|
118 |
} |
|
119 |
|
|
120 |
rerender(): void { |
|
121 |
this.datatableElement.dtInstance.then((dtInstance: DataTables.Api) => { |
|
122 |
// Destroy the table first |
|
123 |
dtInstance.destroy(); |
|
124 |
|
|
125 |
// Call the dtTrigger to rerender again |
|
126 |
this.dtTrigger.next(); |
|
127 |
}); |
|
128 |
} |
|
129 |
|
|
130 |
ngAfterViewInit(): void { |
|
131 |
$.fn['dataTable'].ext.search.push((settings, data, dataIndex) => { |
|
132 |
|
|
133 |
if (this.filterData(data, this.communitySearchUtils.keyword, this.selectedFunder)) { |
|
134 |
return true; |
|
135 |
} |
|
136 |
return false; |
|
137 |
}); |
|
138 |
|
|
139 |
//console.info("ngAfterViewInit"); |
|
140 |
} |
|
141 |
|
|
142 |
filterData(row: any, query: string, selectedFunder: string) { |
|
143 |
let returnValue: boolean = false; |
|
144 |
|
|
145 |
if(query) { |
|
146 |
for(var i=0; i <3; i++){ |
|
147 |
var r= this.filterQuery(row[i], query); |
|
148 |
if(r) { |
|
149 |
returnValue = true; |
|
150 |
break; |
|
151 |
} |
|
152 |
} |
|
153 |
|
|
154 |
if(!returnValue) { |
|
155 |
return false; |
|
156 |
} |
|
157 |
} |
|
158 |
|
|
159 |
if(selectedFunder){ |
|
160 |
return this.filterQuery(row[2], selectedFunder); |
|
161 |
} |
|
162 |
|
|
163 |
return true; |
|
164 |
} |
|
165 |
|
|
166 |
filterQuery(data, query){ |
|
167 |
if(data.toLowerCase().indexOf(query.toLowerCase()) > -1){ |
|
168 |
return true; |
|
169 |
}else{ |
|
170 |
return false; |
|
171 |
} |
|
172 |
} |
|
173 |
|
|
174 |
|
|
175 |
/* |
|
176 |
Trigger a table draw in order to get the initial filtering |
|
177 |
*/ |
|
178 |
triggerInitialLoad(){ |
|
179 |
this.triggered = true; |
|
180 |
//console.info("triggerInitialLoad"); |
|
181 |
setTimeout(function(){ |
|
182 |
var table = (<any>$('#dpTable')).DataTable(); |
|
183 |
table.page( 0 ).draw( false ); |
|
184 |
}, 500); |
|
185 |
this.dtTrigger.next(); |
|
186 |
} |
|
187 |
|
|
188 |
public inCommunity(result: any): any { |
|
189 |
let found = false; |
|
190 |
for(let project of this.communityProjects) { |
|
191 |
if(project.opeaireId == result.id) { |
|
192 |
return true; |
|
193 |
} else if(result['title'].name.search("("+project.grantId+")") != -1 && result.funderShortname == project.funder) { |
|
194 |
return true; |
|
195 |
} |
|
196 |
} |
|
197 |
return found; |
|
198 |
|
|
199 |
} |
|
200 |
|
|
201 |
goTo(page:number = 1){ |
|
202 |
this.communitySearchUtils.page=page; |
|
203 |
|
|
204 |
var table = $('#dpTable').DataTable(); |
|
205 |
table.page( page - 1 ).draw( false ); |
|
206 |
|
|
207 |
var info = table.page.info(); |
|
208 |
this.communitySearchUtils.totalResults = info.recordsDisplay; |
|
209 |
} |
|
210 |
|
|
211 |
totalPages(): number { |
|
212 |
let totalPages:any = this.communitySearchUtils.totalResults/(this.rowsOnPage); |
|
213 |
if(!(Number.isInteger(totalPages))) { |
|
214 |
totalPages = (parseInt(totalPages, 10) + 1); |
|
215 |
} |
|
216 |
return totalPages; |
|
217 |
} |
|
218 |
|
|
219 |
public confirmedDeleteProject(data : any) { |
|
220 |
if(!Session.isLoggedIn()){ |
|
221 |
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} }); |
|
222 |
} else { |
|
223 |
this.subRemove = this._manageCommunityProjectsService.removeProject(this.properties, this.community, this.selectedCommunityProject.id).subscribe( |
|
224 |
data => { |
|
225 |
//console.info(data); |
|
226 |
}, |
|
227 |
err => { |
|
228 |
console.log(err); |
|
229 |
}, |
|
230 |
() => { |
|
231 |
let index = this.communityProjects.indexOf(this.selectedCommunityProject); |
|
232 |
this.communityProjects.splice(index, 1); |
|
233 |
|
|
234 |
this.communitySearchUtils.totalResults--; |
|
235 |
this.communitySearchUtils.page=1; |
|
236 |
|
|
237 |
this.rerender(); |
|
238 |
} |
|
239 |
) |
|
240 |
} |
|
241 |
} |
|
242 |
|
|
243 |
public removeProject(communityProject: any) { |
|
244 |
if(!Session.isLoggedIn()){ |
|
245 |
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} }); |
|
246 |
} else { |
|
247 |
this.selectedCommunityProject = communityProject; |
|
248 |
this.alertModalDeleteCommunity.cancelButton = true; |
|
249 |
this.alertModalDeleteCommunity.okButton = true; |
|
250 |
this.alertModalDeleteCommunity.alertTitle = "Remove project?"; |
|
251 |
let title = ""; |
|
252 |
if(communityProject.name) { |
|
253 |
title = communityProject.name; |
|
254 |
} |
|
255 |
if(communityProject.name && communityProject.acronym) { |
|
256 |
title += " ("; |
|
257 |
} |
|
258 |
if(communityProject.acronym) { |
|
259 |
title += communityProject.acronym; |
|
260 |
} |
|
261 |
if(communityProject.name && communityProject.acronym) { |
|
262 |
title += ")"; |
|
263 |
} |
|
264 |
this.alertModalDeleteCommunity.message = "Project"; |
|
265 |
if(title) { |
|
266 |
this.alertModalDeleteCommunity.message += " '"+title+"' "; |
|
267 |
} |
|
268 |
this.alertModalDeleteCommunity.message += "will be removed from your community. Are you sure?"; |
|
269 |
this.alertModalDeleteCommunity.okButtonText = "Yes"; |
|
270 |
this.alertModalDeleteCommunity.open(); |
|
271 |
} |
|
272 |
} |
|
273 |
|
|
274 |
public _getCommunityProjects(){ |
|
275 |
if(!Session.isLoggedIn()){ |
|
276 |
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} }); |
|
277 |
} else { |
|
278 |
this.communitySearchUtils.status = this.errorCodes.LOADING; |
|
279 |
this.disableForms = true; |
|
280 |
this.communityProjects = []; |
|
281 |
this.communitySearchUtils.totalResults = 0; |
|
282 |
this.communitySearchUtils.page=1; |
|
283 |
this.communitySearchUtils.keyword = ""; |
|
284 |
this.selectedFunder = ""; |
|
285 |
|
|
286 |
this.subResults = this._searchCommunityProjectsService.searchProjects(this.properties, this.community).subscribe( |
|
287 |
data => { |
|
288 |
//console.info("search Projects [total communityProjects:"+data.length+"]"); |
|
289 |
this.communityProjects = data; |
|
290 |
|
|
291 |
this.communitySearchUtils.totalResults = data.length; |
|
292 |
this.communitySearchUtils.status = this.errorCodes.DONE; |
|
293 |
// if(this.communitySearchUtils.totalResults == 0 ){ |
|
294 |
// this.communitySearchUtils.status = this.errorCodes.NONE; |
|
295 |
// } |
|
296 |
this.disableForms = false; |
|
297 |
if(!this.triggered) { |
|
298 |
this.triggerInitialLoad(); |
|
299 |
} else { |
|
300 |
var table = $('#dpTable').DataTable(); |
|
301 |
table.clear(); |
|
302 |
|
|
303 |
this.rerender(); |
|
304 |
} |
|
305 |
|
|
306 |
this.communityProjectsChanged.emit({ |
|
307 |
value: this.communityProjects, |
|
308 |
}); |
|
309 |
|
|
310 |
this.createFunderFilter(); |
|
311 |
}, |
|
312 |
err => { |
|
313 |
console.log(err); |
|
314 |
//TODO check erros (service not available, bad request) |
|
315 |
|
|
316 |
if(err.status == '404') { |
|
317 |
this.communitySearchUtils.status = this.errorCodes.NOT_FOUND; |
|
318 |
} else if(err.status == '500') { |
|
319 |
this.communitySearchUtils.status = this.errorCodes.ERROR; |
|
320 |
} else { |
|
321 |
this.communitySearchUtils.status = this.errorCodes.NOT_AVAILABLE; |
|
322 |
} |
|
323 |
|
|
324 |
this.disableForms = false; |
|
325 |
if(!this.triggered) { |
|
326 |
this.triggerInitialLoad(); |
|
327 |
} else { |
|
328 |
var table = $('#dpTable').DataTable(); |
|
329 |
table.clear(); |
|
330 |
|
|
331 |
this.rerender(); |
|
332 |
} |
|
333 |
} |
|
334 |
); |
|
335 |
} |
|
336 |
} |
|
337 |
|
|
338 |
private createFunderFilter(): Set<String> { |
|
339 |
this.funders = new Set<string>(); |
|
340 |
let i; |
|
341 |
for(i=0; i<this.communityProjects.length; i++) { |
|
342 |
let funder = this.communityProjects[i].funder; |
|
343 |
if(funder && !this.funders.has(funder)) { |
|
344 |
this.funders.add(funder); |
|
345 |
} |
|
346 |
} |
|
347 |
return this.funders; |
|
348 |
} |
|
349 |
} |
modules/uoa-admin-portal/branches/new-UI/src/app/pages/community/projects/communityProjects-routing.module.ts | ||
---|---|---|
1 |
import { NgModule } from '@angular/core'; |
|
2 |
import {RouterModule} from '@angular/router'; |
|
3 |
import {IsCommunity} from '../../../openaireLibrary/connect/communityGuard/isCommunity.guard'; |
|
4 |
import {ConnectAdminLoginGuard} from '../../../openaireLibrary/connect/communityGuard/connectAdminLoginGuard.guard'; |
|
5 |
import {ManageProjectsComponent} from './manage-projects.component'; |
|
6 |
|
|
7 |
@NgModule({ |
|
8 |
imports: [ |
|
9 |
RouterModule.forChild([ |
|
10 |
{ path: '', canActivate: [IsCommunity, ConnectAdminLoginGuard], component: ManageProjectsComponent} |
|
11 |
]) |
|
12 |
] |
|
13 |
}) |
|
14 |
export class CommunityProjectsRoutingModule { } |
modules/uoa-admin-portal/branches/new-UI/src/app/pages/community/projects/add-projects.component.html | ||
---|---|---|
1 |
<div class="uk-child-width-expand@s uk-text-center uk-margin-bottom" uk-grid> |
|
2 |
<div> |
|
3 |
<form class=" uk-animation uk-card uk-card-default uk-padding" > |
|
4 |
<div> |
|
5 |
<select class="uk-select" [(ngModel)]="selectedFunderId" name="select_funder" > |
|
6 |
<option value="0" (click)="funderChanged('0','Select funder:')">Select funder:</option> |
|
7 |
<option *ngFor="let funder of funders" [value]="funder.id" (click)="funderChanged(funder.id,funder.name)">{{(funder.name.split("||").length > 0)?(funder.name.split("||")[0]+" ("+funder.name.split("||")[1]+")"):(funder.name)}}</option> |
|
8 |
</select> |
|
9 |
</div> |
|
10 |
</form> |
|
11 |
</div> |
|
12 |
<div> |
|
13 |
<form class="uk-text-center uk-animation uk-card uk-card-default uk-padding"> |
|
14 |
<div> |
|
15 |
<input type="text" class="uk-input uk-width-1-2" placeholder="Project name or ID" aria-describedby="sizing-addon2" [(ngModel)]="openaireSearchUtils.keyword" name="keyword" > |
|
16 |
<button (click)="keywordChanged(openaireSearchUtils.keyword)" type="submit" class=" uk-button"> |
|
17 |
<span class="uk-icon"> |
|
18 |
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="search" ratio="1"><circle fill="none" stroke="#000" stroke-width="1.1" cx="9" cy="9" r="7"></circle><path fill="none" stroke="#000" stroke-width="1.1" d="M14,14 L18,18 L14,14 Z"></path></svg> |
|
19 |
</span>Search |
|
20 |
</button> |
|
21 |
</div> |
|
22 |
</form> |
|
23 |
</div> |
|
24 |
</div> |
|
25 |
|
|
26 |
<div *ngIf="openaireSearchUtils.status == errorCodes.DONE" class="uk-alert uk-alert-primary"> |
|
27 |
<span class="uk-margin-small-right uk-icon" uk-icon="warning"></span> |
|
28 |
Newly added projects will be linked to your community on the next run of our algorithms. |
|
29 |
<!-- <div> If you cannot find a funder that is relevant for your community, please contact us (<a [href]="'mailto:' + properties.feedbackmailForMissingEntities +'?Subject=[OpenAIRE Connect - '+ community + '] report missing Funder' + '&body=' + body" target="_top">feedback@openaire.eu</a>) and we'll try to get the funder on board!</div> --> |
|
30 |
|
|
31 |
|
|
32 |
</div> |
|
33 |
<div *ngIf="openaireSearchUtils.status == errorCodes.DONE" class="uk-alert uk-alert-primary"> |
|
34 |
<span class="uk-margin-small-right uk-icon" uk-icon="warning"></span> |
|
35 |
If you cannot find a funder that is relevant for your community, please contact us (<a [href]="'mailto:' + properties.feedbackmailForMissingEntities +'?Subject=[OpenAIRE Connect - '+ community + '] report missing Funder' + '&body=' + body" target="_top">feedback@openaire.eu</a>) and we'll try to get the funder on board! |
|
36 |
|
|
37 |
|
|
38 |
</div> |
|
39 |
|
|
40 |
<errorMessages [status]="[openaireSearchUtils.status]" [type]="'OpenAIRE projects'"></errorMessages> |
|
41 |
<div *ngIf="openaireSearchUtils.status == errorCodes.NONE" class="uk-alert uk-alert-primary"> |
|
42 |
<span class="uk-margin-small-right uk-icon" uk-icon="warning"></span> |
|
43 |
If you wish to suggest a new funder to include or report a missing project, please contact us via |
|
44 |
<a [href]="'mailto:' + properties.feedbackmailForMissingEntities +'?Subject=[OpenAIRE Connect - '+ community + '] report missing project' + '&body=' + body" target="_top">feedback@openaire.eu</a>. |
|
45 |
</div> |
|
46 |
|
|
47 |
<div *ngIf="openaireSearchUtils.totalResults > 0" class="uk-align-center uk-margin-remove-bottom"> |
|
48 |
<div class="searchPaging uk-panel uk-margin-top uk-grid uk-margin-bottom"> |
|
49 |
<span class="uk-h6 uk-width-1-1@s uk-width-1-2@m"> |
|
50 |
{{openaireSearchUtils.totalResults | number}} projects, page {{openaireSearchUtils.page | number}} of {{(totalPages()) | number}} |
|
51 |
</span> |
|
52 |
<span class="float-children-right-at-medium margin-small-top-at-small uk-width-1-1@s uk-width-1-2@m"> |
|
53 |
<paging-no-load [limitPaging]=true [currentPage]="openaireSearchUtils.page" [totalResults]="openaireSearchUtils.totalResults" [size]="rowsOnPage" (pageChange)="goTo($event.value)"></paging-no-load> |
|
54 |
</span> |
|
55 |
</div> |
|
56 |
</div> |
|
57 |
|
|
58 |
<ul *ngIf="(openaireSearchUtils.page <= pagingLimit)" [class]="'uk-list uk-list-divider uk-margin '+custom_class"> |
|
59 |
<!-- <errorMessages [status]="[status]" [type]="'results'"></errorMessages> --> |
|
60 |
|
|
61 |
<li *ngFor="let result of openaireProjects" class="uk-animation-fade"> |
|
62 |
<h6 class="uk-grid" uk-grid> |
|
63 |
<span class="uk-width-5-6"> |
|
64 |
<a target="_blank" [href]="properties.baseOpenaireLink+'/search/project?projectId='+result.id"> |
|
65 |
<span *ngIf="result['title'].name || result.acronym"> |
|
66 |
<span *ngIf="result.acronym">{{result.acronym}}</span> |
|
67 |
<span *ngIf="result.acronym && result['title'].name">-</span> |
|
68 |
<span [innerHTML]="result['title'].name"></span> |
|
69 |
<span *ngIf="result.code">({{result.code}})</span> |
|
70 |
</span> |
|
71 |
<span *ngIf="!result['title'].name && !result.acronym"> |
|
72 |
[no title available] |
|
73 |
<span *ngIf="result.code">({{result.code}})</span> |
|
74 |
</span> |
|
75 |
<span class="custom-external custom-icon space"></span> |
|
76 |
</a> |
|
77 |
</span> |
|
78 |
|
|
79 |
<span class="uk-width-1-6 uk-text-center"> |
|
80 |
<!-- <a *ngIf="!inCommunity(result)" (click)="addProject(result)" class="uk-icon-button"><svg height="20" icon="plus" ratio="1" viewBox="0 0 20 20" width="20" xmlns="http://www.w3.org/2000/svg"><rect height="17" width="1" x="9" y="1"></rect><rect height="1" width="17" x="1" y="9"></rect></svg></a> --> |
|
81 |
<!-- green_background_color green_color--> |
|
82 |
<a *ngIf="!inCommunity(result)" (click)="addProject(result)" class="uk-icon-button add uk-button-primary" uk-icon="plus" title="Add"></a> |
|
83 |
|
|
84 |
<span *ngIf="inCommunity(result)" class="uk-label uk-label-success">Added</span> |
|
85 |
<!-- <svg *ngIf="inCommunity(result)" class="added" src="assets/imgs/check-icon.png" title="Added" width="20" type="image" height="20"></svg> --> |
|
86 |
|
|
87 |
<!-- <button *ngIf="undo[result.id]" class="uk-button uk-button-danger uk-button-small" (click)="removeProject(result.id)">Undo</button> --> |
|
88 |
<!-- <input *ngIf="undo[result.id]" (click)="removeProject(result.id)" class="remove" src="assets/imgs/x-icon.png" title="Undo" width="20" type="image" height="20"> --> |
|
89 |
<!-- <a *ngIf="undo[result.id]" (click)="removeProject(result.id)" class="remove red_colour"><svg height="20" icon="close" ratio="1" viewBox="0 0 20 20" width="20" xmlns="http://www.w3.org/2000/svg"><rect height="17" width="1" x="9" y="1"></rect><rect height="1" width="17" x="1" y="9"></rect></svg></a> --> |
|
90 |
<!-- red_background_color red_color--> |
|
91 |
<a *ngIf="undo[result.id]" (click)="removeProject(undo[result.id], result.id)" class="uk-icon-button remove uk-button-danger" uk-icon="close" title="Undo"></a> |
|
92 |
|
|
93 |
</span> |
|
94 |
</h6> |
|
95 |
<span *ngIf="result.title && result.title.accessMode" [class]="'uk-label custom-label label-'+ result.title.accessMode " title="Access Mode">{{result.title.accessMode}}</span> |
|
96 |
<span *ngIf="result.funderShortname" class="uk-label custom-label label-funder " title="Funder">{{result.funderShortname}}</span> |
|
97 |
<span *ngIf="result.title && result.title.sc39" class="uk-label custom-label label-sc39 " title="Special Clause 39">Special Clause 39</span> |
|
98 |
|
|
99 |
<div *ngIf="result.startYear && result.endYear"> Start year: {{result.startYear}} - End year: {{result.endYear}}</div> |
|
100 |
<div *ngIf="result['organizations'] != undefined && result['organizations'].length > 0"> |
|
101 |
<span> Organization: </span> |
|
102 |
<span *ngFor="let organization of result['organizations'].slice(0,10) let i=index"> |
|
103 |
<a *ngIf="organization.id" target="_blank" |
|
104 |
[href]="properties.baseOpenaireLink+'/search/organization?organizationId='+organization.id"> |
|
105 |
<span>{{organization.name}}</span> |
|
106 |
<span class="custom-external custom-icon space"></span> |
|
107 |
</a> |
|
108 |
<span |
|
109 |
*ngIf="!organization.id"> |
|
110 |
{{organization.name}}</span><span |
|
111 |
|
|
112 |
*ngIf="(i < result['organizations'].length-1) && (i < 9)">,</span> |
|
113 |
</span> |
|
114 |
<span *ngIf="result['organizations'].length > 10">...</span> |
|
115 |
</div> |
|
116 |
</li> |
|
117 |
</ul> |
|
118 |
|
|
119 |
<div [class]="openaireSearchUtils.page > pagingLimit ? 'search-results' : ''" *ngIf="(openaireSearchUtils.page >= pagingLimit) && (openaireSearchUtils.totalResults > resultsPerPage*pagingLimit)"> |
|
120 |
<p class="uk-alert-warning" uk-alert>For more results please try a new, more specific query</p> |
|
121 |
</div> |
|
122 |
|
|
123 |
<div *ngIf="openaireSearchUtils.totalResults > 0" class="uk-align-center uk-margin-remove-bottom"> |
|
124 |
<div class="searchPaging uk-panel uk-margin-top uk-grid uk-margin-bottom"> |
|
125 |
<span class="uk-h6 uk-width-1-1@s uk-width-1-2@m"> |
|
126 |
{{openaireSearchUtils.totalResults | number}} projects, page {{openaireSearchUtils.page | number}} of {{(totalPages()) | number}} |
|
127 |
</span> |
|
128 |
<span class="float-children-right-at-medium margin-small-top-at-small uk-width-1-1@s uk-width-1-2@m"> |
|
129 |
<paging-no-load [limitPaging]=true [currentPage]="openaireSearchUtils.page" [totalResults]="openaireSearchUtils.totalResults" [size]="rowsOnPage" (pageChange)="goTo($event.value)"></paging-no-load> |
|
130 |
</span> |
|
131 |
</div> |
|
132 |
</div> |
modules/uoa-admin-portal/branches/new-UI/src/app/pages/community/projects/add-projects.component.ts | ||
---|---|---|
1 |
import { Component, ViewChild, OnInit, ViewEncapsulation, Input, Output, EventEmitter } from '@angular/core'; |
|
2 |
import { ActivatedRoute, Router } from "@angular/router"; |
|
3 |
//import { Subject } from 'rxjs/Subject'; |
|
4 |
import {SearchResult} from '../../../openaireLibrary/utils/entities/searchResult'; |
|
5 |
import {ErrorCodes} from '../../../openaireLibrary/utils/properties/errorCodes'; |
|
6 |
import {SearchFields, FieldDetails} from '../../../openaireLibrary/utils/properties/searchFields'; |
|
7 |
import {SearchUtilsClass } from '../../../openaireLibrary/searchPages/searchUtils/searchUtils.class'; |
|
8 |
import {EnvProperties} from '../../../openaireLibrary/utils/properties/env-properties'; |
|
9 |
import {SearchProjectsService} from '../../../openaireLibrary/services/searchProjects.service'; |
|
10 |
import {RouterHelper} from '../../../openaireLibrary/utils/routerHelper.class'; |
|
11 |
import {DOI, StringUtils} from '../../../openaireLibrary/utils/string-utils.class'; |
|
12 |
import {ManageCommunityProjectsService} from '../../../services/manageProjects.service'; |
|
13 |
|
|
14 |
import {Session} from '../../../openaireLibrary/login/utils/helper.class'; |
|
15 |
import {LoginErrorCodes} from '../../../openaireLibrary/login/utils/guardHelper.class'; |
|
16 |
|
|
17 |
@Component({ |
|
18 |
selector: 'add-projects', |
|
19 |
templateUrl: './add-projects.component.html', |
|
20 |
}) |
|
21 |
|
|
22 |
export class AddProjectsComponent implements OnInit { |
|
23 |
@Input() communityProjects = []; |
|
24 |
//@Output() communityProjectsChanged = new EventEmitter(); |
|
25 |
|
|
26 |
private community: string = ''; |
|
27 |
|
|
28 |
public openaireProjects = []; |
|
29 |
public undo = {}; |
|
30 |
public queryParameters: string = ""; |
|
31 |
|
|
32 |
public funders:string[]; |
|
33 |
public selectedFunderId:string ="0"; |
|
34 |
selectedFunderName:string ="Select funder:"; |
|
35 |
|
|
36 |
public disableForms: boolean = false; |
|
37 |
|
|
38 |
public warningMessage = ""; |
|
39 |
public infoMessage = ""; |
|
40 |
|
|
41 |
public rowsOnPage:number = 10; |
|
42 |
|
|
43 |
public routerHelper:RouterHelper = new RouterHelper(); |
|
44 |
public errorCodes: ErrorCodes; |
|
45 |
public openaireSearchUtils:SearchUtilsClass = new SearchUtilsClass(); |
|
46 |
public properties:EnvProperties = null; |
|
47 |
public pagingLimit:number = 0; |
|
48 |
public resultsPerPage: number = 0; |
|
49 |
|
|
50 |
public subFunders: any; public subResults: any; subAdd: any; subRemove: any; |
|
51 |
public body:string = "Send from page"; |
|
52 |
|
|
53 |
ngOnInit() { |
|
54 |
this.route.data |
|
55 |
.subscribe((data: { envSpecific: EnvProperties }) => { |
|
56 |
this.properties = data.envSpecific; |
|
57 |
this.pagingLimit = data.envSpecific.pagingLimit; |
|
58 |
this.resultsPerPage =data.envSpecific.resultsPerPage; |
|
59 |
|
|
60 |
this.route.queryParams.subscribe(params => { |
|
61 |
this.community = params['communityId']; |
|
62 |
this.getFunders(); |
|
63 |
this._getOpenaireProjects("", 1, 10); |
|
64 |
|
|
65 |
var referrer = null; |
|
66 |
if (typeof location !== 'undefined') { |
|
67 |
referrer = location.href; |
|
68 |
} |
|
69 |
this.body = "[Please write your message here]"; |
|
70 |
this.body = StringUtils.URIEncode(this.body); |
|
71 |
}); |
|
72 |
}); |
|
73 |
} |
|
74 |
|
|
75 |
constructor(private route: ActivatedRoute, private _router: Router, private _searchProjectsService: SearchProjectsService, private _manageCommunityProjectsService: ManageCommunityProjectsService) { |
|
76 |
this.errorCodes = new ErrorCodes(); |
|
77 |
this.openaireSearchUtils.status = this.errorCodes.LOADING; |
|
78 |
} |
|
79 |
|
|
80 |
public ngOnDestroy() { |
|
81 |
if(this.subFunders){ |
|
82 |
this.subFunders.unsubscribe(); |
|
83 |
} |
|
84 |
if(this.subResults){ |
|
85 |
this.subResults.unsubscribe(); |
|
86 |
} |
|
87 |
if(this.subAdd) { |
|
88 |
this.subAdd.unsubscribe(); |
|
89 |
} |
|
90 |
if(this.subRemove) { |
|
91 |
this.subRemove.unsubscribe(); |
|
92 |
} |
|
93 |
} |
|
94 |
|
|
95 |
public addProject(project: SearchResult) { |
|
96 |
if(!Session.isLoggedIn()){ |
|
97 |
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} }); |
|
98 |
} else { |
|
99 |
this.subAdd = this._manageCommunityProjectsService.addProject(this.properties, this.community, project).subscribe( |
|
100 |
data => { |
|
101 |
this.undo[project.id] = data.id; |
|
102 |
}, |
|
103 |
err => { |
|
104 |
console.log(err.status); |
|
105 |
}/*, |
|
106 |
() => { |
|
107 |
console.info("completed ADD"); |
|
108 |
}*/ |
|
109 |
); |
|
110 |
} |
|
111 |
} |
|
112 |
|
|
113 |
public removeProject(projectId: string, communityProjectId: string) { |
|
114 |
if(!Session.isLoggedIn()){ |
|
115 |
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} }); |
|
116 |
} else { |
|
117 |
this.subRemove = this._manageCommunityProjectsService.removeProject(this.properties, this.community, projectId).subscribe( |
|
118 |
data => { |
|
119 |
//console.info(data); |
|
120 |
}, |
|
121 |
err => { |
|
122 |
console.log(err); |
|
123 |
}, |
|
124 |
() => { |
|
125 |
this.undo[communityProjectId] = ""; |
|
126 |
} |
|
127 |
) |
|
128 |
} |
|
129 |
} |
|
130 |
|
|
131 |
public inCommunity(project: any): any { |
|
132 |
for(let communityProject of this.communityProjects) { |
|
133 |
if(communityProject.openaireId == project.id) { |
|
134 |
return true; |
|
135 |
} else if(project.code == communityProject.grantId && project.funderShortname == communityProject.funder) { |
|
136 |
return true; |
|
137 |
} |
|
138 |
} |
|
139 |
|
|
140 |
if(this.undo[project.id]) { |
|
141 |
return true; |
|
142 |
} |
|
143 |
return false; |
|
144 |
} |
|
145 |
|
|
146 |
getFunders () { |
|
147 |
if(!Session.isLoggedIn()){ |
|
148 |
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} }); |
|
149 |
} else { |
|
150 |
this.subFunders = this._searchProjectsService.getFunders(this.properties).subscribe( |
|
151 |
data => { |
|
152 |
this.funders = data[1]; |
|
153 |
}, |
|
154 |
err => console.log(err) |
|
155 |
); |
|
156 |
} |
|
157 |
} |
|
158 |
|
|
159 |
private _getOpenaireProjects(parameters:string, page: number, size: number){ |
|
160 |
if(!Session.isLoggedIn()){ |
|
161 |
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} }); |
|
162 |
} else { |
|
163 |
if(page > this.pagingLimit) { |
|
164 |
size=0; |
|
165 |
} |
|
166 |
|
|
167 |
if(this.openaireSearchUtils.status == this.errorCodes.LOADING) { |
|
168 |
this.openaireSearchUtils.status = this.errorCodes.LOADING; |
|
169 |
|
|
170 |
this.disableForms = true; |
|
171 |
this.openaireProjects = []; |
|
172 |
this.openaireSearchUtils.totalResults = 0; |
|
173 |
|
|
174 |
this.subResults = this._searchProjectsService.searchProjects(parameters, null, page, size, [], this.properties).subscribe( |
|
175 |
data => { |
|
176 |
this.undo = {}; |
|
177 |
//console.info("total openaire projects = "+data[0]); |
|
178 |
this.openaireSearchUtils.totalResults = data[0]; |
|
179 |
this.openaireProjects = data[1]; |
|
180 |
|
|
181 |
//this.searchPage.checkSelectedFilters(this.filters); |
|
182 |
|
|
183 |
this.openaireSearchUtils.status = this.errorCodes.DONE; |
|
184 |
if(this.openaireSearchUtils.totalResults == 0 ){ |
|
185 |
this.openaireSearchUtils.status = this.errorCodes.NONE; |
|
186 |
} |
|
187 |
|
|
188 |
this.disableForms = false; |
|
189 |
|
|
190 |
if(this.openaireSearchUtils.status == this.errorCodes.DONE) { |
|
191 |
// Page out of limit!!! |
|
192 |
let totalPages:any = this.openaireSearchUtils.totalResults/(this.openaireSearchUtils.size); |
|
193 |
if(!(Number.isInteger(totalPages))) { |
|
194 |
totalPages = (parseInt(totalPages, 10) + 1); |
|
195 |
} |
|
196 |
if(totalPages < page) { |
|
197 |
this.openaireSearchUtils.totalResults = 0; |
|
198 |
this.openaireSearchUtils.status = this.errorCodes.OUT_OF_BOUND; |
|
199 |
} |
|
200 |
} |
|
201 |
}, |
|
202 |
err => { |
|
203 |
console.log(err); |
|
204 |
//TODO check erros (service not available, bad request) |
|
205 |
if(err.status == '404') { |
|
206 |
this.openaireSearchUtils.status = this.errorCodes.NOT_FOUND; |
|
207 |
} else if(err.status == '500') { |
|
208 |
this.openaireSearchUtils.status = this.errorCodes.ERROR; |
|
209 |
} else { |
|
210 |
this.openaireSearchUtils.status = this.errorCodes.NOT_AVAILABLE; |
|
211 |
} |
|
212 |
|
|
213 |
this.disableForms = false; |
|
214 |
} |
|
215 |
); |
|
216 |
} |
|
217 |
} |
|
218 |
} |
|
219 |
|
|
220 |
totalPages(): number { |
|
221 |
let totalPages:any = this.openaireSearchUtils.totalResults/(this.rowsOnPage); |
|
222 |
if(!(Number.isInteger(totalPages))) { |
|
223 |
totalPages = (parseInt(totalPages, 10) + 1); |
|
224 |
} |
|
225 |
return totalPages; |
|
226 |
} |
|
227 |
|
|
228 |
keywordChanged(keyword) { |
|
229 |
this.openaireSearchUtils.keyword = keyword; |
|
230 |
this.buildQueryParameters(); |
|
231 |
this.goTo(1); |
|
232 |
} |
|
233 |
|
|
234 |
funderChanged(funderId:string, funderName:string){ |
|
235 |
this.selectedFunderId = funderId; |
|
236 |
this.selectedFunderName = funderName; |
|
237 |
|
|
238 |
this.buildQueryParameters(); |
|
239 |
this.goTo(1); |
|
240 |
} |
|
241 |
|
|
242 |
buildQueryParameters() { |
|
243 |
this.queryParameters = ""; |
|
244 |
|
|
245 |
if(this.openaireSearchUtils.keyword) { |
|
246 |
this.queryParameters = "q="+StringUtils.URIEncode(this.openaireSearchUtils.keyword); |
|
247 |
} |
|
248 |
|
|
249 |
if(this.selectedFunderId != "0") { |
|
250 |
this.queryParameters += this.queryParameters ? "&" : ""; |
|
251 |
this.queryParameters += "fq=funder exact " + '"'+StringUtils.URIEncode(this.selectedFunderId)+ '"'; |
|
252 |
} |
|
253 |
} |
|
254 |
|
|
255 |
goTo(page:number = 1){ |
|
256 |
this.openaireSearchUtils.page=page; |
|
257 |
this.openaireSearchUtils.status = this.errorCodes.LOADING; |
|
258 |
this._getOpenaireProjects(this.queryParameters, page, 10); |
|
259 |
} |
|
260 |
} |
modules/uoa-admin-portal/branches/new-UI/src/app/pages/community/projects/manage-projects.component.ts | ||
---|---|---|
1 |
import { Component, ViewChild, OnInit, ViewEncapsulation, Input, ElementRef } from '@angular/core'; |
|
2 |
import { ActivatedRoute, Router } from "@angular/router"; |
|
3 |
|
|
4 |
import {RemoveProjectsComponent} from './remove-projects.component'; |
|
5 |
import {AddProjectsComponent} from './add-projects.component'; |
|
6 |
|
|
7 |
import {Session} from '../../../openaireLibrary/login/utils/helper.class'; |
|
8 |
import {LoginErrorCodes} from '../../../openaireLibrary/login/utils/guardHelper.class'; |
|
9 |
import {HelperFunctions} from "../../../openaireLibrary/utils/HelperFunctions.class"; |
|
10 |
import {Title} from '@angular/platform-browser'; |
|
11 |
|
|
12 |
@Component({ |
|
13 |
selector: 'manage-projects', |
|
14 |
template: ` |
|
15 |
<div id="manage-projects"> |
|
16 |
<div class="menubar uk-margin-bottom "> |
|
17 |
<a *ngIf="!toggle" (click)="updateCommunityProjects()" uk-toggle="target: .toggle-usage" class="uk-button uk-button-primary uk-float-right">{{toggleLinkMessage}}</a> |
|
18 |
<div class="manage-projects-title uk-text-large">{{pageTitle}}</div> |
|
19 |
</div> |
|
20 |
|
|
21 |
<div class="toggle-usage"> |
|
22 |
<remove-projects (communityProjectsChanged)="communityProjectsChanged($event)"></remove-projects> |
|
23 |
<fab (clicked)="updateCommunityProjects()" uk-toggle="target: .toggle-usage"></fab> |
|
24 |
</div> |
|
25 |
<div class="toggle-usage" hidden> |
|
26 |
<!-- (updateCommunityProjects)="updateCommunityProjects($event)" --> |
|
27 |
<add-projects [(communityProjects)]="communityProjects"></add-projects> |
|
28 |
</div> |
|
29 |
</div> |
|
30 |
` |
|
31 |
}) |
|
32 |
|
|
33 |
export class ManageProjectsComponent implements OnInit { |
|
34 |
private community: string = ''; |
|
35 |
|
|
36 |
@Input() communityProjects =[]; |
|
37 |
@ViewChild (RemoveProjectsComponent) removeProjectsComponent : RemoveProjectsComponent ; |
|
38 |
@ViewChild (AddProjectsComponent) addProjectsComponent : AddProjectsComponent ; |
|
39 |
|
|
40 |
public warningMessage = ""; |
|
41 |
public infoMessage = ""; |
|
42 |
|
|
43 |
public toggle: boolean = true; |
|
44 |
public updateCommunityProjectsOnToggle: boolean = false; |
|
45 |
public pageTitle: string = "Manage projects"; |
|
46 |
public toggleLinkMessage: string = "Manage projects"; |
|
47 |
|
|
48 |
ngOnInit() { |
|
49 |
this.route.queryParams.subscribe(params => { |
|
50 |
if(params['communityId']) { |
|
51 |
this.community = params['communityId']; |
|
52 |
this.title.setTitle('Administration Dashboard | Projects'); |
|
53 |
} |
|
54 |
}); |
|
55 |
} |
|
56 |
|
|
57 |
constructor(private element: ElementRef, |
|
58 |
private title: Title, |
|
59 |
private route: ActivatedRoute, private _router: Router) {} |
|
60 |
|
|
61 |
public ngOnDestroy() {} |
|
62 |
|
|
63 |
public updateCommunityProjects() { |
|
64 |
if(!Session.isLoggedIn()){ |
|
65 |
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} }); |
|
66 |
} else { |
|
67 |
HelperFunctions.scroll(); |
|
68 |
|
|
69 |
this.toggle = !this.toggle; |
|
70 |
if(this.toggle) { |
|
71 |
this.pageTitle = "Manage projects"; |
|
72 |
// this.toggleLinkMessage = "Missing projects?"; |
|
73 |
|
|
74 |
//if(this.updateCommunityProjectsOnToggle) { |
|
75 |
this.removeProjectsComponent._getCommunityProjects(); |
|
76 |
this.addProjectsComponent.undo = {}; |
|
77 |
//} |
|
78 |
} else { |
|
79 |
this.updateCommunityProjectsOnToggle = false; |
|
80 |
this.pageTitle = "Search projects"; |
|
81 |
//this.toggleLinkMessage = "Manage projects"; |
|
82 |
} |
|
83 |
} |
|
84 |
} |
|
85 |
|
|
86 |
public communityProjectsChanged($event) { |
|
87 |
this.communityProjects = $event.value; |
|
88 |
} |
|
89 |
|
|
90 |
// public updateCommunityProjects($event) { |
|
91 |
// this.updateCommunityProjectsOnToggle = true; |
|
92 |
// } |
|
93 |
} |
modules/uoa-admin-portal/branches/new-UI/src/app/pages/community/projects/communityProjects.module.ts | ||
---|---|---|
1 |
import { NgModule } from '@angular/core'; |
|
2 |
import { HttpClientModule } from '@angular/common/http'; |
|
3 |
import { FormsModule, ReactiveFormsModule } from '@angular/forms'; |
|
4 |
import { RouterModule } from '@angular/router'; |
|
5 |
|
|
6 |
|
|
7 |
import { EnvironmentSpecificResolver } from '../../../openaireLibrary/utils/properties/environmentSpecificResolver'; |
|
8 |
import { EnvironmentSpecificService } from '../../../openaireLibrary/utils/properties/environment-specific.service'; |
|
9 |
|
|
10 |
import { DataTablesModule } from 'angular-datatables'; |
|
11 |
import { ManageProjectsComponent } from './manage-projects.component'; |
|
12 |
import { ManageCommunityProjectsService } from '../../../services/manageProjects.service'; |
|
13 |
import { SearchProjectsServiceModule } from '../../../openaireLibrary/connect/projects/searchProjectsService.module'; |
|
14 |
|
|
15 |
import { RemoveProjectsComponent } from './remove-projects.component'; |
|
16 |
import { AddProjectsComponent } from './add-projects.component'; |
|
17 |
import { SearchProjectsService } from '../../../openaireLibrary/services/searchProjects.service'; |
|
18 |
import { PagingModule } from '../../../openaireLibrary/utils/paging.module'; |
|
19 |
import { SearchPagingModule } from '../../../openaireLibrary/searchPages/searchUtils/searchPaging.module'; |
|
20 |
|
|
21 |
import {ErrorMessagesModule} from '../../../openaireLibrary/utils/errorMessages.module'; |
|
22 |
import {AlertModalModule} from '../../../openaireLibrary/utils/modal/alertModal.module'; |
|
23 |
import {FABModule} from '../../../utils/fabModule.module'; |
|
24 |
import {CommonModule} from '@angular/common'; |
|
25 |
import {CommunityProjectsRoutingModule} from './communityProjects-routing.module'; |
|
26 |
|
|
27 |
@NgModule({ |
|
28 |
imports: [ |
|
29 |
CommonModule, |
|
30 |
HttpClientModule, |
|
31 |
FormsModule, |
|
32 |
ReactiveFormsModule, |
|
33 |
RouterModule, |
|
34 |
DataTablesModule, |
|
35 |
PagingModule, SearchPagingModule, |
|
36 |
ErrorMessagesModule, |
|
37 |
AlertModalModule, |
|
38 |
SearchProjectsServiceModule, |
|
39 |
FABModule, |
|
40 |
CommunityProjectsRoutingModule |
|
41 |
], |
|
42 |
declarations: [ |
|
43 |
ManageProjectsComponent, |
|
44 |
RemoveProjectsComponent, |
|
45 |
AddProjectsComponent |
|
46 |
], |
|
47 |
providers: [ |
|
48 |
ManageCommunityProjectsService, |
|
49 |
SearchProjectsService, |
|
50 |
EnvironmentSpecificResolver, EnvironmentSpecificService |
|
51 |
], |
|
52 |
exports: [ManageProjectsComponent] |
|
53 |
}) |
|
54 |
|
|
55 |
export class CommunityProjectsModule { } |
modules/uoa-admin-portal/branches/new-UI/src/app/pages/community/projects/remove-projects.component.html | ||
---|---|---|
1 |
<div class="uk-child-width-expand@s uk-text-center uk-margin-bottom" uk-grid> |
|
2 |
<div> |
|
3 |
<form class=" uk-animation uk-card uk-card-default uk-padding" > |
|
4 |
<div> |
|
5 |
<select class="uk-select" [(ngModel)]="selectedFunder" name="select_funder" > |
|
6 |
<option value="" (click)="goTo(1)">Select funder:</option> |
|
7 |
<option *ngFor="let funder of funders" [value]="funder" (click)="goTo(1)">{{funder}}</option> |
|
8 |
</select> |
|
9 |
</div> |
|
10 |
</form> |
|
11 |
</div> |
|
12 |
<div> |
|
13 |
<form class="uk-text-center uk-animation uk-card uk-card-default uk-padding"> |
|
14 |
<div> |
|
15 |
<input type="text" class="uk-input uk-width-1-2" placeholder="Search community projects..." aria-describedby="sizing-addon2" [(ngModel)]="communitySearchUtils.keyword" name="keyword" > |
|
16 |
<button (click)="goTo(1)" type="submit" class=" uk-button"> |
|
17 |
<span class="uk-icon"> |
|
18 |
<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" icon="search" ratio="1"><circle fill="none" stroke="#000" stroke-width="1.1" cx="9" cy="9" r="7"></circle><path fill="none" stroke="#000" stroke-width="1.1" d="M14,14 L18,18 L14,14 Z"></path></svg> |
|
19 |
</span>Search |
|
20 |
</button> |
|
21 |
</div> |
|
22 |
</form> |
|
23 |
</div> |
|
24 |
</div> |
|
25 |
|
|
26 |
<errorMessages [status]="[communitySearchUtils.status]" [type]="'community projects'"></errorMessages> |
|
27 |
<div *ngIf="communitySearchUtils.status == errorCodes.DONE" class="uk-alert uk-alert-primary"> |
|
28 |
<span class="uk-margin-small-right uk-icon" uk-icon="warning"></span> |
|
29 |
All the research results linked to the projects specified here will be automatically linked to your community dashboard. |
|
30 |
</div> |
|
31 |
<div *ngIf="communitySearchUtils.totalResults > 0" class="uk-align-center uk-margin-remove-bottom"> |
|
32 |
<div class="searchPaging uk-panel uk-margin-top uk-grid uk-margin-bottom"> |
|
33 |
<span class="uk-h6 uk-width-1-1@s uk-width-1-2@m"> |
|
34 |
{{communitySearchUtils.totalResults | number}} projects, page {{communitySearchUtils.page | number}} of {{(totalPages()) | number}} |
|
35 |
</span> |
|
36 |
<span class="float-children-right-at-medium margin-small-top-at-small uk-width-1-1@s uk-width-1-2@m"> |
|
37 |
<paging-no-load [currentPage]="communitySearchUtils.page" [totalResults]="communitySearchUtils.totalResults" [size]="10" (pageChange)="goTo($event.value, false)"></paging-no-load> |
|
38 |
</span> |
|
39 |
</div> |
|
40 |
</div> |
|
41 |
|
|
42 |
<!-- uk-first-column uk-width-expand --> |
|
43 |
<div class="custom-dataTable-content"> |
|
44 |
<div class="uk-overflow-container"> |
|
45 |
<table datatable class="uk-table uk-table-striped divider-table" [dtOptions]="dtOptions" id="dpTable" [dtTrigger]="dtTrigger" dtInstance="dtInstanceCallback"> |
|
46 |
<thead> |
|
47 |
<tr> |
|
48 |
<th class="uk-text-center">Project</th> |
|
49 |
<th class="uk-text-center">Grant Id</th> |
|
50 |
<th class="uk-text-center">Funder</th> |
|
51 |
<th class="uk-text-center">Action</th> |
|
52 |
</tr> |
|
53 |
</thead> |
|
54 |
<tbody> |
|
55 |
<tr class="uk-table-middle" *ngFor="let result of communityProjects"> |
|
56 |
<td class="uk-text-center uk-width-1-4"> |
|
57 |
<a target="_blank" |
|
58 |
[href]="communityUrl+'/search/project?' + ((result.openaireId) ? 'projectId='+result.openaireId : 'grantId='+result.grantId+'&funder='+result.funder)"> |
|
59 |
<span *ngIf="result.name">{{result.name}}</span> |
|
60 |
<span *ngIf="result.name && result.acronym">(</span><span *ngIf="result.acronym">{{result.acronym}}</span><span *ngIf="result.name && result.acronym">)</span> |
|
61 |
<span *ngIf="!result.name && !result.acronym">[no title available]</span> |
|
62 |
<span class="custom-external custom-icon space"></span> |
|
63 |
</a> |
|
64 |
</td> |
|
65 |
<td class="uk-text-center uk-width-1-4"> |
|
66 |
<span *ngIf="result.grantId">{{result.grantId}}</span> |
|
67 |
<span *ngIf="!result.grantId">-</span> |
|
68 |
</td> |
|
69 |
<td class="uk-text-center uk-width-1-4"> |
|
70 |
<span *ngIf="result.funder">{{result.funder}}</span> |
|
71 |
<span *ngIf="!result.funder">-</span> |
|
72 |
</td> |
|
73 |
|
|
74 |
<td class="uk-text-center uk-width-1-4"> |
|
75 |
<!-- red_background_color red_color--> |
|
76 |
<a (click)="removeProject(result)" class="uk-icon-button remove uk-button-danger" uk-icon="icon: close; ratio: 1" title="Remove"></a> |
|
77 |
</td> |
|
78 |
</tr> |
|
79 |
</tbody> |
|
80 |
</table> |
|
81 |
</div> |
|
82 |
</div> |
|
83 |
|
|
84 |
<div *ngIf="communitySearchUtils.totalResults > 0" class="uk-align-center uk-margin-remove-bottom"> |
|
85 |
<div class="searchPaging uk-panel uk-margin-top uk-grid uk-margin-bottom"> |
|
86 |
<span class="uk-h6 uk-width-1-1@s uk-width-1-2@m"> |
|
87 |
{{communitySearchUtils.totalResults | number}} projects, page {{communitySearchUtils.page | number}} of {{(totalPages()) | number}} |
|
88 |
</span> |
|
89 |
<span class="float-children-right-at-medium margin-small-top-at-small uk-width-1-1@s uk-width-1-2@m"> |
|
90 |
<paging-no-load [currentPage]="communitySearchUtils.page" [totalResults]="communitySearchUtils.totalResults" [size]="10" (pageChange)="goTo($event.value, false)"></paging-no-load> |
|
91 |
</span> |
|
92 |
</div> |
|
93 |
</div> |
|
94 |
|
|
95 |
<modal-alert #AlertModalDeleteCommunity (alertOutput)="confirmedDeleteProject($event)"></modal-alert> |
|
96 |
<!-- <delete-confirmation-dialog #deleteConfirmationModal [isModalShown]="isModalShown" (emmitObject)="confirmedDeleteProject($event)"> |
|
97 |
Are you sure you want to remove the selected project from your community? |
|
98 |
</delete-confirmation-dialog> --> |
|
99 |
<!-- </div> --> |
modules/uoa-admin-portal/branches/new-UI/src/app/pages/zenodo-communities/add-zenodo-communities.component.html | ||
---|---|---|
1 |
|
|
2 |
<div class="uk-width-1-1 uk-flex uk-flex-right@m uk-flex-center uk-flex-wrap uk-flex-middle uk-grid" uk-grid> |
|
1 |
<div class="uk-width-1-1 uk-flex uk-flex-right@m uk-flex-center uk-flex-wrap uk-flex-middle uk-grid uk-margin-bottom" uk-grid> |
|
3 | 2 |
<div #searchInputComponent search-input [control]="filterForm" [showSearch]="false" |
4 | 3 |
placeholder="Search Zenodo Communites" |
5 | 4 |
[selected]="zenodoCommunitySearchUtils.keyword" (closeEmitter)="onSearchClose()" (resetEmitter)="resetInput()" |
... | ... | |
7 | 6 |
class="uk-width-1-2@l uk-width-1-2@m uk-width-1-1"></div> |
8 | 7 |
|
9 | 8 |
</div> |
10 |
|
|
11 |
<div id="manage-zenodo-communities" class="uk-padding-small"> |
|
12 |
|
|
13 |
<div *ngIf="zenodoCommunitySearchUtils.status == errorCodes.LOADING " class="uk-position-center"> |
|
14 |
<loading></loading> |
|
15 |
</div> |
|
16 |
<div *ngIf="zenodoCommunitySearchUtils.status == errorCodes.NONE " |
|
17 |
class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold"> |
|
18 |
<div> No zenodo communities found |
|
19 |
</div> |
|
9 |
<div *ngIf="zenodoCommunitySearchUtils.status == errorCodes.LOADING" class="uk-position-large-top"> |
|
10 |
<loading></loading> |
|
11 |
</div> |
|
12 |
<div *ngIf="zenodoCommunitySearchUtils.status == errorCodes.NONE " |
|
13 |
class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold"> |
|
14 |
<div> No zenodo communities found |
|
20 | 15 |
</div> |
21 |
<no-load-paging *ngIf="zenodoCommunitySearchUtils.totalResults > 0" [type]="'Zenodo Communities'" |
|
22 |
[page]="zenodoCommunitySearchUtils.page" [pageSize]="rowsOnPage" (pageChange)="goTo($event.value)" |
|
23 |
[totalResults]="zenodoCommunitySearchUtils.totalResults" > |
|
16 |
</div> |
|
17 |
<div *ngIf="zenodoCommunitySearchUtils.totalResults > 0"> |
|
18 |
<no-load-paging [type]="'Zenodo Communities'" |
|
19 |
[page]="zenodoCommunitySearchUtils.page" [pageSize]="rowsOnPage" (pageChange)="goTo($event.value)" |
|
20 |
[totalResults]="zenodoCommunitySearchUtils.totalResults"> |
|
24 | 21 |
</no-load-paging> |
25 | 22 |
<ul class="uk-list"> |
26 |
|
|
27 | 23 |
<li class="" *ngFor="let item of zenodoCommunities; let i = index;" |
28 |
class="uk-card uk-card-default uk-margin-bottom uk-padding" >
|
|
24 |
class="uk-card uk-card-default uk-margin-bottom uk-padding"> |
|
29 | 25 |
<div class="uk-grid uk-grid-divider " uk-grid> |
30 | 26 |
<div class="uk-width-expand"> |
31 | 27 |
<preview-zenodo-community [item]="item"></preview-zenodo-community> |
32 | 28 |
</div> |
33 | 29 |
|
34 |
<div class="uk-width-auto@m uk-width-1-1"> |
|
35 |
<div class=" uk-flex uk-flex-middle uk-flex-center uk-flex-column uk-height-1-1"> |
|
36 |
<div class="uk-padding-small uk-padding-remove-horizontal"> |
|
37 |
<div [class.hide-element]="inThelist(item, selectedCommunities)"> |
|
38 |
<span *ngIf=" masterCommunity && item.id==masterCommunity.id" class="uk-label uk-label-warning">Master zenodo community</span> |
|
39 |
<div (click)="addCommunity(item)" class="uk-button action uk-flex uk-flex-middle" |
|
40 |
uk-tooltip="title:<div class='uk-padding-small'><div class='uk-margin-bottom uk-text-bold'>Add new community </div><div>Newly added Zenodo communities will be linked to your community on the next run of our algorithms.</div></div>"> |
|
41 |
<!-- <i class="clickable uk-text-success" uk-icon="plus"></i>--> |
|
42 |
<div class="uk-text-success"> |
|
43 |
<icon name="add"></icon> |
|
44 |
</div> |
|
45 |
<span class="uk-margin-small-left"> Add community</span> |
|
46 |
</div> |
|
30 |
<div class="uk-width-auto@m uk-width-1-1"> |
|
31 |
<div class=" uk-flex uk-flex-middle uk-flex-center uk-flex-column uk-height-1-1"> |
|
32 |
<div class="uk-padding-small uk-padding-remove-horizontal"> |
|
33 |
<div [class.hide-element]="inThelist(item, selectedCommunities)"> |
|
34 |
<span *ngIf=" masterCommunity && item.id==masterCommunity.id" class="uk-label uk-label-warning">Master zenodo community</span> |
|
35 |
<div (click)="addCommunity(item)" class="uk-button action uk-flex uk-flex-middle" |
|
36 |
uk-tooltip="title:<div class='uk-padding-small'><div class='uk-margin-bottom uk-text-bold'>Add new community </div><div>Newly added Zenodo communities will be linked to your community on the next run of our algorithms.</div></div>"> |
|
37 |
<!-- <i class="clickable uk-text-success" uk-icon="plus"></i>--> |
|
38 |
<div class="uk-text-success"> |
|
39 |
<icon name="add"></icon> |
|
47 | 40 |
</div> |
48 |
<div [class.hide-element]="!inThelist(item, selectedCommunities) && !(masterCommunity && item.id==masterCommunity.id)"> |
|
49 |
<div (click)="removeCommunity(item)" class="uk-button action uk-flex uk-flex-middle"> |
|
50 |
<!-- <i class="clickable " uk-icon="trash"--> |
|
51 |
<!-- ></i>--> |
|
52 |
<icon name="remove_circle_outline" ratio="0.7"></icon> |
|
53 |
<span class="uk-margin-small-left"> Remove community </span> |
|
54 |
</div> |
|
55 |
</div> |
|
41 |
<span class="uk-margin-small-left"> Add community</span> |
|
56 | 42 |
</div> |
57 | 43 |
</div> |
44 |
<div |
|
45 |
[class.hide-element]="!inThelist(item, selectedCommunities) && !(masterCommunity && item.id==masterCommunity.id)"> |
|
46 |
<div (click)="removeCommunity(item)" class="uk-button action uk-flex uk-flex-middle"> |
|
47 |
<!-- <i class="clickable " uk-icon="trash"--> |
|
48 |
<!-- ></i>--> |
|
49 |
<icon name="remove_circle_outline" ratio="0.7"></icon> |
|
50 |
<span class="uk-margin-small-left"> Remove community </span> |
|
51 |
</div> |
|
52 |
</div> |
|
58 | 53 |
</div> |
54 |
</div> |
|
55 |
</div> |
|
59 | 56 |
|
60 |
</div>
|
|
61 |
</li>
|
|
62 |
</ul>
|
|
63 |
<no-load-paging *ngIf="zenodoCommunitySearchUtils.totalResults > 0" [type]="'Zenodo Communities'"
|
|
64 |
[page]="zenodoCommunitySearchUtils.page" [pageSize]="rowsOnPage" (pageChange)="goTo($event.value)"
|
|
65 |
[totalResults]="zenodoCommunitySearchUtils.totalResults" >
|
|
57 |
</div> |
|
58 |
</li> |
|
59 |
</ul> |
|
60 |
<no-load-paging [type]="'Zenodo Communities'" |
|
61 |
[page]="zenodoCommunitySearchUtils.page" [pageSize]="rowsOnPage" (pageChange)="goTo($event.value)" |
|
62 |
[totalResults]="zenodoCommunitySearchUtils.totalResults">
|
|
66 | 63 |
</no-load-paging> |
67 |
|
|
68 | 64 |
</div> |
modules/uoa-admin-portal/branches/new-UI/src/app/pages/zenodo-communities/manage-zenodo-communities.component.html | ||
---|---|---|
10 | 10 |
<icon name="add"></icon> |
11 | 11 |
</button> |
12 | 12 |
<button class="uk-button uk-button-link uk-margin-small-left uk-text-secondary">Add new zenodo |
13 |
communities</button> |
|
13 |
communities |
|
14 |
</button> |
|
14 | 15 |
</a> |
15 | 16 |
</div> |
16 | 17 |
<div #searchInputComponent search-input [control]="filterForm" [showSearch]="false" |
17 | 18 |
placeholder="Search Zenodo Communities " |
18 | 19 |
[selected]="searchUtils.keyword" (closeEmitter)="onSearchClose()" (resetEmitter)="resetInput()" |
19 |
[bordered]="true" colorClass="uk-text-secondary" class="uk-width-1-3@xl uk-width-2-5@l uk-width-1-2@m uk-width-1-1"></div> |
|
20 |
[bordered]="true" colorClass="uk-text-secondary" |
|
21 |
class="uk-width-1-3@xl uk-width-2-5@l uk-width-1-2@m uk-width-1-1"></div> |
|
20 | 22 |
</div> |
21 | 23 |
</div> |
22 | 24 |
<div inner> |
23 |
<div id="manage-zenodo-communities" class="uk-padding uk-padding-remove-top"> |
|
24 |
<div *ngIf="masterCommunity" class="uk-animation-fade uk-alert uk-alert-primary uk-padding-small uk-margin-large-bottom"> |
|
25 |
<div class="uk-text-large uk-margin-bottom" >Main Zenodo community</div> |
|
26 |
<preview-zenodo-community [item]="masterCommunity"></preview-zenodo-community> |
|
27 |
</div> |
|
28 |
|
|
29 |
<!--<div *ngIf="searchUtils.status == errorCodes.DONE ||searchUtils.status == errorCodes.NONE " class="uk-alert uk-alert-primary"> |
|
30 |
<span class="uk-margin-small-right uk-icon" uk-icon="warning"></span> |
|
31 |
All the research results belonging to the Zenodo communities specified here will be automatically linked to your community dashboard. |
|
32 |
</div>--> |
|
33 |
<div *ngIf="searchUtils.status == errorCodes.LOADING " |
|
34 |
class="uk-animation-fade uk-margin-top uk-width-1-1" role="alert"> |
|
35 |
<span class="loading-gif uk-align-center" ></span> |
|
25 |
<div *ngIf="searchUtils.status === errorCodes.LOADING" class="uk-position-center"> |
|
26 |
<loading></loading> |
|
36 | 27 |
</div> |
37 |
<div *ngIf="searchUtils.status == errorCodes.NONE || (searchUtils.status != errorCodes.LOADING && |
|
38 |
previewCommunities && previewCommunities.length == 0)" |
|
39 |
class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold"> |
|
40 |
<div> No zenodo communities found |
|
28 |
<div *ngIf="searchUtils.status != errorCodes.LOADING && previewCommunities"> |
|
29 |
<div *ngIf="masterCommunity" |
|
30 |
class="uk-animation-fade uk-alert uk-alert-primary uk-padding-small uk-margin-large-bottom"> |
|
31 |
<div class="uk-text-large uk-margin-bottom">Main Zenodo community</div> |
|
32 |
<preview-zenodo-community [item]="masterCommunity"></preview-zenodo-community> |
|
41 | 33 |
</div> |
42 |
</div> |
|
43 |
|
|
44 |
<div class=""> |
|
45 |
<div class="uk-overflow-container"> |
|
46 |
<no-load-paging *ngIf=" previewCommunities && previewCommunities.length > 0" [type]="'Zenodo Communities'" |
|
47 |
[page]="page" [pageSize]="size" (pageChange)="page = $event.value" |
|
48 |
[totalResults]="previewCommunities.length" > |
|
34 |
<div *ngIf="previewCommunities.length == 0" |
|
35 |
class="uk-card uk-card-default uk-padding-large uk-text-center uk-margin-bottom uk-text-bold"> |
|
36 |
<div> No zenodo communities found |
|
37 |
</div> |
|
38 |
</div> |
|
39 |
<div *ngIf="previewCommunities.length > 0"> |
|
40 |
<no-load-paging *ngIf=" previewCommunities && previewCommunities.length > 0" [type]="'Zenodo Communities'" |
|
41 |
[page]="page" [pageSize]="size" (pageChange)="page = $event.value" |
|
42 |
[totalResults]="previewCommunities.length"> |
|
49 | 43 |
</no-load-paging> |
50 | 44 |
<ul class="uk-list"> |
51 | 45 |
|
52 |
<li class="" *ngFor="let item of previewCommunities; let i = index;" class="uk-card uk-card-default uk-margin-bottom" |
|
53 |
[class.uk-hidden] = "i >= page * size || |
|
46 |
<li class="" *ngFor="let item of previewCommunities; let i = index;" |
|
47 |
class="uk-card uk-card-default uk-margin-bottom" |
|
48 |
[class.uk-hidden]="i >= page * size || |
|
54 | 49 |
i < (page - 1) * size"> |
55 |
<div class="uk-grid uk-padding uk-grid-divider " uk-grid> |
|
56 |
<div class="uk-width-expand@m uk-width-1-1"> |
|
57 |
<preview-zenodo-community [item]="item"></preview-zenodo-community> |
|
58 |
</div> |
|
59 |
<div class="uk-text-center uk-width-auto@m uk-width-1-1"> |
|
60 |
<div class=" uk-flex uk-flex-middle uk-flex-center uk-height-1-1"> |
|
61 |
<div class="uk-padding-small uk-padding-remove-horizontal"> |
|
62 |
<div (click)="removeCommunity(item)" |
|
63 |
class="uk-button action uk-flex uk-flex-middle "> |
|
64 |
<icon name="remove_circle_outline" ratio="0.7"></icon> |
|
65 |
<span class="uk-margin-small-left">Remove community</span> |
|
66 |
</div> |
|
50 |
<div class="uk-grid uk-padding uk-grid-divider " uk-grid> |
|
51 |
<div class="uk-width-expand@m uk-width-1-1"> |
|
52 |
<preview-zenodo-community [item]="item"></preview-zenodo-community> |
|
53 |
</div> |
|
54 |
<div class="uk-text-center uk-width-auto@m uk-width-1-1"> |
|
55 |
<div class=" uk-flex uk-flex-middle uk-flex-center uk-height-1-1"> |
|
56 |
<div class="uk-padding-small uk-padding-remove-horizontal"> |
|
57 |
<div (click)="removeCommunity(item)" |
|
58 |
class="uk-button action uk-flex uk-flex-middle "> |
|
59 |
<icon name="remove_circle_outline" ratio="0.7"></icon> |
|
60 |
<span class="uk-margin-small-left">Remove community</span> |
|
67 | 61 |
</div> |
68 | 62 |
</div> |
69 | 63 |
</div> |
70 | 64 |
</div> |
71 |
</li> |
|
72 |
</ul> |
|
65 |
</div> |
|
66 |
</li> |
|
67 |
</ul> |
|
73 | 68 |
</div> |
74 | 69 |
</div> |
75 |
|
|
76 |
</div> |
|
77 | 70 |
</div> |
78 | 71 |
</div> |
79 | 72 |
<modal-alert #AlertModalDeleteCommunity (alertOutput)="confirmedDeleteCommunity($event)"></modal-alert> |
modules/uoa-admin-portal/branches/new-UI/src/app/pages/zenodo-communities/add-zenodo-communities.component.ts | ||
---|---|---|
13 | 13 |
import {debounceTime, distinctUntilChanged} from 'rxjs/operators'; |
14 | 14 |
|
15 | 15 |
declare var UIkit; |
16 |
|
|
16 | 17 |
@Component({ |
17 |
selector: 'add-zenodo-communities',
|
|
18 |
templateUrl: './add-zenodo-communities.component.html',
|
|
18 |
selector: 'add-zenodo-communities', |
|
19 |
templateUrl: './add-zenodo-communities.component.html', |
|
19 | 20 |
}) |
20 |
|
|
21 | 21 |
export class AddZenodoCommunitiesComponent implements OnInit { |
22 |
|
|
23 |
public zenodoCommunities = null; // zenodo search API results
|
|
24 |
public totalZenodoCommunities = null;
|
|
25 |
@Input() properties:EnvProperties = null;
|
|
26 |
@Input() communityId = null;
|
|
27 |
@ViewChild('searchInputComponent') searchInputComponent: SearchInputComponent;
|
|
28 |
public filterForm: FormControl;
|
|
29 |
private subscriptions: any[] = [];
|
|
30 |
public zenodoCommunitySearchUtils:SearchUtilsClass = new SearchUtilsClass();
|
|
22 |
|
|
23 |
public zenodoCommunities = null; // zenodo search API results |
|
24 |
public totalZenodoCommunities = null; |
|
25 |
@Input() properties: EnvProperties = null;
|
|
26 |
@Input() communityId = null; |
|
27 |
@ViewChild('searchInputComponent') searchInputComponent: SearchInputComponent; |
|
28 |
public filterForm: FormControl; |
|
29 |
private subscriptions: any[] = []; |
|
30 |
public zenodoCommunitySearchUtils: SearchUtilsClass = new SearchUtilsClass();
|
|
31 | 31 |
public searchTermStream = new Subject<string>(); |
32 |
errorCodes: ErrorCodes; |
|
33 |
public rowsOnPage = 10; |
|
34 |
@Input() masterCommunity = null; |
|
35 |
@Input() selectedCommunities = []; |
|
36 |
constructor (private route: ActivatedRoute, |
|
37 |
private _router: Router, |
|
38 |
public _fb: FormBuilder, |
|
39 |
private _zenodoCommunitieService: ZenodoCommunitiesService, |
|
40 |
private _manageZenodoCommunitiesService: ManageZenodoCommunitiesService) { |
|
41 |
|
|
42 |
this.errorCodes = new ErrorCodes(); |
|
43 |
this.zenodoCommunitySearchUtils.status = this.errorCodes.LOADING; |
|
44 |
} |
|
45 |
|
|
46 |
ngOnInit() { |
|
47 |
this.filterForm = this._fb.control(''); |
|
48 |
this.subscriptions.push(this.filterForm.valueChanges.subscribe(value => { |
|
49 |
this.searchTermStream.next(value); |
|
32 |
errorCodes: ErrorCodes; |
|
33 |
public rowsOnPage = 10; |
|
34 |
@Input() masterCommunity = null; |
|
35 |
@Input() selectedCommunities = []; |
|
36 |
|
|
37 |
constructor(private route: ActivatedRoute, |
|
38 |
private _router: Router, |
|
39 |
public _fb: FormBuilder, |
|
40 |
private _zenodoCommunitieService: ZenodoCommunitiesService, |
|
41 |
private _manageZenodoCommunitiesService: ManageZenodoCommunitiesService) { |
|
42 |
|
|
43 |
this.errorCodes = new ErrorCodes(); |
|
44 |
this.zenodoCommunitySearchUtils.status = this.errorCodes.LOADING; |
|
45 |
} |
|
46 |
|
|
47 |
ngOnInit() { |
|
48 |
this.filterForm = this._fb.control(''); |
|
49 |
this.subscriptions.push(this.filterForm.valueChanges.subscribe(value => { |
|
50 |
this.searchTermStream.next(value); |
|
51 |
})); |
|
52 |
this.subscriptions.push(this.searchTermStream |
|
53 |
.pipe(debounceTime(1000), distinctUntilChanged()) |
|
54 |
.subscribe((term: string) => { |
|
55 |
this.zenodoCommunitySearchUtils.keyword = term; |
|
56 |
this.goTo(1); |
|
50 | 57 |
})); |
51 |
this.subscriptions.push(this.searchTermStream |
|
52 |
.pipe(debounceTime(1000), distinctUntilChanged()) |
|
53 |
.subscribe((term: string) => { |
|
54 |
this.zenodoCommunitySearchUtils.keyword = term; |
|
55 |
this.goTo(1); |
|
56 |
})); |
|
57 |
|
|
58 |
this.zenodoCommunitySearchUtils.keyword = ""; |
|
59 |
if(!Session.isLoggedIn()){ |
|
60 |
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} }); |
|
61 |
} else { |
|
62 |
this.zenodoCommunitySearchUtils.status = this.errorCodes.LOADING; |
|
63 |
if (this.communityId != null && this.communityId != '') { |
|
64 |
this._zenodoCommunitieService.getZenodoCommunities(this.properties, this.properties.zenodoCommunities+"?page="+this.zenodoCommunitySearchUtils.page+"&size="+this.rowsOnPage).subscribe( |
|
65 |
result => { |
|
66 |
this.zenodoCommunities = result[0]; |
|
67 |
this.totalZenodoCommunities = result[1]; |
|
68 |
this.zenodoCommunitySearchUtils.totalResults = result[1]; |
|
69 |
this.zenodoCommunitySearchUtils.page = 1; |
|
70 |
this.zenodoCommunitySearchUtils.size =this.rowsOnPage; |
|
71 |
if(this.totalZenodoCommunities == 0){ |
|
72 |
this.zenodoCommunitySearchUtils.status = this.errorCodes.NONE; |
|
73 |
}else{ |
|
74 |
this.zenodoCommunitySearchUtils.status = this.errorCodes.DONE; |
|
75 |
} |
|
76 |
|
|
77 |
}, |
|
78 |
error => { |
|
79 |
this.zenodoCommunitySearchUtils.status = this.errorCodes.ERROR; |
|
58 |
|
|
59 |
this.zenodoCommunitySearchUtils.keyword = ""; |
|
60 |
if (!Session.isLoggedIn()) { |
|
61 |
this._router.navigate(['/user-info'], { |
|
62 |
queryParams: { |
|
63 |
"errorCode": LoginErrorCodes.NOT_VALID, |
|
64 |
"redirectUrl": this._router.url |
|
65 |
} |
|
66 |
}); |
|
67 |
} else { |
|
68 |
this.zenodoCommunitySearchUtils.status = this.errorCodes.LOADING; |
|
69 |
if (this.communityId != null && this.communityId != '') { |
|
70 |
this._zenodoCommunitieService.getZenodoCommunities(this.properties, this.properties.zenodoCommunities + "?page=" + this.zenodoCommunitySearchUtils.page + "&size=" + this.rowsOnPage).subscribe( |
|
71 |
result => { |
|
72 |
this.zenodoCommunities = result[0]; |
|
73 |
this.totalZenodoCommunities = result[1]; |
|
74 |
this.zenodoCommunitySearchUtils.totalResults = result[1]; |
|
75 |
this.zenodoCommunitySearchUtils.page = 1; |
|
76 |
this.zenodoCommunitySearchUtils.size = this.rowsOnPage; |
|
77 |
if (this.totalZenodoCommunities == 0) { |
|
78 |
this.zenodoCommunitySearchUtils.status = this.errorCodes.NONE; |
|
79 |
} else { |
|
80 |
this.zenodoCommunitySearchUtils.status = this.errorCodes.DONE; |
|
80 | 81 |
} |
81 |
); |
|
82 |
} |
|
82 |
|
|
83 |
}, |
|
84 |
error => { |
|
85 |
this.zenodoCommunitySearchUtils.status = this.errorCodes.ERROR; |
|
86 |
} |
|
87 |
); |
|
83 | 88 |
} |
84 |
|
|
85 | 89 |
} |
86 |
ngOnDestroy() { |
|
87 |
this.subscriptions.forEach(subscription => { |
|
88 |
if (subscription instanceof Subscription) { |
|
89 |
subscription.unsubscribe(); |
|
90 |
|
|
91 |
} |
|
92 |
|
|
93 |
ngOnDestroy() { |
|
94 |
this.subscriptions.forEach(subscription => { |
|
95 |
if (subscription instanceof Subscription) { |
|
96 |
subscription.unsubscribe(); |
|
97 |
} |
|
98 |
}); |
|
99 |
} |
|
100 |
|
|
101 |
public goTo(page: number = 1) { |
|
102 |
if (!Session.isLoggedIn()) { |
|
103 |
this._router.navigate(['/user-info'], { |
|
104 |
queryParams: { |
|
105 |
"errorCode": LoginErrorCodes.NOT_VALID, |
|
106 |
"redirectUrl": this._router.url |
|
90 | 107 |
} |
91 | 108 |
}); |
109 |
} else { |
|
110 |
this.zenodoCommunitySearchUtils.page = page; |
|
111 |
this.zenodoCommunitySearchUtils.status = this.errorCodes.LOADING; |
|
112 |
this.subscriptions.push(this._zenodoCommunitieService.getZenodoCommunities(this.properties, |
|
113 |
this.properties.zenodoCommunities + "?page=" + this.zenodoCommunitySearchUtils.page |
|
114 |
+ "&size=" + this.rowsOnPage |
|
115 |
+ ((this.zenodoCommunitySearchUtils.keyword) ? ("&q=" + this.zenodoCommunitySearchUtils.keyword) : "") |
|
116 |
).subscribe( |
|
117 |
result => { |
|
118 |
this.zenodoCommunities = result[0]; |
|
119 |
this.totalZenodoCommunities = result[1]; |
|
120 |
this.zenodoCommunitySearchUtils.totalResults = result[1]; |
|
121 |
this.zenodoCommunitySearchUtils.size = this.rowsOnPage; |
|
122 |
if (this.totalZenodoCommunities == 0) { |
Also available in: Unified diff
[Admin | NewUI]: Remove some unusage files. Fix zenodo loaing paddings. Fix mining title