public HtmlActionResult <Host> TagView(string host)
        {
            IStateQuery syslogState = base.GetSyslogState();
            Host        h           = syslogState.GetHost(host);

            return(new HtmlActionResult <Host>(Path.Combine(base.GetViewDirectory(), "Tags.cshtml"), h));
        }
        public HtmlActionResult <TagMessagesCollection> MessageView(string host, string tag)
        {
            IStateQuery           syslogState   = base.GetSyslogState();
            TagMessagesCollection msgCollection = syslogState.GetTagMessages(host, tag);

            msgCollection.Messages.Sort((x, y) => y.Timestamp.CompareTo(x.Timestamp));
            return(new HtmlActionResult <TagMessagesCollection>(Path.Combine(base.GetViewDirectory(), "Messages.cshtml"), msgCollection));
        }
Beispiel #3
0
        public HostsCollection Hosts([FromUri] string name = null)
        {
            IStateQuery syslogState = base.GetSyslogState();
            List <Host> hosts       = syslogState.GetHosts();

            return(new HostsCollection()
            {
                Hosts = hosts
            });
        }
        public HtmlActionResult <HostsCollection> HostView()
        {
            IStateQuery     syslogState = base.GetSyslogState();
            List <Host>     hosts       = syslogState.GetHosts();
            HostsCollection coll        = new HostsCollection()
            {
                Hosts = hosts
            };

            return(new HtmlActionResult <HostsCollection>(Path.Combine(base.GetViewDirectory(), "Hosts.cshtml"), coll));
        }
        public HtmlActionResult <SearchModel> Search([FromUri] SearchQuery search)
        {
            IStateQuery           syslogState   = base.GetSyslogState();
            TagMessagesCollection msgCollection = syslogState.GetTagMessages(search.Host, search.Tag);

            //msgCollection.Messages.Sort((x, y) => y.Timestamp.CompareTo(x.Timestamp));
            //TODO: This is stable sort but not in-place => possible memory pressure
            msgCollection.Messages = msgCollection.Messages.OrderByDescending(x => x.Timestamp).ToList();
            SearchModel searchModel = FilterUtility.ApplyFilters(search, msgCollection);

            return(new HtmlActionResult <SearchModel>(Path.Combine(base.GetViewDirectory(), "Search.cshtml"), searchModel));
        }
 public StatesController(
     IStateQuery stateQuery)
 {
     this.stateQuery = stateQuery;
 }
Beispiel #7
0
        public TagMessagesCollection Messages(string host, string tag)
        {
            IStateQuery syslogState = base.GetSyslogState();

            return(syslogState.GetTagMessages(host, tag));
        }
Beispiel #8
0
 public StateController(
     IStateQuery stateQuery
     )
 {
     _stateQuery = stateQuery;
 }