Revision 60666
Added by Konstantinos Triantafyllou about 3 years ago
portals.component.ts | ||
---|---|---|
40 | 40 |
public properties: EnvProperties = null; |
41 | 41 |
|
42 | 42 |
public showLoading = true; |
43 |
public errorMessage = ''; |
|
44 |
public updateErrorMessage = ''; |
|
45 |
public modalErrorMessage = ''; |
|
46 | 43 |
public portalUtils: PortalUtils = new PortalUtils(); |
47 | 44 |
private index: number; |
48 | 45 |
public selectedKeyword: string; |
... | ... | |
89 | 86 |
}); |
90 | 87 |
} else { |
91 | 88 |
this.showLoading = true; |
92 |
this.updateErrorMessage = ''; |
|
93 |
this.errorMessage = ''; |
|
94 |
|
|
95 |
|
|
96 | 89 |
this.subscriptions.push(this._helpContentService.getPortalsFull(this.properties.adminToolsAPIURL).subscribe( |
97 | 90 |
portals => { |
98 | 91 |
this.portals = portals; |
... | ... | |
164 | 157 |
}); |
165 | 158 |
} else { |
166 | 159 |
this.showLoading = true; |
167 |
this.updateErrorMessage = ''; |
|
168 |
|
|
169 | 160 |
this.subscriptions.push(this._helpContentService.deleteCommunities(this.selectedPortals, this.properties.adminToolsAPIURL).subscribe( |
170 | 161 |
_ => { |
171 | 162 |
this.deletePortalsFromArray(this.selectedPortals); |
... | ... | |
192 | 183 |
type: this._fb.control(portal.type, Validators.required), |
193 | 184 |
}); |
194 | 185 |
this.portalForm.get('type').disable(); |
195 |
this.modalErrorMessage = ''; |
|
196 | 186 |
this.portalModalOpen('Edit Portal', 'Save'); |
197 | 187 |
} |
198 | 188 |
|
... | ... | |
207 | 197 |
piwik: this._fb.control(''), |
208 | 198 |
type: this._fb.control('', Validators.required), |
209 | 199 |
}); |
210 |
this.modalErrorMessage = ''; |
|
211 | 200 |
this.portalModalOpen('Create Portal', 'Create'); |
212 | 201 |
} |
213 | 202 |
|
... | ... | |
239 | 228 |
} |
240 | 229 |
}); |
241 | 230 |
} else { |
242 |
this.modalErrorMessage = ''; |
|
243 | 231 |
if (this.portalForm.value._id) { |
244 | 232 |
this.portalForm.get('type').enable(); |
245 | 233 |
this.subscriptions.push(this._helpContentService.updateCommunity(<Portal>this.portalForm.value, |
... | ... | |
313 | 301 |
type: '' |
314 | 302 |
}); |
315 | 303 |
} else { |
316 |
this.updateErrorMessage = message; |
|
304 |
UIkit.notification(message, { |
|
305 |
status: 'danger', |
|
306 |
timeout: 6000, |
|
307 |
pos: 'bottom-right' |
|
308 |
}); |
|
317 | 309 |
console.log('Server responded: ' + error); |
318 | 310 |
} |
319 |
UIkit.notification('An error has occurred. Please try again later', { |
|
311 |
this.showLoading = false; |
|
312 |
} |
|
313 |
|
|
314 |
handleError(message: string, error) { |
|
315 |
UIkit.notification(message, { |
|
320 | 316 |
status: 'danger', |
321 | 317 |
timeout: 6000, |
322 | 318 |
pos: 'bottom-right' |
323 | 319 |
}); |
324 |
this.showLoading = false; |
|
325 |
} |
|
326 |
|
|
327 |
handleError(message: string, error) { |
|
328 |
this.errorMessage = message; |
|
329 | 320 |
console.log('Server responded: ' + error); |
330 | 321 |
this.showLoading = false; |
331 | 322 |
} |
Also available in: Unified diff
[Library | Trunk]: Dashboard: Admin tools pages: Fix no rasults card and loading. Add notifications on actions and errors.