"use strict"; /** * Licensed Materials - Property of IBM * IBM Cognos Products: Cognos Analytics * Copyright IBM Corp. 2016 * US Government Users Restricted Rights - Use, duplication or disclosure * restricted by GSA ADP Schedule Contract with IBM Corp. */ define(['q', 'bi/admin/nls/StringResource', 'bi/admin/common/ui/BasePerspectiveListView', 'bi/commons/ui/content/SingleSelectListControl', 'ba-react-admin/ba-react-admin.min'], function (Q, StringResource, ListView, ListControl, AdminReact) { var LoginPerspectiveListView = ListView.extend({ init: function init() { LoginPerspectiveListView.inherited('init', this, arguments); var spec = this._getListSpec(); spec.$el = this._contentView.$standardBody; spec.selectedRow = ['name', this.currentValue]; this._body = this._getNewListControl(spec); this._contentView.bodyView = this._body; this.$el = this._contentView.$el; }, _getNewListControl: function _getNewListControl(options) { return new ListControl(options); }, render: function render() { return LoginPerspectiveListView.inherited('render', this, arguments).then(function (result) { $(result).addClass('login-perspective-view'); }); }, _getPerspectives: function _getPerspectives() { return AdminReact.AdminSvc.getPerspectives(this.glassContext.getCoreSvc('.Ajax'), { type: 'login', extension: true }).then(function (list) { var defaultLogin = { name: 'login' }; if (list === undefined) { list = []; } list.push(defaultLogin); return list; }, function (err) { this.glassContext.appController.showToast(StringResource.get('failedToRetrievePerspectivesList'), { type: 'error' }); this.glassContext.getCoreSvc('.Logger').error('failed to get the perspective list from glass service.', err); }.bind(this)); } }); return LoginPerspectiveListView; });