ContentPane.js 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. "use strict";
  2. /**
  3. * Licensed Materials - Property of IBM
  4. * IBM Cognos Products: admin
  5. * Copyright IBM Corp. 2015, 2017
  6. * US Government Users Restricted Rights - Use, duplication or disclosure
  7. * restricted by GSA ADP Schedule Contract with IBM Corp.
  8. */
  9. define(['bi/admin/common/slideout/BasePane', 'bi/admin/system/services/ApiSvc', 'bi/commons/ui/properties/PropertyUIControl', 'bi/admin/nls/StringResource'], function (BasePane, ApiSvc, PropertyUIControl, StringResource) {
  10. var ContentPane = BasePane.extend({
  11. init: function init(options) {
  12. ContentPane.inherited('init', this, arguments);
  13. $.extend(this, options);
  14. ApiSvc.glassContext = this.glassContext;
  15. },
  16. renderBody: function renderBody($body) {
  17. return Promise.try(function () {
  18. return ApiSvc.getBackupList().fail(function (dfd, jqXHR) {
  19. this.logger.error(jqXHR);
  20. }.bind(this));
  21. }.bind(this)).catch(function () {
  22. this.glassContext.appController.showToast(StringResource.get('getBackupListFail'), {
  23. type: 'error'
  24. });
  25. return {
  26. data: []
  27. };
  28. }.bind(this)).then(function (data) {
  29. var tabControlItems = [{
  30. name: StringResource.get('backup'),
  31. module: 'bi/admin/system/BackupTab',
  32. parentView: this.slideout,
  33. items: data.data
  34. }, {
  35. name: StringResource.get('restore'),
  36. module: 'bi/admin/system/RestoreTab',
  37. parentView: this.slideout,
  38. items: data.data
  39. }]; // fix the issue that cannot scroll to bottom of the pane
  40. $body.addClass('bi-admin-noscroll');
  41. var $content = $('<div>');
  42. $content.addClass('bi-admin-fullheight');
  43. $body.append($content);
  44. this._oPropertyUIControl = this._getNewPropUIControl({
  45. 'glassContext': this.glassContext,
  46. 'el': $content,
  47. 'items': [{
  48. 'type': 'TabControl',
  49. 'items': tabControlItems
  50. }]
  51. });
  52. return this._oPropertyUIControl.render();
  53. }.bind(this));
  54. },
  55. _getNewPropUIControl: function _getNewPropUIControl(options) {
  56. return new PropertyUIControl(options);
  57. }
  58. });
  59. return ContentPane;
  60. });