DefaultProfileTab.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. "use strict";
  2. /**
  3. * Licensed Materials - Property of IBM
  4. * IBM Cognos Products: Cognos Analytics
  5. * Copyright IBM Corp. 2018
  6. * US Government Users Restricted Rights - Use, duplication or disclosure
  7. * restricted by GSA ADP Schedule Contract with IBM Corp.
  8. */
  9. define(['bi/admin/nls/StringResource', 'bi/glass/app/ContentView', 'bi/admin/common/utils/AJAXUtils', 'bi/commons/ui/properties/PropertyUIControl', 'q', 'underscore', 'bi/admin/account/ui/PersonalTab', 'bi/admin/common/ui/UserProfileSettingsView'], function (StringResource, ContentView, AJAXUtils, PropertyUIControl, Q, _, PersonalTab, UserProfileSettingsView) {
  10. 'use strict'; //NOSONAR: meant to be strict
  11. var DefaultProfileTab = ContentView.extend({
  12. init: function init(options) {
  13. DefaultProfileTab.inherited('init', this, arguments);
  14. _.extend(this, options);
  15. this.$el.addClass('defaultProfileTab');
  16. this.$el.attr('id', 'caDefaultProfileTab');
  17. },
  18. render: function render() {
  19. //NOSONAR
  20. var getDefaultUserProfileURL = AJAXUtils.getPath('get_default_user_profile');
  21. var requestOptions = {
  22. contentType: 'application/json; charset=utf-8',
  23. dataType: 'json'
  24. };
  25. var userProfilePromise = this.glassContext.services.fetch.get(getDefaultUserProfileURL, requestOptions);
  26. return userProfilePromise.then(function (response) {
  27. this.objectInfo = response.data;
  28. this.objectInfo.permissions = 'write';
  29. var userProfileSettingsView = new UserProfileSettingsView({
  30. objectInfo: this.objectInfo,
  31. $el: this.$el,
  32. glassContext: this.glassContext,
  33. options: this.objectInfo,
  34. slideout: this.slideout
  35. });
  36. return userProfileSettingsView.render();
  37. }.bind(this));
  38. }
  39. });
  40. return DefaultProfileTab;
  41. });