var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var Unibase; (function (Unibase) { let Platform; (function (Platform) { let Dashboards; (function (Dashboards) { let Managers; (function (Managers) { class DashboardManager extends Platform.Core.BaseManager { getDashboardGroups() { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/dashboards/groups'; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result !== null) { response.result = JSON.parse(response.result); } return response; }); }); } getDashboardGroup(DashboardGroupId) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/dashboards/get/' + DashboardGroupId; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result !== null) { response.result = JSON.parse(response.result); } return response; }); }); } getDashboardGroupbyName(DashboardGroupName) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/dashboards/groups/name/' + DashboardGroupName; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result !== null && response.result != "") { response.result = JSON.parse(response.result); } return response; }); }); } saveDashboardGroup(obj) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/dashboards/savedashboardgroup'; return yield this.dataHelper().postAsync(url, obj).then(function (response) { if (response.result !== null) { response.result = JSON.parse(response.result); } return response; }); }); } updateDashboardGroup(obj) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/dashboards/changegroup'; return yield this.dataHelper().postAsync(url, obj).then(function (response) { if (response.result !== null) { response.result = JSON.parse(response.result); } return response; }); }); } deleteDashboardGroup(DashboardGroupId) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/dashboards/deletegroup/groupid/' + DashboardGroupId; return yield this.dataHelper().postAsync(url, "{}").then(function (response) { if (response.result !== null) { response.result = JSON.parse(response.result); } return response; }); }); } unGroupAllandDelete(ItemsArray, ToDeleteGroupId) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/dashboards/deletedashboardgroup/groupid/' + ToDeleteGroupId + '/groupitems/' + ItemsArray; return yield this.dataHelper().postAsync(url, "{}").then(function (response) { if (response.result !== null) { response.result = JSON.parse(response.result); } return response; }); }); } renameGroup(obj) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/dashboards/renamedashboardgroup'; return yield this.dataHelper().postAsync(url, obj).then(function (response) { if (response.result !== null) { response.result = JSON.parse(response.result); } return response; }); }); } setDashboardGroupAsViewable(obj) { return __awaiter(this, void 0, void 0, function* () { var ViewAll = obj.IsExclude; var DashboardGroupId = Number(obj.DashboardGroupId); const url = 'apis/v4/unibase/platform/dashboards/setgroupasviewable/dashboardgroupid/' + DashboardGroupId + '/viewall/' + ViewAll; return yield this.dataHelper().postAsync(url, "{}").then(function (response) { if (response.result !== null) { response.result = JSON.parse(response.result); } return response; }); }); } getDashboards() { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/dashboards/get'; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result !== null) response.result = JSON.parse(response.result); return response; }); }); } getUserDashboards() { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/bizgaze/platform/dashboards/userdashboards'; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result !== null) response.result = JSON.parse(response.result); return response; }); }); } getUnGroupedDashboards() { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/dashboards/ungrouped'; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result !== null) response.result = JSON.parse(response.result); return response; }); }); } saveDashboard(obj) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/dashboards/save'; return yield this.dataHelper().postAsync(url, obj).then(function (response) { if (response.result !== null) response.result = JSON.parse(response.result); return response; }); }); } deleteDashboard(DashboardId) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/dashboards/delete/dashboardid/' + DashboardId; return yield this.dataHelper().postAsync(url, "{}").then(function (response) { if (response.result !== null) response.result = JSON.parse(response.result); return response; }); }); } getDashboardsByInstalledApp(installedAppId) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/dashboards/getdashboards/installedappid/' + installedAppId; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result !== null) { response.result = JSON.parse(response.result); } return response; }); }); } getDashboard(DashboardId) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/dashboards/getdashboard/dashboardid/' + DashboardId; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result !== null) { response.result = JSON.parse(response.result); } return response; }); }); } getDashboardsByGroup(groupId) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/dashboards/getdashboardsbygroup/groupid/' + groupId; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result !== null) { response.result = JSON.parse(response.result); } return response; }); }); } trackDashboard(obj) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/dashboards/track'; return yield this.dataHelper().postAsync(url, obj).then(function (response) { if (response.result !== null) { response.result = JSON.parse(response.result); } return response; }); }); } getDashboardRolesByGroup(DashboardGroupId) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/dashboards/getdashboardgroupprole/dashboardgroupid/' + DashboardGroupId; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result !== null) { response.result = JSON.parse(response.result); } return response; }); }); } getRolesList() { return __awaiter(this, void 0, void 0, function* () { let term; if (term == "") { term = undefined; } const url = 'apis/v4/unibase/platform/roles/get/term/' + term; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result !== null) { response.result = JSON.parse(response.result); } return response; }); }); } saveDashboardGroupRole(obj) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/dashboards/savedashboardgrouprole'; return yield this.dataHelper().postAsync(url, obj).then(function (response) { if (response.result !== null) { response.result = JSON.parse(response.result); } return response; }); }); } removeDashboardGroupRole(obj) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/dashboards/deletedashboardgrouprole/dashboardgroupid/' + obj.DashboardGroupId + '/roleid/' + obj.RoleId; return yield this.dataHelper().postAsync(url, "{}").then(function (response) { if (response.result !== null) { response.result = JSON.parse(response.result); } return response; }); }); } getDashboardRoles(DashboardId) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/dashboards/dashboardroles/dashboardid/' + DashboardId; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result !== null) { response.result = JSON.parse(response.result); } return response; }); }); } addViewRole(obj) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/dashboards/savedashboardrole'; return yield this.dataHelper().postAsync(url, obj).then(function (response) { if (response.result !== null) { response.result = JSON.parse(response.result); } return response; }); }); } removeViewRole(obj) { return __awaiter(this, void 0, void 0, function* () { let DashboardId = obj.DashboardId; let roleId = obj.RoleId; const url = 'apis/v4/unibase/platform/dashboards/deletedashboardrole/dashboardid/' + DashboardId + '/roleid/' + roleId; return yield this.dataHelper().postAsync(url, "{}").then(function (response) { if (response.result !== null) { response.result = JSON.parse(response.result); } return response; }); }); } exportDashboard() { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/apps/exportdashboardportlets'; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result != null) { } return response; }); }); } setDashboardAsViewable(DashboardId, viewable) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/dashboards/setdashboardasviewable/dashboardid/' + DashboardId + '/viewall/' + viewable; return yield this.dataHelper().postAsync(url, "{}").then(function (response) { if (response.result !== null) { response.result = JSON.parse(response.result); } return response; }); }); } saveAllDashboardSetting(obj) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/dashboards/savedashboardsettings/List'; return yield this.dataHelper().postAsync(url, obj).then(function (response) { if (response.result !== null) { response.result = JSON.parse(response.result); } return response; }); }); } exportDashboardByDashboardId(dashboardid) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/apps/exportdashboardportlet/dashboardgroupid/' + dashboardid; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result != null) { } return response; }); }); } exportPortlet(portletId) { return __awaiter(this, void 0, void 0, function* () { const url = 'apis/v4/unibase/platform/portlets/exportportlet/PortletId/' + portletId; return yield this.dataHelper().getAsync(url).then(function (response) { if (response.result != null) { } return response; }); }); } static Instance() { if (this._instance === undefined) this._instance = new DashboardManager(); return this._instance; } } Managers.DashboardManager = DashboardManager; })(Managers = Dashboards.Managers || (Dashboards.Managers = {})); })(Dashboards = Platform.Dashboards || (Platform.Dashboards = {})); })(Platform = Unibase.Platform || (Unibase.Platform = {})); })(Unibase || (Unibase = {}));