Example #1
0
		private void RefreshCollectionsList()
		{
			DatabaseCommands.GetTermsCount(CollectionsIndex, "Tag", "", 100)
				.ContinueOnSuccess(collections =>
				                   	{
										var collectionModels = 
                                            new CollectionModel[] { new AllDocumentsCollectionModel { Count = Database.Value.Statistics.Value == null ? 0 : (int)Database.Value.Statistics.Value.CountOfDocuments}, new RavenDocumentsCollectionModel()}
											.Concat(
                                            collections
											.Where(x=>x.Count > 0)
											.Select(col => new CollectionModel { Name = col.Name, Count = col.Count }))
											.ToList();

                                        Collections.Match(collectionModels, () => AfterUpdate(collectionModels));
				                   	})
				.Catch(ex =>
				                           	{
				                           		var urlParser = new UrlParser(UrlUtil.Url);
				                           		if (urlParser.RemoveQueryParam("collection"))
				                           			UrlUtil.Navigate(urlParser.BuildUrl());
				                           		ApplicationModel.Current.AddErrorNotification(ex, "Unable to retrieve collections from server.");
				                           	});
		}