"use strict"; /** * Licensed Materials - Property of IBM * IBM Cognos Products: Cognos Analytics * Copyright IBM Corp. 2017 * US Government Users Restricted Rights - Use, duplication or disclosure * restricted by GSA ADP Schedule Contract with IBM Corp. */ define(['bi/admin/datasource/slideout/ConnectionStringEditorPane', 'bi/admin/nls/StringResource', 'jquery'], function (ConnectionStringEditorPane, StringResource, $) { /** * Sample content view that extends the glass View class */ var MSASConnectionStringPane = ConnectionStringEditorPane.extend({ _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', init: function init(options) { MSASConnectionStringPane.inherited('init', this, arguments); $.extend(this, options); if (!this.parseInfo.languageVal) { this.parseInfo.languageVal = 'en-us'; } }, renderBody: function renderBody($body) { var items = [{ 'name': 'msasVersion', 'label': StringResource.get('msasType'), 'defaultValue': this.parseInfo.msasVersion, 'type': 'DropDown', 'readOnly': !this.isEditable(), 'multiline': true, 'options': [{ label: 'HTTP XMLA', value: 'X8' }, { label: '2019', value: 'M19' }, { label: '2017', value: 'M17' }, { label: '2016', value: 'M16' }, { label: '2014', value: 'M14' }, { label: '2012', value: 'M12' }], 'onChange': this._toggleNamedInstance.bind(this) }, { 'name': 'serverUrl', 'label': StringResource.get('serverUrl'), 'value': this.parseInfo.serverUrl, 'type': 'TextArea', 'multiline': true, 'ellipses': true, 'editable': this.isEditable(), 'onChange': function (name, value) { this.parseInfo.serverUrl = value; }.bind(this) }, { 'name': 'language', 'label': StringResource.get('language'), 'value': this.parseInfo.languageVal, 'type': 'TextArea', 'multiline': true, 'ellipses': false, 'editable': this.isEditable(), 'onChange': function (name, value) { this.parseInfo.languageVal = value; }.bind(this) }, { 'name': 'namedInstance', 'label': StringResource.get('namedInstance'), 'value': this.parseInfo.namedInstance, 'type': 'TextArea', 'multiline': true, 'ellipses': true, 'editable': this.isEditable(), 'onChange': function (name, value) { this.parseInfo.namedInstance = value; }.bind(this) }]; return this._renderBody({ 'el': this.$el.find(".bi-admin-pane-body"), 'glassContext': this.glassContext, 'name': 'MSASConnectionSettings', 'items': items }).then(this._toggleNamedInstance.bind(this, null, this.parseInfo.msasVersion)); }, _addLanguageHelp: function _addLanguageHelp() { var $languageHelp = $(this.$el.find('.l_language')); $languageHelp.css('display', 'inline-flex'); var $helpEl = $('
'); $helpEl.on('primaryaction', function () { window.open(this._languageHelpLink, '_blank'); }.bind(this)); $languageHelp.append($helpEl); }, _postRender: function _postRender() { this._addLanguageHelp(); return this.$el; }, setFocus: function setFocus() { $('textarea.v_serverUrl').focus(); }, _toggleNamedInstance: function _toggleNamedInstance(name, value) { this.parseInfo.msasVersion = value; var prop = this._propertyUIControl.getProperty('namedInstance'); if (!value || value === 'X8') { prop.getHTMLControl().val(''); prop.disable(); } else { prop.enable(); } } }); return MSASConnectionStringPane; });