Revision 60977
Added by Konstantina Galouni almost 3 years ago
modules/uoa-admin-portal/branches/new-UI/src/app/pages/content-providers/add-content-providers.component.html | ||
---|---|---|
41 | 41 |
<div class="uk-flex uk-flex-middle uk-flex-center uk-flex-column uk-height-1-1"> |
42 | 42 |
<div class="uk-padding-small uk-padding-remove-horizontal"> |
43 | 43 |
|
44 |
<div [class.hide-element]="!getCommunityContentProviderId(result)">
|
|
44 |
<div [class.hide-element]="!getCommunityContentProvider(result)"> |
|
45 | 45 |
<a (click)="removeContentProvider(result)" class="uk-button action uk-flex uk-flex-middle"> |
46 | 46 |
<icon name="remove_circle_outline"></icon> |
47 | 47 |
<span class="uk-margin-small-left">Remove content provider</span> |
48 | 48 |
</a> |
49 | 49 |
</div> |
50 | 50 |
|
51 |
<div [class.hide-element]="getCommunityContentProviderId(result)">
|
|
51 |
<div [class.hide-element]="getCommunityContentProvider(result)"> |
|
52 | 52 |
<a (click)="addContentProvider(result)" class="uk-button action uk-flex uk-flex-middle" |
53 | 53 |
uk-tooltip="title:<div class='uk-padding-small'><div class='uk-margin-bottom uk-text-bold'>Add new content provider </div><div>Newly added content providers will be linked to your community on the next run of our algorithms.</div></div>"> |
54 | 54 |
<div class="uk-text-success"> |
modules/uoa-admin-portal/branches/new-UI/src/app/pages/content-providers/add-content-providers.component.ts | ||
---|---|---|
136 | 136 |
} |
137 | 137 |
}); |
138 | 138 |
} else { |
139 |
let contentProviderId: string = this.getCommunityContentProviderId(contentProvider); |
|
139 |
let communityContentProvider = this.getCommunityContentProvider(contentProvider); |
|
140 |
let contentProviderId: string = communityContentProvider['id']; |
|
140 | 141 |
this.subscriptions.push(this._manageCommunityContentProvidersService.removeContentProvider(this.properties, this.community, contentProviderId).subscribe( |
141 | 142 |
data => { |
142 |
let index = this.communityContentProviders.indexOf(contentProviderId);
|
|
143 |
let index = this.communityContentProviders.indexOf(communityContentProvider);
|
|
143 | 144 |
this.communityContentProviders.splice(index, 1); |
144 | 145 |
UIkit.notification('Content Provider successfully removed!', { |
145 | 146 |
status: 'success', |
... | ... | |
158 | 159 |
} |
159 | 160 |
} |
160 | 161 |
|
161 |
public getCommunityContentProviderId(contentProvider: any): string {
|
|
162 |
public getCommunityContentProvider(contentProvider: any): string { |
|
162 | 163 |
let index: number = 0; |
163 | 164 |
for (let communityContentProvider of this.communityContentProviders) { |
164 | 165 |
if (communityContentProvider.openaireId == contentProvider.id) { |
165 |
return communityContentProvider.id;
|
|
166 |
return communityContentProvider; |
|
166 | 167 |
} |
167 | 168 |
index++; |
168 | 169 |
} |
modules/uoa-admin-portal/branches/new-UI/src/app/pages/content-providers/remove-content-providers.component.ts | ||
---|---|---|
330 | 330 |
} |
331 | 331 |
|
332 | 332 |
public filterCommunityContentProviderByKeyword(contentProvider): boolean { |
333 |
const textFlag = this.searchText.toString().toLowerCase() === ''
|
|
334 |
|| (contentProvider.name.toLowerCase() || contentProvider.officialname.toLowerCase()).match(this.searchText) != null;
|
|
333 |
const textFlag = this.searchText.toString() === '' |
|
334 |
|| (contentProvider.name + " " + contentProvider.officialname).match(this.searchText) != null;
|
|
335 | 335 |
return textFlag; |
336 | 336 |
} |
337 | 337 |
|
modules/uoa-admin-portal/branches/new-UI/src/app/pages/projects/add-projects.component.html | ||
---|---|---|
71 | 71 |
<div class="uk-flex uk-flex-middle uk-flex-center uk-flex-column uk-height-1-1"> |
72 | 72 |
<div class="uk-padding-small uk-padding-remove-horizontal"> |
73 | 73 |
|
74 |
<div [class.hide-element]="!getCommunityProjectId(result)">
|
|
74 |
<div [class.hide-element]="!getCommunityProject(result)"> |
|
75 | 75 |
<a (click)="removeProject(result)" class="uk-button action uk-flex uk-flex-middle"> |
76 | 76 |
<icon name="remove_circle_outline"></icon> |
77 | 77 |
<span class="uk-margin-small-left">Remove project</span> |
78 | 78 |
</a> |
79 | 79 |
</div> |
80 | 80 |
|
81 |
<div [class.hide-element]="getCommunityProjectId(result)">
|
|
81 |
<div [class.hide-element]="getCommunityProject(result)"> |
|
82 | 82 |
<a (click)="addProject(result)" class="uk-button action uk-flex uk-flex-middle" |
83 | 83 |
uk-tooltip="title:<div class='uk-padding-small'><div class='uk-margin-bottom uk-text-bold'>Add new project </div><div>Newly added projects will be linked to your community on the next run of our algorithms.</div></div>"> |
84 | 84 |
<div class="uk-text-success"> |
modules/uoa-admin-portal/branches/new-UI/src/app/pages/projects/add-projects.component.ts | ||
---|---|---|
153 | 153 |
} |
154 | 154 |
}); |
155 | 155 |
} else { |
156 |
let projectId: string = this.getCommunityProjectId(project); |
|
156 |
let communityProject = this.getCommunityProject(project); |
|
157 |
let projectId: string = communityProject['id']; |
|
157 | 158 |
this.subscriptions.push(this._manageCommunityProjectsService.removeProject(this.properties, this.community, projectId).subscribe( |
158 | 159 |
data => { |
159 |
let index = this.communityProjects.indexOf(projectId);
|
|
160 |
let index = this.communityProjects.indexOf(communityProject);
|
|
160 | 161 |
this.communityProjects.splice(index, 1); |
161 | 162 |
UIkit.notification('Project successfully removed!', { |
162 | 163 |
status: 'success', |
... | ... | |
175 | 176 |
} |
176 | 177 |
} |
177 | 178 |
|
178 |
public getCommunityProjectId(project: any): string {
|
|
179 |
public getCommunityProject(project: any): string { |
|
179 | 180 |
let index: number = 0; |
180 | 181 |
for (let communityProject of this.communityProjects) { |
181 | 182 |
if (communityProject.openaireId == project.id || |
182 | 183 |
(project.code == communityProject.grantId && project.funderShortname == communityProject.funder)) { |
183 |
return communityProject.id;
|
|
184 |
return communityProject; |
|
184 | 185 |
} |
185 | 186 |
index++; |
186 | 187 |
} |
modules/uoa-admin-portal/branches/new-UI/src/app/pages/projects/remove-projects.component.html | ||
---|---|---|
73 | 73 |
<span *ngIf="!item.name && !item.acronym">[no title available]</span> |
74 | 74 |
<span class="custom-external custom-icon space"></span> |
75 | 75 |
</a> |
76 |
<span *ngIf="!item.openaireId && !item.grantId && !item.funder">
|
|
76 |
<span *ngIf="!item.openaireId && !(item.grantId && item.funder)">
|
|
77 | 77 |
<span *ngIf="item.name">{{item.name}}</span> |
78 | 78 |
<span *ngIf="item.name && item.acronym">(</span><span *ngIf="item.acronym">{{item.acronym}}</span><span *ngIf="item.name && item.acronym">)</span> |
79 | 79 |
<span *ngIf="!item.name && !item.acronym">[no title available]</span> |
... | ... | |
113 | 113 |
|
114 | 114 |
<modal-alert #AlertModalDeleteCommunity (alertOutput)="confirmedDeleteProject($event)"></modal-alert> |
115 | 115 |
</div> |
116 |
</div> |
|
116 |
</div> |
modules/uoa-admin-portal/branches/new-UI/src/app/pages/projects/remove-projects.component.ts | ||
---|---|---|
305 | 305 |
} |
306 | 306 |
|
307 | 307 |
public filterCommunityProjectByKeyword(project): boolean { |
308 |
const textFlag = this.searchText.toString().toLowerCase() === '' |
|
309 |
|| (project.name.toLowerCase() || project.acronym || project.grantId || project.funder).match(this.searchText) != null; |
|
308 |
const textFlag = this.searchText.toString() === '' |
|
309 |
|| ((project.name + " " + project.acronym + " " + project.grantId + " " + project.funder)).match(this.searchText) != null; |
|
310 |
|
|
310 | 311 |
return textFlag; |
311 | 312 |
} |
312 | 313 |
|
Also available in: Unified diff
[new-UI | Admin]:
1. remove-projects.component.html: [Bug fix] When there is no openaireId or no (grantId and funder), show name of project without a link.
2. remove-content-providers.component.ts & remove-projects.component.ts: [Bug fix] In method for filtering by keyword, match all fields with search text.
3. add-content-providers.component.ts & add-projects.component.ts:
a. getCommunityProjectId() --> getCommunityProject() and getCommunityContentProviderId() --> getCommunityContentProvider().
b. [Bug fix] call getCommunityProject() and getCommunityContentProvider() in remove method, to find index and splice deleted project/ content provider.
4. add-content-providers.component.html & add-projects.component.html: Call updated getCommunityProject() and getCommunityContentProvider().