"use strict"; /** * Licensed Materials - Property of IBM * IBM Cognos Products: Cognos Analytics * Copyright IBM Corp. 2016, 2017 * 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/admin/system/SetHomePageView', 'ba-react-admin/ba-react-admin.min'], function (Q, StringResource, ListView, SetHomePageView, AdminReact) { var HomePerspectiveListView = ListView.extend({ init: function init() { HomePerspectiveListView.inherited('init', this, arguments); var spec = this._getListSpec(); spec.$el = this._contentView.$standardBody; spec.selectedRow = ['name', this.currentValue.perspective]; var options = { currentValue: this.currentValue, $el: this._contentView.$standardBody, glassContext: this.glassContext, listSpec: spec, _selectionChanged: this._selectionChanged }; this._body = new SetHomePageView(options); this._contentView.bodyView = this._body; this.$el = this._contentView.$el; }, render: function render() { return HomePerspectiveListView.inherited('render', this, arguments).then(function (result) { $(result).addClass('home-perspective-page'); }); }, _getPerspectives: function _getPerspectives() { return AdminReact.AdminSvc.getPerspectives(this.glassContext.getCoreSvc('.Ajax'), { type: 'home', extension: true }).then(function (list) { var defaultHome = { name: this._getDefaultHome() }; if (list === undefined) { list = []; } list.push(defaultHome); return list; }.bind(this), function (err) { this.glassContext.appController.showToast(StringResource.get('failedToRetrievePerspectivesList'), { type: 'error' }); this.glassContext.services.logger.error('failed to get the perspective list from glass service.', err); }.bind(this)); }, _getDefaultHome: function _getDefaultHome() { return this.global ? 'home' : StringResource.get('default'); } }); return HomePerspectiveListView; });