Beispiel #1
0
        public ActionResult GetRebuildingInfo(string keys)
        {
            var results = new List<object>();
            var keyArray = keys.Split(new[] { "||" }, StringSplitOptions.RemoveEmptyEntries);
            foreach (var key in keyArray)
            {
                var parts = key.Split('|');
                var task = RebuildTasks.GetTask(CurrentInstance.Name, Type.GetType(parts[0], true), CultureInfo.GetCultureInfo(parts[1]));

                var result = new IndexModel();
                UpdateIndexModel(result, task);

                results.Add(result);
            }

            return JsonNet(results).UsingClientConvention();
        }
Beispiel #2
0
        private List<IndexModel> CreateIndexModels(string name, Type modelType)
        {
            var languages = new List<string> { String.Empty };
            languages.AddRange(_languageStore.All().Select(l => l.Name));

            var models = new List<IndexModel>();

            foreach (var lang in languages)
            {
                var model = new IndexModel
                {
                    Name = name + (!String.IsNullOrEmpty(lang) ? " (" + lang + ")" : String.Empty),
                    Culture = lang,
                    DocumentType = modelType.AssemblyQualifiedNameWithoutVersion()
                };

                var task = RebuildTasks.GetTask(CurrentInstance.Name, modelType, CultureInfo.GetCultureInfo(lang));
                UpdateIndexModel(model, task);

                models.Add(model);
            }

            return models;
        }
Beispiel #3
0
        private void UpdateIndexModel(IndexModel model, RebuildTask task)
        {
            model.IsRebuilding = task.Status == RebuildStatus.Running;
            model.RebuildProgress = task.Progress;

            var taskInfo = task.GetTaskInfo();
            model.LastSucceededRebuildTimeUtc = taskInfo.LastSucceededRebuildTimeUtc;
            model.LastRebuildStatus = taskInfo.LastRebuildStatus;
            model.LastRebuildError = taskInfo.LastRebuildError;
            model.LastRebuildErrorDetail = taskInfo.LastRebuildErrorDetail;
        }