Skip to content

Commit

Permalink
Merge d406368 into a05e54c
Browse files Browse the repository at this point in the history
  • Loading branch information
gcnabeel authored Jan 7, 2025
2 parents a05e54c + d406368 commit 3eb3c08
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,58 +14,66 @@

@inject NavigationManager _navigationManager

<MudStack Class="px-4">
<MudGrid>
<MudItem xs="12">
<MudStack>
<MudText Typo="Typo.h4">
@Localizer["Are you sure you want to delete the following workspace: {0}?", WorkspaceAcronym]
</MudText>
<MudText Typo="Typo.body1">
@Localizer["This action is permanent. Upon deletion, the workspace and all its resources will be deleted"]
</MudText>
<MudText Typo="Typo.body1">
@Localizer["Please type {0} to confirm the deletion.", WorkspaceAcronym]
</MudText>
<MudGrid>
<MudItem xs="5">
<MudTextField @bind-Value="_deleteConfirmation" Variant="Variant.Text"></MudTextField>
</MudItem>
</MudGrid>
</MudStack>

@if (_error.Equals("_emptyConfirmation"))
{
<MudAlert Severity="Severity.Error">
<MudText Typo="Typo.body2">@Localizer["Please enter a workspace acronym."]</MudText>
</MudAlert>
}
else if (_error.Equals("_badConfirmation"))
{
<MudAlert Severity="Severity.Error">
<MudText Typo="Typo.body2">@Localizer["Incorrect workspace acronym."]</MudText>
</MudAlert>
}
</MudItem>
<MudItem xs="3">
<DHButton Variant="@Variant.Filled" Color="@Color.Default" Href="@_settingsPage">
@Localizer["Cancel"]
</DHButton>
</MudItem>
<MudItem xs="3">
<DHButton Disabled="@_deleteRequested" Variant="@Variant.Filled" Color="@Color.Error" OnClick="@ConfirmDeletion">
@_deleteButtonText
<DHIcon Icon="@SidebarIcons.Delete" Class="ml-2" Style="font-size: 0.8rem;" />
</DHButton>
</MudItem>
</MudGrid>
</MudStack>
<DatahubAuthView AuthLevel="DatahubAuthView.AuthLevels.WorkspaceLead" ProjectAcronym="@WorkspaceAcronym" ElevatedWorkspaceAccessEnabled="true">
<Authorized>
<MudStack Class="px-4">
<MudGrid>
<MudItem xs="12">
<MudStack>
<MudText Typo="Typo.h4">
@Localizer["Are you sure you want to delete the following workspace: {0}?", WorkspaceAcronym]
</MudText>
<MudText Typo="Typo.body1">
@Localizer["This action is permanent. Upon deletion, the workspace and all its resources will be deleted"]
</MudText>
<MudText Typo="Typo.body1">
@Localizer["Please type {0} to confirm the deletion.", WorkspaceAcronym]
</MudText>
<MudGrid>
<MudItem xs="5">
<MudTextField @bind-Value="_deleteConfirmation" Variant="Variant.Text"></MudTextField>
</MudItem>
</MudGrid>
</MudStack>

@if (_error.Equals("_emptyConfirmation"))
{
<MudAlert Severity="Severity.Error">
<MudText Typo="Typo.body2">@Localizer["Please enter a workspace acronym."]</MudText>
</MudAlert>
}
else if (_error.Equals("_badConfirmation"))
{
<MudAlert Severity="Severity.Error">
<MudText Typo="Typo.body2">@Localizer["Incorrect workspace acronym."]</MudText>
</MudAlert>
}
</MudItem>
<MudItem xs="3">
<DHButton Variant="@Variant.Filled" Color="@Color.Default" Href="@_settingsPage">
@Localizer["Cancel"]
</DHButton>
</MudItem>
<MudItem xs="3">
<DHButton Disabled="@_deleteRequested" Variant="@Variant.Filled" Color="@Color.Error" OnClick="@ConfirmDeletion">
@_deleteButtonText
<DHIcon Icon="@SidebarIcons.Delete" Class="ml-2" Style="font-size: 0.8rem;" />
</DHButton>
</MudItem>
</MudGrid>
</MudStack>
</Authorized>
<NotAuthorized>
<MudAlert Severity="Severity.Warning" Variant="Variant.Outlined" Style="color: #000;" Class="mb-6">
@Localizer["Access Denied"]
</MudAlert>
</NotAuthorized>
</DatahubAuthView>
@code
{
[Parameter]
public string WorkspaceAcronym { get; set; }
[Parameter]
[Parameter]
public bool ElevatedWorkspaceAccessEnabled { get; set; } = true;

private string _deleteConfirmation;
Expand All @@ -91,7 +99,7 @@

if (WorkspaceAcronym == null)
{
_snackbar.Add(Localizer["Invalid parameters, redirecting"], Severity.Error);
_snackbar.Add(Localizer["Invalid parameters, redirecting"], Severity.Error);
_navigationManager.NavigateTo(_settingsPage);
return;
}
Expand All @@ -105,7 +113,7 @@
_snackbar.Add(Localizer["Please enter a workspace acronym."], Severity.Error);
_error = "_emptyConfirmation";
}
else if(!_deleteConfirmation.Equals(WorkspaceAcronym))
else if (!_deleteConfirmation.Equals(WorkspaceAcronym))
{
_snackbar.Add(Localizer["Incorrect workspace acronym."], Severity.Error);
_error = "_badConfirmation";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
<WorkspaceBudgetControl Disabled InitialValue="@_budget"/>
</NotAuthorized>
</DatahubAuthView>
<DatahubAuthView AuthLevel="DatahubAuthView.AuthLevels.DatahubSupport" ProjectAcronym="@WorkspaceAcronym">
<DatahubAuthView AuthLevel="DatahubAuthView.AuthLevels.WorkspaceLead" ProjectAcronym="@WorkspaceAcronym" ElevatedWorkspaceAccessEnabled="true">
<Authorized>
<WorkspaceDeleteControl WorkspaceAcronym="@WorkspaceAcronym"/>
</Authorized>
Expand Down

0 comments on commit 3eb3c08

Please sign in to comment.