From 2a3fe4653a3cfbdabe64aed3b0c23b20c418c8f5 Mon Sep 17 00:00:00 2001 From: Johanna England Date: Thu, 21 Nov 2024 15:30:43 +0100 Subject: [PATCH] Hide "Delete dashboard" button for default dashboard --- python/nav/web/static/js/src/webfront.js | 4 +++- python/nav/web/templates/webfront/index.html | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/python/nav/web/static/js/src/webfront.js b/python/nav/web/static/js/src/webfront.js index ae36bb173a..a2ddaa2e8c 100644 --- a/python/nav/web/static/js/src/webfront.js +++ b/python/nav/web/static/js/src/webfront.js @@ -210,7 +210,8 @@ require([ function addDefaultDashboardListener(feedback) { var defaultDashboardContainer = $('#default-dashboard-container'), setDefaultDashboardForm = $('#form-set-default-dashboard'), - isDefaultDashboardAlert = defaultDashboardContainer.find('.alert-box'); + isDefaultDashboardAlert = defaultDashboardContainer.find('.alert-box'), + deleteDashboardForm = $('#form-delete-dashboard'); if (defaultDashboardContainer.data('is-default-dashboard')) { setDefaultDashboardForm.hide(); @@ -226,6 +227,7 @@ require([ feedback.addFeedback(responseText); setDefaultDashboardForm.hide(); isDefaultDashboardAlert.show(); + deleteDashboardForm.hide(); $dashboardNavigator.find('.fa-star').addClass('hidden'); $dashboardNavigator.find('.current .fa-star').removeClass('hidden'); }); diff --git a/python/nav/web/templates/webfront/index.html b/python/nav/web/templates/webfront/index.html index 9e71e96999..01d42e9bdf 100644 --- a/python/nav/web/templates/webfront/index.html +++ b/python/nav/web/templates/webfront/index.html @@ -144,7 +144,7 @@

Import dashboard

- {% if request.account.account_dashboards.count > 1 %} + {% if request.account.account_dashboards.count > 1 and not dashboard.is_default %}