MSASConnectionStringPane.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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/datasource/slideout/ConnectionStringEditorPane', 'bi/admin/nls/StringResource', 'jquery'], function (ConnectionStringEditorPane, StringResource, $) {
  10. /**
  11. * Sample content view that extends the glass View class
  12. */
  13. var MSASConnectionStringPane = ConnectionStringEditorPane.extend({
  14. _languageHelpLink: 'https://www.ibm.com/support/knowledgecenter/SSEP7J_11.1.0/com.ibm.swg.ba.cognos.ag_manage.doc/c_data_server_language_parameter.html',
  15. init: function init(options) {
  16. MSASConnectionStringPane.inherited('init', this, arguments);
  17. $.extend(this, options);
  18. if (!this.parseInfo.languageVal) {
  19. this.parseInfo.languageVal = 'en-us';
  20. }
  21. },
  22. renderBody: function renderBody($body) {
  23. var items = [{
  24. 'name': 'msasVersion',
  25. 'label': StringResource.get('msasType'),
  26. 'defaultValue': this.parseInfo.msasVersion,
  27. 'type': 'DropDown',
  28. 'readOnly': !this.isEditable(),
  29. 'multiline': true,
  30. 'options': [{
  31. label: 'HTTP XMLA',
  32. value: 'X8'
  33. }, {
  34. label: '2019',
  35. value: 'M19'
  36. }, {
  37. label: '2017',
  38. value: 'M17'
  39. }, {
  40. label: '2016',
  41. value: 'M16'
  42. }, {
  43. label: '2014',
  44. value: 'M14'
  45. }, {
  46. label: '2012',
  47. value: 'M12'
  48. }],
  49. 'onChange': this._toggleNamedInstance.bind(this)
  50. }, {
  51. 'name': 'serverUrl',
  52. 'label': StringResource.get('serverUrl'),
  53. 'value': this.parseInfo.serverUrl,
  54. 'type': 'TextArea',
  55. 'multiline': true,
  56. 'ellipses': true,
  57. 'editable': this.isEditable(),
  58. 'onChange': function (name, value) {
  59. this.parseInfo.serverUrl = value;
  60. }.bind(this)
  61. }, {
  62. 'name': 'language',
  63. 'label': StringResource.get('language'),
  64. 'value': this.parseInfo.languageVal,
  65. 'type': 'TextArea',
  66. 'multiline': true,
  67. 'ellipses': false,
  68. 'editable': this.isEditable(),
  69. 'onChange': function (name, value) {
  70. this.parseInfo.languageVal = value;
  71. }.bind(this)
  72. }, {
  73. 'name': 'namedInstance',
  74. 'label': StringResource.get('namedInstance'),
  75. 'value': this.parseInfo.namedInstance,
  76. 'type': 'TextArea',
  77. 'multiline': true,
  78. 'ellipses': true,
  79. 'editable': this.isEditable(),
  80. 'onChange': function (name, value) {
  81. this.parseInfo.namedInstance = value;
  82. }.bind(this)
  83. }];
  84. return this._renderBody({
  85. 'el': this.$el.find(".bi-admin-pane-body"),
  86. 'glassContext': this.glassContext,
  87. 'name': 'MSASConnectionSettings',
  88. 'items': items
  89. }).then(this._toggleNamedInstance.bind(this, null, this.parseInfo.msasVersion));
  90. },
  91. _addLanguageHelp: function _addLanguageHelp() {
  92. var $languageHelp = $(this.$el.find('.l_language'));
  93. $languageHelp.css('display', 'inline-flex');
  94. var $helpEl = $('<div tabindex="0" style="padding-left: 10px;" role="img" title="' + StringResource.get('learnMore') + '"><svg class="svgIcon dsSvgInfoIcon" role="presentation"><text>' + StringResource.get('learnMore') + '</text><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#common-titan_help"></use></svg></div>');
  95. $helpEl.on('primaryaction', function () {
  96. window.open(this._languageHelpLink, '_blank');
  97. }.bind(this));
  98. $languageHelp.append($helpEl);
  99. },
  100. _postRender: function _postRender() {
  101. this._addLanguageHelp();
  102. return this.$el;
  103. },
  104. setFocus: function setFocus() {
  105. $('textarea.v_serverUrl').focus();
  106. },
  107. _toggleNamedInstance: function _toggleNamedInstance(name, value) {
  108. this.parseInfo.msasVersion = value;
  109. var prop = this._propertyUIControl.getProperty('namedInstance');
  110. if (!value || value === 'X8') {
  111. prop.getHTMLControl().val('');
  112. prop.disable();
  113. } else {
  114. prop.enable();
  115. }
  116. }
  117. });
  118. return MSASConnectionStringPane;
  119. });