Skip to content

Add button to star/unstar dashboards

Miguel Rincon requested to merge 214581-star-dashboard-btn into master

What does this MR do?

Adds a button to "star/unstar" a dashboard. frontend implementation of #214581 (closed)

Note: Pending on backend implementation at: !31316 (merged) and !31892 (merged)

Screenshots

desktop mobile
Screen_Shot_2020-05-11_at_6.45.32_PM Screen_Shot_2020-05-12_at_12.16.49_PM

In action

2020-05-12_18.16.23

Test locally without a backend (not needed anymore)

EDIT: Now that this MR is rebased against the backend update this MR should "just work".

Click here if still want to see the diff 👇

While we wait for the backend to be merged we can test by:

diff --git a/app/assets/javascripts/monitoring/stores/actions.js b/app/assets/javascripts/monitoring/stores/actions.js
index 4481395cbbd..afce782b011 100644
--- a/app/assets/javascripts/monitoring/stores/actions.js
+++ b/app/assets/javascripts/monitoring/stores/actions.js
@@ -356,6 +356,13 @@ export const toggleStarredValue = ({ commit, state, getters }) => {
     return;
   }
 
+  // TODO REMOVE THIS AND REPLACE WITH REAL AXIOS
+  const axios = config => {
+    console.log(config);
+    return new Promise(resolve => setTimeout(resolve, 1000));
+  };
+  // END TODO
+
   const method = selectedDashboard.starred ? 'DELETE' : 'POST';
   const url = selectedDashboard.user_starred_path;
   const newStarredValue = !selectedDashboard.starred;

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by 🤖 GitLab Bot 🤖

Merge request reports