public void Transition_BCE_to_CE_should_contain_1BCE_and_1CE_ticks() { Logger.Log("Bug: @https://github.com/alterm4nn/ChronoZoom/issues/87", LogType.Debug); TimelineHelper.OpenBceCeArea(); List <string> labels = TimescaleHelper.GetLabels(); CollectionAssert.Contains(labels, Label1Bce, Label1Bce + " is not presented"); CollectionAssert.Contains(labels, Label1Ce, Label1Ce + " is not presented"); }
public void Life_TimeLine_Contains_Data() { TimelineHelper.OpenCosmosTimeline(); TimelineHelper.OpenLifeTimeline(); List <string> labels = TimescaleHelper.GetLabels(); CollectionAssert.Contains(labels, Label3500Ma, Label3500Ma + " is not presented"); CollectionAssert.Contains(labels, Label500Ma, Label500Ma + "is not presented"); }
public void timeline_should_be_created_in_date_mode() { _timeline = new Timeline { Title = "WebdriverTitleDayMode" }; TimelineHelper.AddTimelineWithDateMode(_timeline); _newTimeline = TimelineHelper.GetLastTimeline(); Assert.AreEqual(_timeline.Title, _newTimeline.Title); }
public void Humanity_TimeLine_Contains_Data() { TimelineHelper.OpenHumanityTimeline(); List <string> labels = TimescaleHelper.GetLabels(); CollectionAssert.Contains(labels, Label2000Bce, Label2000Bce + " is not presented"); CollectionAssert.Contains(labels, Label2000Ce, Label2000Ce + " is not presented"); CollectionAssert.DoesNotContain(labels, Label2001Bce, Label2001Bce + " is presented"); }
public void timeline_should_be_created_in_date_mode() { Logger.Log("Bug: https://github.com/alterm4nn/ChronoZoom/issues/528", LogType.Debug); _timeline = new Timeline { Title = "WebdriverTitleDayMode" }; TimelineHelper.AddTimelineWithDayMode(_timeline); _newTimeline = TimelineHelper.GetLastTimeline(); Assert.AreEqual(_timeline.Title, _newTimeline.Title); }
public void Roman_History_TimeLine_Borders() { TimelineHelper.OpenHumanityTimeline(); TimelineHelper.OpenRomanHistoryTimeline(); const double expected = 942; double leftBorder = TimescaleHelper.GetLeftBorderDate(); double rightBorder = TimescaleHelper.GetRightBorderDate(); Assert.AreEqual(expected, rightBorder - leftBorder); }
public static void ClassInitialize(TestContext testContext) { BrowserStateManager.RefreshState(); HomePageHelper.OpenSandboxPage(); _timeline = new Timeline { Title = "WebdriverTitle" }; HomePageHelper.DeleteAllElementsLocally(); TimelineHelper.AddTimeline(_timeline); _newTimeline = TimelineHelper.GetLastTimeline(); }
public void Roman_History_TimeLine_Borders_Ages() { TimelineHelper.OpenHumanityTimeline(); TimelineHelper.OpenRomanHistoryTimeline(); const string leftBorderAge = "BCE"; const string righBorderAge = "CE"; string leftBorder = TimescaleHelper.GetLeftBorderDateAge(); string rightBorder = TimescaleHelper.GetRightBorderDateAge(); Assert.AreEqual(leftBorderAge, leftBorder); Assert.AreEqual(righBorderAge, rightBorder); }
public void TestCleanup() { if (_newExhibit != null && ExhibitHelper.IsExhibitFound(_newExhibit)) { ExhibitHelper.DeleteExhibitByJavascript(_newExhibit); } if (_newTimeline != null && TimelineHelper.IsTimelineFound(_newTimeline)) { TimelineHelper.DeleteTimelineByJavaScript(_newTimeline); } CreateScreenshotsIfTestFail(TestContext); }
public static void ClassInitialize(TestContext testContext) { BrowserStateManager.RefreshState(); HomePageHelper.OpenSandboxPage(); _timeline = new Timeline { Title = RandomString.GetRandomString(1, 200, isUsingSpecChars: true) }; HomePageHelper.DeleteAllElementsLocally(); TimelineHelper.AddTimeline(_timeline); _newTimeline = TimelineHelper.GetLastTimeline(); }
public void Mouse_Marker() { TimelineHelper.OpenHumanityTimeline(); string mouseMarkerText = TimescaleHelper.GetMouseMarkerText(); HomePageHelper.MoveMouseToCenter(); string mouseMarkerCenterText = TimescaleHelper.GetMouseMarkerText(); Assert.AreNotEqual(mouseMarkerText, mouseMarkerCenterText); HomePageHelper.MoveMouseToLeft(); mouseMarkerText = TimescaleHelper.GetMouseMarkerText(); Assert.AreNotEqual(mouseMarkerText, mouseMarkerCenterText); }
public void Draw(EventStepData data, int index) { //GetRescale(); ManageData(data); Vector2 barPos = new Vector2(TimelineHelper.ConvertTimeToOverflowPixels(data.startTime, (int)overflow.x, time), TimelineHelper.ConvertTimeToOverflowPixels(data.startTime + data.duration, (int)overflow.x, time)); // Guarantee a minimum size for all zero-duration steps if (data.duration == 0f) { Vector2 minSize = barStyle.CalcSize(new GUIContent(data.type.ToString())); barPos.y = barPos.x + minSize.x + 4; } GUI.depth = 1; GUILayout.BeginArea(drawArea); //GUI.BeginScrollView(new Rect(0,0,drawArea.width,drawArea.height), scroll, new Rect(0,0,overflow.x,overflow.y)); GUIStyle useForBar = this.barStyle; Rect barRect = new Rect(barPos.x, index * barHeight + index, barPos.y - barPos.x, barHeight); if (barRect.x + barRect.width > this.drawArea.width) { barRect.x -= barRect.width; useForBar = this.occludedBarStyle; } GUI.Label(barRect, data.type.ToString(), useForBar); if (GUI.Button(barRect, "", labelStyle)) { EventStepDataWindow stepDataWindow; stepDataWindow = EditorWindow.GetWindow <EventStepDataWindow>(); stepDataWindow.Edit(this, data); } GUIContent calc = new GUIContent(data.startTime.ToString()); Vector2 size = GUI.skin.label.CalcSize(calc); GUI.Label(new Rect(barRect.x, barRect.y, size.x, size.y), calc, labelStyle); calc.text = (data.startTime + data.duration).ToString(); size = GUI.skin.label.CalcSize(calc); GUI.Label(new Rect((barRect.x + barRect.width) - size.x, (barRect.y + barRect.height) - size.y, size.x, size.y), calc, labelStyle); //GUI.EndScrollView(); GUILayout.EndArea(); }
public ActionResult GraphByInterval(Guid id, TimelineInterval interval) { var toDate = MvcApplication.GetServerDateTime(); var fromDate = TimelineHelper.IntervalToStartDate(toDate, interval); var metricRepository = CurrentAccountDbContext.GetMetricRepository(); var metric = metricRepository.GetById(id); var metricHistoryRepository = CurrentAccountDbContext.GetMetricHistoryRepository(); var rows = metricHistoryRepository .GetByPeriod(metric.ComponentId, fromDate, toDate, new[] { metric.MetricTypeId }) .OrderBy(t => t.BeginDate) .ToArray(); var model = GetCounterGraphDataModel(metric.MetricType, rows); return(PartialView("GraphPartial", model)); }
public ActionResult Index(TimelineInterval?interval) { var userSettingService = CurrentAccountDbContext.GetUserSettingService(); var savedInterval = (TimelineInterval?)userSettingService.ComponentHistoryInterval(CurrentUser.Id) ?? TimelineInterval.Hour; if (interval != null) { userSettingService.ComponentHistoryInterval(CurrentUser.Id, (int)interval.Value); DbContext.SaveChanges(); } var model = new IndexModel() { Interval = interval ?? savedInterval }; model.ToDate = MvcApplication.GetServerDateTime(); model.FromDate = TimelineHelper.IntervalToStartDate(model.ToDate, model.Interval); return(View(model)); }
public async Task <IActionResult> UserTimeline([FromRoute] Guid userId) { try { var timeline = new List <TimelineDTO>(); var userSetting = await _userSettingRepo.First(us => us.UserId == userId); if (userSetting == null) { return(NotFound("Kullanıcı ayarı bulunamadı.")); } //User Events if (userSetting.IsCreateEventVisibleTimeline) { var eventsTimeline = (await _eventRepo.UserEvents(userId)).Select(e => new TimelineDTO() { Header = e.Title, Body = TimelineHelper.GenerateUserCreateEventBody(e), Image = e.Photo, CreateAt = e.CreatedAt, CustomId = e.Id, Type = "create-event", LineColor = "#a6714e" }).ToList(); if (!eventsTimeline.IsNullOrEmpty()) { timeline.AddRange(eventsTimeline); } } //Event Operations if (userSetting.IsJoinEventVisibleTimeline) { var eventOperationsTimeline = (await _eventOperationRepo.UserEventOperations(userId)).Select(eo => new TimelineDTO() { Header = eo.Event.Title, Body = TimelineHelper.GenerateUserJoinEventBody(eo.Event), Image = eo.Event.Photo, CreateAt = eo.CreatedAt, CustomId = eo.EventId, Type = "join-event", LineColor = "#f78f8f" }).ToList(); if (!eventOperationsTimeline.IsNullOrEmpty()) { timeline.AddRange(eventOperationsTimeline); } } //Following Friend Operations if (userSetting.IsFollowingVisibleTimeline) { var followFriendOperationsTimeline = (await _friendOperationRepo.Followings(userId)).Select(fo => new TimelineDTO() { Header = fo.FollowingUser.FirstName + " " + fo.FollowingUser.LastName, Body = TimelineHelper.GenerateUserFollowingBody(), Image = null, CreateAt = fo.CreatedAt, CustomId = fo.FollowingUserId, Type = "following", LineColor = "#ffeea3" }).ToList(); if (!followFriendOperationsTimeline.IsNullOrEmpty()) { timeline.AddRange(followFriendOperationsTimeline); } } //Follow Friend Operations if (userSetting.IsFollowerVisibleTimeline) { var followingFriendOperationsTimeline = (await _friendOperationRepo.Followers(userId)).Select(fo => new TimelineDTO() { Header = fo.FollowerUser.FirstName + " " + fo.FollowerUser.LastName, Body = TimelineHelper.GenerateUserFollowerBody(), Image = null, CreateAt = fo.CreatedAt, CustomId = fo.FollowerUserId, Type = "follower", LineColor = "#ffeea3" }).ToList(); if (!followingFriendOperationsTimeline.IsNullOrEmpty()) { timeline.AddRange(followingFriendOperationsTimeline); } } //Comments if (userSetting.IsCommentVisibleTimeline) { var commentsTimeline = (await _commentRepo.UserComments(userId)).Select(c => new TimelineDTO() { Header = c.Event.Title, Body = TimelineHelper.GenerateUserCommentBody(userId, c), Image = null, CreateAt = c.CreatedAt, CustomId = c.EventId, Type = "comment-event", LineColor = "#dcd5f2" }).ToList(); if (!commentsTimeline.IsNullOrEmpty()) { timeline.AddRange(commentsTimeline); } } if (timeline.IsNullOrEmpty()) { return(NotFound("Kayıt bulunamadı.")); } return(Ok(timeline.OrderByDescending(t => t.CreateAt))); } catch (Exception ex) { _logHelper.Log("UsersController", 500, "UserTimeline", ex.Message); return(null); } }
public void random_new_timeline_should_be_deleted() { TimelineHelper.DeleteTimeline(_newTimeline); Assert.IsFalse(TimelineHelper.IsTimelineFound(_newTimeline)); }
public TimelineHelper GetTimelineHelper() { return(_timelineHelper ?? (_timelineHelper = new TimelineHelper())); }
private void ResizeOverflow() { this.overflow = TimelineHelper.GetOverflowSize(timescale, drawArea); }
/// <summary> /// Método responsável por renderizar uma timeline na view a partir de um IEnumerable<TimelineItem> /// </summary> /// <param name="htmlHelper">Html Helper</param> /// <param name="itens">Itens a serem renderizados na timeline</param> /// <returns></returns> public static MvcHtmlString RenderTimeline(this HtmlHelper htmlHelper, IEnumerable <TimelineItem> itens) { //criação do nó principal da timeline var unorderedListTimeline = new TagBuilder("ul"); unorderedListTimeline.Attributes.Add(new KeyValuePair <string, string>("class", "timeline")); //iteração dos itens para construção da timeline foreach (var timelineItem in itens) { //criação do item da timeline, setando sua cor configurada var timelineColor = new TagBuilder("li"); timelineColor.Attributes.Add(new KeyValuePair <string, string>("class", TimelineHelper.GetCssByTimelineColor(timelineItem.Color))); //criação do nó que conterá as informações sobre a data e hora do evento na timeline var timelineTime = new TagBuilder("div"); timelineTime.Attributes.Add(new KeyValuePair <string, string>("class", "timeline-time")); //criação do nó que conterá a data var spanDate = new TagBuilder("span"); spanDate.Attributes.Add(new KeyValuePair <string, string>("class", "date")); //spanDate.InnerHtml = timelineItem.DateTime.ToString("dd/MM/yyyy"); spanDate.InnerHtml = timelineItem.MarcacaoPatioAtual; //criação do nó que conterá a hora var spanTime = new TagBuilder("span"); spanTime.Attributes.Add(new KeyValuePair <string, string>("class", "time")); //spanTime.InnerHtml = timelineItem.DateTime.ToString("HH:mm"); spanTime.InnerHtml = timelineItem.SiglaPatio; //atribuição do nó de data e de hora ao nó principal relativo a essa informação timelineTime.InnerHtml = spanDate.ToString() + spanTime.ToString(); //criação do nó que conterá o ícone do item da timeline var timelineIcon = new TagBuilder("div"); if (!timelineItem.EntrePatios) { timelineIcon.Attributes.Add(new KeyValuePair <string, string>("class", "timeline-icon")); } //verificação se o item possui css indicando qual ícone a exibir if (timelineItem.MiddleIconCss != "") { var icon = new TagBuilder("i"); icon.Attributes.Add(new KeyValuePair <string, string>("class", timelineItem.MiddleIconCss)); timelineIcon.InnerHtml = icon.ToString(); } //criação do nó que conterá o "corpo" da timeline var timelineBody = new TagBuilder("div"); timelineBody.Attributes.Add(new KeyValuePair <string, string>("class", "timeline-body")); //criação do nó que conterá o título var timelineTitle = new TagBuilder("H2"); timelineTitle.InnerHtml = timelineItem.Title; //criação do nó que conterá a dados antes da descrição do conteúdo do item da timeline var timelineAfterContent = new TagBuilder("div"); timelineAfterContent.Attributes.Add(new KeyValuePair <string, string>("class", "timeline-content")); timelineAfterContent.InnerHtml = timelineItem.AfterDescription; //criação do nó que conterá a descrição do conteúdo do item da timeline var timelineContent = new TagBuilder("div"); timelineContent.Attributes.Add(new KeyValuePair <string, string>("class", "timeline-content")); timelineContent.InnerHtml = timelineItem.Description; //criação do nó que conterá a dados depois da descrição do conteúdo do item da timeline var timelineBeforeContent = new TagBuilder("div"); timelineBeforeContent.Attributes.Add(new KeyValuePair <string, string>("class", "timeline-content")); timelineBeforeContent.InnerHtml = timelineItem.BeforeDescription; //criação do nó que conterá o rodapé do item da timeline var timelineFooter = new TagBuilder("div"); timelineFooter.Attributes.Add(new KeyValuePair <string, string>("class", "timeline-footer")); //criação do nó que conterá o link de "leia mais" no rodapé da timeline var readMoreLink = new TagBuilder("a"); readMoreLink.Attributes.Add(new KeyValuePair <string, string>("class", "nav-link pull-right")); readMoreLink.Attributes.Add(new KeyValuePair <string, string>("href", "javascript:" + timelineItem.LinkContent + ";")); //criação do nó que conterá a imagem alinhada a descrição "Leia mais" no rodapé var readMoreImg = new TagBuilder("i"); readMoreImg.Attributes.Add(new KeyValuePair <string, string>("class", "fa fa-chevron-circle-right")); //atribuição dos valores ao link "Leia mais..." readMoreLink.InnerHtml = timelineItem.LinkDescription + readMoreImg.ToString(); //atribuição dos valores ao nó de cabecalho //timelineTitle.InnerHtml = readMoreLink.ToString(); //atribuição dos valores ao nó de rodapé if (!String.IsNullOrEmpty(timelineItem.LinkDescription)) { timelineFooter.InnerHtml = readMoreLink.ToString(); } //atribuição dos valores ao nó que representa o corpo do item da timeline timelineBody.InnerHtml = timelineTitle.ToString() + timelineBeforeContent.ToString() + "<br/>" + timelineContent.ToString() + "<br/>" + timelineAfterContent.ToString() + timelineFooter.ToString(); //atribuição dos valores ao nó que representa o item completo da timeline timelineColor.InnerHtml = timelineTime.ToString() + timelineIcon.ToString() + timelineBody.ToString(); unorderedListTimeline.InnerHtml += timelineColor.ToString(); } return(new MvcHtmlString(unorderedListTimeline.ToString())); }
public async Task <IActionResult> Timeline() { try { Guid userId = User.GetUserId(); List <TimelineDTO> timeline = new List <TimelineDTO>(); //User Events var eventsTimeline = (await _eventRepo.UserEvents(userId)).Select(e => new TimelineDTO() { Header = e.Title, Body = TimelineHelper.GenerateMyCreateEventBody(e), Image = e.Photo, CreateAt = e.CreatedAt, CustomId = e.Id, Type = "create-event", LineColor = "#a6714e" }).ToList(); if (!eventsTimeline.IsNullOrEmpty()) { timeline.AddRange(eventsTimeline); } //Event Operations var eventOperationsTimeline = (await _eventOperationRepo.UserEventOperations(userId)).Select(eo => new TimelineDTO() { Header = eo.Event.Title, Body = TimelineHelper.GenerateMyJoinEventBody(eo.Event), Image = eo.Event.Photo, CreateAt = eo.CreatedAt, CustomId = eo.EventId, Type = "join-event", LineColor = "#f78f8f" }).ToList(); if (!eventOperationsTimeline.IsNullOrEmpty()) { timeline.AddRange(eventOperationsTimeline); } //Following Friend Operations var followFriendOperationsTimeline = (await _friendOperationRepo.Followings(userId)).Select(fo => new TimelineDTO() { Header = fo.FollowingUser.FirstName + " " + fo.FollowingUser.LastName, Body = TimelineHelper.GenerateMyFollowingBody(), Image = null, CreateAt = fo.CreatedAt, CustomId = fo.FollowingUserId, Type = "following", LineColor = "#ffeea3" }).ToList(); if (!followFriendOperationsTimeline.IsNullOrEmpty()) { timeline.AddRange(followFriendOperationsTimeline); } //Follow Friend Operations var followingFriendOperationsTimeline = (await _friendOperationRepo.Followers(userId)).Select(fo => new TimelineDTO() { Header = fo.FollowerUser.FirstName + " " + fo.FollowerUser.LastName, Body = TimelineHelper.GenerateMyFollowerBody(), Image = null, CreateAt = fo.CreatedAt, CustomId = fo.FollowerUserId, Type = "follower", LineColor = "#ffeea3" }).ToList(); if (!followingFriendOperationsTimeline.IsNullOrEmpty()) { timeline.AddRange(followingFriendOperationsTimeline); } //Comments var commentsTimeline = (await _commentRepo.UserComments(userId)).Select(c => new TimelineDTO() { Header = c.Event.Title, Body = TimelineHelper.GenerateMyCommentBody(userId, c), Image = null, CreateAt = c.CreatedAt, CustomId = c.EventId, Type = "comment-event", LineColor = "#dcd5f2" }).ToList(); if (!commentsTimeline.IsNullOrEmpty()) { timeline.AddRange(commentsTimeline); } if (timeline.IsNullOrEmpty()) { return(NotFound("Kayıt bulunamadı.")); } return(Ok(timeline.OrderByDescending(t => t.CreateAt))); } catch (Exception ex) { _logHelper.Log("AccountController", 500, "Timeline", ex.Message); return(null); } }
public PartialViewResult ShowTimelinesEventsPartial(Guid id, TimelineInterval interval, bool all = false) { var toDate = MvcApplication.GetServerDateTime(); var fromDate = TimelineHelper.IntervalToStartDate(toDate, interval); var eventTypeRepository = CurrentAccountDbContext.GetEventTypeRepository(); var eventTypes = eventTypeRepository.QueryAll().Select(t => new { t.Id, t.DisplayName }).ToDictionary(t => t.Id, t => t); var eventRepository = CurrentAccountDbContext.GetEventRepository(); var query = eventRepository.QueryAllByAccount() .Where(t => t.OwnerId == id && t.StartDate <= toDate && t.ActualDate >= fromDate); if (all) { query = query.Where(t => t.Category == EventCategory.ApplicationError || t.Category == EventCategory.ComponentEvent); } else { query = query.Where(t => t.Category == EventCategory.ApplicationError); } var events = query .GroupBy(t => t.EventTypeId) .Select(t => new { Id = t.Key, Importance = t.Max(z => z.Importance), Count = t.Sum(z => z.Count), LastMessage = t.OrderByDescending(z => z.StartDate).FirstOrDefault().Message }) .ToArray(); var model = new ComponentShowTimelinesGroupModel() { FromDate = fromDate, ToDate = toDate, HideUptime = true, Items = events .Select(t => new { Id = t.Id, Importance = t.Importance, Count = t.Count, Name = eventTypes[t.Id].DisplayName, LastMessage = t.LastMessage }) .OrderByDescending(t => t.Importance) .ThenByDescending(t => t.Count) .ThenBy(t => t.Name) .Take(MaxEventTimelineCount) .Select(t => new ComponentShowTimelinesGroupItemModel() { Action = "ForEventType", Category = null, OwnerId = id, EventTypeId = t.Id, Importance = t.Importance, Name = t.Name, Count = t.Count, Comment = t.LastMessage, Url = Url.Action("Show", "EventTypes", new { Id = t.Id }) }) .ToArray() }; return(PartialView("~/Views/Components/ShowTimelinesPartialGroup.cshtml", model)); }