public string GetSessionLog()
        {
            string retString = $"<div class=\"cdeInfoBlock\" style=\"clear:both; max-width:1570px; width:initial; \"><div class=\"cdeInfoBlockHeader cdeInfoBlockHeaderText\" id=\"sessionLog\">Session Log: ({MySessionStates.Count}) ";

            retString += $"<a download =\"SessionLog_{TheCommonUtils.GetMyNodeName()}.csv\" href=\"#\" class=\'cdeExportLink\' onclick=\"return ExcellentExport.csv(this, 'sessionLogTable');\">(Export as CSV)</a></div>";
            List <string> tSessions = MySessionStates.TheKeys;
            string        tFont;
            int           count = 0;

            foreach (string tKey in tSessions)
            {
                if (count == 0)
                {
                    retString += $"<table class=\"cdeHilite\" style=\"width:95%; margin-left:1%;\" id=\"sessionLogTable\"><tr>";
                    retString += $"<th style=\"background-color:rgba(90,90,90, 0.25);font-size:x-small;min-width:175px; width:300px;\">SEID</th>";
                    retString += $"<th style=\"background-color:rgba(90,90,90, 0.25);font-size:x-small;min-width:80px; width:80px;\">DID</th>";
                    retString += $"<th style=\"background-color:rgba(90,90,90, 0.25);font-size:x-small;min-width:80px; width:150px;\">Last Access</th>";
                    retString += $"<th style=\"background-color:rgba(90,90,90, 0.25);font-size:x-small;min-width:80px; width:150px;\">End</th>";
                    retString += $"<th style=\"background-color:rgba(90,90,90, 0.25);font-size:x-small;width:100px;\">Browser</th>";
                    retString += $"<th style=\"background-color:rgba(90,90,90, 0.25);font-size:x-small;width:200px;\">Current Url</th>";
                    retString += $"<th style=\"background-color:rgba(90,90,90, 0.25);font-size:x-small;width:300px\">Remote Address</th>";
                    retString += $"<th style=\"background-color:rgba(90,90,90, 0.25);font-size:x-small;min-width:80px; width:80px;\">CID</th>";
                    retString += $"<th style=\"background-color:rgba(90,90,90, 0.25);font-size:x-small;min-width:80px; width:80px;\">SID</th>";
                    retString += $"<th style=\"background-color:rgba(90,90,90, 0.25);font-size:x-small;width:400px;\">User Agent</th>";
                    retString += "</tr>";
                }
                count++;
                TheSessionState tSession = MySessionStates.MyMirrorCache.MyRecords[tKey];
                if (tSession.MyDevice == Guid.Empty)
                {
                    tFont = " style='color:lightgray'";
                }
                else
                {
                    tFont = "";
                }
                retString += $"<tr {tFont}>";
                retString += $"<td class=\"cdeClip cdeLogEntry\" style=\"text-align:left;\">{tSession.cdeMID}</td>";
                retString += $"<td class=\"cdeClip cdeLogEntry\" style=\"text-align:left;\">{TheCommonUtils.GetDeviceIDML(tSession.MyDevice)}</td>";
                retString += $"<td class=\"cdeClip cdeLogEntry\" style=\"text-align:center;\">{TheCommonUtils.GetDateTimeString(tSession.LastAccess,-1)}</td>";
                retString += $"<td class=\"cdeClip cdeLogEntry\" style=\"text-align:center;\">{TheCommonUtils.GetDateTimeString(tSession.EndTime,-1)}</td>";
                retString += $"<td class=\"cdeClip cdeLogEntry\" style=\"text-align:left;\">{tSession.Browser} {tSession.BrowserDesc}</td>";
                retString += $"<td class=\"cdeClip cdeLogEntry\" style=\"max-width:200px; width: 200px;\"><div class=\"cdeClip\" style=\"max-height:100px; overflow-y:auto;\">{tSession.CurrentURL}</div></td>";
                retString += $"<td class=\"cdeClip cdeLogEntry\" style=\"text-align:left;\">{tSession.RemoteAddress}</td>";
                retString += $"<td class=\"cdeClip cdeLogEntry\" style=\"text-align:left;\">{(tSession.CID==Guid.Empty?"Not Set":tSession.CID.ToString().Substring(0,4))}</td>";
                retString += $"<td class=\"cdeClip cdeLogEntry\" style=\"text-align:left;\">{(string.IsNullOrEmpty(tSession.SScopeID) ? "Not Set" : cdeStatus.GetSScopeHashML(tSession.SScopeID))}</td>";
                retString += $"<td class=\"cdeClip cdeLogEntry\" style=\"max-width:400px; width: 400px;\"><div class=\"cdeClip\" style=\"max-height:100px; overflow-y:auto;\">{tSession.UserAgent}</div></td>";
                retString += "</tr>";
            }
            if (count > 0)
            {
                retString += "</table></div>";
                return(retString);
            }
            return("");
        }
