-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
657 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
COMETwebapp/Components/SiteDirectory/Roles/ParticipantRoleDetails.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<!------------------------------------------------------------------------------ | ||
Copyright (c) 2023-2024 RHEA System S.A. | ||
Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Jaime Bernar, Antoine Théate, João Rua | ||
This file is part of CDP4-COMET WEB Community Edition | ||
The CDP4-COMET WEB Community Edition is the RHEA Web Application implementation of ECSS-E-TM-10-25 Annex A and Annex C. | ||
The CDP4-COMET WEB Community Edition is free software; you can redistribute it and/or | ||
modify it under the terms of the GNU Affero General Public | ||
License as published by the Free Software Foundation; either | ||
version 3 of the License, or (at your option) any later version. | ||
The CDP4-COMET WEB Community Edition is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
Affero General Public License for more details. | ||
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/. | ||
-------------------------------------------------------------------------------> | ||
@inherits DisposableComponent | ||
|
||
<DxFormLayout CssClass="w-100 overflow-auto max-height-50vh"> | ||
<DxFormLayoutItem Caption="Shortname:" ColSpanMd="10"> | ||
<DxTextBox @bind-Text="@(this.ViewModel.Thing.ShortName)"/> | ||
</DxFormLayoutItem> | ||
<DxFormLayoutItem Caption="Name:" ColSpanMd="10"> | ||
<DxTextBox @bind-Text="@(this.ViewModel.Thing.Name)"/> | ||
</DxFormLayoutItem> | ||
|
||
@foreach (var permission in this.ViewModel.Thing.ParticipantPermission.OrderBy(x => x.ObjectClass.ToString())) | ||
{ | ||
<DxFormLayoutItem Caption="@(permission.ObjectClass.ToString())" | ||
ColSpanMd="12"> | ||
<DxComboBox Data="@this.ViewModel.ParticipantAccessKinds" | ||
@bind-Value="@permission.AccessRight" | ||
CssClass="cw-480" | ||
ClearButtonDisplayMode="DataEditorClearButtonDisplayMode.Auto"/> | ||
</DxFormLayoutItem> | ||
} | ||
</DxFormLayout> | ||
|
||
<DxPopup @bind-Visible="@(this.ViewModel.IsOnDeprecationMode)" HeaderText="Please confirm" Width="auto" CloseOnOutsideClick="false"> | ||
@(this.ViewModel.PopupDialog) | ||
<div class="dxbl-grid-confirm-dialog-buttons"> | ||
<DxButton Text="Cancel " RenderStyle="ButtonRenderStyle.Success" Click="@(this.ViewModel.OnCancelPopupButtonClick)"/> | ||
<DxButton Text="Confirm" RenderStyle="ButtonRenderStyle.Danger" Click="@(this.ViewModel.OnConfirmPopupButtonClick)"/> | ||
</div> | ||
</DxPopup> |
50 changes: 50 additions & 0 deletions
50
COMETwebapp/Components/SiteDirectory/Roles/ParticipantRoleDetails.razor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// -------------------------------------------------------------------------------------------------------------------- | ||
// <copyright file="ParticipantRoleDetails.razor.cs" company="RHEA System S.A."> | ||
// Copyright (c) 2023-2024 RHEA System S.A. | ||
// | ||
// Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Jaime Bernar, Théate Antoine, João Rua | ||
// | ||
// This file is part of CDP4-COMET WEB Community Edition | ||
// The CDP4-COMET WEB Community Edition is the RHEA Web Application implementation of ECSS-E-TM-10-25 Annex A and Annex C. | ||
// | ||
// The CDP4-COMET WEB Community Edition is free software; you can redistribute it and/or | ||
// modify it under the terms of the GNU Affero General Public | ||
// License as published by the Free Software Foundation; either | ||
// version 3 of the License, or (at your option) any later version. | ||
// | ||
// The CDP4-COMET WEB Community Edition is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
// Affero General Public License for more details. | ||
// | ||
// 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/>. | ||
// </copyright> | ||
// -------------------------------------------------------------------------------------------------------------------- | ||
|
||
namespace COMETwebapp.Components.SiteDirectory.Roles | ||
{ | ||
using COMET.Web.Common.Components; | ||
|
||
using COMETwebapp.ViewModels.Components.SiteDirectory.Roles; | ||
|
||
using Microsoft.AspNetCore.Components; | ||
|
||
/// <summary> | ||
/// Support class for the <see cref="ParticipantRoleDetails"/> | ||
/// </summary> | ||
public partial class ParticipantRoleDetails : DisposableComponent | ||
{ | ||
/// <summary> | ||
/// The <see cref="IParticipantRolesTableViewModel" /> for this component | ||
/// </summary> | ||
[Parameter] | ||
public IParticipantRolesTableViewModel ViewModel { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the value to check if the deprecatable option should be shown | ||
/// </summary> | ||
[Parameter] | ||
public bool ShowDeprecatableOption { get; set; } | ||
} | ||
} |
97 changes: 97 additions & 0 deletions
97
COMETwebapp/Components/SiteDirectory/Roles/ParticipantRolesTable.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
<!------------------------------------------------------------------------------ | ||
Copyright (c) 2023-2024 RHEA System S.A. | ||
Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Jaime Bernar, Antoine Théate, João Rua | ||
This file is part of CDP4-COMET WEB Community Edition | ||
The CDP4-COMET WEB Community Edition is the RHEA Web Application implementation of ECSS-E-TM-10-25 Annex A and Annex C. | ||
The CDP4-COMET WEB Community Edition is free software; you can redistribute it and/or | ||
modify it under the terms of the GNU Affero General Public | ||
License as published by the Free Software Foundation; either | ||
version 3 of the License, or (at your option) any later version. | ||
The CDP4-COMET WEB Community Edition is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
Affero General Public License for more details. | ||
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/. | ||
-------------------------------------------------------------------------------> | ||
@inherits SelectedDeprecatableDataItemBase<ParticipantRole, ParticipantRoleRowViewModel> | ||
|
||
<LoadingComponent IsVisible="@(this.ViewModel.IsLoading)"> | ||
<div style="display: flex; justify-content: space-between;"> | ||
<DxGrid @ref="this.Grid" | ||
Data="this.ViewModel.Rows.Items" | ||
ColumnResizeMode="GridColumnResizeMode.ColumnsContainer" | ||
ShowSearchBox="true" | ||
SearchBoxNullText="Search for a participant role..." | ||
AllowSelectRowByClick="true" | ||
SelectedDataItemChanged="@(row => this.OnSelectedDataItemChanged((ParticipantRoleRowViewModel)row))" | ||
PopupEditFormCssClass="pw-800" | ||
PopupEditFormHeaderText="Participant Role" | ||
CustomizeElement="DisableDeprecatedThing" | ||
CustomizeEditModel="this.CustomizeEditThing" | ||
EditMode="GridEditMode.PopupEditForm" | ||
EditModelSaving="@(() => this.OnEditThingSaving())" | ||
PageSize="20" | ||
PagerNavigationMode="PagerNavigationMode.Auto" | ||
PageSizeSelectorVisible="true" | ||
PageSizeSelectorItems="@(new[] { 20, 35, 50 })" | ||
PageSizeSelectorAllRowsItemVisible="true" | ||
CssClass="d-inline"> | ||
<Columns> | ||
<DxGridDataColumn FieldName="@nameof(ParticipantRoleRowViewModel.Name)" MinWidth="150"/> | ||
<DxGridDataColumn FieldName="@nameof(ParticipantRoleRowViewModel.ShortName)" MinWidth="80" /> | ||
<DxGridDataColumn FieldName="@nameof(ParticipantRoleRowViewModel.IsDeprecated)" MinWidth="80" Visible="false"/> | ||
<DxGridCommandColumn Width="200px" EditButtonVisible="false" DeleteButtonVisible="false"> | ||
<HeaderTemplate> | ||
<DxButton Id="addParticipantRoleButton" Text="Add Participant Role" IconCssClass="oi oi-plus" Click="() => this.Grid.StartEditNewRowAsync()"/> | ||
</HeaderTemplate> | ||
</DxGridCommandColumn> | ||
</Columns> | ||
|
||
<EditFormTemplate Context="EditFormContext"> | ||
<DxFormLayout CssClass="w-100"> | ||
<DxFormLayoutTabPages> | ||
|
||
<DxFormLayoutTabPage Caption="Basic"> | ||
<DxFormLayoutItem Caption="Shortname:" ColSpanMd="10"> | ||
<DxTextBox @bind-Text="@(this.ViewModel.Thing.ShortName)"/> | ||
</DxFormLayoutItem> | ||
<DxFormLayoutItem Caption="Name:" ColSpanMd="10"> | ||
<DxTextBox @bind-Text="@(this.ViewModel.Thing.Name)"/> | ||
</DxFormLayoutItem> | ||
</DxFormLayoutTabPage> | ||
|
||
<DxFormLayoutTabPage Caption="Permissions" CssClass="overflow-auto max-height-50vh"> | ||
@foreach (var permission in this.ViewModel.Thing.ParticipantPermission.OrderBy(x => x.ObjectClass.ToString())) | ||
{ | ||
<DxFormLayoutItem Caption="@(permission.ObjectClass.ToString())" | ||
ColSpanMd="12"> | ||
<DxComboBox Data="@this.ViewModel.ParticipantAccessKinds" | ||
@bind-Value="@permission.AccessRight" | ||
CssClass="cw-480" | ||
ClearButtonDisplayMode="DataEditorClearButtonDisplayMode.Auto"/> | ||
</DxFormLayoutItem> | ||
} | ||
</DxFormLayoutTabPage> | ||
|
||
</DxFormLayoutTabPages> | ||
</DxFormLayout> | ||
<ValidationSummary/> | ||
</EditFormTemplate> | ||
|
||
<CustomValidators> | ||
<FluentValidationValidator/> | ||
</CustomValidators> | ||
|
||
</DxGrid> | ||
</div> | ||
<div class="pb-3"></div> | ||
</LoadingComponent> | ||
|
||
<DxPopup @bind-Visible="@(this.ViewModel.IsOnDeprecationMode)" HeaderText="Please confirm" Width="auto" CloseOnOutsideClick="false"> | ||
@(this.ViewModel.PopupDialog) | ||
<div class="dxbl-grid-confirm-dialog-buttons"> | ||
<DxButton Text="Cancel " RenderStyle="ButtonRenderStyle.Success" Click="@(this.ViewModel.OnCancelPopupButtonClick)"/> | ||
<DxButton Text="Confirm" RenderStyle="ButtonRenderStyle.Danger" Click="@(this.ViewModel.OnConfirmPopupButtonClick)"/> | ||
</div> | ||
</DxPopup> |
107 changes: 107 additions & 0 deletions
107
COMETwebapp/Components/SiteDirectory/Roles/ParticipantRolesTable.razor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
// -------------------------------------------------------------------------------------------------------------------- | ||
// <copyright file="ParticipantRolesTable.razor.cs" company="RHEA System S.A."> | ||
// Copyright (c) 2023-2024 RHEA System S.A. | ||
// | ||
// Authors: Sam Gerené, Alex Vorobiev, Alexander van Delft, Jaime Bernar, Théate Antoine, João Rua | ||
// | ||
// This file is part of CDP4-COMET WEB Community Edition | ||
// The CDP4-COMET WEB Community Edition is the RHEA Web Application implementation of ECSS-E-TM-10-25 Annex A and Annex C. | ||
// | ||
// The CDP4-COMET WEB Community Edition is free software; you can redistribute it and/or | ||
// modify it under the terms of the GNU Affero General Public | ||
// License as published by the Free Software Foundation; either | ||
// version 3 of the License, or (at your option) any later version. | ||
// | ||
// The CDP4-COMET WEB Community Edition is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
// Affero General Public License for more details. | ||
// | ||
// 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/>. | ||
// </copyright> | ||
// -------------------------------------------------------------------------------------------------------------------- | ||
|
||
namespace COMETwebapp.Components.SiteDirectory.Roles | ||
{ | ||
using CDP4Common.SiteDirectoryData; | ||
|
||
using COMETwebapp.Components.Common; | ||
using COMETwebapp.ViewModels.Components.SiteDirectory.Roles; | ||
using COMETwebapp.ViewModels.Components.SiteDirectory.Rows; | ||
|
||
using DevExpress.Blazor; | ||
|
||
using Microsoft.AspNetCore.Components; | ||
|
||
/// <summary> | ||
/// Support class for the <see cref="ParticipantRolesTable"/> | ||
/// </summary> | ||
public partial class ParticipantRolesTable : SelectedDeprecatableDataItemBase<ParticipantRole, ParticipantRoleRowViewModel> | ||
{ | ||
/// <summary> | ||
/// The <see cref="IParticipantRolesTableViewModel" /> for this component | ||
/// </summary> | ||
[Inject] | ||
public IParticipantRolesTableViewModel ViewModel { get; set; } | ||
|
||
/// <summary> | ||
/// Method invoked when the component is ready to start, having received its | ||
/// initial parameters from its parent in the render tree. | ||
/// </summary> | ||
protected override void OnInitialized() | ||
{ | ||
base.OnInitialized(); | ||
this.Initialize(this.ViewModel); | ||
} | ||
|
||
/// <summary> | ||
/// Method that is invoked when the edit/add thing form is being saved | ||
/// </summary> | ||
/// <returns>A <see cref="Task" /></returns> | ||
protected override async Task OnEditThingSaving() | ||
{ | ||
await this.ViewModel.CreateOrEditParticipantRole(this.ShouldCreateThing); | ||
} | ||
|
||
/// <summary> | ||
/// Method invoked when creating a new thing | ||
/// </summary> | ||
/// <param name="e">A <see cref="GridCustomizeEditModelEventArgs" /></param> | ||
protected override void CustomizeEditThing(GridCustomizeEditModelEventArgs e) | ||
{ | ||
base.CustomizeEditThing(e); | ||
|
||
var dataItem = (ParticipantRoleRowViewModel)e.DataItem; | ||
this.ShouldCreateThing = e.IsNew; | ||
|
||
if (dataItem == null) | ||
{ | ||
this.ViewModel.Thing = new ParticipantRole(); | ||
e.EditModel = this.ViewModel.Thing; | ||
return; | ||
} | ||
|
||
this.ViewModel.Thing = dataItem.Thing.Clone(false); | ||
e.EditModel = this.ViewModel.Thing; | ||
} | ||
|
||
/// <summary> | ||
/// Metgid invoked everytime a row is selected | ||
/// </summary> | ||
/// <param name="row">The selected row</param> | ||
private void OnSelectedDataItemChanged(ParticipantRoleRowViewModel row) | ||
{ | ||
// do something | ||
} | ||
|
||
/// <summary> | ||
/// Sets the selected values for the <see cref="Participant"/> creation and submits the form | ||
/// </summary> | ||
/// <returns>A <see cref="Task"/></returns> | ||
private async Task SetSelectedValuesAndSubmit() | ||
{ | ||
await this.Grid.SaveChangesAsync(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.