123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- define([
- 'react',
- 'react-dom',
- 'ba-react-admin/ba-react-admin.min',
- 'bi/content_apps/utils/GlassContextHelper',
- 'bacontentnav/utils/ContentStoreObject',
- 'q',
- 'jquery',
- 'bi/sharecommon/utils/translator'
- ], function(React, ReactDOM, AdminReact, GlassContextHelper, ContentStoreObject, Q, $, t) {
- return {
- MAX_DISPLAY: 20,
- PREVIEW_PANE_WIDTH: '400px',
-
- showNotificationContent: function(messageContext) {
- return messageContext.glassContext.getSvc('.Notification').then(function(notificationSvc) {
- return notificationSvc.getSpecificNotification(messageContext.messageId).then(function(messageDetails) {
-
- var newSlideout = React.createElement(AdminReact.PreviewView, {
- onHide: messageContext.onHideCallback,
- data: messageDetails,
- glassContext: messageContext.glassContext,
- GlassContextHelper: GlassContextHelper,
- ContentStoreObject: ContentStoreObject,
- StringResource: t,
- messageList: messageContext.messageListView
- });
-
- if (messageDetails.unread) {
- notificationSvc.markRead(messageContext.messageId);
- }
- $('.flyoutPane.pane-right.active.shadow').append('<div class="notificationNewSlideout"></div>');
- ReactDOM.unmountComponentAtNode(document.getElementsByClassName('notificationNewSlideout')[0]);
- newSlideout && newSlideout.type.prototype.setOpen();
- ReactDOM.render(newSlideout, document.getElementsByClassName('notificationNewSlideout')[0]);
- }).catch(function() {
-
- });
- }.bind(this));
- },
-
- deleteNotification: function(messageId, context) {
- return context.glassContext.getSvc('.Notification').then(function(notificationSvc) {
- return notificationSvc.deleteNotification(messageId);
- });
- },
- getNotificationState: function(reportId, context) {
- return context.glassContext.getSvc('.Notification').then(function(notificationSvc) {
- return notificationSvc.getNotificationState(reportId);
- });
- },
- updateNotificationState: function(descriptor, context) {
- return context.glassContext.getSvc('.Notification').then(function(notificationSvc) {
- return notificationSvc.updateNotificationState(descriptor);
- });
- },
- getObjectProperties: function(properties, context) {
- return context.glassContext.getSvc('.Content').then(function(contentSvc) {
- var server_URL = contentSvc.getBaseObjectsURL() + '/' + properties.reportId + '?fields=type,runInAdvancedViewer';
- return Promise.resolve(contentSvc.get(server_URL, {})).then(function(data) {
- if (data.data[0]) {
- var info = data.data[0];
- if ('runInAdvancedViewer' in info) {
- properties.runInAdvancedViewer = info.runInAdvancedViewer;
- }
- if ('type' in info) {
- properties.type = info.type;
- }
- return properties;
- } else {
- return Promise.reject();
- }
- }.bind(this));
- }.bind(this));
- }
- };
- });
|