-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDeleteExtension.js
35 lines (32 loc) · 1.2 KB
/
DeleteExtension.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
function DeleteDashboardExtension(wrapper) {
this._dashboarControl = wrapper.GetDashboardControl();
this._performRequest = wrapper.PerformDataCallback.bind(wrapper);
this.name = "dxdde-delete-dashboard";
this._menuItem = {
id: this.name,
title: "Delete",
click: this.deleteDashboard.bind(this),
selected: ko.observable(false),
disabled: ko.computed(function () { return !this._dashboarControl.dashboard(); }, this),
index: 113,
hasSeparator: true,
data: this
};
}
DeleteDashboardExtension.prototype.deleteDashboard = function () {
if (this._toolbox) {
if (confirm("Delete this Dashboard?")) {
var dashboardid = this._dashboarControl.getDashboardId();
var param = JSON.stringify({ DashboardID: dashboardid, ExtensionName: this.name });
this._toolbox.menuVisible(false);
this._performRequest(param, (function () { this._dashboarControl.unloadDashboard(); }).bind(this));
}
}
}
DeleteDashboardExtension.prototype.start = function () {
this._toolbox = this._dashboarControl.findExtension('toolbox');
this._toolbox && this._toolbox.menuItems.push(this._menuItem);
};
DeleteDashboardExtension.prototype.stop = function () {
this._toolbox && this._toolbox.menuItems.remove(this._menuItem);
};