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
Add delete functionality to dashboard component
Turtuvshinc96a3eb2bff1
diff --git a/console/app/components/dashboard.hbs b/console/app/components/dashboard.hbsindex c7be241c..a25281e0 100644--- a/console/app/components/dashboard.hbs+++ b/console/app/components/dashboard.hbs@@ -41,6 +41,13 @@</div><span>Add widgets</span></a>++ <a href="javascript:;" class="next-dd-item" {{on "click" (dropdown-fn dd this.deleteDashboard this.currentDashboard)}}>+ <div class="w-6">+ <FaIcon @icon="trash" />+ </div>+ <span>Delete dashboard</span>+ </a></div></div></DropdownButton>diff --git a/console/app/components/dashboard.js b/console/app/components/dashboard.jsindex 5e3c67d0..455f6d8a 100644--- a/console/app/components/dashboard.js+++ b/console/app/components/dashboard.js@@ -87,4 +87,39 @@ export default class DashboardComponent extends Component {...options,});}++ @action deleteDashboard(dashboard, options = {}) {+ this.modalsManager.confirm({+ title: `Are you sure to delete this ${dashboard.name}?`,+ confirm: (modal) => {+ if (typeof options.onConfirm === 'function') {+ options.onConfirm(model);+ }++ modal.startLoading();++ return dashboard+ .destroyRecord()+ .then((model) => {+ this.notifications.success(options.successNotification || `${dashboard.name} has been deleted.`);+ if (typeof options.onSuccess === 'function') {+ options.onSuccess(model);+ }+ })+ .catch((error) => {+ this.notifications.serverError(error);++ if (typeof options.onError === 'function') {+ options.onError(error, model);+ }+ })+ .finally(() => {+ if (typeof options.callback === 'function') {+ options.callback(this.currentDashboard);+ }+ });+ },+ ...options,+ });+ }}