aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Azure/Tango.AzureUtils.UI
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2020-02-14 12:13:10 +0200
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2020-02-14 12:13:10 +0200
commit6e6126cca201dae1f3a9499bb0d950fb9d797a8f (patch)
treec1cc50ee03b24a21ae4f620bc805076dfba948a8 /Software/Visual_Studio/Azure/Tango.AzureUtils.UI
parent678b22afc27e53811f978103b7ea41609ff68606 (diff)
downloadTango-6e6126cca201dae1f3a9499bb0d950fb9d797a8f.tar.gz
Tango-6e6126cca201dae1f3a9499bb0d950fb9d797a8f.zip
Implemented version rollback on AzureUtils.
Changed GetLatestVersion on machine service to respond to any version difference instead of smaller version.
Diffstat (limited to 'Software/Visual_Studio/Azure/Tango.AzureUtils.UI')
-rw-r--r--Software/Visual_Studio/Azure/Tango.AzureUtils.UI/AzureDashboardViewModel.cs12
-rw-r--r--Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Controls/WebAppPropertiesControl.xaml2
-rw-r--r--Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Controls/WebAppPropertiesControl.xaml.cs13
-rw-r--r--Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Tango.AzureUtils.UI.csproj8
-rw-r--r--Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModelLocator.cs9
-rw-r--r--Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentFirmwareUpgradeViewVM.cs14
-rw-r--r--Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentRemovalViewVM.cs9
-rw-r--r--Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentRollbackViewVM.cs86
-rw-r--r--Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentUpgradeViewVM.cs20
-rw-r--r--Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/EnvironmentRollbackView.xaml44
-rw-r--r--Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/EnvironmentRollbackView.xaml.cs28
-rw-r--r--Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/MainView.xaml3
12 files changed, 234 insertions, 14 deletions
diff --git a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/AzureDashboardViewModel.cs b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/AzureDashboardViewModel.cs
index eddc7d009..9d3a07b7b 100644
--- a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/AzureDashboardViewModel.cs
+++ b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/AzureDashboardViewModel.cs
@@ -27,7 +27,7 @@ namespace Tango.AzureUtils.UI
public virtual void OnApplicationReady()
{
-
+
}
public virtual void OnAuthenticated(IAzure azure, List<IWebAppBase> apps)
@@ -47,6 +47,16 @@ namespace Tango.AzureUtils.UI
}
}
+ protected void RequireRefresh()
+ {
+ TangoIOC.Default.GetAllInstancesByBase<AzureDashboardViewModel>().ToList().ForEach(x => x.OnRefreshRequired());
+ }
+
+ protected virtual void OnRefreshRequired()
+ {
+
+ }
+
public void ProgressHandler(object sender, AzureUtilsProgressEventArgs e)
{
StatusManager.UpdateStatus(e);
diff --git a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Controls/WebAppPropertiesControl.xaml b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Controls/WebAppPropertiesControl.xaml
index 5adec916a..fe8b4bdef 100644
--- a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Controls/WebAppPropertiesControl.xaml
+++ b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Controls/WebAppPropertiesControl.xaml
@@ -63,5 +63,7 @@
<TextBlock Text="{Binding ElementName=control,Path=TangoVersion.FirmwareVersion}"></TextBlock>
</controls:TableGrid>
</StackPanel>
+
+ <ProgressBar VerticalAlignment="Bottom" Height="5" Background="Transparent" BorderThickness="0" Foreground="Silver" IsIndeterminate="{Binding ElementName=control,Path=IsBusy}"></ProgressBar>
</Grid>
</UserControl>
diff --git a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Controls/WebAppPropertiesControl.xaml.cs b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Controls/WebAppPropertiesControl.xaml.cs
index f71f236c7..ea7475fb1 100644
--- a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Controls/WebAppPropertiesControl.xaml.cs
+++ b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Controls/WebAppPropertiesControl.xaml.cs
@@ -55,6 +55,13 @@ namespace Tango.AzureUtils.UI.Controls
public static readonly DependencyProperty MachineStudioVersionProperty =
DependencyProperty.Register("MachineStudioVersion", typeof(MachineStudioVersion), typeof(WebAppPropertiesControl), new PropertyMetadata(null));
+ public bool IsBusy
+ {
+ get { return (bool)GetValue(IsBusyProperty); }
+ set { SetValue(IsBusyProperty, value); }
+ }
+ public static readonly DependencyProperty IsBusyProperty =
+ DependencyProperty.Register("IsBusy", typeof(bool), typeof(WebAppPropertiesControl), new PropertyMetadata(false));
public WebAppPropertiesControl()
{
@@ -71,6 +78,8 @@ namespace Tango.AzureUtils.UI.Controls
try
{
+ IsBusy = true;
+
HostNames = app.HostNames.Select(x => x).ToList();
Settings = await app.GetMachineServiceSettingsAsync(false);
@@ -81,6 +90,10 @@ namespace Tango.AzureUtils.UI.Controls
MachineStudioVersion = await databaseManager.GetLatestMachineStudioVersion(app);
}
catch { }
+ finally
+ {
+ IsBusy = false;
+ }
}
}
}
diff --git a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Tango.AzureUtils.UI.csproj b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Tango.AzureUtils.UI.csproj
index 985c54c00..b88b39c6f 100644
--- a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Tango.AzureUtils.UI.csproj
+++ b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Tango.AzureUtils.UI.csproj
@@ -207,9 +207,13 @@
<Compile Include="ViewModels\EnvironmentCreationViewVM.cs" />
<Compile Include="ViewModels\EnvironmentLogStreamViewVM.cs" />
<Compile Include="ViewModels\EnvironmentRemovalViewVM.cs" />
+ <Compile Include="ViewModels\EnvironmentRollbackViewVM.cs" />
<Compile Include="ViewModels\EnvironmentUpgradeViewVM.cs" />
<Compile Include="ViewModels\EnvironmentFirmwareUpgradeViewVM.cs" />
<Compile Include="ViewModels\MainViewVM.cs" />
+ <Compile Include="Views\EnvironmentRollbackView.xaml.cs">
+ <DependentUpon>EnvironmentRollbackView.xaml</DependentUpon>
+ </Compile>
<Compile Include="Views\EnvironmentCreationView.xaml.cs">
<DependentUpon>EnvironmentCreationView.xaml</DependentUpon>
</Compile>
@@ -252,6 +256,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
+ <Page Include="Views\EnvironmentRollbackView.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ <SubType>Designer</SubType>
+ </Page>
<Page Include="Views\EnvironmentCreationView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
diff --git a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModelLocator.cs b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModelLocator.cs
index 4fd7293c9..ef765f93a 100644
--- a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModelLocator.cs
+++ b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModelLocator.cs
@@ -24,6 +24,7 @@ namespace Tango.AzureUtils.UI
TangoIOC.Default.Register<EnvironmentRemovalViewVM>();
TangoIOC.Default.Register<EnvironmentFirmwareUpgradeViewVM>();
TangoIOC.Default.Register<EnvironmentLogStreamViewVM>();
+ TangoIOC.Default.Register<EnvironmentRollbackViewVM>();
TangoIOC.Default.Register<IStatusManager, DefaultStatusManager>();
}
@@ -76,5 +77,13 @@ namespace Tango.AzureUtils.UI
return TangoIOC.Default.GetInstance<EnvironmentLogStreamViewVM>();
}
}
+
+ public static EnvironmentRollbackViewVM EnvironmentRollbackViewVM
+ {
+ get
+ {
+ return TangoIOC.Default.GetInstance<EnvironmentRollbackViewVM>();
+ }
+ }
}
}
diff --git a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentFirmwareUpgradeViewVM.cs b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentFirmwareUpgradeViewVM.cs
index 54576cda7..964febbd8 100644
--- a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentFirmwareUpgradeViewVM.cs
+++ b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentFirmwareUpgradeViewVM.cs
@@ -94,10 +94,6 @@ namespace Tango.AzureUtils.UI.ViewModels
IsFree = false;
await _firmwareManager.InjectFirmwarePackage(SelectedDeploymentSlot, FilePath);
-
- var old = SelectedDeploymentSlot;
- SelectedDeploymentSlot = null;
- SelectedDeploymentSlot = old;
}
catch (Exception ex)
{
@@ -105,8 +101,18 @@ namespace Tango.AzureUtils.UI.ViewModels
}
finally
{
+ RequireRefresh();
IsFree = true;
}
}
+
+ protected override void OnRefreshRequired()
+ {
+ base.OnRefreshRequired();
+
+ var old = SelectedDeploymentSlot;
+ SelectedDeploymentSlot = null;
+ SelectedDeploymentSlot = old;
+ }
}
}
diff --git a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentRemovalViewVM.cs b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentRemovalViewVM.cs
index 0917b012d..e296ac16e 100644
--- a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentRemovalViewVM.cs
+++ b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentRemovalViewVM.cs
@@ -77,8 +77,6 @@ namespace Tango.AzureUtils.UI.ViewModels
Config.Password = Settings.Password;
await _environmentManager.RemoveEnvironment(SelectedDeploymentSlot, SlotName, Config);
-
- SelectedDeploymentSlot = null;
}
catch (Exception ex)
{
@@ -86,8 +84,15 @@ namespace Tango.AzureUtils.UI.ViewModels
}
finally
{
+ RequireRefresh();
IsFree = true;
}
}
+
+ protected override void OnRefreshRequired()
+ {
+ base.OnRefreshRequired();
+ SelectedDeploymentSlot = null;
+ }
}
}
diff --git a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentRollbackViewVM.cs b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentRollbackViewVM.cs
new file mode 100644
index 000000000..69e18b51d
--- /dev/null
+++ b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentRollbackViewVM.cs
@@ -0,0 +1,86 @@
+using Microsoft.Azure.Management.AppService.Fluent;
+using Microsoft.Azure.Management.Fluent;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.AzureUtils.Environment;
+using Tango.Core.Commands;
+
+namespace Tango.AzureUtils.UI.ViewModels
+{
+ public class EnvironmentRollbackViewVM : AzureDashboardViewModel
+ {
+ private IWebAppBase _machineServiceApp;
+ private EnvironmentManager _environmentManager;
+
+ private List<IDeploymentSlot> _deploymentSlots;
+ public List<IDeploymentSlot> DeploymentSlots
+ {
+ get { return _deploymentSlots; }
+ set { _deploymentSlots = value; RaisePropertyChangedAuto(); }
+ }
+
+ private IDeploymentSlot _selectedDeploymentSlot;
+ public IDeploymentSlot SelectedDeploymentSlot
+ {
+ get { return _selectedDeploymentSlot; }
+ set { _selectedDeploymentSlot = value; RaisePropertyChangedAuto(); }
+ }
+
+ private RollbackEnvironmentConfiguration _config;
+ public RollbackEnvironmentConfiguration Config
+ {
+ get { return _config; }
+ set { _config = value; RaisePropertyChangedAuto(); }
+ }
+
+ public RelayCommand RollbackEnvironmentCommand { get; set; }
+
+ public EnvironmentRollbackViewVM()
+ {
+ RollbackEnvironmentCommand = new RelayCommand(RollbackEnvironment);
+ Config = new RollbackEnvironmentConfiguration();
+ }
+
+ public override void OnAuthenticated(IAzure azure, List<IWebAppBase> apps)
+ {
+ _machineServiceApp = apps.SingleOrDefault(x => x.Name == "MachineService");
+ DeploymentSlots = apps.OfType<IDeploymentSlot>().Where(x => x.Parent == _machineServiceApp).ToList();
+ SelectedDeploymentSlot = DeploymentSlots.FirstOrDefault();
+
+ _environmentManager = new EnvironmentManager(azure);
+ _environmentManager.ConfirmationRequired += ConfirmationHandler;
+ _environmentManager.Progress += ProgressHandler;
+ }
+
+ private async void RollbackEnvironment()
+ {
+ try
+ {
+ IsFree = false;
+
+ await _environmentManager.RollbackEnvironment(SelectedDeploymentSlot, Config);
+ }
+ catch (Exception ex)
+ {
+ StatusManager.UpdateStatus(ex);
+ }
+ finally
+ {
+ RequireRefresh();
+ IsFree = true;
+ }
+ }
+
+ protected override void OnRefreshRequired()
+ {
+ base.OnRefreshRequired();
+
+ var old = SelectedDeploymentSlot;
+ SelectedDeploymentSlot = null;
+ SelectedDeploymentSlot = old;
+ }
+ }
+}
diff --git a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentUpgradeViewVM.cs b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentUpgradeViewVM.cs
index 14e4bf196..3f353d54d 100644
--- a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentUpgradeViewVM.cs
+++ b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentUpgradeViewVM.cs
@@ -112,13 +112,6 @@ namespace Tango.AzureUtils.UI.ViewModels
{
IsFree = false;
await EnvironmentManager.UpgradeEnvironment(SelectedSourceApp, SelectedTargetApp, Config);
-
- var oldSource = SelectedSourceApp;
- var oldTarget = SelectedTargetApp;
- SelectedSourceApp = null;
- SelectedTargetApp = null;
- SelectedSourceApp = oldSource;
- SelectedTargetApp = oldTarget;
}
catch (Exception ex)
{
@@ -126,8 +119,21 @@ namespace Tango.AzureUtils.UI.ViewModels
}
finally
{
+ RequireRefresh();
IsFree = true;
}
}
+
+ protected override void OnRefreshRequired()
+ {
+ base.OnRefreshRequired();
+
+ var oldSource = SelectedSourceApp;
+ var oldTarget = SelectedTargetApp;
+ SelectedSourceApp = null;
+ SelectedTargetApp = null;
+ SelectedSourceApp = oldSource;
+ SelectedTargetApp = oldTarget;
+ }
}
}
diff --git a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/EnvironmentRollbackView.xaml b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/EnvironmentRollbackView.xaml
new file mode 100644
index 000000000..d3a198e21
--- /dev/null
+++ b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/EnvironmentRollbackView.xaml
@@ -0,0 +1,44 @@
+<UserControl x:Class="Tango.AzureUtils.UI.Views.EnvironmentRollbackView"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:vm="clr-namespace:Tango.AzureUtils.UI.ViewModels"
+ xmlns:helpers="clr-namespace:Tango.SharedUI.Helpers;assembly=Tango.SharedUI"
+ xmlns:global="clr-namespace:Tango.AzureUtils.UI"
+ xmlns:local="clr-namespace:Tango.AzureUtils.UI.Views"
+ xmlns:localControls="clr-namespace:Tango.AzureUtils.UI.Controls"
+ mc:Ignorable="d"
+ d:DesignHeight="700"
+ d:DesignWidth="1100"
+ d:DataContext="{d:DesignInstance Type=vm:EnvironmentRollbackViewVM, IsDesignTimeCreatable=False}"
+ DataContext="{x:Static global:ViewModelLocator.EnvironmentRollbackViewVM}"
+ Background="{StaticResource PrimaryBackgroundBrush}"
+ Foreground="{StaticResource PrimaryForegroundBrush}">
+ <Grid>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="50*"/>
+ <ColumnDefinition Width="60*"/>
+ </Grid.ColumnDefinitions>
+
+ <GroupBox Header="Source Deployment Slot" Padding="5" Margin="10">
+ <DockPanel>
+ <ComboBox DockPanel.Dock="Top" ItemsSource="{Binding DeploymentSlots}" SelectedItem="{Binding SelectedDeploymentSlot}" DisplayMemberPath="Name"></ComboBox>
+
+ <localControls:WebAppPropertiesControl VerticalAlignment="Top" Margin="0 20 0 0" DataContext="{Binding SelectedDeploymentSlot}" />
+ </DockPanel>
+ </GroupBox>
+
+ <Grid Grid.Column="1">
+ <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Width="300">
+ <GroupBox DockPanel.Dock="Top" Header="Configuration" Padding="10 20">
+ <StackPanel>
+ <CheckBox Margin="0 5 0 0" IsChecked="{Binding Config.RollbackMachineStudio}" >Rollback Machine Studio Version</CheckBox>
+ <CheckBox Margin="0 5 0 0" IsChecked="{Binding Config.RollbackPPC}" >Rollback PPC Version</CheckBox>
+ </StackPanel>
+ </GroupBox>
+ <Button Margin="0 20 0 0" Padding="20" Command="{Binding RollbackEnvironmentCommand}">ROLLBACK VERSION</Button>
+ </StackPanel>
+ </Grid>
+ </Grid>
+</UserControl>
diff --git a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/EnvironmentRollbackView.xaml.cs b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/EnvironmentRollbackView.xaml.cs
new file mode 100644
index 000000000..aa38c19d0
--- /dev/null
+++ b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/EnvironmentRollbackView.xaml.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace Tango.AzureUtils.UI.Views
+{
+ /// <summary>
+ /// Interaction logic for EnvironmentCreationView.xaml
+ /// </summary>
+ public partial class EnvironmentRollbackView : UserControl
+ {
+ public EnvironmentRollbackView()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/MainView.xaml b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/MainView.xaml
index b79d306d1..aa3623f4b 100644
--- a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/MainView.xaml
+++ b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/MainView.xaml
@@ -55,6 +55,9 @@
<TabItem Header="Environment Firmware Injection" Padding="5">
<views:EnvironmentFirmwareUpgradeView/>
</TabItem>
+ <TabItem Header="Environment Rollback" Padding="5">
+ <views:EnvironmentRollbackView/>
+ </TabItem>
<TabItem Header="Environment Log Stream" Padding="5">
<views:EnvironmentLogStreamView/>
</TabItem>