ContactListPane.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. "use strict";
  2. /**
  3. * Licensed Materials - Property of IBM
  4. * IBM Cognos Products: Cognos Analytics
  5. * Copyright IBM Corp. 2018, 2018
  6. * US Government Users Restricted Rights - Use, duplication or disclosure
  7. * restricted by GSA ADP Schedule Contract with IBM Corp.
  8. */
  9. define(['react', 'react-dom', 'ba-react-admin/ba-react-admin.min', 'underscore', 'bi/glass/app/ContentView', 'bi/admin/nls/StringResource', 'bacontentnav/lib/@waca/core-client/js/core-client/utils/DateTimeUtils', 'bacontentnav/utils/GlassContextHelper'], function (React, ReactDOM, AdminReact, _, ContentView, StringResource, DateTimeUtils, GlassContextHelper) {
  10. 'use strict'; //NOSONAR: meant to be strict
  11. var ContactListPane = ContentView.extend({
  12. init: function init(options) {
  13. ContactListPane.inherited('init', this, arguments);
  14. _.extend(this, options);
  15. },
  16. formatDate: function formatDate(dateTime) {
  17. var date = DateTimeUtils.formatDate(dateTime, 'short', GlassContextHelper.getLocaleTime(this.glassContext)).toString();
  18. var time = DateTimeUtils.formatTime(dateTime, 'short', GlassContextHelper.getLocaleTime(this.glassContext)).toString();
  19. return {
  20. date: date,
  21. time: time
  22. };
  23. },
  24. render: function render() {
  25. ReactDOM.unmountComponentAtNode(this.$el[0]);
  26. var contactListPane = React.createElement(AdminReact.ContactListPanel, {
  27. glassContext: this.glassContext,
  28. StringResource: StringResource,
  29. parent: this,
  30. title: this.title
  31. });
  32. ReactDOM.render(contactListPane, this.$el[0]);
  33. return Promise.resolve();
  34. },
  35. remove: function remove() {
  36. if (this.$el) {
  37. ReactDOM.unmountComponentAtNode(this.$el[0]);
  38. }
  39. this.viewState = null;
  40. return ContactListPane.inherited('remove', this, arguments);
  41. }
  42. });
  43. return ContactListPane;
  44. });