Modular logistics and supply chain operating system (LSOS)
JavaScript driver-appfleet-managementfreight-managementinfrastructureinventory-managementlast-mile-deliverylogisticsondemandopen-sourceorder-managementroute-optimizationsupply-chain-managementtracking-and-monitoringtransport-management-systemtransportationwarehouse-management
Refactor widget position update logic
Turtuvshinf42de06dcf2f
diff --git a/console/app/components/dashboard/create.js b/console/app/components/dashboard/create.jsindex b0326af6..fe988c80 100644--- a/console/app/components/dashboard/create.js+++ b/console/app/components/dashboard/create.js@@ -22,14 +22,27 @@ export default class DashboardCreateComponent extends Component {'dashboard: ',this.args.dashboard.widgets.map((widget) => widget.serialize()));- const widgetEvent = event.detail[0];- const changedWidget = this.args.dashboard.widgets.find((widget) => widget.id === widgetEvent.id);- if (changedWidget) {- const { id, x, y, w, h } = widgetEvent;+ const updatedWidgets = [];++ event.detail.forEach((currentWidgetEvent, index) => {+ const alreadyUpdated = updatedWidgets.find((item) => item.uuid === currentWidgetEvent.id);+ if (alreadyUpdated) {+ return; // Skip updating if already updated+ }++ const changedWidget = this.args.dashboard.widgets.find((widget) => widget.id === currentWidgetEvent.id);+ if (!changedWidget) {+ return;+ }++ const { id, x, y, w, h } = currentWidgetEvent;changedWidget.grid_options = { x, y, w, h };- changedWidget.updatePosition({ id, x, y, h, w });- }+ const response = changedWidget.updatePosition({ id, x, y, h, w });+ if (response) {+ updatedWidgets.push(changedWidget);+ }+ });}@action removeWidget(widget) {