Revision 60331
Added by Konstantinos Triantafyllou about 3 years ago
modules/uoa-services-library/trunk/ng-openaire-library/src/app/dashboard/divId/divIds.component.html | ||
---|---|---|
40 | 40 |
</div> |
41 | 41 |
</div> |
42 | 42 |
<div inner> |
43 |
<div>
|
|
44 |
<div class="contentPanel">
|
|
43 |
<loading *ngIf="showLoading" class="uk-margin-large-top"></loading>
|
|
44 |
<div *ngIf="!showLoading">
|
|
45 | 45 |
<div *ngIf="updateErrorMessage" class="uk-alert-danger" uk-alert> |
46 | 46 |
<a class="uk-alert-close" uk-close></a> |
47 | 47 |
{{updateErrorMessage}} |
48 | 48 |
</div> |
49 | 49 |
<div *ngIf="errorMessage" class="uk-alert uk-alert-danger uk-margin-large-top" |
50 | 50 |
role="alert">{{errorMessage}}</div> |
51 |
<div [style.display]="showLoading ? 'inline' : 'none'" |
|
52 |
class="uk-animation-fade uk-margin-large-top uk-width-1-1" role="alert"><img |
|
53 |
class="uk-align-center loading-gif"></div> |
|
54 |
|
|
55 |
<div class="md-card uk-margin-medium-bottom" *ngIf="!errorMessage && !showLoading"> |
|
51 |
<div class="md-card uk-margin-medium-bottom" *ngIf="!errorMessage"> |
|
56 | 52 |
<div class="md-card-content"> |
57 | 53 |
<div class="uk-overflow-container"> |
58 | 54 |
|
... | ... | |
103 | 99 |
</div> |
104 | 100 |
</div> |
105 | 101 |
</div> |
106 |
</div> |
|
107 | 102 |
</div> |
108 | 103 |
</div> |
109 | 104 |
<modal-alert #editModal (alertOutput)="divIdSaveConfirmed($event)" |
modules/uoa-services-library/trunk/ng-openaire-library/src/app/dashboard/divId/divIds.component.ts | ||
---|---|---|
15 | 15 |
import {AlertModal} from "../../utils/modal/alert"; |
16 | 16 |
import {Option} from "../../sharedComponents/input/input.component"; |
17 | 17 |
|
18 |
declare var UIkit; |
|
19 |
|
|
18 | 20 |
@Component({ |
19 | 21 |
selector: 'divIds', |
20 | 22 |
templateUrl: './divIds.component.html', |
... | ... | |
174 | 176 |
this.subscriptions.push(this._helpContentService.deleteDivIds(this.selectedDivIds, this.properties.adminToolsAPIURL).subscribe( |
175 | 177 |
_ => { |
176 | 178 |
this.deleteDivIdsFromArray(this.selectedDivIds); |
179 |
UIkit.notification('Classes have been <b>successfully deleted</b>', { |
|
180 |
status: 'success', |
|
181 |
timeout: 6000, |
|
182 |
pos: 'bottom-right' |
|
183 |
}); |
|
177 | 184 |
this.showLoading = false; |
178 | 185 |
}, |
179 | 186 |
error => this.handleUpdateError('System error deleting the selected classes', error) |
... | ... | |
233 | 240 |
} |
234 | 241 |
|
235 | 242 |
public divIdSaveConfirmed(data: any) { |
243 |
this.showLoading = true; |
|
236 | 244 |
if (!Session.isLoggedIn()) { |
237 | 245 |
this._router.navigate(['/user-info'], { |
238 | 246 |
queryParams: { |
... | ... | |
246 | 254 |
this.subscriptions.push(this._helpContentService.saveDivId(<DivId>this.classForm.value, this.properties.adminToolsAPIURL).subscribe( |
247 | 255 |
divId => { |
248 | 256 |
this.divIdSavedSuccessfully(divId); |
257 |
UIkit.notification('Class <b>' + divId.name + '</b> has been <b>successfully created</b>', { |
|
258 |
status: 'success', |
|
259 |
timeout: 6000, |
|
260 |
pos: 'bottom-right' |
|
261 |
}); |
|
249 | 262 |
}, |
250 | 263 |
error => this.handleUpdateError("System error creating class", error) |
251 | 264 |
)); |
... | ... | |
254 | 267 |
this.subscriptions.push(this._helpContentService.updateDivId(<DivId>this.classForm.value, this.properties.adminToolsAPIURL).subscribe( |
255 | 268 |
divId => { |
256 | 269 |
this.divIdUpdatedSuccessfully(divId); |
270 |
UIkit.notification('Class <b>' + divId.name + '</b> has been <b>successfully updated</b>', { |
|
271 |
status: 'success', |
|
272 |
timeout: 6000, |
|
273 |
pos: 'bottom-right' |
|
274 |
}); |
|
257 | 275 |
}, |
258 | 276 |
error => this.handleUpdateError("System error updating class", error) |
259 | 277 |
)); |
... | ... | |
266 | 284 |
this.divIds.push(divId); |
267 | 285 |
this.applyFilters(); |
268 | 286 |
this.applyCheck(false); |
287 |
this.showLoading = false; |
|
269 | 288 |
} |
270 | 289 |
|
271 | 290 |
public divIdUpdatedSuccessfully(divId: DivId) { |
272 | 291 |
this.divIds[this.index] = divId; |
273 | 292 |
this.applyFilters(); |
274 | 293 |
this.applyCheck(false); |
294 |
this.showLoading = false; |
|
275 | 295 |
} |
276 | 296 |
|
277 | 297 |
public applyFilters() { |
... | ... | |
298 | 318 |
this.updateErrorMessage = message; |
299 | 319 |
console.log('Server responded: ' + error); |
300 | 320 |
} |
301 |
|
|
321 |
UIkit.notification('An error has occurred. Please try again later', { |
|
322 |
status: 'danger', |
|
323 |
timeout: 6000, |
|
324 |
pos: 'bottom-right' |
|
325 |
}); |
|
302 | 326 |
this.showLoading = false; |
303 | 327 |
} |
304 | 328 |
|
modules/uoa-services-library/trunk/ng-openaire-library/src/app/dashboard/divId/divIds.module.ts | ||
---|---|---|
20 | 20 |
import {IconsModule} from "../../utils/icons/icons.module"; |
21 | 21 |
import {IconsService} from "../../utils/icons/icons.service"; |
22 | 22 |
import {add} from "../../utils/icons/icons"; |
23 |
import {LoadingModule} from "../../utils/loading/loading.module"; |
|
23 | 24 |
|
24 | 25 |
@NgModule({ |
25 | 26 |
imports: [ |
26 | 27 |
CommonModule, RouterModule, FormsModule, |
27 | 28 |
AlertModalModule, ReactiveFormsModule, AdminToolServiceModule, InputModule, MatAutocompleteModule, MatFormFieldModule, MatChipsModule, |
28 |
MatCheckboxModule, AdminTabsModule, PageContentModule, ClassesRoutingModule, SearchInputModule, IconsModule |
|
29 |
MatCheckboxModule, AdminTabsModule, PageContentModule, ClassesRoutingModule, SearchInputModule, IconsModule, LoadingModule
|
|
29 | 30 |
], |
30 | 31 |
declarations: [DivIdsComponent], |
31 | 32 |
exports: [DivIdsComponent] |
modules/uoa-services-library/trunk/ng-openaire-library/src/app/dashboard/portal/portals.component.html | ||
---|---|---|
40 | 40 |
</div> |
41 | 41 |
</div> |
42 | 42 |
<div inner> |
43 |
<div *ngIf="updateErrorMessage" class="uk-alert-danger" uk-alert> |
|
44 |
<a class="uk-alert-close" uk-close></a> |
|
45 |
{{updateErrorMessage}} |
|
46 |
</div> |
|
47 |
<div *ngIf="errorMessage" class="uk-alert uk-alert-danger uk-margin-large-top" |
|
48 |
role="alert">{{errorMessage}}</div> |
|
49 |
<div [style.display]="showLoading ? 'inline' : 'none'" |
|
50 |
class="uk-animation-fade uk-margin-large-top uk-width-1-1" role="alert"><img |
|
51 |
class="uk-align-center loading-gif"></div> |
|
52 |
|
|
53 |
|
|
54 |
<div class=" uk-margin-medium-bottom" *ngIf="!errorMessage && !showLoading"> |
|
55 |
|
|
56 |
<div class=""> |
|
43 |
<loading *ngIf="showLoading" class="uk-margin-large-top"></loading> |
|
44 |
<div *ngIf="!showLoading"> |
|
45 |
<div *ngIf="updateErrorMessage" class="uk-alert-danger" uk-alert> |
|
46 |
<a class="uk-alert-close" uk-close></a> |
|
47 |
{{updateErrorMessage}} |
|
48 |
</div> |
|
49 |
<div *ngIf="errorMessage" class="uk-alert uk-alert-danger uk-margin-large-top" |
|
50 |
role="alert">{{errorMessage}}</div> |
|
51 |
<div class=" uk-margin-medium-bottom" *ngIf="!errorMessage"> |
|
57 | 52 |
<div class="uk-overflow-container"> |
58 |
<table class="uk-table uk-table-striped uk-table-hover"> |
|
59 |
<thead class="uk-card-header"> |
|
60 |
<tr> |
|
61 |
<th><input id="allCommunityCheckbox" type="checkbox" (change)="toggleCheckBoxes($event)"></th> |
|
62 |
<th>Name</th> |
|
63 |
<th>Type</th> |
|
64 |
<th>Actions</th> |
|
65 |
</tr> |
|
66 |
</thead> |
|
67 |
<tbody> |
|
68 |
<tr *ngFor="let check of checkboxes; let i=index"> |
|
69 |
<td><input id="{{check.portal._id}}" class="checkBox" type="checkbox" |
|
70 |
name="communitiescb[]" value="{{check.portal._id}}" [(ngModel)]="check.checked"> |
|
71 |
</td> |
|
72 |
<td> |
|
73 |
<div class="name" href="#">{{check.portal.name}}</div> |
|
74 |
</td> |
|
75 |
<td> |
|
76 |
<div class="type" href="#">{{check.portal.type}}</div> |
|
77 |
</td> |
|
78 |
<td> |
|
79 |
<div class="actions" href="#"> |
|
80 |
<i class="clickable" uk-icon="pencil" (click)="editPortal(i)"></i> |
|
81 |
<i class="clickable uk-text-danger" uk-icon="trash" |
|
82 |
(click)="confirmDeletePortal(check.portal._id)"></i> |
|
83 |
</div> |
|
84 |
</td> |
|
53 |
<table class="uk-table uk-table-striped uk-table-hover">
|
|
54 |
<thead class="uk-card-header">
|
|
55 |
<tr>
|
|
56 |
<th><input id="allCommunityCheckbox" type="checkbox" (change)="toggleCheckBoxes($event)"></th>
|
|
57 |
<th>Name</th>
|
|
58 |
<th>Type</th>
|
|
59 |
<th>Actions</th>
|
|
60 |
</tr>
|
|
61 |
</thead>
|
|
62 |
<tbody>
|
|
63 |
<tr *ngFor="let check of checkboxes; let i=index">
|
|
64 |
<td><input id="{{check.portal._id}}" class="checkBox" type="checkbox"
|
|
65 |
name="communitiescb[]" value="{{check.portal._id}}" [(ngModel)]="check.checked">
|
|
66 |
</td>
|
|
67 |
<td>
|
|
68 |
<div class="name" href="#">{{check.portal.name}}</div>
|
|
69 |
</td>
|
|
70 |
<td>
|
|
71 |
<div class="type" href="#">{{check.portal.type}}</div>
|
|
72 |
</td>
|
|
73 |
<td>
|
|
74 |
<div class="actions" href="#">
|
|
75 |
<i class="clickable" uk-icon="pencil" (click)="editPortal(i)"></i>
|
|
76 |
<i class="clickable uk-text-danger" uk-icon="trash"
|
|
77 |
(click)="confirmDeletePortal(check.portal._id)"></i>
|
|
78 |
</div>
|
|
79 |
</td>
|
|
85 | 80 |
|
86 |
</tr> |
|
81 |
</tr>
|
|
87 | 82 |
|
88 |
</tbody> |
|
89 |
</table> |
|
90 |
<div *ngIf="checkboxes.length==0" class="col-md-12"> |
|
91 |
<div class="uk-alert-warning" uk-alert>No portals found</div> |
|
83 |
</tbody> |
|
84 |
</table> |
|
85 |
<div *ngIf="checkboxes.length==0" class="col-md-12"> |
|
86 |
<div class="uk-alert-warning" uk-alert>No portals found</div> |
|
87 |
</div> |
|
88 |
<!--<div class="uk-width-1-1 uk-flex uk-flex-center "> |
|
89 |
<div class="uk-width-small uk-button-default uk-button" (click)="newCommunity()"> |
|
90 |
<i class="" uk-icon="plus"></i> |
|
91 |
</div> |
|
92 |
</div>--> |
|
92 | 93 |
</div> |
93 |
<!--<div class="uk-width-1-1 uk-flex uk-flex-center "> |
|
94 |
<div class="uk-width-small uk-button-default uk-button" (click)="newCommunity()"> |
|
95 |
<i class="" uk-icon="plus"></i> |
|
96 |
</div> |
|
97 |
</div>--> |
|
98 |
</div> |
|
99 | 94 |
</div> |
100 | 95 |
</div> |
101 | 96 |
</div> |
modules/uoa-services-library/trunk/ng-openaire-library/src/app/dashboard/portal/portals.component.ts | ||
---|---|---|
13 | 13 |
import {properties} from "../../../../environments/environment"; |
14 | 14 |
import {AlertModal} from "../../utils/modal/alert"; |
15 | 15 |
|
16 |
declare var UIkit; |
|
17 |
|
|
16 | 18 |
@Component({ |
17 | 19 |
selector: 'portals', |
18 | 20 |
templateUrl: './portals.component.html', |
... | ... | |
164 | 166 |
this.subscriptions.push(this._helpContentService.deleteCommunities(this.selectedPortals, this.properties.adminToolsAPIURL).subscribe( |
165 | 167 |
_ => { |
166 | 168 |
this.deletePortalsFromArray(this.selectedPortals); |
169 |
UIkit.notification('Portals have been <b>successfully deleted</b>', { |
|
170 |
status: 'success', |
|
171 |
timeout: 6000, |
|
172 |
pos: 'bottom-right' |
|
173 |
}); |
|
167 | 174 |
this.showLoading = false; |
168 | 175 |
}, |
169 | 176 |
error => this.handleUpdateError('System error deleting the selected communities', error) |
... | ... | |
220 | 227 |
} |
221 | 228 |
|
222 | 229 |
public portalSaveConfirmed(data: any) { |
230 |
this.showLoading = true; |
|
223 | 231 |
if (!Session.isLoggedIn()) { |
224 | 232 |
this._router.navigate(['/user-info'], { |
225 | 233 |
queryParams: { |
... | ... | |
235 | 243 |
this.properties.adminToolsAPIURL).subscribe( |
236 | 244 |
portal => { |
237 | 245 |
this.portalUpdatedSuccessfully(portal); |
246 |
UIkit.notification('Portal <b>' + portal.name + '</b> has been <b>successfully updated</b>', { |
|
247 |
status: 'success', |
|
248 |
timeout: 6000, |
|
249 |
pos: 'bottom-right' |
|
250 |
}); |
|
238 | 251 |
}, |
239 | 252 |
error => this.handleUpdateError('System error updating portal', error) |
240 | 253 |
)); |
... | ... | |
243 | 256 |
this.properties.adminToolsAPIURL).subscribe( |
244 | 257 |
portal => { |
245 | 258 |
this.portalSavedSuccessfully(portal); |
259 |
UIkit.notification('Portal <b>' + portal.name + '</b> has been <b>successfully created</b>', { |
|
260 |
status: 'success', |
|
261 |
timeout: 6000, |
|
262 |
pos: 'bottom-right' |
|
263 |
}); |
|
246 | 264 |
}, |
247 | 265 |
error => this.handleUpdateError('System error creating portal', error) |
248 | 266 |
)); |
... | ... | |
250 | 268 |
} |
251 | 269 |
} |
252 | 270 |
|
253 |
public portalUpdateConfirmed(data: any) { |
|
254 |
if (!Session.isLoggedIn()) { |
|
255 |
this._router.navigate(['/user-info'], { |
|
256 |
queryParams: {'errorCode': LoginErrorCodes.NOT_VALID, 'redirectUrl': this._router.url} |
|
257 |
}); |
|
258 |
} else { |
|
259 |
this.portalForm.get('type').enable(); |
|
260 |
this.subscriptions.push(this._helpContentService.updateCommunity(<Portal>this.portalForm.value, |
|
261 |
this.properties.adminToolsAPIURL).subscribe( |
|
262 |
portal => { |
|
263 |
this.portalUpdatedSuccessfully(portal); |
|
264 |
}, |
|
265 |
error => this.handleUpdateError('System error updating portal', error) |
|
266 |
)); |
|
267 |
} |
|
268 |
} |
|
269 |
|
|
270 | 271 |
public portalSavedSuccessfully(portal: Portal) { |
271 | 272 |
this.portals.push(portal); |
272 | 273 |
this.applyFilters(); |
273 | 274 |
this.applyCheck(false); |
275 |
this.showLoading = false; |
|
274 | 276 |
} |
275 | 277 |
|
276 | 278 |
public portalUpdatedSuccessfully(portal: Portal) { |
277 | 279 |
this.portals[this.index] = portal; |
278 | 280 |
this.applyFilters(); |
279 | 281 |
this.applyCheck(false); |
282 |
this.showLoading = false; |
|
280 | 283 |
} |
281 | 284 |
|
282 | 285 |
public applyFilters() { |
... | ... | |
310 | 313 |
this.updateErrorMessage = message; |
311 | 314 |
console.log('Server responded: ' + error); |
312 | 315 |
} |
316 |
UIkit.notification('An error has occurred. Please try again later', { |
|
317 |
status: 'danger', |
|
318 |
timeout: 6000, |
|
319 |
pos: 'bottom-right' |
|
320 |
}); |
|
313 | 321 |
this.showLoading = false; |
314 | 322 |
} |
315 | 323 |
|
modules/uoa-services-library/trunk/ng-openaire-library/src/app/dashboard/portal/portals.module.ts | ||
---|---|---|
13 | 13 |
import {add} from "../../utils/icons/icons"; |
14 | 14 |
import {IconsModule} from "../../utils/icons/icons.module"; |
15 | 15 |
import {SearchInputModule} from "../../sharedComponents/search-input/search-input.module"; |
16 |
import {LoadingModule} from "../../utils/loading/loading.module"; |
|
16 | 17 |
|
17 | 18 |
@NgModule({ |
18 | 19 |
imports: [ |
19 | 20 |
CommonModule, FormsModule, AlertModalModule, |
20 | 21 |
ReactiveFormsModule, |
21 |
RouterModule, AdminToolServiceModule, InputModule, AdminTabsModule, PageContentModule, PortalsRoutingModule, IconsModule, SearchInputModule |
|
22 |
RouterModule, AdminToolServiceModule, InputModule, AdminTabsModule, PageContentModule, PortalsRoutingModule, IconsModule, SearchInputModule, LoadingModule
|
|
22 | 23 |
], |
23 | 24 |
declarations: [PortalsComponent], |
24 | 25 |
exports: [PortalsComponent] |
modules/uoa-services-library/trunk/ng-openaire-library/src/app/dashboard/entity/entities.component.html | ||
---|---|---|
48 | 48 |
</div> |
49 | 49 |
</div> |
50 | 50 |
<div inner> |
51 |
<div class="contentPanel "> |
|
51 |
<loading *ngIf="showLoading" class="uk-margin-large-top"></loading> |
|
52 |
<div *ngIf="!showLoading"> |
|
52 | 53 |
<div *ngIf="!isPortalAdministrator" class="uk-alert uk-alert-primary uk-margin-top-large"> |
53 | 54 |
<div> |
54 | 55 |
<span class="uk-margin-small-right uk-icon" uk-icon="warning"></span> |
... | ... | |
67 | 68 |
</div> |
68 | 69 |
<div *ngIf="errorMessage" class="uk-alert uk-alert-danger uk-margin-large-top" |
69 | 70 |
role="alert">{{errorMessage}}</div> |
70 |
<div [style.display]="showLoading ? 'inline' : 'none'" |
|
71 |
class="uk-animation-fade uk-margin-large-top uk-width-1-1" role="alert"><img |
|
72 |
class="uk-align-center loading-gif"></div> |
|
73 |
|
|
74 |
|
|
75 |
<div class="md-card uk-margin-medium-bottom" *ngIf="!errorMessage && !showLoading"> |
|
71 |
<div class="md-card uk-margin-medium-bottom" *ngIf="!errorMessage"> |
|
76 | 72 |
<div class="md-card-content"> |
77 | 73 |
<div class="uk-overflow-container"> |
78 | 74 |
<table class="uk-table uk-table-striped uk-table-hover uk-table-large"> |
modules/uoa-services-library/trunk/ng-openaire-library/src/app/dashboard/entity/entities.component.ts | ||
---|---|---|
13 | 13 |
import {ConnectHelper} from "../../connect/connectHelper"; |
14 | 14 |
import {AlertModal} from "../../utils/modal/alert"; |
15 | 15 |
|
16 |
declare var UIkit; |
|
17 |
|
|
16 | 18 |
@Component({ |
17 | 19 |
selector: 'entities', |
18 | 20 |
templateUrl: './entities.component.html', |
19 | 21 |
}) |
20 |
|
|
21 | 22 |
export class EntitiesComponent implements OnInit { |
22 | 23 |
|
23 | 24 |
@ViewChild('editModal') editModal: AlertModal; |
... | ... | |
188 | 189 |
this._helpContentService.deleteEntities(this.selectedEntities, this.properties.adminToolsAPIURL).subscribe( |
189 | 190 |
_ => { |
190 | 191 |
this.deleteEntitiesFromArray(this.selectedEntities); |
192 |
UIkit.notification('Entities have been <b>successfully deleted</b>', { |
|
193 |
status: 'success', |
|
194 |
timeout: 6000, |
|
195 |
pos: 'bottom-right' |
|
196 |
}); |
|
191 | 197 |
this.showLoading = false; |
192 | 198 |
}, |
193 | 199 |
error => this.handleUpdateError('System error deleting the selected entities', error) |
... | ... | |
232 | 238 |
} |
233 | 239 |
|
234 | 240 |
public entitySaveConfirmed(data: any) { |
241 |
this.showLoading = true; |
|
235 | 242 |
if (!Session.isLoggedIn()) { |
236 | 243 |
this._router.navigate(['/user-info'], |
237 | 244 |
{queryParams: {'errorCode': LoginErrorCodes.NOT_VALID, 'redirectUrl': this._router.url}}); |
... | ... | |
242 | 249 |
<Entity>this.entityForm.value, this.properties.adminToolsAPIURL).subscribe( |
243 | 250 |
entity => { |
244 | 251 |
this.entityUpdatedSuccessfully(entity); |
252 |
UIkit.notification('Entity <b>' + entity.name + '</b> has been <b>successfully updated</b>', { |
|
253 |
status: 'success', |
|
254 |
timeout: 6000, |
|
255 |
pos: 'bottom-right' |
|
256 |
}); |
|
245 | 257 |
}, |
246 | 258 |
error => this.handleUpdateError('System error updating entity', error) |
247 | 259 |
); |
... | ... | |
249 | 261 |
this._helpContentService.saveEntity(<Entity>this.entityForm.value, this.properties.adminToolsAPIURL).subscribe( |
250 | 262 |
entity => { |
251 | 263 |
this.entitySavedSuccessfully(entity); |
264 |
UIkit.notification('Entity <b>' + entity.name + '</b> has been <b>successfully created</b>', { |
|
265 |
status: 'success', |
|
266 |
timeout: 6000, |
|
267 |
pos: 'bottom-right' |
|
268 |
}); |
|
252 | 269 |
}, |
253 | 270 |
error => this.handleUpdateError('System error creating entity', error) |
254 | 271 |
); |
... | ... | |
261 | 278 |
this.entities.push(entity); |
262 | 279 |
this.applyFilters(); |
263 | 280 |
this.applyCheck(false); |
281 |
this.showLoading = false; |
|
264 | 282 |
} |
265 | 283 |
|
266 | 284 |
public entityUpdatedSuccessfully(entity: Entity) { |
267 | 285 |
this.entities[this.index] = entity; |
268 | 286 |
this.applyFilters(); |
269 | 287 |
this.applyCheck(false); |
288 |
this.showLoading = false; |
|
270 | 289 |
} |
271 | 290 |
|
272 | 291 |
public applyFilters() { |
... | ... | |
306 | 325 |
this.updateErrorMessage = message; |
307 | 326 |
console.log('Server responded: ' + error); |
308 | 327 |
} |
309 |
|
|
328 |
UIkit.notification('An error has occurred. Please try again later', { |
|
329 |
status: 'danger', |
|
330 |
timeout: 6000, |
|
331 |
pos: 'bottom-right' |
|
332 |
}); |
|
310 | 333 |
this.showLoading = false; |
311 | 334 |
} |
312 | 335 |
|
modules/uoa-services-library/trunk/ng-openaire-library/src/app/dashboard/entity/entities.module.ts | ||
---|---|---|
14 | 14 |
import {IconsModule} from "../../utils/icons/icons.module"; |
15 | 15 |
import {IconsService} from "../../utils/icons/icons.service"; |
16 | 16 |
import {add} from "../../utils/icons/icons"; |
17 |
import {LoadingModule} from "../../utils/loading/loading.module"; |
|
17 | 18 |
|
18 | 19 |
@NgModule({ |
19 | 20 |
imports: [ |
20 | 21 |
CommonModule, RouterModule, FormsModule, AdminToolServiceModule, |
21 |
AlertModalModule, ReactiveFormsModule, MatSlideToggleModule, InputModule, PageContentModule, AdminTabsModule, EntitiesRoutingModule, SearchInputModule, IconsModule |
|
22 |
AlertModalModule, ReactiveFormsModule, MatSlideToggleModule, InputModule, PageContentModule, AdminTabsModule, EntitiesRoutingModule, SearchInputModule, IconsModule, LoadingModule
|
|
22 | 23 |
], |
23 | 24 |
declarations: [EntitiesComponent], |
24 | 25 |
exports: [EntitiesComponent] |
modules/uoa-services-library/trunk/ng-openaire-library/src/app/dashboard/page/pages.component.html | ||
---|---|---|
43 | 43 |
</div> |
44 | 44 |
</div> |
45 | 45 |
<div inner> |
46 |
<div class="contentPanel "> |
|
46 |
<loading *ngIf="showLoading" class="uk-margin-large-top"></loading> |
|
47 |
<div *ngIf="!showLoading"> |
|
47 | 48 |
<div *ngIf="!isPortalAdministrator" class="uk-alert uk-alert-primary uk-margin-top-large"> |
48 | 49 |
<div> |
49 | 50 |
<span class="uk-margin-small-right uk-icon" uk-icon="warning"></span> |
... | ... | |
61 | 62 |
</div> |
62 | 63 |
<div *ngIf="errorMessage" class="uk-alert uk-alert-danger uk-margin-large-top" |
63 | 64 |
role="alert">{{errorMessage}}</div> |
64 |
<div [style.display]="showLoading ? 'inline' : 'none'" |
|
65 |
class="uk-animation-fade uk-margin-large-top uk-width-1-1" role="alert"><img |
|
66 |
class="uk-align-center loading-gif"></div> |
|
67 |
<div class="md-card uk-margin-medium-bottom" *ngIf="!errorMessage && !showLoading"> |
|
65 |
<div class="uk-margin-medium-bottom" *ngIf="!errorMessage"> |
|
68 | 66 |
<div class="md-card-content"> |
69 | 67 |
<div class="uk-overflow-container"> |
70 | 68 |
<ul class="uk-list pages"> |
... | ... | |
78 | 76 |
<div class="name uk-margin-medium-bottom" href="#">{{check.page.name}}</div> |
79 | 77 |
<div *ngIf="check.page.entities && check.page.entities.length > 0"><span |
80 | 78 |
class="title">Entities: </span> |
81 |
{{check.page.entities.join(", ")}}</div>
|
|
79 |
{{getEntitiesAsString(check.page)}}</div>
|
|
82 | 80 |
<div class=" uk-margin-small-bottom"><span class="title">Route: </span> {{check.page.route}}</div> |
83 | 81 |
<div *ngIf="!pagesType" class=" uk-margin-small-bottom"><span |
84 | 82 |
class="title">Type: </span> {{check.page.type}}</div> |
modules/uoa-services-library/trunk/ng-openaire-library/src/app/dashboard/page/pages.component.ts | ||
---|---|---|
1 | 1 |
import {Component, ElementRef, OnInit, ViewChild} from '@angular/core'; |
2 | 2 |
import {ActivatedRoute, Router} from '@angular/router'; |
3 | 3 |
import {HelpContentService} from '../../services/help-content.service'; |
4 |
import {FormArray, FormBuilder, FormControl, FormGroup, Validators} from '@angular/forms';
|
|
4 |
import {FormArray, FormBuilder, FormGroup, Validators} from '@angular/forms'; |
|
5 | 5 |
import {CheckPage, Page} from '../../utils/entities/adminTool/page'; |
6 |
import {Portal} from '../../utils/entities/adminTool/portal'; |
|
7 |
import {CheckEntity, Entity} from '../../utils/entities/adminTool/entity'; |
|
6 |
import {Entity} from '../../utils/entities/adminTool/entity'; |
|
8 | 7 |
import {EnvProperties} from '../../utils/properties/env-properties'; |
9 | 8 |
import {Session} from '../../login/utils/helper.class'; |
10 | 9 |
import {LoginErrorCodes} from '../../login/utils/guardHelper.class'; |
11 |
import {HelperFunctions} from '../../utils/HelperFunctions.class'; |
|
12 | 10 |
import {UserManagementService} from '../../services/user-management.service'; |
13 |
import {Observable, Subscriber} from "rxjs"; |
|
14 |
import {map, startWith} from "rxjs/operators"; |
|
15 |
import {MatAutocompleteSelectedEvent} from "@angular/material"; |
|
11 |
import {Subscriber} from "rxjs"; |
|
16 | 12 |
import {PortalUtils} from "../portal/portalHelper"; |
17 | 13 |
import {properties} from "../../../../environments/environment"; |
18 | 14 |
import {ConnectHelper} from "../../connect/connectHelper"; |
19 | 15 |
import {Option} from "../../sharedComponents/input/input.component"; |
20 | 16 |
import {AlertModal} from "../../utils/modal/alert"; |
21 | 17 |
|
18 |
declare var UIkit; |
|
19 |
|
|
22 | 20 |
@Component({ |
23 | 21 |
selector: 'pages', |
24 | 22 |
templateUrl: './pages.component.html', |
25 | 23 |
}) |
26 |
|
|
27 | 24 |
export class PagesComponent implements OnInit { |
28 | 25 |
|
29 | 26 |
@ViewChild('editModal') editModal: AlertModal; |
... | ... | |
100 | 97 |
this.isPortalAdministrator = Session.isPortalAdministrator(user) && !this.portal; |
101 | 98 |
})); |
102 | 99 |
})); |
103 |
|
|
104 | 100 |
this.subscriptions.push(this._helpContentService.getEntities(this.properties.adminToolsAPIURL).subscribe( |
105 | 101 |
entities => { |
106 | 102 |
this.allEntities = []; |
... | ... | |
110 | 106 |
value: entity |
111 | 107 |
}); |
112 | 108 |
}); |
113 |
this.showLoading = false; |
|
114 | 109 |
}, |
115 | 110 |
error => this.handleError('System error retrieving pages', error))); |
116 | 111 |
|
... | ... | |
139 | 134 |
this.showLoading = true; |
140 | 135 |
this.updateErrorMessage = ''; |
141 | 136 |
this.errorMessage = ''; |
142 |
|
|
143 | 137 |
this.pageWithDivIds = []; |
144 |
|
|
145 | 138 |
let parameters = ''; |
146 | 139 |
if (this.pagesType) { |
147 | 140 |
parameters = '?page_type=' + this.pagesType; |
... | ... | |
279 | 272 |
this.subscriptions.push(this._helpContentService.deletePages(this.selectedPages, this.properties.adminToolsAPIURL).subscribe( |
280 | 273 |
_ => { |
281 | 274 |
this.deletePagesFromArray(this.selectedPages); |
275 |
UIkit.notification('Pages have been <b>successfully deleted</b>', { |
|
276 |
status: 'success', |
|
277 |
timeout: 6000, |
|
278 |
pos: 'bottom-right' |
|
279 |
}); |
|
282 | 280 |
this.showLoading = false; |
283 | 281 |
}, |
284 | 282 |
error => this.handleUpdateError('System error deleting the selected pages', error) |
... | ... | |
352 | 350 |
} |
353 | 351 |
|
354 | 352 |
public pageSaveConfirmed(data: any) { |
353 |
this.showLoading = true; |
|
355 | 354 |
if (!Session.isLoggedIn()) { |
356 | 355 |
this._router.navigate(['/user-info'], { |
357 | 356 |
queryParams: { |
... | ... | |
365 | 364 |
this.subscriptions.push(this._helpContentService.savePage(<Page>this.pageForm.value, this.properties.adminToolsAPIURL).subscribe( |
366 | 365 |
page => { |
367 | 366 |
this.pageSavedSuccessfully(page, true); |
367 |
UIkit.notification('Page <b>' + page.name + '</b> has been <b>successfully created</b>', { |
|
368 |
status: 'success', |
|
369 |
timeout: 6000, |
|
370 |
pos: 'bottom-right' |
|
371 |
}); |
|
368 | 372 |
}, |
369 | 373 |
error => this.handleUpdateError('System error creating page', error) |
370 | 374 |
)); |
... | ... | |
373 | 377 |
this.subscriptions.push(this._helpContentService.updatePage(<Page>this.pageForm.value, this.properties.adminToolsAPIURL).subscribe( |
374 | 378 |
page => { |
375 | 379 |
this.pageSavedSuccessfully(page, false); |
380 |
UIkit.notification('Page <b>' + page.name + '</b> has been <b>successfully updated</b>', { |
|
381 |
status: 'success', |
|
382 |
timeout: 6000, |
|
383 |
pos: 'bottom-right' |
|
384 |
}); |
|
376 | 385 |
}, |
377 | 386 |
error => this.handleUpdateError('System error updating page', error) |
378 | 387 |
)); |
... | ... | |
389 | 398 |
} |
390 | 399 |
this.applyFilters(); |
391 | 400 |
this.applyCheck(false); |
401 |
this.showLoading = false; |
|
392 | 402 |
} |
393 | 403 |
|
394 | 404 |
public applyFilters() { |
... | ... | |
440 | 450 |
this.updateErrorMessage = message;// + ' (Server responded: ' + error + ')'; |
441 | 451 |
console.log('Server responded: ' + error); |
442 | 452 |
} |
443 |
|
|
453 |
UIkit.notification('An error has occurred. Please try again later', { |
|
454 |
status: 'danger', |
|
455 |
timeout: 6000, |
|
456 |
pos: 'bottom-right' |
|
457 |
}); |
|
444 | 458 |
this.showLoading = false; |
445 | 459 |
} |
446 | 460 |
|
461 |
public getEntitiesAsString(page: Page): string { |
|
462 |
if(page.entities) { |
|
463 |
return (<any[]> page.entities).map((page: Entity) => page.name).join(','); |
|
464 |
} |
|
465 |
return ''; |
|
466 |
} |
|
467 |
|
|
447 | 468 |
// public filterByPortal(event: any) { |
448 | 469 |
// this.portal = event.target.value; |
449 | 470 |
// this.applyPortalFilter(this.portal); |
modules/uoa-services-library/trunk/ng-openaire-library/src/app/dashboard/page/pages.module.ts | ||
---|---|---|
14 | 14 |
import {IconsModule} from "../../utils/icons/icons.module"; |
15 | 15 |
import {IconsService} from "../../utils/icons/icons.service"; |
16 | 16 |
import {add} from "../../utils/icons/icons"; |
17 |
import {LoadingModule} from "../../utils/loading/loading.module"; |
|
17 | 18 |
|
18 | 19 |
@NgModule({ |
19 | 20 |
imports: [ |
20 | 21 |
CommonModule, RouterModule, FormsModule, AlertModalModule, ReactiveFormsModule, MatSlideToggleModule, AdminToolServiceModule, InputModule, |
21 |
MatAutocompleteModule, MatFormFieldModule, MatChipsModule, AdminTabsModule, PageContentModule, PagesRoutingModule, SearchInputModule, IconsModule |
|
22 |
MatAutocompleteModule, MatFormFieldModule, MatChipsModule, AdminTabsModule, PageContentModule, PagesRoutingModule, SearchInputModule, IconsModule, LoadingModule
|
|
22 | 23 |
], |
23 | 24 |
declarations: [PagesComponent], |
24 | 25 |
exports: [PagesComponent] |
Also available in: Unified diff
[Library | Trunk]: Admin tools pages add loading and notifications