Revision 51669
Added by Konstantina Galouni about 6 years ago
modules/uoa-admin-portal/branches/project-cli/src/app/services/manageContentProviders.service.ts | ||
---|---|---|
11 | 11 |
export class ManageCommunityContentProvidersService { |
12 | 12 |
constructor(private http: Http ) {} |
13 | 13 |
|
14 |
searchContentProviders (properties:EnvProperties, communityId: string):any { |
|
15 |
let url = properties.communityAPI+communityId+"/contentproviders"; |
|
16 |
console.info(url); |
|
17 |
|
|
18 |
return this.http.get(url) |
|
19 |
.map(res => <any> res.json()) |
|
20 |
} |
|
21 |
|
|
22 | 14 |
removeContentProvider (properties:EnvProperties, communityId: string, id: string):any { |
23 | 15 |
let headers = new Headers({'Content-Type': 'application/json', 'accept': 'application/json'}); |
24 | 16 |
let options = new RequestOptions({headers: headers, body: id}); |
modules/uoa-admin-portal/branches/project-cli/src/app/services/manageProjects.service.ts | ||
---|---|---|
11 | 11 |
export class ManageCommunityProjectsService { |
12 | 12 |
constructor(private http: Http ) {} |
13 | 13 |
|
14 |
searchProjects (properties:EnvProperties, communityId: string):any { |
|
15 |
let url = properties.communityAPI+communityId+"/projects"; |
|
16 |
console.info(url); |
|
17 |
|
|
18 |
return this.http.get(/*(properties.useCache)? (properties.cacheUrl+encodeURIComponent(url)): */url) |
|
19 |
.map(res => <any> res.json()) |
|
20 |
} |
|
21 |
|
|
22 | 14 |
removeProject (properties:EnvProperties, communityId: string, id: string):any { |
23 | 15 |
let headers = new Headers({'Content-Type': 'application/json', 'accept': 'application/json'}); |
24 | 16 |
let options = new RequestOptions({headers: headers, body: id}); |
... | ... | |
27 | 19 |
console.info(url); |
28 | 20 |
|
29 | 21 |
return this.http.delete(url, options) |
30 |
//.map(res => <any> res.json()); |
|
31 | 22 |
} |
32 | 23 |
|
33 | 24 |
addProject(properties:EnvProperties, communityId: string, project: any) { |
... | ... | |
51 | 42 |
|
52 | 43 |
return this.http.post(url, JSON.stringify(communityProject), options) |
53 | 44 |
.map(res => <any> res.json()) |
54 |
// .pipe( |
|
55 |
// catchError(this.handleError) |
|
56 |
// ); |
|
57 | 45 |
} |
58 | 46 |
|
59 | 47 |
convertSearchProjectToCommunityProject(project: any, community: string) : any { |
... | ... | |
75 | 63 |
return communityProject; |
76 | 64 |
} |
77 | 65 |
|
78 |
private handleError(error: HttpErrorResponse) { |
|
79 |
|
|
80 |
if (error.error instanceof ErrorEvent) { |
|
81 |
// A client-side or network error occurred. Handle it accordingly. |
|
82 |
console.error('An error occurred:', error.error.message); |
|
83 |
} else { |
|
84 |
// The backend returned an unsuccessful response code. |
|
85 |
// The response body may contain clues as to what went wrong, |
|
86 |
console.error( |
|
87 |
`Backend returned code ${error.status}, ` + |
|
88 |
`body was: ${error.error}`); |
|
89 |
} |
|
90 |
// return an ErrorObservable with a user-facing error message |
|
91 |
return new ErrorObservable( |
|
92 |
'Something bad happened; please try again later.'); |
|
93 |
}; |
|
94 |
|
|
95 | 66 |
} |
modules/uoa-admin-portal/branches/project-cli/src/app/pages/community/content-providers/add-content-providers.component.html | ||
---|---|---|
1 |
<div class="uk-child-width-expand@s uk-text-center uk-padding" uk-grid> |
|
2 |
<form class="uk-text-center uk-animation uk-card uk-card-default uk-padding"> |
|
3 |
<div> |
|
4 |
<input type="text" class="uk-input uk-width-1-2" placeholder="Search content providers in OpenAIRE..." aria-describedby="sizing-addon2" [(ngModel)]="keyword" name="keyword" > |
|
5 |
<button (click)="keywordChanged(keyword)" type="submit" class=" uk-button"> |
|
6 |
<span class="uk-icon"> |
|
7 |
<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> |
|
8 |
</span>Search |
|
9 |
</button> |
|
10 |
</div> |
|
11 |
</form> |
|
1 |
<div class="uk-child-width-expand@s uk-text-center uk-margin-bottom" uk-grid> |
|
2 |
<div> |
|
3 |
<form class="uk-text-center uk-animation uk-card uk-card-default uk-padding"> |
|
4 |
<div> |
|
5 |
<input type="text" class="uk-input uk-width-1-2" placeholder="Search content providers in OpenAIRE..." aria-describedby="sizing-addon2" [(ngModel)]="keyword" name="keyword" > |
|
6 |
<button (click)="keywordChanged(keyword)" type="submit" class=" uk-button"> |
|
7 |
<span class="uk-icon"> |
|
8 |
<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> |
|
9 |
</span>Search |
|
10 |
</button> |
|
11 |
</div> |
|
12 |
</form> |
|
13 |
</div> |
|
12 | 14 |
</div> |
13 | 15 |
|
14 |
<div *ngIf="openaireSearchUtils.status == errorCodes.DONE" class="uk-alert uk-alert-primary uk-margin-top-large">
|
|
16 |
<div *ngIf="openaireSearchUtils.status == errorCodes.DONE" class="uk-alert uk-alert-primary"> |
|
15 | 17 |
<span class="uk-margin-small-right uk-icon" uk-icon="warning"></span> |
16 | 18 |
Metadata of newly added content providers, will be linked to your community on the next update of our central database. |
17 | 19 |
</div> |
modules/uoa-admin-portal/branches/project-cli/src/app/pages/community/content-providers/remove-content-providers.component.html | ||
---|---|---|
1 |
<div class="uk-child-width-expand@s uk-text-center uk-padding" uk-grid> |
|
2 |
<form class="uk-text-center uk-animation uk-card uk-card-default uk-padding"> |
|
3 |
<div> |
|
4 |
<input type="text" class="uk-input uk-width-1-2" placeholder="Search community content providers..." aria-describedby="sizing-addon2" [(ngModel)]="communitySearchUtils.keyword" name="keyword" > |
|
5 |
<button (click)="goTo(1)" type="submit" class=" uk-button"> |
|
6 |
<span class="uk-icon"> |
|
7 |
<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> |
|
8 |
</span>Search |
|
9 |
</button> |
|
10 |
</div> |
|
11 |
</form> |
|
1 |
<div class="uk-child-width-expand@s uk-text-center uk-margin-bottom" uk-grid> |
|
2 |
<div> |
|
3 |
<form class="uk-text-center uk-animation uk-card uk-card-default uk-padding"> |
|
4 |
<div> |
|
5 |
<input type="text" class="uk-input uk-width-1-2" placeholder="Search community content providers..." aria-describedby="sizing-addon2" [(ngModel)]="communitySearchUtils.keyword" name="keyword" > |
|
6 |
<button (click)="goTo(1)" type="submit" class=" uk-button"> |
|
7 |
<span class="uk-icon"> |
|
8 |
<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> |
|
9 |
</span>Search |
|
10 |
</button> |
|
11 |
</div> |
|
12 |
</form> |
|
13 |
</div> |
|
12 | 14 |
</div> |
13 | 15 |
|
14 | 16 |
<errorMessages [status]="[communitySearchUtils.status]" [type]="'community Content Providers'"></errorMessages> |
modules/uoa-admin-portal/branches/project-cli/src/app/pages/community/content-providers/communityContentProviders.module.ts | ||
---|---|---|
12 | 12 |
import { DataTablesModule } from 'angular-datatables'; |
13 | 13 |
import { ManageContentProvidersComponent } from './manage-content-providers.component'; |
14 | 14 |
import { ManageCommunityContentProvidersService } from "../../../services/manageContentProviders.service"; |
15 |
import {SearchDataprovidersServiceModule} from '../../../openaireLibrary/connect/contentProviders/searchDataprovidersService.module'; |
|
15 | 16 |
|
16 | 17 |
import { RemoveContentProvidersComponent } from './remove-content-providers.component'; |
17 | 18 |
import { AddContentProvidersComponent } from './add-content-providers.component'; |
... | ... | |
20 | 21 |
import { SearchPagingModule } from '../../../openaireLibrary/searchPages/searchUtils/searchPaging.module'; |
21 | 22 |
|
22 | 23 |
import {ErrorMessagesModule} from '../../../openaireLibrary/utils/errorMessages.module'; |
23 |
//import { DeleteConfirmationDialogModule } from "../../delete-confirmation-dialog.module"; |
|
24 | 24 |
import {AlertModalModule} from '../../../openaireLibrary/utils/modal/alertModal.module'; |
25 | 25 |
|
26 | 26 |
@NgModule({ |
... | ... | |
34 | 34 |
DataTablesModule, |
35 | 35 |
PagingModule, SearchPagingModule, |
36 | 36 |
ErrorMessagesModule, |
37 |
//DeleteConfirmationDialogModule
|
|
38 |
AlertModalModule
|
|
37 |
AlertModalModule,
|
|
38 |
SearchDataprovidersServiceModule
|
|
39 | 39 |
], |
40 | 40 |
declarations: [ |
41 | 41 |
ManageContentProvidersComponent, |
modules/uoa-admin-portal/branches/project-cli/src/app/pages/community/content-providers/remove-content-providers.component.ts | ||
---|---|---|
3 | 3 |
import { Subject } from 'rxjs/Subject'; |
4 | 4 |
import { DataTableDirective } from 'angular-datatables'; |
5 | 5 |
|
6 |
import {SearchResult} from '../../../openaireLibrary/utils/entities/searchResult'; |
|
7 | 6 |
import {ErrorCodes} from '../../../openaireLibrary/utils/properties/errorCodes'; |
8 |
import {SearchFields, FieldDetails} from '../../../openaireLibrary/utils/properties/searchFields'; |
|
9 | 7 |
import {SearchUtilsClass } from '../../../openaireLibrary/searchPages/searchUtils/searchUtils.class'; |
10 | 8 |
import {EnvProperties} from '../../../openaireLibrary/utils/properties/env-properties'; |
11 | 9 |
import {ManageCommunityContentProvidersService} from '../../../services/manageContentProviders.service'; |
10 |
import {SearchCommunityDataprovidersService} from '../../../openaireLibrary/connect/contentProviders/searchDataproviders.service'; |
|
12 | 11 |
import {RouterHelper} from '../../../openaireLibrary/utils/routerHelper.class'; |
13 | 12 |
import {DOI, StringUtils} from '../../../openaireLibrary/utils/string-utils.class'; |
14 |
import { DeleteConfirmationDialogComponent } from "../../delete-confirmation-dialog.component"; |
|
15 | 13 |
|
16 | 14 |
@Component({ |
17 | 15 |
selector: 'remove-content-providers', |
... | ... | |
38 | 36 |
public communitySearchUtils:SearchUtilsClass = new SearchUtilsClass(); |
39 | 37 |
|
40 | 38 |
public sub: any; public subResults: any; subRemove: any; |
41 |
public _location:Location; |
|
42 |
public searchFields:SearchFields = new SearchFields(); |
|
43 | 39 |
properties:EnvProperties; |
44 | 40 |
|
45 | 41 |
public disableForms: boolean = false; |
... | ... | |
89 | 85 |
this.communitySearchUtils.keyword = ""; |
90 | 86 |
} |
91 | 87 |
|
92 |
constructor(private route: ActivatedRoute, private _manageCommunityContentProvidersService: ManageCommunityContentProvidersService) { |
|
88 |
constructor(private route: ActivatedRoute, |
|
89 |
private _manageCommunityContentProvidersService: ManageCommunityContentProvidersService, |
|
90 |
private _searchCommunityContentProvidersService: SearchCommunityDataprovidersService) { |
|
93 | 91 |
this.errorCodes = new ErrorCodes(); |
94 | 92 |
this.communitySearchUtils.status = this.errorCodes.LOADING; |
95 | 93 |
} |
... | ... | |
250 | 248 |
this.communitySearchUtils.page=1; |
251 | 249 |
this.communitySearchUtils.keyword = ""; |
252 | 250 |
|
253 |
this.subResults = this._manageCommunityContentProvidersService.searchContentProviders(this.properties, this.community).subscribe(
|
|
251 |
this.subResults = this._searchCommunityContentProvidersService.searchDataproviders(this.properties, this.community).subscribe(
|
|
254 | 252 |
data => { |
255 | 253 |
console.info(data); |
256 | 254 |
console.info("search Content Providers [total communityContentProviders:"+data.length+"]"); |
... | ... | |
288 | 286 |
} |
289 | 287 |
|
290 | 288 |
this.disableForms = false; |
289 |
if(!this.triggered) { |
|
290 |
this.triggerInitialLoad(); |
|
291 |
} else { |
|
292 |
var table = $('#dpTable').DataTable(); |
|
293 |
table.clear(); |
|
294 |
|
|
295 |
this.rerender(); |
|
296 |
} |
|
291 | 297 |
} |
292 | 298 |
); |
293 | 299 |
} |
modules/uoa-admin-portal/branches/project-cli/src/app/pages/community/community-edit-form/community-edit-form.component.ts | ||
---|---|---|
42 | 42 |
communityId => { |
43 | 43 |
this.communityId = communityId['communityId']; |
44 | 44 |
if (this.communityId != null && this.communityId != '') { |
45 |
this._communityService.getCommunity(this.properties.communityAPI+this.communityId).subscribe ( |
|
45 |
this._communityService.getCommunity(this.properties, this.properties.communityAPI+this.communityId).subscribe (
|
|
46 | 46 |
community => { |
47 | 47 |
this.community = community; |
48 | 48 |
this.params = {community: encodeURIComponent('"'+community.queryId+'"')}; |
... | ... | |
72 | 72 |
public resetForm(communityId : any) { |
73 | 73 |
|
74 | 74 |
if (communityId != null && communityId != '') { |
75 |
this._communityService.getCommunity(this.properties.communityAPI+communityId).subscribe ( |
|
75 |
this._communityService.getCommunity(this.properties, this.properties.communityAPI+communityId).subscribe (
|
|
76 | 76 |
community => { |
77 | 77 |
this.community = community; |
78 | 78 |
this.params = {community: encodeURIComponent('"'+community.queryId+'"')}; |
modules/uoa-admin-portal/branches/project-cli/src/app/pages/community/projects/add-projects.component.html | ||
---|---|---|
1 |
<div class="uk-child-width-expand@s uk-text-center" uk-grid> |
|
1 |
<div class="uk-child-width-expand@s uk-text-center uk-margin-bottom" uk-grid>
|
|
2 | 2 |
<div> |
3 | 3 |
<form class=" uk-animation uk-card uk-card-default uk-padding" > |
4 | 4 |
<div> |
... | ... | |
23 | 23 |
</div> |
24 | 24 |
</div> |
25 | 25 |
|
26 |
<div *ngIf="openaireSearchUtils.status == errorCodes.DONE" class="uk-alert uk-alert-primary uk-margin-top-large">
|
|
26 |
<div *ngIf="openaireSearchUtils.status == errorCodes.DONE" class="uk-alert uk-alert-primary"> |
|
27 | 27 |
<span class="uk-margin-small-right uk-icon" uk-icon="warning"></span> |
28 | 28 |
Metadata of newly added projects, will be linked to your community on the next update of our central database. |
29 | 29 |
</div> |
modules/uoa-admin-portal/branches/project-cli/src/app/pages/community/projects/communityProjects.module.ts | ||
---|---|---|
12 | 12 |
import { DataTablesModule } from 'angular-datatables'; |
13 | 13 |
import { ManageProjectsComponent } from './manage-projects.component'; |
14 | 14 |
import { ManageCommunityProjectsService } from "../../../services/manageProjects.service"; |
15 |
import { SearchProjectsServiceModule } from '../../../openaireLibrary/connect/projects/searchProjectsService.module'; |
|
15 | 16 |
|
16 | 17 |
import { RemoveProjectsComponent } from './remove-projects.component'; |
17 | 18 |
import { AddProjectsComponent } from './add-projects.component'; |
... | ... | |
20 | 21 |
import { SearchPagingModule } from '../../../openaireLibrary/searchPages/searchUtils/searchPaging.module'; |
21 | 22 |
|
22 | 23 |
import {ErrorMessagesModule} from '../../../openaireLibrary/utils/errorMessages.module'; |
23 |
//import { DeleteConfirmationDialogModule } from "../../delete-confirmation-dialog.module"; |
|
24 | 24 |
import {AlertModalModule} from '../../../openaireLibrary/utils/modal/alertModal.module'; |
25 | 25 |
|
26 | 26 |
@NgModule({ |
... | ... | |
34 | 34 |
DataTablesModule, |
35 | 35 |
PagingModule, SearchPagingModule, |
36 | 36 |
ErrorMessagesModule, |
37 |
//DeleteConfirmationDialogModule
|
|
38 |
AlertModalModule
|
|
37 |
AlertModalModule,
|
|
38 |
SearchProjectsServiceModule
|
|
39 | 39 |
], |
40 | 40 |
declarations: [ |
41 | 41 |
ManageProjectsComponent, |
modules/uoa-admin-portal/branches/project-cli/src/app/pages/community/projects/remove-projects.component.html | ||
---|---|---|
1 |
<div class="uk-child-width-expand@s uk-text-center" uk-grid> |
|
1 |
<div class="uk-child-width-expand@s uk-text-center uk-margin-bottom" uk-grid>
|
|
2 | 2 |
<div> |
3 | 3 |
<form class=" uk-animation uk-card uk-card-default uk-padding" > |
4 | 4 |
<div> |
modules/uoa-admin-portal/branches/project-cli/src/app/pages/community/projects/remove-projects.component.ts | ||
---|---|---|
3 | 3 |
import { Subject } from 'rxjs/Subject'; |
4 | 4 |
import { DataTableDirective } from 'angular-datatables'; |
5 | 5 |
|
6 |
import {SearchResult} from '../../../openaireLibrary/utils/entities/searchResult'; |
|
7 | 6 |
import {ErrorCodes} from '../../../openaireLibrary/utils/properties/errorCodes'; |
8 |
import {SearchFields, FieldDetails} from '../../../openaireLibrary/utils/properties/searchFields'; |
|
9 |
//import {SearchPageTableViewComponent } from '../../openaireLibrary/searchPages/searchUtils/searchPageTableView.component'; |
|
10 | 7 |
import {SearchUtilsClass } from '../../../openaireLibrary/searchPages/searchUtils/searchUtils.class'; |
11 | 8 |
import {EnvProperties} from '../../../openaireLibrary/utils/properties/env-properties'; |
12 | 9 |
import {ManageCommunityProjectsService} from '../../../services/manageProjects.service'; |
13 |
//import {SearchProjectsService} from '../../../openaireLibrary/services/searchProjects.service';
|
|
10 |
import {SearchCommunityProjectsService} from '../../../openaireLibrary/connect/projects/searchProjects.service';
|
|
14 | 11 |
import {RouterHelper} from '../../../openaireLibrary/utils/routerHelper.class'; |
15 | 12 |
import {DOI, StringUtils} from '../../../openaireLibrary/utils/string-utils.class'; |
16 | 13 |
|
... | ... | |
39 | 36 |
public communitySearchUtils:SearchUtilsClass = new SearchUtilsClass(); |
40 | 37 |
|
41 | 38 |
public sub: any; public subResults: any; subRemove: any; |
42 |
public _location:Location; |
|
43 |
public searchFields:SearchFields = new SearchFields(); |
|
44 | 39 |
properties:EnvProperties; |
45 | 40 |
|
46 | 41 |
public disableForms: boolean = false; |
... | ... | |
100 | 95 |
this.communitySearchUtils.keyword = ""; |
101 | 96 |
} |
102 | 97 |
|
103 |
constructor(private route: ActivatedRoute, private _manageCommunityProjectsService: ManageCommunityProjectsService/*, private _searchProjectsService: SearchProjectsService*/) {
|
|
98 |
constructor(private route: ActivatedRoute, private _manageCommunityProjectsService: ManageCommunityProjectsService, private _searchCommunityProjectsService: SearchCommunityProjectsService) {
|
|
104 | 99 |
this.errorCodes = new ErrorCodes(); |
105 | 100 |
this.communitySearchUtils.status = this.errorCodes.LOADING; |
106 | 101 |
} |
... | ... | |
279 | 274 |
this.communitySearchUtils.keyword = ""; |
280 | 275 |
this.selectedFunder = ""; |
281 | 276 |
|
282 |
this.subResults = this._manageCommunityProjectsService.searchProjects(this.properties, this.community).subscribe(
|
|
277 |
this.subResults = this._searchCommunityProjectsService.searchProjects(this.properties, this.community).subscribe(
|
|
283 | 278 |
data => { |
284 | 279 |
console.info(data); |
285 | 280 |
console.info("search Projects [total communityProjects:"+data.length+"]"); |
... | ... | |
319 | 314 |
} |
320 | 315 |
|
321 | 316 |
this.disableForms = false; |
317 |
if(!this.triggered) { |
|
318 |
this.triggerInitialLoad(); |
|
319 |
} else { |
|
320 |
var table = $('#dpTable').DataTable(); |
|
321 |
table.clear(); |
|
322 |
|
|
323 |
this.rerender(); |
|
324 |
} |
|
322 | 325 |
} |
323 | 326 |
); |
324 | 327 |
} |
modules/uoa-admin-portal/branches/project-cli/src/app/app.component.ts | ||
---|---|---|
50 | 50 |
this.communityId = ((data['communityId'])?data['communityId']:""); |
51 | 51 |
this.menuItems = []; |
52 | 52 |
this.userMenuItems = []; |
53 |
this._communitiesService.getCommunities(this.properties.communityAPI+"communities").subscribe ( |
|
53 |
this._communitiesService.getCommunities(this.properties, this.properties.communityAPI+"communities").subscribe (
|
|
54 | 54 |
communities => { |
55 | 55 |
// this.community = community; |
56 | 56 |
|
modules/uoa-admin-portal/branches/project-cli/src/assets/env-properties.json | ||
---|---|---|
1 | 1 |
{ |
2 | 2 |
"enablePiwikTrack" : false, |
3 | 3 |
"enableHelper" : false, |
4 |
"useCache" : true,
|
|
4 |
"useCache" : false,
|
|
5 | 5 |
"metricsAPIURL" : "https://beta.services.openaire.eu/usagestats/", |
6 | 6 |
"framesAPIURL" : "https://beta.openaire.eu/stats3/", |
7 | 7 |
"claimsAPIURL" : "http://scoobydoo.di.uoa.gr:8080/dnet-claims-service-2.0.0-SNAPSHOT/rest/claimsService/", |
Also available in: Unified diff
1. assets/env-properties.json: useCache set to false.
2. manageProjects.service.ts & manageContentProviders.service: Remove search services.
3. Use openaireLibrary/connect/projects and openaireLibrary/connect/contentProviders for getting community's projects or contentproviders.
4. remove-content-providers.component.html & add-content-providers.component.html: Bug fix in form display.
5. remove-content-providers.component.ts & remove-projects.component.ts: trigger datatable even if error occurs.
6. add properties argument to services where necessary (community-edit-form).
7. community-edit-form.component: change ordering in 'reset' and 'save' buttons.