ConnectionStringEditorPane.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. "use strict";
  2. /**
  3. * Licensed Materials - Property of IBM
  4. * IBM Cognos Products: Cognos Analytics
  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/nls/StringResource', 'bi/commons/ui/properties/PropertyUIControl'], function (BasePane, StringResource, PropertyUIControl) {
  10. /**
  11. * Sample content view that extends the glass View class
  12. */
  13. var ConnectionStringEditorPane = BasePane.extend({
  14. init: function init(options) {
  15. ConnectionStringEditorPane.inherited('init', this, arguments);
  16. $.extend(this, options);
  17. this.connectionType = options.connectionType;
  18. var sText = StringResource.get('connectionInformationTitle', {
  19. 'connType': this.parseInfo.metadata.title
  20. });
  21. this.title = sText;
  22. this.slideout.$el.addClass('connection-string-editor-pane');
  23. },
  24. isEditable: function isEditable() {
  25. return this.objectInfo.permissions && this.objectInfo.permissions.indexOf("write") !== -1;
  26. },
  27. _getNewPropertyUIControl: function _getNewPropertyUIControl(options) {
  28. return new PropertyUIControl(options);
  29. },
  30. _renderBody: function _renderBody(propOptions) {
  31. this.addFooterItems(propOptions);
  32. this._propertyUIControl = this._getNewPropertyUIControl(propOptions);
  33. return this._propertyUIControl.render().then(this._postRender.bind(this));
  34. },
  35. _postRender: function _postRender() {},
  36. closeClick: function closeClick() {
  37. this.slideout.hide({
  38. force: true
  39. });
  40. },
  41. addFooterItems: function addFooterItems(propOptions) {
  42. propOptions.items.push({
  43. 'type': 'Footer',
  44. 'items': [{
  45. 'type': 'Button',
  46. 'id': 'editConnectionCloseButton',
  47. 'label': StringResource.get('close'),
  48. 'onSelect': this.closeClick.bind(this),
  49. 'primary': true
  50. }]
  51. });
  52. },
  53. getPropertyUIControl: function getPropertyUIControl() {
  54. return this._propertyUIControl;
  55. }
  56. });
  57. return ConnectionStringEditorPane;
  58. });