123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- "use strict";
- /**
- * Licensed Materials - Property of IBM
- * IBM Cognos Products: Cognos Analytics
- * Copyright IBM Corp. 2017, 2018
- * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- */
- define(['q', 'doT', 'jquery', 'bi/admin/common/slideout/BasePane', 'bi/admin/nls/StringResource', 'bi/commons/ui/properties/PropertyUIControl'], function (Q, dot, $, BasePane, StringResource, PropertyUIControl) {
- /**
- * Sample content view that extends the glass View class
- *
- */
- var TestResultSlideout = BasePane.extend({
- title: StringResource.get('testResultsTitle'),
- init: function init(options) {
- TestResultSlideout.inherited('init', this, arguments);
- $.extend(this, options);
- },
- _getMessages: function _getMessages() {
- var messages = [];
- if (this.objectInfo && (this.objectInfo.connectionString === 'undefined' || this.objectInfo.connectionString === '')) {
- messages.push(StringResource.get('emptyConnectionInfo'));
- return messages;
- }
- var resultArray = this.results.data ? this.results.data : this.results.responseJSON.data;
- if (!resultArray || resultArray.length === 0) {
- this.logger.error("could not find result objects");
- return messages;
- } else {
- if (resultArray[0].messages) {
- return resultArray[0].messages;
- } else {
- //report the fault code
- messages.push(StringResource.get('testServerError'));
- messages.push(resultArray[0].faultCode);
- messages.push(resultArray[0].faultString);
- return messages;
- }
- }
- },
- _getMessageItems: function _getMessageItems(items) {
- var messages = "";
- this._getMessages().forEach(function (message) {
- messages += message + "\n";
- });
- items.push({
- 'name': 'testResultMessagesText',
- 'label': StringResource.get('testResultMessages'),
- 'value': messages,
- 'editable': false,
- 'type': 'TextArea',
- 'class': 'connStringText',
- 'multiline': true
- });
- },
- _updateConnectionStringTextForCopying: function _updateConnectionStringTextForCopying() {
- var connectionStringTextArea = this.$el.find('.v_connectionStringText');
- $(connectionStringTextArea).removeAttr("disabled");
- $(connectionStringTextArea).attr("readOnly", "true");
- },
- renderBody: function renderBody($body) {
- var deferred = Q.defer();
- var $rootEl = $(this.$el.find(".bi-admin-pane-body.bi-admin-pane-flex"));
- var items = [];
- this._getMessageItems(items);
- this._oPropertyUIControl = new PropertyUIControl({
- 'el': $rootEl,
- 'glassContext': this.glassContext,
- 'items': items
- });
- this._oPropertyUIControl.render().then(function () {
- var textArea = this.$el.find('.v_testResultMessagesText');
- $(textArea).css('border', '1px');
- $(textArea).removeAttr("disabled");
- $(textArea).css('maxHeight', '100%');
- $(textArea).css('height', '100%');
- $(this.$el.find(".propertyRow")).css('height', '100%');
- this._updateConnectionStringTextForCopying();
- deferred.resolve(this);
- }.bind(this));
- return deferred.promise;
- },
- setFocus: function setFocus() {
- this.$el.find('textarea').filter(':visible:first').focus();
- }
- });
- return TestResultSlideout;
- });
|