Example #1
0
        public InspectorViewModel(
            InspectionReportMap map,
            Func <string, string> urlmapper,
            bool recursive,
            Action <Node> action = null
            )
        {
            _root = new Node("Actors", recursive);

            foreach (var report in map.Reports)
            {
                var node = new Node(report.Value, recursive);
                _map[node.Id] = node;

                action?.Invoke(node);
            }

            foreach (var node in _map.Values)
            {
                var last = node.Id.LastIndexOf('/');

                // root?
                if (last == -1 || last == node.Id.IndexOf('/'))
                {
                    _root.Add(node);
                }
                else
                {
                    var parent = node.Id.Substring(0, last);
                    node.Parent = new NavigationLink(parent, urlmapper(parent));
                    _map[parent].Add(node);
                }
            }

            foreach (var node in _map.Values.Union(new[] { _root }))
            {
                node.CreateNodeLinks(urlmapper);
            }
        }
Example #2
0
        public async Task <InspectionReportMap> GetReportAsync(string clientId)
        {
            if (clientId != null && _roots.TryGetValue(clientId, out var node))
            {
                return(await node.RequestAsync <InspectionReportMap>(new InspectionReportRequest()).ConfigureAwait(false));
            }

            var report = new InspectionReportMap();

            var inspectionReport = new InspectionReport
            {
                Pid = new PID("nonhost", clientId ?? "Demo")
            };

            inspectionReport.Status.Add("kernel::name", "Name");
            inspectionReport.Status.Add("kernel::actorType", "ActorType");
            inspectionReport.Status.Add("kernel::status", "Started");

            report.Reports.Add("root", inspectionReport);

            return(report);
        }