| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 | "use strict";/** * Licensed Materials - Property of IBM * IBM Cognos Products: Cognos Analytics * Copyright IBM Corp. 2016, 2019 * US Government Users Restricted Rights - Use, duplication or disclosure * restricted by GSA ADP Schedule Contract with IBM Corp. */define(['underscore', 'bi/admin/nls/StringResource', 'bi/commons/ui/properties/PropertyTabView', 'bi/admin/common/Uploader', 'bi/admin/common/services/ExtensionService', 'bi/commons/ui/properties/PropertyUIControl', 'bi/admin/common/actions/ThemeListActionController', 'react', 'react-dom', 'ba-react-admin/ba-react-admin.min'], function (_, StringResource, View, Uploader, ExtensionService, PropertyUIControl, ThemeListActionController, React, ReactDOM, AdminReact) {  'use strict'; //NOSONAR: meant to be strict  var ThemesTab = View.extend({    init: function init(options) {      ThemesTab.inherited('init', this, arguments);      this.showTitle = false;      _.extend(this, options);    },    remove: function remove() {      this.cleanUpReact();    },    cleanUpReact: function cleanUpReact() {      if (this.$el) {        ReactDOM.unmountComponentAtNode(this.$el.find('.themesListPaneRoot')[0]);      }    },    render: function render() {      this.actController = new ThemeListActionController();      var aRoot = this.$el.append("<div ><div class='themesListPaneRoot'></div></div>");      var themeListView = React.createElement(AdminReact.ThemeListView, {        glassContext: this.glassContext,        StringResource: StringResource,        parent: this      });      ReactDOM.render(themeListView, this.$el.find('.themesListPaneRoot')[0]);      return Promise.resolve(this);    },    _getContentBarAccesibleLabel: function _getContentBarAccesibleLabel() {      return StringResource.get('themes');    },    /**     * Prepares the uploader and calls for an upload, then refreshes the themes list     */    uploadTheme: function uploadTheme() {      if (_.isUndefined(this.extensionService)) {        var esOptions = {          'glassContext': this.glassContext        };        this.extensionService = new ExtensionService(esOptions);      }      var ajaxOptions = {        'isUpload': true,        'type': 'theme',        'tenantID': this.tenantID      };      var uploader = new Uploader({        '$el': this.$el,        'glassContext': this.glassContext,        'ajax': this.extensionService.updateOrUpload.bind(this.extensionService),        'ajaxOptions': ajaxOptions      });      return uploader.doUpload().then(function () {        AdminReact.ThemeListStore.readThemes(this.glassContext);      }.bind(this));    }  });  return ThemesTab;});
 |