public void Accept(DatabaseStatistics stats)
		{
			CountOfDocuments = stats.CountOfDocuments;

			UpdateOrSetStatEntry("documents", stats.CountOfDocuments, IoC.Get<Documents.BrowseDocumentsViewModel>);
			UpdateOrSetStatEntry("indexes", stats.CountOfIndexes, IoC.Get<IndexesViewModel>);
			UpdateOrSetStatEntry("stale", stats.StaleIndexes.Length, IoC.Get<IndexesViewModel>);
			UpdateOrSetStatEntry("errors", stats.Errors.Length, IoC.Get<ErrorsViewModel>);
			UpdateOrSetStatEntry("triggers", stats.Triggers.Length, null);
			UpdateOrSetStatEntry("tasks", stats.ApproximateTaskCount, null);
		}
Exemple #2
0
		private void UpdateGroupedIndexList(DatabaseStatistics statistics)
		{
			var indexes = statistics.Indexes;
			var currentSelection = ItemSelection.GetSelectedItems().Select(i => i.Name).ToHashSet();

			var indexGroups = from index in indexes
							  let groupDetails = GetIndexGroup(index.Name)
							  let indexGroup = groupDetails.Item1
							  let indexOrder = groupDetails.Item2
							  orderby indexOrder
							  group index by indexGroup;

			var indexesAndGroupHeaders =
				indexGroups.SelectMany(group => new IndexListItem[] {new IndexGroupHeader {Name = group.Key}}
													.Concat(group.Select(index => new IndexItem {Name = index.Name, IndexStats = index})));

			GroupedIndexes.Clear();
			GroupedIndexes.AddRange(indexesAndGroupHeaders.ToList());

			var selection = GroupedIndexes.OfType<IndexItem>().Where(i => currentSelection.Contains(i.Name));

			ItemSelection.SetDesiredSelection(selection);
		}
Exemple #3
0
		private void UpdateGroupedIndexList(DatabaseStatistics statistics)
		{
			Indexes.Clear();
			if(string.IsNullOrWhiteSpace(SearchText.Value))
				Indexes.AddRange(statistics.Indexes.Where(stats => stats != null)
					.Select(stats => new IndexItem { Name = stats.Name, GroupName = GetIndexGroup(stats), IndexStats = stats }));
			else
				Indexes.AddRange(statistics.Indexes
					.Where(stats => stats != null && stats.Name.IndexOf(SearchText.Value, StringComparison.InvariantCultureIgnoreCase) != -1)
					.Select(stats => new IndexItem { Name = stats.Name, GroupName = GetIndexGroup(stats), IndexStats = stats }));
			
			CleanGroupIndexes();
			foreach (var indexItem in Indexes)
			{
				var groupItem = GroupedIndexes.FirstOrDefault(@group => string.Equals(@group.GroupName, indexItem.GroupName, StringComparison.OrdinalIgnoreCase));
				if (groupItem == null)
				{
					groupItem = new Group(indexItem.GroupName);
					GroupedIndexes.Add(groupItem);
				}

				groupItem.Items.Add(indexItem);
			}

			OnPropertyChanged(() => GroupedIndexes);
		}
Exemple #4
0
		private void UpdateGroupedIndexList(DatabaseStatistics statistics)
		{
			Indexes.Clear();
			Indexes.AddRange(statistics.Indexes.Select(stats => new IndexItem{Name = stats.Name, GroupName = GetIndexGroup(stats), IndexStats = stats}));
			
			CleanGroupIndexes();
			foreach (var indexItem in Indexes)
			{
				var groupItem = GroupedIndexes.FirstOrDefault(@group => string.Equals(@group.GroupName, indexItem.GroupName, StringComparison.OrdinalIgnoreCase));
				if (groupItem == null)
				{
					groupItem = new Group(indexItem.GroupName);
					GroupedIndexes.Add(groupItem);
				}

				groupItem.Items.Add(indexItem);
			}

			OnPropertyChanged(() => GroupedIndexes);
		}
Exemple #5
0
		public StatisticsUpdated(DatabaseStatistics statistics) { Statistics = statistics; }