Revision 60293
Added by Konstantinos Triantafyllou almost 4 years ago
modules/uoa-admin-portal/branches/new-UI/src/app/pages/subscribers/manage-subscribers.component.html | ||
---|---|---|
1 |
<div id="manage-subscribers" class=" uk-card uk-card-default uk-padding"> |
|
2 |
<div class="uk-text-large uk-text-center uk-width-5-6@l uk-width">Manage subscribers</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 subscribers..." aria-describedby="sizing-addon2" [(ngModel)]="subscribersSearchUtils.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 |
|
|
14 |
<div *ngIf="subscribersSearchUtils.totalResults > 0" class="uk-align-center uk-margin-remove-bottom"> |
|
15 |
<div class="searchPaging uk-panel uk-margin-top uk-grid uk-margin-bottom"> |
|
16 |
<span class="uk-h6 uk-width-1-1@s uk-width-1-2@m"> |
|
17 |
{{subscribersSearchUtils.totalResults | number}} subscribers, page {{subscribersSearchUtils.page | number}} of {{(totalPages()) | number}} |
|
18 |
</span> |
|
19 |
<span class="float-children-right-at-medium margin-small-top-at-small uk-width-1-1@s uk-width-1-2@m"> |
|
20 |
<paging-no-load [currentPage]="subscribersSearchUtils.page" [totalResults]="subscribersSearchUtils.totalResults" [size]="10" (pageChange)="goTo($event.value, false)"></paging-no-load> |
|
21 |
</span> |
|
22 |
</div> |
|
23 |
</div> |
|
24 |
|
|
25 |
<div class="custom-dataTable-content"> |
|
26 |
<div class="uk-overflow-container"> |
|
27 |
<table datatable class="uk-table uk-table-striped divider-table" id="dpTable" [dtOptions]="dtOptions" [dtTrigger]="dtTrigger" dtInstance="dtInstanceCallback"> |
|
28 |
<thead> |
|
29 |
<tr> |
|
30 |
<th class="uk-text-center">Email</th> |
|
31 |
<th class="uk-text-center">Action</th> |
|
32 |
</tr> |
|
33 |
</thead> |
|
34 |
<tbody *ngIf="communitySubscribers"> |
|
35 |
<tr class="uk-table-middle" *ngFor="let item of communitySubscribers.subscribers;"> |
|
36 |
<td class="uk-text-center uk-width-1-2"> |
|
37 |
{{item.email}} |
|
38 |
</td> |
|
39 |
<td class="uk-text-center uk-width-1-2"> |
|
40 |
<!-- red_background_color red_color--> |
|
41 |
<a (click)="removeSubscriber(item.email)" class="uk-icon-button remove uk-button-danger" uk-icon="icon: close; ratio: 1" title="Remove"></a> |
|
42 |
</td> |
|
43 |
</tr> |
|
44 |
</tbody> |
|
45 |
</table> |
|
46 |
</div> |
|
47 |
</div> |
|
48 |
|
|
49 |
<div *ngIf="subscribersSearchUtils.totalResults > 0" class="uk-align-center uk-margin-remove-bottom"> |
|
50 |
<div class="searchPaging uk-panel uk-margin-top uk-grid uk-margin-bottom"> |
|
51 |
<span class="uk-h6 uk-width-1-1@s uk-width-1-2@m"> |
|
52 |
{{subscribersSearchUtils.totalResults | number}} subscribers, page {{subscribersSearchUtils.page | number}} of {{(totalPages()) | number}} |
|
53 |
</span> |
|
54 |
<span class="float-children-right-at-medium margin-small-top-at-small uk-width-1-1@s uk-width-1-2@m"> |
|
55 |
<paging-no-load [currentPage]="subscribersSearchUtils.page" [totalResults]="subscribersSearchUtils.totalResults" [size]="10" (pageChange)="goTo($event.value, false)"></paging-no-load> |
|
56 |
</span> |
|
57 |
</div> |
|
58 |
</div> |
|
59 |
|
|
60 |
</div> |
|
61 |
|
|
62 |
<modal-alert #AlertModalDeleteSubscriber (alertOutput)="confirmedDeleteSubscriber()"></modal-alert> |
modules/uoa-admin-portal/branches/new-UI/src/app/pages/subscribers/manage-subscribers.component.ts | ||
---|---|---|
1 |
import {Component, ViewChild, OnInit, Input, Output, ElementRef} from '@angular/core'; |
|
2 |
import {ViewEncapsulation, EventEmitter} from '@angular/core'; |
|
3 |
import {SimpleChanges, OnChanges} from '@angular/core'; |
|
4 |
import {FormGroup, FormArray, FormBuilder, Validators} from '@angular/forms'; |
|
5 |
import {ActivatedRoute, Router} from '@angular/router'; |
|
6 |
import {Subject} from 'rxjs'; |
|
7 |
import {DataTableDirective} from 'angular-datatables'; |
|
8 |
|
|
9 |
import {EnvProperties} from '../../openaireLibrary/utils/properties/env-properties'; |
|
10 |
import {SubscribeService} from '../../openaireLibrary/utils/subscribe/subscribe.service'; |
|
11 |
import {RouterHelper} from '../../openaireLibrary/utils/routerHelper.class'; |
|
12 |
|
|
13 |
import {ErrorCodes} from '../../openaireLibrary/utils/properties/errorCodes'; |
|
14 |
import {SearchUtilsClass} from '../../openaireLibrary/searchPages/searchUtils/searchUtils.class'; |
|
15 |
|
|
16 |
import {Session} from '../../openaireLibrary/login/utils/helper.class'; |
|
17 |
import {LoginErrorCodes} from '../../openaireLibrary/login/utils/guardHelper.class'; |
|
18 |
import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class"; |
|
19 |
import {Title} from '@angular/platform-browser'; |
|
20 |
|
|
21 |
@Component({ |
|
22 |
selector: 'manage-subscribers', |
|
23 |
templateUrl: './manage-subscribers.component.html', |
|
24 |
styles: [` |
|
25 |
#dpTable_info, #dpTable_paginate, #dpTable_length, #dpTable_filter{ |
|
26 |
display: none; |
|
27 |
} |
|
28 |
`], |
|
29 |
encapsulation: ViewEncapsulation.None // this used in order styles to work |
|
30 |
}) |
|
31 |
|
|
32 |
export class ManageSubscribersComponent implements OnInit { |
|
33 |
public routerHelper:RouterHelper = new RouterHelper(); |
|
34 |
|
|
35 |
private errorCodes: ErrorCodes; |
|
36 |
|
|
37 |
@Output() commmunitySubscribersChanged = new EventEmitter(); |
|
38 |
public communitySubscribers = []; |
|
39 |
public subscribersSearchUtils: SearchUtilsClass = new SearchUtilsClass(); |
|
40 |
|
|
41 |
public sub: any; public subResults: any; subRemove: any; |
|
42 |
public 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 selectedSubscribersEmail=[]; |
|
57 |
public elementRef; |
|
58 |
|
|
59 |
public subscribers:string[]; |
|
60 |
private triggered: boolean = false; |
|
61 |
|
|
62 |
private selectedSubscriberEmail: any; |
|
63 |
|
|
64 |
public communityId = null; |
|
65 |
|
|
66 |
@ViewChild('AlertModalDeleteSubscriber') alertModalDeleteSubscriber; |
|
67 |
|
|
68 |
constructor (private element: ElementRef, |
|
69 |
private route: ActivatedRoute, |
|
70 |
private title: Title, |
|
71 |
private _router: Router, |
|
72 |
public _fb: FormBuilder, |
|
73 |
private _subscribeService: SubscribeService) { |
|
74 |
|
|
75 |
this.errorCodes = new ErrorCodes(); |
|
76 |
this.subscribersSearchUtils.status = this.errorCodes.LOADING; |
|
77 |
} |
|
78 |
|
|
79 |
ngOnInit() { |
|
80 |
this.route.data.subscribe((data: { envSpecific: EnvProperties }) => { |
|
81 |
this.properties = data.envSpecific; |
|
82 |
this.route.queryParams.subscribe( |
|
83 |
|
|
84 |
communityId => { |
|
85 |
HelperFunctions.scroll(); |
|
86 |
|
|
87 |
this.communityId = communityId['communityId']; |
|
88 |
this.title.setTitle('Administration Dashboard | Subscribers'); |
|
89 |
if (this.communityId != null && this.communityId != '') { |
|
90 |
this._getCommunitySubscribers(); |
|
91 |
} |
|
92 |
}); |
|
93 |
}); |
|
94 |
|
|
95 |
this.dtOptions = { |
|
96 |
"pageLength": this.rowsOnPage, |
|
97 |
"language": { |
|
98 |
"search": "", |
|
99 |
"searchPlaceholder": "Search subscribers..." |
|
100 |
} |
|
101 |
}; |
|
102 |
|
|
103 |
this.subscribersSearchUtils.keyword = ""; |
|
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.subscribersSearchUtils.keyword)) { |
|
134 |
return true; |
|
135 |
} |
|
136 |
return false; |
|
137 |
}); |
|
138 |
|
|
139 |
//console.info("ngAfterViewInit"); |
|
140 |
} |
|
141 |
|
|
142 |
filterData(row: any, query: string) { |
|
143 |
if(!Session.isLoggedIn()){ |
|
144 |
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} }); |
|
145 |
} else { |
|
146 |
let returnValue: boolean = false; |
|
147 |
|
|
148 |
if(query) { |
|
149 |
for(var i = 0; i < 2; i++) { |
|
150 |
var r= this.filterQuery(row[i], query); |
|
151 |
if(r) { |
|
152 |
returnValue = true; |
|
153 |
break; |
|
154 |
} |
|
155 |
} |
|
156 |
|
|
157 |
if(!returnValue) { |
|
158 |
return false; |
|
159 |
} |
|
160 |
} |
|
161 |
return true; |
|
162 |
} |
|
163 |
} |
|
164 |
|
|
165 |
filterQuery(data, query){ |
|
166 |
if(data.toLowerCase().indexOf(query.toLowerCase()) > -1) { |
|
167 |
return true; |
|
168 |
} else { |
|
169 |
return false; |
|
170 |
} |
|
171 |
} |
|
172 |
|
|
173 |
/* |
|
174 |
Trigger a table draw in order to get the initial filtering |
|
175 |
*/ |
|
176 |
triggerInitialLoad(){ |
|
177 |
this.triggered = true; |
|
178 |
//console.info("triggerInitialLoad"); |
|
179 |
setTimeout(function() { |
|
180 |
var table = (<any>$('#dpTable')).DataTable(); |
|
181 |
table.page( 0 ).draw( false ); |
|
182 |
}, 500); |
|
183 |
this.dtTrigger.next(); |
|
184 |
} |
|
185 |
|
|
186 |
public goTo(page:number = 1) { |
|
187 |
if(!Session.isLoggedIn()){ |
|
188 |
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} }); |
|
189 |
} else { |
|
190 |
this.subscribersSearchUtils.page=page; |
|
191 |
|
|
192 |
var table = $('#dpTable').DataTable(); |
|
193 |
table.page( page - 1 ).draw( false ); |
|
194 |
|
|
195 |
var info = table.page.info(); |
|
196 |
this.subscribersSearchUtils.totalResults = info.recordsDisplay; |
|
197 |
} |
|
198 |
} |
|
199 |
|
|
200 |
totalPages(): number { |
|
201 |
let totalPages:any = this.subscribersSearchUtils.totalResults/(this.rowsOnPage); |
|
202 |
if(!(Number.isInteger(totalPages))) { |
|
203 |
totalPages = (parseInt(totalPages, 10) + 1); |
|
204 |
} |
|
205 |
return totalPages; |
|
206 |
} |
|
207 |
|
|
208 |
public removeSubscriber(email:string) { |
|
209 |
if(!Session.isLoggedIn()){ |
|
210 |
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} }); |
|
211 |
} else { |
|
212 |
this.selectedSubscriberEmail = email; |
|
213 |
this.alertModalDeleteSubscriber.cancelButton = true; |
|
214 |
this.alertModalDeleteSubscriber.okButton = true; |
|
215 |
this.alertModalDeleteSubscriber.alertTitle = "Remove subscriber?"; |
|
216 |
|
|
217 |
this.alertModalDeleteSubscriber.message = "Subscriber with email "; |
|
218 |
if (email) { |
|
219 |
this.alertModalDeleteSubscriber.message += " '"+email+"' "; |
|
220 |
} |
|
221 |
|
|
222 |
this.alertModalDeleteSubscriber.message += "will be removed from your community. Are you sure?"; |
|
223 |
this.alertModalDeleteSubscriber.okButtonText = "Yes"; |
|
224 |
this.alertModalDeleteSubscriber.open(); |
|
225 |
} |
|
226 |
} |
|
227 |
|
|
228 |
public confirmedDeleteSubscriber() { |
|
229 |
if(!Session.isLoggedIn()){ |
|
230 |
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} }); |
|
231 |
} else { |
|
232 |
this.subRemove = this._subscribeService.unSubscribeToCommunityByEmail(this.properties, this.communityId, this.selectedSubscriberEmail).subscribe( |
|
233 |
result => { |
|
234 |
this.communitySubscribers = result; |
|
235 |
}, |
|
236 |
err => { |
|
237 |
console.log(err); |
|
238 |
}, |
|
239 |
() => { |
|
240 |
this.subscribersSearchUtils.totalResults--; |
|
241 |
this.subscribersSearchUtils.page=1; |
|
242 |
|
|
243 |
this.rerender(); |
|
244 |
} |
|
245 |
) |
|
246 |
} |
|
247 |
} |
|
248 |
|
|
249 |
public _getCommunitySubscribers(){ |
|
250 |
if(!Session.isLoggedIn()){ |
|
251 |
this._router.navigate(['/user-info'], { queryParams: { "errorCode": LoginErrorCodes.NOT_VALID, "redirectUrl": this._router.url} }); |
|
252 |
} else { |
|
253 |
this.subscribersSearchUtils.status = this.errorCodes.LOADING; |
|
254 |
this.disableForms = true; |
|
255 |
this.communitySubscribers = []; |
|
256 |
this.subscribersSearchUtils.totalResults = 0; |
|
257 |
this.subscribersSearchUtils.page=1; |
|
258 |
this.subscribersSearchUtils.keyword = ""; |
|
259 |
|
|
260 |
this.subResults = this._subscribeService.getCommunitySubscribers(this.properties, this.communityId).subscribe( |
|
261 |
|
|
262 |
res => { |
|
263 |
//console.info("search Subscribers [total communitySubscribers:"+res.subscribers.length+"]"); |
|
264 |
this.communitySubscribers = res; |
|
265 |
|
|
266 |
this.subscribersSearchUtils.totalResults = res.subscribers.length; |
|
267 |
this.subscribersSearchUtils.status = this.errorCodes.DONE; |
|
268 |
|
|
269 |
this.disableForms = false; |
|
270 |
if(!this.triggered) { |
|
271 |
this.triggerInitialLoad(); |
|
272 |
} else { |
|
273 |
var table = $('#dpTable').DataTable(); |
|
274 |
table.clear(); |
|
275 |
|
|
276 |
this.rerender(); |
|
277 |
} |
|
278 |
|
|
279 |
this.commmunitySubscribersChanged.emit({ |
|
280 |
value: this.communitySubscribers, |
|
281 |
}); |
|
282 |
}, |
|
283 |
err => { |
|
284 |
console.log(err); |
|
285 |
//TODO check erros (service not available, bad request) |
|
286 |
|
|
287 |
if(err.status == '404') { |
|
288 |
this.subscribersSearchUtils.status = this.errorCodes.NOT_FOUND; |
|
289 |
} else if(err.status == '500') { |
|
290 |
this.subscribersSearchUtils.status = this.errorCodes.ERROR; |
|
291 |
} else { |
|
292 |
this.subscribersSearchUtils.status = this.errorCodes.NOT_AVAILABLE; |
|
293 |
} |
|
294 |
|
|
295 |
this.disableForms = false; |
|
296 |
if(!this.triggered) { |
|
297 |
this.triggerInitialLoad(); |
|
298 |
} else { |
|
299 |
var table = $('#dpTable').DataTable(); |
|
300 |
table.clear(); |
|
301 |
|
|
302 |
this.rerender(); |
|
303 |
} |
|
304 |
} |
|
305 |
); |
|
306 |
} |
|
307 |
} |
|
308 |
} |
modules/uoa-admin-portal/branches/new-UI/src/app/pages/subscribers/manage-subscribers.module.ts | ||
---|---|---|
1 |
import {NgModule} from '@angular/core'; |
|
2 |
import {CommonModule} from '@angular/common'; |
|
3 |
import {FormsModule} from '@angular/forms'; |
|
4 |
import {RouterModule} from '@angular/router'; |
|
5 |
import {DataTablesModule} from 'angular-datatables'; |
|
6 |
|
|
7 |
import {AlertModalModule} from '../../openaireLibrary/utils/modal/alertModal.module'; |
|
8 |
import {PagingModule} from '../../openaireLibrary/utils/paging.module'; |
|
9 |
import {ManageSubscribersComponent} from './manage-subscribers.component'; |
|
10 |
import {ManageSubscribersRoutingModule} from './manage-subscribers-routing.module'; |
|
11 |
import {IsCommunity} from '../../openaireLibrary/connect/communityGuard/isCommunity.guard'; |
|
12 |
import {ConnectAdminLoginGuard} from '../../openaireLibrary/connect/communityGuard/connectAdminLoginGuard.guard'; |
|
13 |
|
|
14 |
@NgModule({ |
|
15 |
imports: [ |
|
16 |
ManageSubscribersRoutingModule, CommonModule, FormsModule, RouterModule, |
|
17 |
PagingModule, DataTablesModule, AlertModalModule |
|
18 |
], |
|
19 |
declarations: [ |
|
20 |
ManageSubscribersComponent |
|
21 |
], |
|
22 |
providers: [ |
|
23 |
IsCommunity, ConnectAdminLoginGuard |
|
24 |
], |
|
25 |
exports: [ |
|
26 |
ManageSubscribersComponent |
|
27 |
] |
|
28 |
}) |
|
29 |
|
|
30 |
export class ManageSubscribersModule { } |
modules/uoa-admin-portal/branches/new-UI/src/app/pages/subscribers/manage-subscribers-routing.module.ts | ||
---|---|---|
1 |
import { NgModule } from '@angular/core'; |
|
2 |
import {RouterModule} from '@angular/router'; |
|
3 |
import {ManageSubscribersComponent} from './manage-subscribers.component'; |
|
4 |
import {IsCommunity} from '../../openaireLibrary/connect/communityGuard/isCommunity.guard'; |
|
5 |
import {ConnectAdminLoginGuard} from '../../openaireLibrary/connect/communityGuard/connectAdminLoginGuard.guard'; |
|
6 |
|
|
7 |
@NgModule({ |
|
8 |
imports: [ |
|
9 |
RouterModule.forChild([ |
|
10 |
{ path: '', canActivate: [IsCommunity, ConnectAdminLoginGuard], component: ManageSubscribersComponent} |
|
11 |
]) |
|
12 |
] |
|
13 |
}) |
|
14 |
export class ManageSubscribersRoutingModule { } |
modules/uoa-admin-portal/branches/new-UI/src/app/pages/admin-tools/portal-admin-tools-routing.module.ts | ||
---|---|---|
1 |
import {NgModule} from "@angular/core"; |
|
2 |
import {RouterModule} from "@angular/router"; |
|
3 |
|
|
4 |
@NgModule({ |
|
5 |
imports: [RouterModule.forChild([ |
|
6 |
{path: '', loadChildren: './admin-tools-routing.module#AdminToolsRoutingModule'}, |
|
7 |
{path: 'portals', loadChildren: '../../openaireLibrary/dashboard/portal/portals.module#PortalsModule'}, |
|
8 |
{path: 'classes', loadChildren: '../../openaireLibrary/dashboard/divId/divIds.module#DivIdsModule'} |
|
9 |
])] |
|
10 |
}) |
|
11 |
export class PortalAdminToolsRoutingModule { |
|
12 |
|
|
13 |
} |
modules/uoa-admin-portal/branches/new-UI/src/app/pages/admin-tools/admin-tools-routing.module.ts | ||
---|---|---|
1 |
import {NgModule} from '@angular/core'; |
|
2 |
import {RouterModule} from '@angular/router'; |
|
3 |
|
|
4 |
@NgModule({ |
|
5 |
imports: [ |
|
6 |
RouterModule.forChild([ |
|
7 |
{ |
|
8 |
path: 'entities', |
|
9 |
loadChildren: '../../openaireLibrary/dashboard/entity/entities.module#EntitiesModule', |
|
10 |
pathMatch: 'full' |
|
11 |
}, |
|
12 |
{ |
|
13 |
path: 'classContents', |
|
14 |
loadChildren: '../../openaireLibrary/dashboard/divhelpcontent/div-help-contents.module#DivHelpContentsModule' |
|
15 |
}, |
|
16 |
{ |
|
17 |
path: 'classContents/new', |
|
18 |
loadChildren: '../../openaireLibrary/dashboard/divhelpcontent/new-div-help-content.module#NewDivHelpContentModule', |
|
19 |
pathMatch: 'full' |
|
20 |
}, |
|
21 |
{ |
|
22 |
path: 'classContents/edit', |
|
23 |
loadChildren: '../../openaireLibrary/dashboard/divhelpcontent/edit-div-help-content.module#EditDivHelpContentModule', |
|
24 |
pathMatch: 'full' |
|
25 |
}, |
|
26 |
{ |
|
27 |
path: 'helptexts', |
|
28 |
loadChildren: '../../openaireLibrary/dashboard/helpTexts/page-help-contents.module#PageHelpContentsModule', |
|
29 |
pathMatch: 'full' |
|
30 |
}, |
|
31 |
{ |
|
32 |
path: 'helptexts/new', |
|
33 |
loadChildren: '../../openaireLibrary/dashboard/helpTexts/new-page-help-content.module#NewPageHelpContentModule', |
|
34 |
pathMatch: 'full' |
|
35 |
}, |
|
36 |
{ |
|
37 |
path: 'helptexts/edit', |
|
38 |
loadChildren: '../../openaireLibrary/dashboard/helpTexts/edit-page-help-content.module#EditPageHelpContentModule', |
|
39 |
pathMatch: 'full' |
|
40 |
}, |
|
41 |
{ |
|
42 |
path: 'pages', |
|
43 |
loadChildren: '../../openaireLibrary/dashboard/page/pages.module#PagesModule', |
|
44 |
pathMatch: 'full' |
|
45 |
}, |
|
46 |
{ |
|
47 |
path: 'pageContents', |
|
48 |
loadChildren: '../../openaireLibrary/dashboard/helpTexts/page-help-contents.module#PageHelpContentsModule', |
|
49 |
pathMatch: 'full' |
|
50 |
}, |
|
51 |
{ |
|
52 |
path: 'pageContents/new', |
|
53 |
loadChildren: '../../openaireLibrary/dashboard/helpTexts/new-page-help-content.module#NewPageHelpContentModule', |
|
54 |
pathMatch: 'full' |
|
55 |
}, |
|
56 |
{ |
|
57 |
path: 'pageContents/edit', |
|
58 |
loadChildren: '../../openaireLibrary/dashboard/helpTexts/edit-page-help-content.module#EditPageHelpContentModule', |
|
59 |
pathMatch: 'full' |
|
60 |
} |
|
61 |
]) |
|
62 |
] |
|
63 |
}) |
|
64 |
export class AdminToolsRoutingModule { |
|
65 |
} |
modules/uoa-admin-portal/branches/new-UI/src/app/pages/pages-routing.module.ts | ||
---|---|---|
1 | 1 |
import {NgModule} from "@angular/core"; |
2 | 2 |
import {RouterModule} from "@angular/router"; |
3 |
import {ConnectRIGuard} from "../openaireLibrary/connect/communityGuard/connectRIGuard.guard"; |
|
3 | 4 |
|
4 | 5 |
@NgModule({ |
5 | 6 |
imports: [RouterModule.forChild([ |
... | ... | |
11 | 12 |
{ |
12 | 13 |
path: 'mining', |
13 | 14 |
loadChildren: './mining/mining.module#MiningModule', |
14 |
canActivate: [/*ConnectRIGuard*/] |
|
15 |
canActivate: [ConnectRIGuard] |
|
16 |
}, |
|
17 |
{ |
|
18 |
path: 'admin-tools', |
|
19 |
loadChildren: './admin-tools/admin-tools-routing.module#AdminToolsRoutingModule', |
|
20 |
data: { |
|
21 |
param: 'community' |
|
22 |
} |
|
15 | 23 |
} |
16 | 24 |
])] |
17 | 25 |
}) |
modules/uoa-admin-portal/branches/new-UI/src/app/app.component.ts | ||
---|---|---|
185 | 185 |
} |
186 | 186 |
if (Session.isPortalAdministrator(this.user)) { |
187 | 187 |
this.userMenuItems.push(new MenuItem("adminOptions", "Super Admin options", "", "/admin-tools/portals", false, [], [], {})); |
188 |
this.userMenuItems.push(new MenuItem("connectOptions", "Connect portal options", "", "/admin-tools/pages", false, [], [], {communityId: 'connect'})); |
|
188 |
this.userMenuItems.push(new MenuItem("connectOptions", "Connect portal options", "", "/connect/admin-tools/pages", false, [], [], {})); |
|
189 |
this.userMenuItems.push(new MenuItem("exploreOptions", "Explore portal options", "", "/openaire/admin-tools/pages", false, [], [], {})); |
|
190 |
|
|
189 | 191 |
} |
190 | 192 |
this.userMenuItems.push(new MenuItem("", "User information", "", "/user-info", false, [], [], {})); |
191 | 193 |
} |
... | ... | |
203 | 205 |
}; |
204 | 206 |
this.sideBarItems.push(new MenuItem("community", "Community Info", "", "/" + this.community.communityId, false, [], [], {})); |
205 | 207 |
this.sideBarItems.push(new MenuItem("users", "Users", "", "/" + this.community.communityId + "/users", false, [], [], {})); |
206 |
this.sideBarItems.push(new MenuItem("admin-tools", "Pages & Entities", "", "/" + this.community.communityId + "/pages", false, [], [], {}));
|
|
208 |
this.sideBarItems.push(new MenuItem("admin-tools", "Pages & Entities", "", "/" + this.community.communityId + "/admin-tools/pages", false, [], [], {}, null, null, null, "/" + this.community.communityId + "/admin-tools"));
|
|
207 | 209 |
if (this.community.type === 'ri') { |
208 | 210 |
this.sideBarItems.push(new MenuItem("mining", "Mining", "", "/" + this.community.communityId + "/mining/manage-profiles", false, [], [], {}, null, null, null, "/" + this.community.communityId + "/mining")); |
209 | 211 |
} |
modules/uoa-admin-portal/branches/new-UI/src/app/app.module.ts | ||
---|---|---|
30 | 30 |
import {SideBarModule} from "./openaireLibrary/dashboard/sharedComponents/sidebar/sideBar.module"; |
31 | 31 |
import {RoleVerificationModule} from "./openaireLibrary/role-verification/role-verification.module"; |
32 | 32 |
import {SharedModule} from "./openaireLibrary/shared/shared.module"; |
33 |
import {HttpInterceptorService} from "./openaireLibrary/http-interceptor.service"; |
|
34 | 33 |
import {ErrorInterceptorService} from "./openaireLibrary/error-interceptor.service"; |
35 | 34 |
import {DEFAULT_TIMEOUT, TimeoutInterceptor} from "./openaireLibrary/timeout-interceptor.service"; |
35 |
import {AdminLoginGuard} from "./openaireLibrary/login/adminLoginGuard.guard"; |
|
36 | 36 |
|
37 | 37 |
@NgModule({ |
38 | 38 |
imports: [ |
... | ... | |
53 | 53 |
], |
54 | 54 |
providers: [ |
55 | 55 |
HelpContentService, CommunityService, SubscribeService, |
56 |
ConnectAdminLoginGuard, |
|
56 |
ConnectAdminLoginGuard, AdminLoginGuard,
|
|
57 | 57 |
EnvironmentSpecificResolver, EnvironmentSpecificService, |
58 | 58 |
IsCommunity, ConnectRIGuard, CommunitiesService, TitleCasePipe, |
59 | 59 |
{ |
modules/uoa-admin-portal/branches/new-UI/src/app/app.routing.ts | ||
---|---|---|
11 | 11 |
|
12 | 12 |
import {CommunityErrorPageComponent} from './openaireLibrary/connect/communityGuard/communityErrorPage.component'; |
13 | 13 |
import {AdminErrorPageComponent} from './pages/error/errorPage.component'; |
14 |
import {AdminLoginGuard} from "./openaireLibrary/login/adminLoginGuard.guard"; |
|
14 | 15 |
|
15 | 16 |
const oldRoutes: Routes = [ |
16 | 17 |
{ |
... | ... | |
190 | 191 |
data: {hasSidebar: false} |
191 | 192 |
}, |
192 | 193 |
{ |
194 |
path: 'connect/admin-tools', |
|
195 |
loadChildren: './pages/admin-tools/admin-tools-routing.module#AdminToolsRoutingModule', |
|
196 |
canActivate: [AdminLoginGuard], |
|
197 |
data: {portal: 'connect'} |
|
198 |
}, |
|
199 |
{ |
|
200 |
path: 'openaire/admin-tools', |
|
201 |
loadChildren: './pages/admin-tools/admin-tools-routing.module#AdminToolsRoutingModule', |
|
202 |
canActivate: [AdminLoginGuard], |
|
203 |
data: {portal: 'openaire'} |
|
204 |
}, |
|
205 |
{ |
|
206 |
path: 'admin-tools', |
|
207 |
loadChildren: './pages/admin-tools/portal-admin-tools-routing.module#PortalAdminToolsRoutingModule', |
|
208 |
canActivate: [AdminLoginGuard] |
|
209 |
}, |
|
210 |
{ |
|
193 | 211 |
path: ':community', |
194 | 212 |
loadChildren: './pages/pages-routing.module#PagesRoutingModule', |
195 | 213 |
canActivate: [ConnectAdminLoginGuard] |
... | ... | |
205 | 223 |
imports: [RouterModule.forRoot(routes, { |
206 | 224 |
preloadingStrategy: PreloadAllModules, |
207 | 225 |
scrollPositionRestoration: "top", |
208 |
onSameUrlNavigation: "reload" |
|
226 |
onSameUrlNavigation: "reload", |
|
227 |
relativeLinkResolution: 'corrected' |
|
209 | 228 |
})], |
210 | 229 |
exports: [ RouterModule ] |
211 | 230 |
}) |
Also available in: Unified diff
[Admin | New UI]: Fix routes for new admin