Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ public class CommunityCommandsMainControlViewModel : WindowControlViewModelBase
{
private const int SearchResultsPageSize = 25;

/// <summary>
/// Set to true to disable all backend calls during infrastructure migration.
/// Set to false when the new backend is ready.
/// In the future, this will be an API call in MixItUpService.cs to enable/disable community commands from the dashboard
/// </summary>
public const bool IsMaintenanceMode = true;

public ICommand BackCommand { get; set; }

public bool ShowHome
Expand Down Expand Up @@ -383,6 +390,13 @@ await ServiceManager.Get<MixItUpService>().ReportCommand(new CommunityCommandRep

protected override async Task OnVisibleInternal()
{
// Skip all backend calls during maintenance mode
if (IsMaintenanceMode)
{
await base.OnVisibleInternal();
return;
}

if (this.firstLoadCompleted)
{
if (this.ShowHome)
Expand All @@ -396,6 +410,12 @@ protected override async Task OnVisibleInternal()

private async Task NavigateToCategories()
{
// Skip all backend calls during maintenance mode
if (IsMaintenanceMode)
{
return;
}

if (this.lastCategoryRefresh.TotalMinutesFromNow() > 1)
{
try
Expand Down
30 changes: 30 additions & 0 deletions MixItUp.WPF/Controls/MainControls/CommunityCommandsControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,35 @@
</local:MainControlBase.Resources>

<Grid>
<!-- MAINTENANCE MODE -->
<Grid VerticalAlignment="Center" HorizontalAlignment="Center">
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" MaxWidth="600">
<MaterialDesign:PackIcon Kind="Wrench" Width="120" Height="120" HorizontalAlignment="Center" Foreground="{DynamicResource MaterialDesign.Brush.Primary}" />

<TextBlock Text="Community Commands" FontSize="32" FontWeight="Bold" HorizontalAlignment="Center" Margin="0,30,0,0" Foreground="{DynamicResource MaterialDesign.Brush.Primary}" />

<TextBlock Text="Temporarily Unavailable" FontSize="20" FontWeight="Medium" HorizontalAlignment="Center" Margin="0,10,0,0" Foreground="{DynamicResource MaterialDesign.Brush.Foreground}" Opacity="0.7" />

<TextBlock TextWrapping="Wrap" TextAlignment="Center" FontSize="16" Margin="0,30,0,0" Foreground="{DynamicResource MaterialDesign.Brush.Foreground}" Opacity="0.8">
Community Commands is temporarily unavailable while we work on switching and improving our backend infrastructure.
</TextBlock>

<TextBlock TextWrapping="Wrap" TextAlignment="Center" FontSize="16" Margin="0,20,0,0" Foreground="{DynamicResource MaterialDesign.Brush.Foreground}" Opacity="0.8">
This feature will return in a future update. Thank you for your patience!
</TextBlock>

<Border CornerRadius="8" Padding="20,15" Margin="0,40,0,0" Opacity="0.9">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<MaterialDesign:PackIcon Kind="Information" Width="24" Height="24" VerticalAlignment="Center" Foreground="{DynamicResource MaterialDesign.Brush.Foreground}" />
<TextBlock Text="Your existing commands are safe and will continue to work." Foreground="{DynamicResource MaterialDesign.Brush.Foreground}" FontSize="14" VerticalAlignment="Center" Margin="10,0,0,0" />
</StackPanel>
</Border>
</StackPanel>
</Grid>
<!-- END MAINTENANCE MODE -->

<!-- ORIGINAL COMMUNITY COMMANDS UI -->
<!--
<Grid Visibility="{Binding ShowHome, Converter={StaticResource BooleanToVisibilityConverter}}">
<Grid Margin="20">
<Button Command="{Binding GetMyCommandsCommand}" VerticalAlignment="Top" HorizontalAlignment="Right" Content="{x:Static resx:Resources.CommunityCommandsMyCommands}" />
Expand Down Expand Up @@ -416,5 +445,6 @@
</Grid>
</Grid>
</Grid>
-->
</Grid>
</local:MainControlBase>
22 changes: 20 additions & 2 deletions MixItUp.WPF/Controls/MainControls/CommunityCommandsControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,21 @@ namespace MixItUp.WPF.Controls.MainControls
{
/// <summary>
/// Interaction logic for CommunityCommandsControl.xaml
/// Community Commands is temporarily disabled while backend infrastructure is being migrated.
/// </summary>
public partial class CommunityCommandsControl : MainControlBase
{
private static HashSet<Guid> downloadedCommandsCache = new HashSet<Guid>();

public static async Task ProcessDownloadedCommunityCommand(CommunityCommandDetailsViewModel command)
{
// Community Commands is in maintenance mode
if (CommunityCommandsMainControlViewModel.IsMaintenanceMode)
{
await DialogHelper.ShowMessage("Community Commands is temporarily unavailable while we work on switching and improving our backend infrastructure. This feature will return in a future update.");
return;
}

try
{
if (bool.Equals(await DialogHelper.ShowCustom(new CommandImporterDialogControl(command.PrimaryCommand)), true))
Expand Down Expand Up @@ -59,13 +67,23 @@ public CommunityCommandsControl()
protected override async Task InitializeInternal()
{
this.DataContext = this.viewModel = new CommunityCommandsMainControlViewModel((MainWindowViewModel)this.Window.ViewModel);
await this.viewModel.OnOpen();

// Skip loading data during maintenance mode
if (!CommunityCommandsMainControlViewModel.IsMaintenanceMode)
{
await this.viewModel.OnOpen();
}

await base.InitializeInternal();
}

protected override async Task OnVisibilityChanged()
{
await this.viewModel.OnVisible();
// Skip refreshing data during maintenance mode
if (!CommunityCommandsMainControlViewModel.IsMaintenanceMode)
{
await this.viewModel.OnVisible();
}
}

private void CommandsList_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
Expand Down
16 changes: 16 additions & 0 deletions MixItUp.WPF/Windows/Commands/CommunityCommandUploadWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using MixItUp.Base.Services;
using MixItUp.Base.Util;
using MixItUp.Base.ViewModel.CommunityCommands;
using MixItUp.Base.ViewModel.MainControls;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Processing;
using System;
Expand Down Expand Up @@ -50,6 +51,14 @@ protected override async Task OnLoaded()
{
await base.OnLoaded();

// Community Commands is in maintenance mode
if (CommunityCommandsMainControlViewModel.IsMaintenanceMode)
{
await DialogHelper.ShowMessage("Community Commands is temporarily unavailable while we work on switching and improving our backend infrastructure. This feature will return in a future update.");
this.Close();
return;
}

try
{
if (this.command != null)
Expand Down Expand Up @@ -158,6 +167,13 @@ await this.RunAsyncOperation(async () =>
{
try
{
// Community Commands is in maintenance mode
if (CommunityCommandsMainControlViewModel.IsMaintenanceMode)
{
await DialogHelper.ShowMessage("Community Commands is temporarily unavailable while we work on switching and improving our backend infrastructure. This feature will return in a future update.");
return;
}

if (this.commandContainsScript)
{
await DialogHelper.ShowMessage(MixItUp.Base.Resources.CommunityCommandsScriptActionsNotSupported);
Expand Down