TenantsListPaneLegacy.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. "use strict";
  2. /**
  3. * Licensed Materials - Property of IBM
  4. * IBM Cognos Products: admin
  5. * Copyright IBM Corp. 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/multitenancy/views/TenantsListView', 'bi/admin/nls/StringResource'], function (BasePane, TenantsListView, StringResource) {
  10. /**
  11. * Sample content view that extends the glass View class
  12. *
  13. */
  14. var TenantsListPane = BasePane.extend({
  15. init: function init(options) {
  16. TenantsListPane.inherited('init', this, arguments);
  17. $.extend(this, options);
  18. this.title = StringResource.get('multitenancy');
  19. this.enableTenantMenuItem = false;
  20. },
  21. _getNewTenantsListView: function _getNewTenantsListView(spec) {
  22. return new TenantsListView(spec);
  23. },
  24. renderBody: function renderBody($body) {
  25. this.listView = this._getNewTenantsListView({
  26. glassContext: this.glassContext,
  27. el: $body,
  28. showAddButton: true,
  29. showListHeader: true,
  30. slideout: this.slideout,
  31. parent: this
  32. });
  33. this._bindEvents();
  34. return this.listView.render();
  35. },
  36. _bindEvents: function _bindEvents() {
  37. this.listView.on('addItem', function () {
  38. if (this.slideout.child) {
  39. this.slideout.child.hide();
  40. }
  41. this.openSlideout();
  42. }.bind(this));
  43. this.slideout.$el.on('com.ibm.bi.multitenant.properties', function (e, data) {
  44. this.listView.doSetProperties(data);
  45. }.bind(this));
  46. },
  47. openSlideout: function openSlideout(tenant) {
  48. this.glassContext.appController.showSlideOut({
  49. parent: this.slideout,
  50. content: {
  51. module: 'bi/admin/multitenancy/slideout/TenantsDetailPane',
  52. id: 'TenantsDetailPane',
  53. tenant: tenant
  54. }
  55. });
  56. },
  57. reOpenSlideout: function reOpenSlideout() {
  58. this.glassContext.appController.showSlideOut({
  59. parent: this.slideout.parent,
  60. overlay: true,
  61. width: "400px",
  62. label: this.title,
  63. content: {
  64. module: "bi/admin/multitenancy/slideout/TenantsListPane",
  65. id: 'TenantsListPane',
  66. title: this.title,
  67. showGobackButton: true
  68. }
  69. });
  70. },
  71. reload: function reload() {
  72. this.$body.empty();
  73. this.render();
  74. }
  75. });
  76. return TenantsListPane;
  77. });