Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "BobIngham"

Answer

Sorry guys - this is not an issue for sweet alter, my bad. It's an issue forpush.js, the small messages to the bottom right of the page. Is there any way I can get them to stack on top of each other going up the page so more than one is visible?

Question

dotnetcore, angular, aspnet framework, Zero 6.8.0 Hi Guys,

I'm on an old version of the system and hope to upgrade soon. In the meantime is there any way to implement stacking of sweet alert notifications? I find that one alert is overwritten with another when results are almost instantantaneous. Is there any setting to insert new alerts under the old alerts?

Thanks, in anticipation of your help.

Hi @demirmursa,

There is no problem with this.OnlineClientManager.GetAllClients(), it works perfectly. Thanks for the links, I was able to build an OnlineDeviceStore and OnlineDeviceManager along with all the supporting code (and there's a lot of it) to implement something similar for online devices. That now allows me track devices connected to the system using IP addresses, geolocation and user information. Thanks a lot!

Glad to be of help.

I have a SignalR hub in my solution for devices. I'm having a problem finding which devices are connected. I implemented an ITypedCache (GetNcDeviceOnlineCache) to handle connections which I thought would do the job. But the cache does not allow me to get a list of all connected devices when I want to display a devices grid. For now I persist the value "IsOnline" in my database on connection and disconnection to the hub. At the moment this works but if SignalR and the database get out of sync (and I figure they will on account of both being agnostic of the other) I have a problem. I am worried about the supportability of this, I just don't believe it will be 100% accurate as I scale up.

For online users the solution is simple, there is no database persistence and I initially show connected users using IOnlineClient which allows me to get a list of all uses connected to the hub for each individual tenant. I then subscribe to, and override abp's version of SignalR's OnConnectedAsync() and OnDisconnectedAsync(Exception exception) methods. The server code is below:

       public List<IOnlineClient> GetOnlineUsers()
        {
            return this.OnlineClientManager.GetAllClients().Where(c => c.TenantId == AbpSession.TenantId).ToList();
        }

        public override async Task OnConnectedAsync()
        {
            await base.OnConnectedAsync();
            await Clients.All.SendAsync("userConnected", Convert.ToInt64(Context.UserIdentifier));
            Logger.Debug("A client connected to NcChatHub: " + Context.ConnectionId);
        }

        public override async Task OnDisconnectedAsync(Exception exception)
        {
            await base.OnDisconnectedAsync(exception);
            await Clients.All.SendAsync("userDisconnected", Convert.ToInt64(Context.UserIdentifier));
            Logger.Debug("A client connected to NcChatHub: " + Context.ConnectionId);
        }

The key piece of code here is this.OnlineClientManager.GetAllClients().Where(c => c.TenantId == AbpSession.TenantId).ToList(); I have searched the github code for abpboilerplate and cannot find the implementation of OnlineClientManager.

I really appreciate the fact that you guys are the wizards and I am very much an apprentice. But can anyone tell me how to get a list of connected devices without having to persist the value in the database? i.e. something like the elusive implementation of OnlineClientManager?

Your attention, advice and direction would be most appreciated.

Perfect, thanks so much for your help. You learn something new about Zero every day!

Hi @ismcagdas, sure, thanks for helping. The user registers a device by entering the tenancyName in an app. I have a DeviceRegistrationManager.RegisterDevice method which is passed details about the new device such as model, manufacturer, serial number etc. So, the key code is here:

var model = ObjectMapper.Map<NcDevice>(input);
model.TenantId = tenant.Id;
deviceId = await _deviceRepository.InsertAndGetIdAsync(model);

//Notifications
var notificationData = new LocalizableMessageNotificationData(
    new LocalizableString(
        "NewDeviceRegisteredNotificationDefinition",
        NuagecareConsts.LocalizationSourceName
        )
    );
_notificationPublisher.Publish(AppNotificationNames.NewDeviceRegistered, notificationData, severity: NotificationSeverity.Info);

The localisation string for NewDeviceRegisteredNotificationDefinition is:

<text name="NewDeviceRegisteredNotificationDefinition">New device registered, please authorise.</text>

What I woud like to say in the notification is "A new device has been registered; device id {Id}, ({Samsung}, {A790F}, {aaappp0001117777333}) please authorise".

Sorry, @ismcagdas - I can't see how to do that. Where do I put the string.Format to inject a device model and manufacturer?

Given the following notification when a device is added to my app:

                    var notificationData = new LocalizableMessageNotificationData(
                        new LocalizableString(
                            "NewDeviceRegisteredNotificationDefinition",
                            NuagecareConsts.LocalizationSourceName
                            )
                        );
                    _notificationPublisher.Publish(AppNotificationNames.NewDeviceRegistered, notificationData, severity: NotificationSeverity.Info);

How do I inject variables into the language string to show the manufacturer, model of the device and the date the device was added?

Showing 61 to 70 of 619 entries