diff --git a/COMETwebapp/Components/Tabs/TabComponent.razor b/COMETwebapp/Components/Tabs/TabComponent.razor index c0b230b3..09d92ff1 100644 --- a/COMETwebapp/Components/Tabs/TabComponent.razor +++ b/COMETwebapp/Components/Tabs/TabComponent.razor @@ -22,15 +22,25 @@ @inherits DisposableComponent
+ @onclick="@(() => this.OnClick?.Invoke())" + title="@(this.Caption)"> + + @if (this.ApplicationIcon is not null) + { + + + + } @(this.Text) - + @if (this.CustomOptionIcon is not null) { diff --git a/COMETwebapp/Components/Tabs/TabComponent.razor.cs b/COMETwebapp/Components/Tabs/TabComponent.razor.cs index a3790502..ed372ae0 100644 --- a/COMETwebapp/Components/Tabs/TabComponent.razor.cs +++ b/COMETwebapp/Components/Tabs/TabComponent.razor.cs @@ -39,6 +39,12 @@ public partial class TabComponent : DisposableComponent [Parameter] public string Text { get; set; } + /// + /// Gets or sets the caption text to be displayed when tab hover + /// + [Parameter] + public string Caption { get; set; } + /// /// Gets or sets the icon to be displayed on the right side of a tab /// @@ -51,6 +57,12 @@ public partial class TabComponent : DisposableComponent [Parameter] public Type CustomOptionIcon { get; set; } + /// + /// Gets or sets the icon to be displayed in the left, distinguishing different applications + /// + [Parameter] + public Type ApplicationIcon { get; set; } + /// /// Gets or sets the action to be executed when the tab is clicked /// diff --git a/COMETwebapp/Components/Tabs/TabsPanelComponent.razor b/COMETwebapp/Components/Tabs/TabsPanelComponent.razor index d07fe76e..ffc055a9 100644 --- a/COMETwebapp/Components/Tabs/TabsPanelComponent.razor +++ b/COMETwebapp/Components/Tabs/TabsPanelComponent.razor @@ -19,6 +19,7 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see http://www.gnu.org/licenses/. -------------------------------------------------------------------------------> +@using COMETwebapp.Model @using CDP4Common.CommonData @inherits DisposableComponent @@ -30,12 +31,14 @@ @foreach (var tab in this.Tabs) { } diff --git a/COMETwebapp/Components/Tabs/TabsPanelComponent.razor.cs b/COMETwebapp/Components/Tabs/TabsPanelComponent.razor.cs index 3ae5831c..b81b4d0e 100644 --- a/COMETwebapp/Components/Tabs/TabsPanelComponent.razor.cs +++ b/COMETwebapp/Components/Tabs/TabsPanelComponent.razor.cs @@ -24,9 +24,12 @@ namespace COMETwebapp.Components.Tabs { + using System.Text; + using CDP4Common.EngineeringModelData; using COMET.Web.Common.Components; + using COMET.Web.Common.Services.SessionManagement; using COMETwebapp.Model; using COMETwebapp.ViewModels.Pages; @@ -94,6 +97,12 @@ public partial class TabsPanelComponent : DisposableComponent [Parameter] public bool IsSidePanelAvailable { get; set; } + /// + /// Gets or sets the + /// + [Inject] + public ISessionService SessionService { get; set; } + /// /// Gets the tab text for the given object of interest /// @@ -109,6 +118,36 @@ private static string GetTabText(object objectOfInterest) }; } + /// + /// Gets the tab caption text for the given object of interest + /// + /// The object of interest to get its tab caption text + /// The tab caption + private string GetCaptionText(object objectOfInterest) + { + var modelName = new StringBuilder(); + Iteration iterationOfInterest = null; + + switch (objectOfInterest) + { + case Iteration iteration: + modelName.Append(((EngineeringModel)iteration.Container).EngineeringModelSetup.Name + " - " + iteration.IterationSetup.IterationNumber); + iterationOfInterest = iteration; + break; + case EngineeringModel engineeringModel: + modelName.Append(engineeringModel.EngineeringModelSetup.Name); + iterationOfInterest = engineeringModel.Iteration.First(x => x.IterationSetup.FrozenOn == null); + break; + } + + modelName.Append(" - "); + + var domainOfExpertiseShortName = this.SessionService.GetDomainOfExpertise(iterationOfInterest).ShortName; + modelName.Append(domainOfExpertiseShortName); + + return modelName.ToString(); + } + /// /// Adds a new side panel to the tabs page ///