"use strict"; /** * Licensed Materials - Property of IBM * IBM Cognos Products: admin * Copyright IBM Corp. 2015, 2018 * US Government Users Restricted Rights * Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ define(['bi/admin/common/ui/GenericListView', 'doT', 'underscore', 'bi/admin/nls/StringResource', 'bi/admin/datasource/ActionHandler', 'bacontentnav/utils/WidgetNavigator', 'bacontentnav/ui/dialogs/SaveAsDialog', 'bi/commons/ui/dialogs/ConfirmationDialog', 'bi/commons/ui/content/dialog/SignOnDialog', 'bi/commons/ui/properties/PropertyUIControl', 'bi/commons/utils/ContentFormatter', 'bi/admin/common/utils/AJAXUtils', 'bi/moser/moser.min', 'bi/admin/datasource/App', 'bi/commons/utils/Utils', 'bi/admin/common/ui/MagicWand'], function (View, dot, _, StringResource, ActionHandler, WidgetNavigator, SaveAsDialog, ConfirmationDialog, SignOnDialog, PropertyUIControl, ContentFormatter, AJAXUtils, MoserJS, App, Utils, MagicWand) { 'use strict'; //NOSONAR: meant to be strict var MetaDataListView = View.extend({ showSystemSchemas: false, retryCount: 5, itemDisplayedCount: 0, ITEM_QUEUE: 50, init: function init(options) { MetaDataListView.inherited('init', this, arguments); _.extend(this, options); this.conn = options.objectInfo; this._runningMetadataTasks = []; this.connectionList = []; }, _getConnections: function _getConnections(objectInfo) { var options = { contentType: 'application/json; charset=utf-8', dataType: 'json' }; var url = AJAXUtils.getAJAXURL('datasources') + '/' + objectInfo.dataSourceId + '/connections' + '?' + encodeURIComponent('fields') + '=' + encodeURIComponent('defaultName,disabled,permissions,owner.defaultName,hidden,capabilities,hasChildren,searchPath,modificationTime,creationTime,ancestors,defaultDescription,connectionString'); return this.glassContext.services.fetch.get(url, options); }, _getListHtmlNewConn: function _getListHtmlNewConn() { return this._getConnections(this.objectInfo).then(function (response) { if (response.data.data.length > 0) { _.forEach(response.data.data, function (data) { if (data.defaultName === this.objectInfo.defaultName) { this.objectInfo = data; } }.bind(this)); } this.conn = this.objectInfo; }.bind(this)).then(this._requestSchemaInfo.bind(this)); }, _getListHtml: function _getListHtml(refresh) { //Check if it's a new connection if (!this.objectInfo.ancestors) { return this._getListHtmlNewConn(); } else { if (!this.items || refresh) { // in the future, can check for a refresh call as well return this._requestSchemaInfo(); } else { // already have the schema items, just re-render (ie. sort) return Promise.resolve(this._generateListHTMLStr()); } } }, _renderListView: function _renderListView(refresh) { return this._renderPane().then(this._renderMetaDataList.bind(this, refresh)); }, _renderMetaDataList: function _renderMetaDataList(refresh) { return this._getListHtml(refresh).then(this._renderSchemaListItems.bind(this, refresh)); }, _renderPane: function _renderPane() { return Promise.try(function () { if (!this._$loadingAnimationContainer) { this._$loadingAnimationContainer = $('
', { 'class': 'metaDataListLoading' }); this._$loadingAnimationContainer.append(Utils.getLoadingAnimation(1)); this.$el.append(this._$loadingAnimationContainer); } if (!this._$metadataList) { this._$metadataList = $('', { 'class': 'metaDataList', 'style': 'visibility: hidden' }); this._$metadataList.append(this._generatePaneHTMLStr()); this._$metadataList.find('.bi-admin-list-headertext').parent().on('primaryaction', function (event) { this._sortItems(event.currentTarget.className, true); this.displayItems = this.items.slice(0, this.itemDisplayedCount); this._renderSchemaListItems(true, this._generateListHTMLStr()); }.bind(this)); this._$metadataListTable = this._$metadataList.find('table.bi-admin-list-table').last(); this._$metadataListTable.parent().scroll(this._onScroll.bind(this)); this.$el.append(this._$metadataList); return this._renderSearch(); } }.bind(this)); }, _resetFilteredDisplayList: function _resetFilteredDisplayList() { this.filteredDisplayList = this.items.slice(0); }, _renderSearch: function _renderSearch() { return MagicWand.searchInput(this.$el).then(function (widgets) { if (widgets.length === 1) { this._searchInput = widgets[0]; this._searchInput.options.hint = StringResource.get('filterTips'); this._searchInput.on('changed', function (e) { if (e.text.length === 0) { this._resetFilteredDisplayList(); } else { var trimmed = e.text.trim(); if (trimmed.length > 0) { this.filteredDisplayList = _.filter(this.items, function (item) { return item.defaultName.toLowerCase().indexOf(trimmed.toLowerCase()) > -1; }); } } var htmlstr = this._processFilter(this.filteredDisplayList); return this._renderSchemaListItems(true, htmlstr); }.bind(this)); } }.bind(this)); }, _onScroll: function _onScroll(evt) { var $target = $(evt.target); if ($target.scrollTop() + $target.innerHeight() >= $target[0].scrollHeight - 20) { this.displayItems = this.filteredDisplayList.slice(this.itemDisplayedCount, this.itemDisplayedCount + this.ITEM_QUEUE); this.itemDisplayedCount = this.itemDisplayedCount + this.ITEM_QUEUE < this.filteredDisplayList.length ? this.itemDisplayedCount + this.ITEM_QUEUE : this.filteredDisplayList.length; this._renderMetaDataList(false); } }, _setHeights: function _setHeights() { var windowHeight = $(window).height(); var toggleElement = this.$el.find("#admin_showSystemSchemas"); var tableCont = this._$metadataListTable.parent(); var headerElementsHeight = tableCont.offset().top; var updatedListHeight = windowHeight - toggleElement.height() - headerElementsHeight - 20; tableCont.height(updatedListHeight); }, _updateConnectionSignonInfo: function _updateConnectionSignonInfo(connections) { var connection = { 'datasource': this.conn.ancestors[this.conn.ancestors.length - 1].defaultName }; if (connections && connections.length > 0) { connection.connection = connections[0].connection; connection.signon = connections[0].signon; } else if (this.connectionList && this.connectionList.length > 0 && this.connectionList[0].connection) { connection.connection = this.connectionList[0].connection; connection.signon = this.connectionList[0].signon; } if (!connection.connection) { connection.connection = this.conn.defaultName; } if (connection.connection && connection.signon) { if (this.connectionList.length > 0) { //clear array this.connectionList.splice(0, 1); } this.connectionList.push(connection); } return connection; }, _extractConnectionInfoFromResolver: function _extractConnectionInfoFromResolver() { var connInfo = {}; if (this.connectionResolver.datasourceConnectionCache && this.connectionResolver.datasourceConnectionCache.datasources) { var key = _.keys(this.connectionResolver.datasourceConnectionCache.datasources)[0]; var info = this.connectionResolver.datasourceConnectionCache.datasources[key]; if (info) { connInfo.datasource = info.name; if (info.connection) { connInfo.connection = info.connection; } if (info.signon) { connInfo.signon = info.signon; } } else { return null; } } return connInfo; }, _sendSchemaInfoRequest: function _sendSchemaInfoRequest(connections) { var connection; if (this.connectionResolver) { connection = this._extractConnectionInfoFromResolver(); if (!connection) { connection = this._updateConnectionSignonInfo(connections); } } else { connection = this._updateConnectionSignonInfo(connections); } if (this.connectionList.length === 0 && connection) { this.connectionList.push(connection); } var connObj = { connections: this.connectionList }; var connectionSpec = "connectionSpec=" + encodeURIComponent(JSON.stringify(connObj)); return this._sendSchemas(connectionSpec, 0); }, _sendSchemas: function _sendSchemas(connectionSpec, count) { var url = 'v1/metadata/sources/' + encodeURIComponent(this.conn.ancestors[2].id) + '/schemas'; var ajaxOptions = { 'dataType': 'json', 'type': 'GET', 'url': url, 'data': connectionSpec }; return this.glassContext.getCoreSvc('.Ajax').ajax(ajaxOptions).fail(function (error) { if (error.jqXHR.responseJSON) { return this.handleErrorResponse(error, count, connectionSpec); } }.bind(this)); }, _handle803ErrorResponse: function _handle803ErrorResponse(connectionSpec, count) { count++; if (count < this.retryCount) { return this._getSelectedSignonFromPrompt().then(this._sendSchemas.bind(this, connectionSpec, count)).then(function (dataRetrieved) { var htmlStr = this._processDataHandling(dataRetrieved); if (htmlStr) { this._renderSchemaListItems(true, htmlStr); } }.bind(this)); } else { var msg = StringResource.get('dataserverFailedLoginAttempts'); var info = '' + _.escape(StringResource.get('dataserverFailedLoginAttempts')) + ''; this.glassContext.appController.showErrorMessage(msg, StringResource.get('error')); this.$el.html('' + info + ''); return Promise.reject(); } }, handleErrorResponse: function handleErrorResponse(error, count, connectionSpec) { if (error.jqXHR.responseJSON.errors) { var errors = error.jqXHR.responseJSON.errors; var theError = errors.length > 0 ? errors[0] : null; if (!theError) { return; } if (theError.code === 'CQE-803') { return this._handle803ErrorResponse(connectionSpec, count); } else { throw error.jqXHR.responseJSON; } } else { throw error.jqXHR.responseJSON; } }, _processDataHandling: function _processDataHandling(dataRetrieved) { if (dataRetrieved && dataRetrieved.data) { var htmlStr; var response = dataRetrieved.data; if (response.data && response.data.length > 0) { this.items = _.map(response.data, this._buildItems.bind(this)); this._sortItems(this._metaDataColName); this._resetFilteredDisplayList(); this.itemDisplayedCount = this.ITEM_QUEUE < this.items.length ? this.ITEM_QUEUE : this.items.length; this.displayItems = this.items.slice(0, this.itemDisplayedCount); this.sortField = ''; htmlStr = this._generateListHTMLStr(); } else { htmlStr = '' + StringResource.get('noEntries') + ''; } return htmlStr; } }, _processFilter: function _processFilter(filteredList) { var htmlStr; if (filteredList && filteredList.length > 0) { this.itemDisplayedCount = this.ITEM_QUEUE < this.items.length ? this.ITEM_QUEUE : this.items.length; this._sortItems(this._metaDataColName); this.displayItems = filteredList.slice(0, this.itemDisplayedCount); this.sortField = ''; htmlStr = this._generateListHTMLStr(); } else { htmlStr = '' + StringResource.get('noEntries') + ''; } return htmlStr; }, _getNewSignOnDialog: function _getNewSignOnDialog(options) { return new SignOnDialog(options); }, _getSelectedSignonFromPrompt: function _getSelectedSignonFromPrompt() { return new Promise(function (resolve, reject) { var signonPrompt = this._getNewSignOnDialog({ 'dataSourceName': this.conn.ancestors[this.conn.ancestors.length - 1].defaultName, 'dataSourceConnectionName': this.conn.defaultName, 'glassContext': this.glassContext, 'displayErrMsg': true, 'canSaveCredentials': false, 'onSubmit': function () { var creds = signonPrompt.view.getCredentialsInfo(); resolve({ credentialsEx: { username: creds.userID, password: creds.password } }); }.bind(this), 'onCancel': function () { var info = '' + _.escape(StringResource.get('cancelled')) + ''; this.$el.html('' + info + ''); reject(); }.bind(this) }); signonPrompt.view.canSaveCredentials = false; signonPrompt.open(); }.bind(this)); }, _requestSchemaInfo: function _requestSchemaInfo() { return Promise.try(function () { return this.glassContext.getSvc('.DataConnectionServiceFactory').then(function (connectionResolverFactory) { return connectionResolverFactory.getDataConnectionResolver(); }.bind(this)).then(function (connectionResolver) { return connectionResolver.execute(this._sendSchemaInfoRequest.bind(this), 'ADMIN_KEY'); }.bind(this)).then(this._processDataHandling.bind(this), function (error) { var info; if (error) { if (error.reason === 'cancel') { info = '' + _.escape(StringResource.get('cancelled')) + ''; this.$el.html('' + info + ''); } else { this.glassContext.appController.showErrorMessage(error.msg, StringResource.get('error')); info = '' + _.escape(error.msg) + ''; if (error.exceptionMsg) { info += '' + _.escape(error.exceptionMsg) + ''; } this.$el.html('' + info + ''); } } else { this.glassContext.appController.showToast(StringResource.get('cancelLogin'), { type: 'warning' }); info = '' + _.escape(StringResource.get('cancelLogin')) + ''; this.$el.html('' + info + ''); } }.bind(this)); }.bind(this)); }, _generateListHTMLStr: function _generateListHTMLStr() { var listData = { items: this.displayItems, strings: { 'contextMenuTips': StringResource.get('moreInContext'), 'moreActionsLabel': StringResource.get('contextMenuLabel') }, showSystemSchemas: this.showSystemSchemas }; return dot.template(this._template)(listData); }, _generatePaneHTMLStr: function _generatePaneHTMLStr() { var listData = { strings: { 'status': StringResource.get('status'), 'colName': StringResource.get(this._metaDataColName), 'loadInformation': StringResource.get('loadInformation'), 'contextMenuTips': StringResource.get('moreInContext') } }; return dot.template(this._paneTemplate)(listData); }, _listHasSystemSchemas: function _listHasSystemSchemas(items) { return _.find(items, function (item) { return item.schemaType === 'system'; }) !== undefined; }, _renderSchemaListItems: function _renderSchemaListItems(refresh, htmlStr) { if (refresh) { this._$metadataListTable.html(htmlStr); } else { this._$metadataListTable.append(htmlStr); } $.each(this.$el.find('.bi-admin-link.groupListFocusable'), function (index, value) { ContentFormatter.middleShortenString(value); }); this.$el.find('.bi-admin-list-sortable-header').toggleClass('bi-admin-list-sortable-selected', false); if (this.sortField) { var blueHighlight = this.$el.find('[class*=' + this.sortField + '] > .bi-admin-list-headertext'); blueHighlight.addClass('bi-admin-list-sortable-selected'); } this._addSystemSchemaToggle(); this.widgetKeyController = new WidgetNavigator({ $el: this.$el.find(".groupList-table"), focusClass: "groupListFocusable", fCallBack: function fCallBack() {} }); this._bindEvents(); this._$loadingAnimationContainer.css('display', 'none'); this._$metadataList.css('visibility', 'visible'); this._setHeights(); return Promise.resolve(); }, _addSystemSchemaToggle: function _addSystemSchemaToggle() { if (this._listHasSystemSchemas(this.items)) { var $toggleButtonDiv = this._$metadataList.find("#admin_showSystemSchemas"); if ($toggleButtonDiv.children().length === 0) { var configProps = []; configProps.push({ 'type': 'CheckBox', 'label': StringResource.get('showSystemSchemas'), 'name': 'showSystemSchemas', 'checked': this.showSystemSchemas, 'onChange': this._setShowSystemSchemas.bind(this) }); this._oPropertyUIControl = new PropertyUIControl({ 'glassContext': this.glassContext, 'el': $toggleButtonDiv, 'items': configProps }); this._oPropertyUIControl.render().then(function () { this._setHeights(); }.bind(this)); } } }, _setShowSystemSchemas: function _setShowSystemSchemas() { var modProp = this._oPropertyUIControl.getModifiedProperties(); if (modProp) { //hide or show system schemas in list var systemSchemaList = this.$el.find(".bi-admin-list-item.system-schema"); if (modProp.showSystemSchemas === true) { systemSchemaList.removeClass("hidden"); systemSchemaList.show(); this.showSystemSchemas = true; } else { systemSchemaList.hide(); this.showSystemSchemas = false; } } }, _getNewActionHandler: function _getNewActionHandler() { return new ActionHandler(); }, _handleBaseModuleError: function _handleBaseModuleError(task) { var msg = task.response ? task.response.entity.msg : task.errorMessage; this.glassContext.appController.showErrorMessage(msg, StringResource.get('error')); }, _isBaseModuleDone: function _isBaseModuleDone(id, response) { var task = response.data; this._updateStatus(id, task); var bDone = false; if (task.state === 'NOT_AVAILABLE') { bDone = true; } else if (task.state === 'ERROR') { this._handleBaseModuleError(task); bDone = true; } else if (task.state === 'SUCCESS') { if (this._displayLoadingToast) { this.glassContext.appController.showToast(StringResource.get('refreshSuccess'), { 'type': 'success' }); } bDone = true; } return bDone; }, _getBaseModule: function _getBaseModule(id, xCaAffinity, response) { return new Promise(function (resolve, reject) { var taskId = response.data.taskID; var getTaskUrl = 'v1/metadata/tasks/' + taskId; this._runningMetadataTasks.push({ id: id, task: taskId, xCaAffinity: xCaAffinity }); var int; var options = { contentType: 'application/json; charset=utf-8', dataType: 'json' }; if (xCaAffinity) { options.headers = { Accept: 'application/json', 'x-ca-affinity': xCaAffinity }; } var func = function () { this.glassContext.services.fetch.get(getTaskUrl, options).then(function (response) { if (this._isBaseModuleDone(id, response)) { clearInterval(int); this._removeRunningTask(id); if (response.data.state === 'SUCCESS') { resolve(response.data.response); } else { reject(); } } }.bind(this), reject); }.bind(this); int = setInterval(func, 1000); }.bind(this)); }, RefreshMetadata: function RefreshMetadata(id) { var connectionSpec; var url; if (this.connectionList.length > 0) { var connList = []; connList.push(this.connectionList[0]); var connObj = { connections: connList }; connectionSpec = 'connectionSpec=' + encodeURIComponent(JSON.stringify(connObj)); url = 'v1/metadata/base_modules/' + encodeURIComponent(id) + '?async=true&' + connectionSpec; } else { url = 'v1/metadata/base_modules/' + encodeURIComponent(id) + '?async=true'; } if (this._displayLoadingToast) { this.glassContext.appController.showToast(StringResource.get('refreshStart'), { 'type': 'info' }); } return this.glassContext.getCoreSvc('.Ajax').ajax({ contentType: 'application/json; charset=utf-8', type: 'POST', dataType: 'json', url: url }).then(function (resp) { var xCaAffinity = resp.jqXHR.getResponseHeader('X-CA-Affinity'); return this._getBaseModule(id, xCaAffinity, resp).then(function (module) { return this.render(true).then(function () { return module; }, function (err) { if (this.logger) { this.logger.error(err); } return module; }.bind(this)); }.bind(this), function (err) { if (err && err.toString) { this.glassContext.appController.showErrorMessage(err.toString(), StringResource.get('error')); } throw err; }.bind(this)).catch(function (e) { this.render(true); throw e; }.bind(this)); }.bind(this)); }, _isLoadingStatusCheck: function _isLoadingStatusCheck(id, status) { var stat = status; var runningTasks = _.find(this._runningMetadataTasks, function (task) { return task.id === id; }); if (runningTasks) { stat = 'loading'; } return stat; }, _getLocationFromSelection: function _getLocationFromSelection(selection) { var location = selection.url.substr(0, selection.url.length - 6); location = location.substr(location.indexOf('objects') + 8); return location; }, createModule: function createModule(data) { return new Promise(function (resolve, reject) { var saveAsDialog = new SaveAsDialog({ glassContext: this.glassContext, defaultFileName: data[0].defaultName, service: { save: function (service, selection, name) { saveAsDialog.hide(); var location = this._getLocationFromSelection(selection); return this.loadSchemaAction(data).then(this._saveModule.bind(this, name, location)).then(function () { this.glassContext.appController.showToast(StringResource.get('savedSuccess', { name: name }), { type: 'success' }); }.bind(this), function (err) { if (err.jqXHR) { var errorRespText = null; if (err.jqXHR.responseText) { var errorRespJson = JSON.parse(err.jqXHR.responseText); errorRespText = errorRespJson.msg ? errorRespJson.msg : err.jqXHR.responseText; } else { errorRespText = err.toString(); } var errorMessage = err.jqXHR.responseJSON ? err.jqXHR.responseJSON.msg : errorRespText; this.glassContext.appController.showErrorMessage(errorMessage, StringResource.get('error')); } else { this.glassContext.appController.showErrorMessage(err.toString(), StringResource.get('error')); } }.bind(this)).then(resolve, resolve); }.bind(this) } }); saveAsDialog.open(); }.bind(this)); }, _saveModule: function _saveModule(name, location, baseModules) { var objFactory = MoserJS.default.createObjectFactory(); var module = MoserJS.default.ModuleUtils.createModule(objFactory, name, 'en-us'); baseModules.forEach(function (baseModule) { MoserJS.default.ModuleUtils.addSource(module, MoserJS.default.UseSpecType.LW_OLAP, baseModule.id, null, objFactory, true); }); var url = 'v1/metadata/modules/?location=' + location; return this.glassContext.services.fetch.post(url, { contentType: 'application/json; charset=utf-8', processData: false, dataType: 'text', data: JSON.stringify(module.toJSON()) }); }, loadSchemaAction: function loadSchemaAction(data) { var aData = data; if (data.constructor !== Array) { aData = [data]; } var aDfd = _.map(aData, this._loadSchema.bind(this)); return Promise.all(aDfd); }, _loadSchema: function _loadSchema(data) { if (data.status === 'not_loaded') { return App.CreateSchema(data, this).then(function (resp) { var location = resp.getResponseHeader('location'); var storeId = location.substring(location.lastIndexOf('/') + 1, location.length); return this.render(true).then(function () { return this.RefreshMetadata(storeId); }.bind(this)); }.bind(this)); } else { return this.RefreshMetadata(data.id); } }, confirmClearSchemaAction: function confirmClearSchemaAction(data) { return new Promise(function (resolve, reject) { var oDialog = this._getNewConfirmationDialog('confirmDelete', StringResource.get('confirmClearMetaData'), StringResource.get('confirmClearMetaDataMessage')); oDialog.confirm(function () { this._clearSchemaAction(data).then(resolve, reject); }.bind(this)); }.bind(this)); }, _getNewConfirmationDialog: function _getNewConfirmationDialog(type, title, message) { return new ConfirmationDialog(type, title, message); }, _clearSchemaAction: function _clearSchemaAction(data) { var aData = data; if (data.constructor !== Array) { aData = [data]; } return Promise.all(this._clearSchemaActionHelper(aData)).then(function () { return this.render(true); }.bind(this), function (e) { this.glassContext.appController.showErrorMessage(e, StringResource.get('error')); }.bind(this)); }, _clearSchemaActionHelper: function _clearSchemaActionHelper(aData) { var aDfd = []; _.forEach(aData, function (d) { if (d.status === 'loaded' || d.status === 'loading' || d.status === 'pending' || d.status === 'error') { aDfd.push(App.ClearSchema(d)); //Cancel polling task if (d.status === 'loading' || d.status === 'pending') { aDfd.push(this.CancelSchema(d)); } } }.bind(this)); return aDfd; }, cancelSchemaAction: function cancelSchemaAction(data) { var aData = data; if (data.constructor !== Array) { aData = [data]; } var promises = _.map(aData, function (d) { var status = this._isLoadingStatusCheck(d.id, d.status); if (status === 'pending' || status === 'executing' || status === 'loading') { return this.CancelSchema(d); } else { return Promise.resolve(); } }.bind(this)); return Promise.all(promises).then(function () { return this.render(true); }.bind(this), function (e) { this.glassContext.appController.showErrorMessage(e, StringResource.get('error')); }.bind(this)); }, CancelSchema: function CancelSchema(item) { var task = _.find(this._runningMetadataTasks, function (task) { return item.id === task.id; }); var taskId = task ? task.task : null; var xCaAffinity = task ? task.xCaAffinity : null; if (taskId) { return App.CancelTask(taskId, xCaAffinity).then(this._removeRunningTask.bind(this, item.id)); } else { return Promise.resolve(); } }, _removeRunningTask: function _removeRunningTask(itemId) { for (var i = 0; i < this._runningMetadataTasks.length; i++) { if (this._runningMetadataTasks[i].id === itemId) { this._runningMetadataTasks.splice(i, 1); break; } } }, _getSchemaLoadPercentageComplete: function _getSchemaLoadPercentageComplete(moserResponse) { var loadInfo = ''; if (moserResponse) { var percentComplete = MoserJS.default.ModuleUtils.taskPercentage(moserResponse); loadInfo = StringResource.get('schemaPercentageLoaded', { percentLoaded: percentComplete }); } return loadInfo; }, _escapeId: function _escapeId(id) { return '#' + id.replace(/(:|\.|\[|\]|,|=)/g, '\\$1'); }, ShowSchemaLoadOptions: function ShowSchemaLoadOptions(items, tabName) { var slideoutId = _.map(items, function (item) { return item.id; }).join('_'); var loSlideout = this.glassContext.appController.showSlideOut({ 'parent': this.slideout, 'width': '300px', 'onHide': function () { if (loSlideout && loSlideout.contentView && loSlideout.contentView.onHide) { loSlideout.contentView.onHide(); } }.bind(this), 'content': { 'id': slideoutId, 'title': items.length === 1 ? items[0].defaultName : StringResource.get('numberOfSchemas', { 'number': items.length }), 'module': 'bi/admin/datasource/slideout/LoadOptionsPane', 'parentView': this, 'items': items, 'selectedTabName': tabName, 'signonAndConnection': this.connectionList, 'glassContext': this.glassContext } }); return Promise.resolve(); } }); return MetaDataListView; });