diff --git a/public/js/api/factory/dashboard/board.js b/public/js/api/factory/dashboard/board.js new file mode 100644 index 000000000..b5e9b5be3 --- /dev/null +++ b/public/js/api/factory/dashboard/board.js @@ -0,0 +1,46 @@ +/** + * Copyright (C) 2026 fhcomplete.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +export default { + list() { + return { + method: 'get', + url: 'api/frontend/v1/dashboard/board/list' + }; + }, + add(params) { + return { + method: 'post', + url: 'api/frontend/v1/dashboard/board/create', + params + }; + }, + update(params) { + return { + method: 'post', + url: 'api/frontend/v1/dashboard/board/update', + params + }; + }, + delete(dashboard_id) { + return { + method: 'post', + url: 'api/frontend/v1/dashboard/board/delete', + params: { dashboard_id } + }; + } +} \ No newline at end of file diff --git a/public/js/api/factory/dashboard/dashboardAdmin.js b/public/js/api/factory/dashboard/dashboardAdmin.js deleted file mode 100644 index edc53ff02..000000000 --- a/public/js/api/factory/dashboard/dashboardAdmin.js +++ /dev/null @@ -1,72 +0,0 @@ -/* -* This program is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ - -export default { - getAllDashboards() { - return { - method: 'get', - url: 'api/frontend/v1/dashboard/board/list' - }; - }, - addDashboard(params) { - return { - method: 'post', - url: 'api/frontend/v1/dashboard/board/create', - params - }; - }, - updateDashboard(params) { - return { - method: 'post', - url: 'api/frontend/v1/dashboard/board/update', - params - }; - }, - deleteDashboard(dashboard_id) { - return { - method: 'post', - url: 'api/frontend/v1/dashboard/board/delete', - params: { dashboard_id } - }; - }, - loadFunktionen(dashboard_kurzbz) { - return { - method: 'get', - url: 'api/frontend/v1/dashboard/preset/list/' - + encodeURIComponent(dashboard_kurzbz) - }; - }, - presetBatch(params) { - return { - method: 'post', - url: 'api/frontend/v1/dashboard/preset/getBatch', - params - }; - }, - addWidgetsToPreset(params) { - return { - method: 'post', - url: 'api/frontend/v1/dashboard/preset/addWidget', - params - }; - }, - removeWidgetFromPreset(params) { - return { - method: 'post', - url: 'api/frontend/v1/dashboard/preset/removeWidget', - params - }; - } -} \ No newline at end of file diff --git a/public/js/api/factory/dashboard/preset.js b/public/js/api/factory/dashboard/preset.js new file mode 100644 index 000000000..3f380581e --- /dev/null +++ b/public/js/api/factory/dashboard/preset.js @@ -0,0 +1,47 @@ +/** + * Copyright (C) 2026 fhcomplete.org + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +export default { + list(dashboard_kurzbz) { + return { + method: 'get', + url: 'api/frontend/v1/dashboard/preset/list/' + + encodeURIComponent(dashboard_kurzbz) + }; + }, + getBatch(params) { + return { + method: 'post', + url: 'api/frontend/v1/dashboard/preset/getBatch', + params + }; + }, + addWidget(params) { + return { + method: 'post', + url: 'api/frontend/v1/dashboard/preset/addWidget', + params + }; + }, + removeWidget(params) { + return { + method: 'post', + url: 'api/frontend/v1/dashboard/preset/removeWidget', + params + }; + } +}; \ No newline at end of file diff --git a/public/js/components/Dashboard/Admin.js b/public/js/components/Dashboard/Admin.js index d2e8292ec..ff117a956 100644 --- a/public/js/components/Dashboard/Admin.js +++ b/public/js/components/Dashboard/Admin.js @@ -3,7 +3,7 @@ import DashboardAdminEdit from "./Admin/Edit.js"; import DashboardAdminWidgets from "./Admin/Widgets.js"; import DashboardAdminPresets from "./Admin/Presets.js"; -import ApiDashboardAdmin from "../../api/factory/dashboard/dashboardAdmin.js"; +import ApiDashboardBoard from "../../api/factory/dashboard/board.js"; import ApiDashboardWidget from "../../api/factory/dashboard/widget.js"; export default { @@ -41,7 +41,7 @@ export default { dashboard_kurzbz: name }; return this.$api - .call(ApiDashboardAdmin.addDashboard(params)) + .call(ApiDashboardBoard.add(params)) .then(response =>{ this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSave')); @@ -58,7 +58,7 @@ export default { }, dashboardUpdate(dashboard) { return this.$api - .call(ApiDashboardAdmin.updateDashboard(dashboard)) + .call(ApiDashboardBoard.update(dashboard)) .then(response =>{ this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSave')); @@ -71,7 +71,7 @@ export default { }, dashboardDelete(dashboard_id) { return this.$api - .call(ApiDashboardAdmin.deleteDashboard(dashboard_id)) + .call(ApiDashboardBoard.delete(dashboard_id)) .then(response => { this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successDelete')); @@ -92,7 +92,7 @@ export default { }, created() { this.$api - .call(ApiDashboardAdmin.getAllDashboards()) + .call(ApiDashboardBoard.list()) .then(result => { this.dashboards = result.data.retval; for (const dashboard of this.dashboards) { diff --git a/public/js/components/Dashboard/Admin/Presets.js b/public/js/components/Dashboard/Admin/Presets.js index 88584cc03..ef1c06e00 100644 --- a/public/js/components/Dashboard/Admin/Presets.js +++ b/public/js/components/Dashboard/Admin/Presets.js @@ -1,7 +1,7 @@ import DashboardSection from "../Section.js"; import DashboardWidgetPicker from "../Widget/Picker.js"; import ObjectUtils from "../../../helpers/ObjectUtils.js"; -import ApiDashboardAdmin from "../../../api/factory/dashboard/dashboardAdmin.js"; +import ApiDashboardPreset from "../../../api/factory/dashboard/preset.js"; export default { components: { @@ -43,7 +43,7 @@ export default { }; return this.$api - .call(ApiDashboardAdmin.addWidgetsToPreset(params)) + .call(ApiDashboardPreset.addWidget(params)) .then(result => { let newId = result.data; widget.id = newId; @@ -84,7 +84,7 @@ export default { this.$api .call(Object.entries(payload).map(([key, widget]) => [ key, - ApiDashboardAdmin.addWidgetsToPreset({ + ApiDashboardPreset.addWidget({ dashboard: this.dashboard, funktion_kurzbz: section_name, widget @@ -113,7 +113,7 @@ export default { widgetid: id }; return this.$api - .call(ApiDashboardAdmin.removeWidgetFromPreset(params)) + .call(ApiDashboardPreset.removeWidget(params)) .then(result => { this.sections.forEach(section => { if (section.name == section_name) @@ -133,7 +133,7 @@ export default { }; return this.$api - .call(ApiDashboardAdmin.presetBatch(params)) + .call(ApiDashboardPreset.getBatch(params)) .then(result => { if (this.tmpLoading !== funktionen.join('###')) return; // NOTE(chris): prevent race condition @@ -155,7 +155,7 @@ export default { }, loadFunktionen() { this.$api - .call(ApiDashboardAdmin.loadFunktionen(this.dashboard)) + .call(ApiDashboardPreset.list(this.dashboard)) .then(result => { this.funktionen = result.data; })