diff --git a/public/js/components/Dashboard/Admin.js b/public/js/components/Dashboard/Admin.js index 8921400b8..e554dd905 100644 --- a/public/js/components/Dashboard/Admin.js +++ b/public/js/components/Dashboard/Admin.js @@ -33,33 +33,32 @@ export default { methods: { dashboardAdd() { let _name = ''; - BsPrompt.popup('New Dashboard name').then( - name => { - _name = name; + BsPrompt + .popup('New Dashboard name') + .then(dashboard_kurzbz => { const params = { - dashboard_kurzbz: name + dashboard_kurzbz }; return this.$api .call(ApiDashboardBoard.add(params)) - .then(response =>{ + .then(response => { this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSave')); let newDashboard = { dashboard_id: response.data, - dashboard_kurzbz: _name, + dashboard_kurzbz, beschreibung: '' }; this.dashboards.push(newDashboard); this.current = newDashboard.dashboard_id; }) .catch(this.$fhcAlert.handleSystemError); - }); + }); }, dashboardUpdate(dashboard) { - return this.$api + this.$api .call(ApiDashboardBoard.update(dashboard)) .then(response => { - this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSave')); let old = this.dashboards.find(el => el.dashboard_id == dashboard.dashboard_id); @@ -69,10 +68,11 @@ export default { .catch(this.$fhcAlert.handleSystemError); }, dashboardDelete(dashboard_id) { - return this.$api + this.$api .call(ApiDashboardBoard.delete(dashboard_id)) .then(response => { this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successDelete')); + this.current = -1; this.dashboards = this.dashboards.filter(el => el.dashboard_id != dashboard_id); }) @@ -90,37 +90,100 @@ export default { }) .catch(this.$fhcAlert.handleSystemError); }, - template: `