1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-10-24 01:28:52 +02:00
phorge-phorge/webroot/rsrc/js/application/dashboard/behavior-dashboard-async-panel.js
epriestley 82c46f4b93 Update "add panel" and "remove panel" Dashboard flows to the new panel storage format
Summary:
Depends on D20407. Ref T13272. This updates the "add panel" (which has two flavors: "add existing" and "create new") and "remove panel" flows to work with the new duplicate-friendly storage format.

  - We now modify panels by "panelKey", not by panel PHID, so one dashboard may have multiple copies of the same panel and we can still figure out what's going on.
  - We now work with "contextPHID", not "dashboardID", to make some flows with tab panels (or other nested panels in the future) easier.

The only major remaining flow is the Javascript "move panels around with drag-and-drop" flow.

Test Plan:
  - Added panels to a dashboard with "Create New Panel".
  - Added panels to a dashboard with "Add Existing Panel".
  - Removed panels from a dashboard.
  - Added and removed duplicate panels, got a correctly-functioning dashboard that didn't care about duplicates.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13272

Differential Revision: https://secure.phabricator.com/D20408
2019-04-14 10:24:58 -07:00

25 lines
605 B
JavaScript

/**
* @provides javelin-behavior-dashboard-async-panel
* @requires javelin-behavior
* javelin-dom
* javelin-workflow
*/
JX.behavior('dashboard-async-panel', function(config) {
var panel = JX.$(config.panelID);
panel.style.opacity = '0.5';
var data = {
parentPanelPHIDs: config.parentPanelPHIDs.join(','),
headerMode: config.headerMode,
contextPHID: config.contextPHID,
panelKey: config.panelKey
};
new JX.Workflow(config.uri)
.setData(data)
.setHandler(function(r) {
JX.DOM.replace(panel, JX.$H(r.panelMarkup));
})
.start();
});