/// <summary> /// Load the necessary information for the given entity /// </summary> internal void LoadEntity(BaseEntity entity) { var viewModel = new DetailedItemViewModel(entity); viewModel.InitializeAsync(); var entityTypeInformation = EntityTypeRegistry.GetEntityTypeInformation(viewModel.Entity); Caption = $"{entityTypeInformation?.ShortLabel} {viewModel.ID}"; detailsControl.DataContext = viewModel; }
/// <summary> /// Constructor /// </summary> /// <param name="entity"></param> public BaseItemViewModel(BaseEntity entity) { if (entity == null) { throw new ArgumentNullException(nameof(entity)); } Entity = entity; if (entity.TypeName != null) { EntityTypeInformation = EntityTypeRegistry.GetEntityTypeInformation(entity); } }
public void DetailedItemViewModelTests_VariousProperties_BeforeAndAfterInitialize_Success() { var viewModel = new DetailedItemViewModel(_story); Assert.AreEqual(WindowMode.Loading, viewModel.Mode, "Mismatched initial mode"); viewModel.InitializeAsync().Wait(); Assert.AreEqual(WindowMode.Loaded, viewModel.Mode, "Mismatched mode after initialization"); var entityTypeInformation = EntityTypeRegistry.GetEntityTypeInformation(_story); Assert.AreEqual(entityTypeInformation.ShortLabel, viewModel.IconText, "Mismatched icon text"); Assert.AreEqual(entityTypeInformation.Color, viewModel.IconBackgroundColor, "Mismatched icon background color"); }
/// <summary> /// Update active item button in toolbar with the current active item's information /// </summary> public void UpdateActiveItemInToolbar() { try { var activeEntity = WorkspaceSessionPersistanceManager.GetActiveEntity(); if (activeEntity != null) { _activeItemMenuCommand.Text = EntityTypeRegistry.GetEntityTypeInformation(activeEntity).ShortLabel + " " + activeEntity.Id; _activeItemMenuCommand.Enabled = true; _copyCommitMessageCommand.Enabled = true; _stopWorkCommand.Enabled = true; } else { DisableActiveItemToolbar(); } } catch (Exception ex) { MessageBox.Show("Unable to update active item in Octane toolbar.\n\n" + "Failed with message: " + ex.Message, ToolWindowHelper.AppName, MessageBoxButton.OK, MessageBoxImage.Error); } }
public MyWorkItemsSublist(string entityType) { TypeInformation = EntityTypeRegistry.GetEntityTypeInformation(entityType); Items = new ObservableCollection <OctaneItemViewModel>(); }
private MyWorkMetadata() { _entitiesFieldsFetchInfo = new Dictionary <Type, Dictionary <string, FieldInfo[]> >(); fieldsByEntityType = new Dictionary <Type, List <string> >(); AddSubType <WorkItem>(WorkItem.SUBTYPE_DEFECT, FieldAtSubTitle(CommonFields.Environment, "Environment", "No environment"), FieldAtTop(CommonFields.Owner, "Owner"), FieldAtTop(CommonFields.DetectedBy, "Detected By"), FieldAtTop(CommonFields.StoryPoints, "SP"), FieldAtTop(CommonFields.Severity, "Severity"), FieldAtBottom(CommonFields.InvestedHours, "Invested Hours"), FieldAtBottom(CommonFields.RemainingHours, "Remaining Hours"), FieldAtBottom(CommonFields.EstimatedHours, "Estimated Hours") ); AddSubType <WorkItem>(WorkItem.SUBTYPE_STORY, FieldAtSubTitle(CommonFields.Release, "Release", "No release"), FieldAtTop(CommonFields.Phase, "Phase"), FieldAtTop(CommonFields.StoryPoints, "SP"), FieldAtTop(CommonFields.Owner, "Owner"), FieldAtTop(CommonFields.Author, "Author", string.Empty, Utility.GetAuthorFullName), FieldAtBottom(CommonFields.InvestedHours, "Invested Hours"), FieldAtBottom(CommonFields.RemainingHours, "Remaining Hours"), FieldAtBottom(CommonFields.EstimatedHours, "Estimated Hours") ); AddSubType <WorkItem>(WorkItem.SUBTYPE_QUALITY_STORY, FieldAtSubTitle(CommonFields.Release, "Release", "No release"), FieldAtTop(CommonFields.Phase, "Phase"), FieldAtTop(CommonFields.StoryPoints, "SP"), FieldAtTop(CommonFields.Owner, "Owner"), FieldAtTop(CommonFields.Author, "Author", string.Empty, Utility.GetAuthorFullName), FieldAtBottom(CommonFields.InvestedHours, "Invested Hours"), FieldAtBottom(CommonFields.RemainingHours, "Remaining Hours"), FieldAtBottom(CommonFields.EstimatedHours, "Estimated Hours") ); AddSubType <Test>(Test.SUBTYPE_MANUAL_TEST, FieldAtSubTitle("test_type", "Test Type"), FieldAtTop(CommonFields.Phase, "Phase"), FieldAtTop(CommonFields.Owner, "Owner"), FieldAtTop(CommonFields.Author, "Author", string.Empty, Utility.GetAuthorFullName), FieldAtBottom(CommonFields.StepsNum, "Steps"), FieldAtBottom(CommonFields.AutomationStatus, "Automation status") ); AddSubType <Test>(TestGherkin.SUBTYPE_GHERKIN_TEST, FieldAtSubTitle("test_type", "Test Type"), FieldAtTop(CommonFields.Phase, "Phase"), FieldAtTop(CommonFields.Owner, "Owner"), FieldAtTop(CommonFields.Author, "Author", string.Empty, Utility.GetAuthorFullName), FieldAtBottom(CommonFields.AutomationStatus, "Automation status") ); AddSubType <Run>(RunSuite.SUBTYPE_RUN_SUITE, FieldAtSubTitle(CommonFields.Environment, "Environment", "[No environment]"), FieldAtTop(CommonFields.TestRunNativeStatus, "Status"), FieldAtBottom(CommonFields.Started, "Started") ); AddSubType <Run>(RunManual.SUBTYPE_RUN_MANUAL, FieldAtSubTitle(CommonFields.Environment, "Environment", "[No environment]"), FieldAtTop(CommonFields.TestRunNativeStatus, "Status"), FieldAtBottom(CommonFields.Started, "Started") ); AddSubType <Requirement>(Requirement.SUBTYPE_DOCUMENT, FieldAtSubTitle(CommonFields.Phase, "Phase"), FieldAtTop(CommonFields.Author, "Author", string.Empty, Utility.GetAuthorFullName) ); AddSubType <Task>(SIMPLE_ENTITY_SUBTYPE_PLACEHOLDER, FieldAtSubTitle(Task.STORY_FIELD, string.Empty, string.Empty, entity => { var parentEntity = entity.GetValue("story") as BaseEntity; if (parentEntity == null) { return(string.Empty); } var parentEntityInformation = EntityTypeRegistry.GetEntityTypeInformation(parentEntity); if (parentEntityInformation == null) { return(string.Empty); } var sb = new StringBuilder("Task of ") .Append(parentEntityInformation.DisplayName.ToLower()) .Append(" ") .Append(parentEntity.Id.ToString()) .Append(": ") .Append(parentEntity.Name); return(sb.ToString()); }), FieldAtTop(Task.OWNER_FIELD, "Owner"), FieldAtTop(Task.PHASE_FIELD, "Phase"), FieldAtTop(Task.AUTHOR_FIELD, "Author", string.Empty, Utility.GetAuthorFullName), FieldAtBottom(Task.INVESTED_HOURS_FIELD, "Invested Hours"), FieldAtBottom(Task.REMAINING_HOURS_FIELD, "Remaining Hours"), FieldAtBottom(Task.ESTIMATED_HOURS_FIELD, "Estimated Hours") ); AddSubType <Comment>(SIMPLE_ENTITY_SUBTYPE_PLACEHOLDER, FieldAtSubTitle(Comment.TEXT_FIELD, string.Empty, string.Empty, entity => { return(Utility.StripHtml(entity.GetStringValue(Comment.TEXT_FIELD))); }), FieldAtTop(Comment.AUTHOR_FIELD, "Author", string.Empty, Utility.GetAuthorFullName) ); AddSubType <Test>(TestBDDScenario.SUBTYPE_BDD_SCENARIO_TEST, FieldAtSubTitle("test_type", "Test Type"), FieldAtTop(CommonFields.Owner, "Owner"), FieldAtBottom(CommonFields.AutomationStatus, "Automation status") ); }