Skip to content

Modular logistics and supply chain operating system (LSOS)

Add logic to automatically enable edit mode when current dashboard has no widgets

Turtuvshin9669e917abf4
diff --git a/console/app/components/dashboard.js b/console/app/components/dashboard.js
index 81501d11..ad46e982 100644
--- a/console/app/components/dashboard.js
+++ b/console/app/components/dashboard.js
@@ -27,6 +27,9 @@ export default class DashboardComponent extends Component {
if (this.dashboards.length > 0) {
this.currentDashboard = this.dashboards.find((dashboard) => dashboard.is_default) || this.dashboards[0];
+ if (this.currentDashboard?.widgets?.length === 0) {
+ this.onChangeEdit(true);
+ }
console.log('Current Dashboard: ', this.currentDashboard);
}
} catch (error) {
@@ -42,6 +45,10 @@ export default class DashboardComponent extends Component {
this.store.pushPayload(response);
const selectedDashboardId = response.uuid;
this.currentDashboard = this.store.peekRecord('dashboard', selectedDashboardId);
+
+ if (this.currentDashboard?.widgets?.length === 0) {
+ this.onChangeEdit(true);
+ }
})
.finally(() => {
this.isLoading = false;