Revision 60331
Added by Konstantinos Triantafyllou about 3 years ago
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 |
|
Also available in: Unified diff
[Library | Trunk]: Admin tools pages add loading and notifications