Exemple #2
0
        public override bool CreateUX()
        {
            if (!mIsUXInitCalled)
            {
                mIsUXInitCalled = true;

                var tHead = TheNMIEngine.AddStandardForm(MyBaseThing, MyBaseThing.FriendlyName, 12, null, null, 0, $"..Event Logs on {TheCommonUtils.GetMyNodeName()}");
                MyStatusForm          = tHead["Form"] as TheFormInfo; // TheNMIEngine.AddForm(new TheFormInfo(MyBaseThing) { FormTitle = MyBaseThing.DeviceType, DefaultView = eDefaultView.Form, PropertyBag = new ThePropertyBag { "MaxTileWidth=6" } });
                MyStatusFormDashPanel = tHead["DashIcon"] as TheDashPanelInfo;
                var tBlock = TheNMIEngine.AddStatusBlock(MyBaseThing, MyStatusForm, 2);
                tBlock["Group"].SetParent(1);

                tBlock = TheNMIEngine.AddConnectivityBlock(MyBaseThing, MyStatusForm, 120, sinkConnect);
                tBlock["Group"].SetParent(1);
                DoCreateUX(tHead["Form"] as TheFormInfo);
                mIsUXInitialized = true;
            }
            return(true);
        }
        public override bool CreateUX()
        {
            if (!mIsUXInitCalled)
            {
                mIsUXInitCalled = true;

                var tFormGuid = new TheFormInfo(MyBaseThing)
                {
                    FormTitle = "Event Log", defDataSource = "EventLog", IsReadOnly = true, IsNotAutoLoading = true, PropertyBag = new nmiCtrlTableView {
                        ShowFilterField = true
                    }
                };
                TheNMIEngine.AddFormToThingUX(MyBaseThing, tFormGuid, "CMyTable", "Event Log", 6, 3, 128, $"..Event Logs on {TheCommonUtils.GetMyNodeName()}", null, new ThePropertyBag {
                    "Thumbnail=FA5:f073"
                });                                                                                                                                                                                                //;:;50;:;True
                                                                                                                                                                                                                   //TheNMIEngine.AddForm(tFormGuid);
                TheNMIEngine.AddFields(tFormGuid, new List <TheFieldInfo> {
                    { new TheFieldInfo()
                      {
                          FldOrder = 5, DataItem = "EventCategory", Flags = 0, Type = eFieldType.DateTime, Header = "Category", FldWidth = 2
                      } },
                    { new TheFieldInfo()
                      {
                          FldOrder = 10, DataItem = "EventTime", Flags = 0, Type = eFieldType.DateTime, Header = "Event Time", FldWidth = 2
                      } },
                    { new TheFieldInfo()
                      {
                          FldOrder = 20, DataItem = "StationName", Flags = 0, Type = eFieldType.SingleEnded, Header = "Node Name", FldWidth = 2
                      } },
                    { new TheFieldInfo()
                      {
                          FldOrder = 30, DataItem = "EventName", Flags = 0, Type = eFieldType.SingleEnded, Header = "Event Name", FldWidth = 2
                      } },
                    { new TheFieldInfo()
                      {
                          FldOrder = 40, DataItem = "EventString", Flags = 0, Type = eFieldType.SingleEnded, Header = "Event", FldWidth = 4
                      } },
                    { new TheFieldInfo()
                      {
                          FldOrder = 50, DataItem = "EventTrigger", Flags = 0, Type = eFieldType.SingleEnded, Header = "Trigger Object", FldWidth = 2
                      } },
                    { new TheFieldInfo()
                      {
                          FldOrder = 60, DataItem = "ActionObject", Flags = 0, Type = eFieldType.SingleEnded, Header = "Action Object", FldWidth = 2
                      } },
                });
                mIsUXInitialized = true;
            }
            return(true);
        }