StorageDetailsTab.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. "use strict";
  2. /**
  3. * Licensed Materials - Property of IBM
  4. * IBM Cognos Products: admin
  5. * Copyright IBM Corp. 2019
  6. * US Government Users Restricted Rights - Use, duplication or disclosure
  7. * restricted by GSA ADP Schedule Contract with IBM Corp.
  8. */
  9. define(['underscore', 'bi/glass/app/ContentView', 'bi/admin/nls/StringResource', 'react-dom', 'react', 'mobx', 'ba-react-admin/ba-react-admin.min'], function (_, ContentView, StringResource, ReactDOM, React, mobx, AdminReact) {
  10. 'use strict'; //NOSONAR: meant to be strict
  11. var StorageDetailsTab = ContentView.extend({
  12. init: function init(options) {
  13. StorageDetailsTab.inherited('init', this, arguments);
  14. _.extend(this, options);
  15. },
  16. setFocus: function setFocus() {},
  17. render: function render() {
  18. this.$el.addClass('reactStorageDetails');
  19. ReactDOM.unmountComponentAtNode(this.$el[0]);
  20. this.storageDetailsView = React.createElement(AdminReact.StorageDetailsView, {
  21. 'glassContext': this.glassContext,
  22. 'slideout': this.slideout,
  23. 'StringResource': StringResource,
  24. 'objectInfo': this.objectInfo,
  25. 'parent': this
  26. });
  27. ReactDOM.render(this.storageDetailsView, this.$el[0]);
  28. if (this.slideout.contentView) {
  29. this.slideout.contentView.canHide = this._canHide.bind(this);
  30. }
  31. return Promise.resolve();
  32. },
  33. _canHide: function _canHide() {
  34. var propertyUIControl = this.slideout.contentView.getPropertyUIControl();
  35. return propertyUIControl.onClose().then(function () {
  36. return !propertyUIControl.hasValidationError();
  37. }.bind(this));
  38. },
  39. onClose: function onClose() {
  40. StorageDetailsTab.inherited('onClose', this, arguments);
  41. if (this.$el[0]) {
  42. ReactDOM.unmountComponentAtNode(this.$el[0]);
  43. }
  44. }
  45. });
  46. return StorageDetailsTab;
  47. });