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-06 18:20:21 +0200
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2020-02-06 18:20:21 +0200
commit0baf31baf01a291b6d2c6f5d45fb15fbbc146198 (patch)
tree96d6fc1b4a5f1385ce2224233ea076d85972ee0d /Software/Visual_Studio/Azure/Tango.AzureUtils.UI
parent258399bb206839cdb7cd276839675fa14910bc36 (diff)
downloadTango-0baf31baf01a291b6d2c6f5d45fb15fbbc146198.tar.gz
Tango-0baf31baf01a291b6d2c6f5d45fb15fbbc146198.zip
Working on Azure Utils.
Diffstat (limited to 'Software/Visual_Studio/Azure/Tango.AzureUtils.UI')
-rw-r--r--Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModelLocator.cs14
-rw-r--r--Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentCreationViewVM.cs8
-rw-r--r--Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentUpgradeViewVM.cs45
-rw-r--r--Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/EnvironmentUpgradeView.xaml17
-rw-r--r--Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/EnvironmentUpgradeView.xaml.cs5
5 files changed, 67 insertions, 22 deletions
diff --git a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModelLocator.cs b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModelLocator.cs
index a522d62cc..196848e95 100644
--- a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModelLocator.cs
+++ b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModelLocator.cs
@@ -5,6 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using Tango.AzureUtils.UI.Managers;
using Tango.AzureUtils.UI.ViewModels;
+using Tango.Core;
using Tango.Core.DI;
namespace Tango.AzureUtils.UI
@@ -13,11 +14,16 @@ namespace Tango.AzureUtils.UI
{
static ViewModelLocator()
{
- TangoIOC.Default.Register<MainViewVM>();
- TangoIOC.Default.Register<EnvironmentUpgradeViewVM>();
- TangoIOC.Default.Register<EnvironmentCreationViewVM>();
+ ExtendedObject obj = new ExtendedObject();
- TangoIOC.Default.Register<IStatusManager, DefaultStatusManager>();
+ if (!obj.DesignMode)
+ {
+ TangoIOC.Default.Register<MainViewVM>();
+ TangoIOC.Default.Register<EnvironmentUpgradeViewVM>();
+ TangoIOC.Default.Register<EnvironmentCreationViewVM>();
+
+ TangoIOC.Default.Register<IStatusManager, DefaultStatusManager>();
+ }
}
public static MainViewVM MainViewVM
diff --git a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentCreationViewVM.cs b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentCreationViewVM.cs
index 74995c16d..fe585191d 100644
--- a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentCreationViewVM.cs
+++ b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentCreationViewVM.cs
@@ -68,6 +68,8 @@ namespace Tango.AzureUtils.UI.ViewModels
public override void OnApplicationReady()
{
Email = "roy@twine-s.com";
+ SlotName = "ROY";
+ Password = "1Creativity";
}
public override void OnAuthenticated(IAzure azure, List<IWebAppBase> apps)
@@ -100,7 +102,11 @@ namespace Tango.AzureUtils.UI.ViewModels
if (!Validate()) return;
IsFree = false;
- await _environmentManager.CreateDeploymentSlot(_machineServiceApp as IWebApp, SelectedDeploymentSlot, SlotName, Email, Password);
+ await _environmentManager.CreateEnvironment(_machineServiceApp as IWebApp, SelectedDeploymentSlot, SlotName, new CreateEnvironmentConfiguration()
+ {
+ Email = Email,
+ Password = Password
+ });
}
catch (Exception ex)
{
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 56228e1c5..695ef9d4f 100644
--- a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentUpgradeViewVM.cs
+++ b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/ViewModels/EnvironmentUpgradeViewVM.cs
@@ -6,6 +6,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.AzureUtils.Deployment;
+using Tango.AzureUtils.Environment;
using Tango.Core.Commands;
using Tango.SharedUI;
@@ -34,11 +35,11 @@ namespace Tango.AzureUtils.UI.ViewModels
set { _selectedTargetAPp = value; RaisePropertyChangedAuto(); }
}
- private DeploymentManager _deploymentManager;
- public DeploymentManager DeploymentManager
+ private EnvironmentManager _environmentManager;
+ public EnvironmentManager EnvironmentManager
{
- get { return _deploymentManager; }
- set { _deploymentManager = value; RaisePropertyChangedAuto(); }
+ get { return _environmentManager; }
+ set { _environmentManager = value; RaisePropertyChangedAuto(); }
}
private bool _canUpgrade;
@@ -48,11 +49,23 @@ namespace Tango.AzureUtils.UI.ViewModels
set { _canUpgrade = value; RaisePropertyChangedAuto(); }
}
+ private UpgradeEnvironmentConfiguration _config;
+ public UpgradeEnvironmentConfiguration Config
+ {
+ get { return _config; }
+ set { _config = value; RaisePropertyChangedAuto(); }
+ }
+
+
public RelayCommand ValidateUpgradeCommand { get; set; }
+ public RelayCommand UpgradeEnvironmentCommand { get; set; }
+
public EnvironmentUpgradeViewVM()
{
+ Config = new UpgradeEnvironmentConfiguration();
ValidateUpgradeCommand = new RelayCommand(() => ValidateUpgrade());
+ UpgradeEnvironmentCommand = new RelayCommand(() => UpgradeEnvironment());
}
public override void OnAuthenticated(IAzure azure, List<IWebAppBase> apps)
@@ -62,9 +75,8 @@ namespace Tango.AzureUtils.UI.ViewModels
SelectedSourceApp = Apps.FirstOrDefault();
SelectedTargetApp = Apps.FirstOrDefault();
- DeploymentManager = new DeploymentManager(azure);
- DeploymentManager.Progress += (x, e) => StatusManager.UpdateStatus(e);
- DeploymentManager.UpgradeConfiguration.PropertyChanged += (x, e) => CanUpgrade = false;
+ EnvironmentManager = new EnvironmentManager(azure);
+ EnvironmentManager.Progress += (x, e) => StatusManager.UpdateStatus(e);
}
private async void ValidateUpgrade()
@@ -78,7 +90,7 @@ namespace Tango.AzureUtils.UI.ViewModels
{
IsFree = false;
StatusManager.UpdateStatus(AzureUtilsStage.Validating, "Validating configuration...", true);
- await DeploymentManager.ValidateUpgrade(SelectedSourceApp, SelectedTargetApp);
+ await EnvironmentManager.ValidateEnvironmentUpgrade(SelectedSourceApp, SelectedTargetApp, Config);
CanUpgrade = true;
StatusManager.UpdateStatus(AzureUtilsStage.Ready, "Configuration validated successfully.");
}
@@ -92,5 +104,22 @@ namespace Tango.AzureUtils.UI.ViewModels
IsFree = true;
}
}
+
+ private async void UpgradeEnvironment()
+ {
+ try
+ {
+ IsFree = false;
+ await EnvironmentManager.UpgradeEnvironment(SelectedSourceApp, SelectedTargetApp, Config);
+ }
+ catch (Exception ex)
+ {
+ StatusManager.UpdateStatus(ex);
+ }
+ finally
+ {
+ IsFree = true;
+ }
+ }
}
}
diff --git a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/EnvironmentUpgradeView.xaml b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/EnvironmentUpgradeView.xaml
index 67eaa52e2..6653653d0 100644
--- a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/EnvironmentUpgradeView.xaml
+++ b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/EnvironmentUpgradeView.xaml
@@ -38,21 +38,20 @@
<StackPanel>
<GroupBox Header="Upgrade Configuration" Padding="10">
<StackPanel>
- <CheckBox IsChecked="{Binding DeploymentManager.UpgradeConfiguration.UpgradeMachineStudio}" >Upgrade Machine Studio</CheckBox>
- <CheckBox Margin="0 5 0 0" IsChecked="{Binding DeploymentManager.UpgradeConfiguration.UpgradePPC}" >Upgrade PPC</CheckBox>
- <CheckBox Margin="0 5 0 0" IsChecked="{Binding DeploymentManager.UpgradeConfiguration.UpgradeMachineService}" >Upgrade Machine Service</CheckBox>
+ <CheckBox Click="OnConfigChanged" IsChecked="{Binding Config.SynchronizeDatabaseSchema}" >Upgrade Database Schema</CheckBox>
+ <CheckBox Click="OnConfigChanged" Margin="0 5 0 0" IsChecked="{Binding Config.SynchronizeDatabaseData}" >Upgrade Database Static Collections</CheckBox>
+ <CheckBox Click="OnConfigChanged" Margin="0 5 0 0" IsChecked="{Binding Config.CopyMachineStudioStorageBlobs}" >Upgrade Machine Studio Blob Storage</CheckBox>
+ <CheckBox Click="OnConfigChanged" Margin="0 5 0 0" IsChecked="{Binding Config.CopyPPCStorageBlobs}" >Upgrade PPC Blob Storage</CheckBox>
+ <CheckBox Click="OnConfigChanged" Margin="0 5 0 0" IsChecked="{Binding Config.UpgradeMachineStudioDatabaseVersion}" >Upgrade Machine Studio Database Version</CheckBox>
+ <CheckBox Click="OnConfigChanged" Margin="0 5 0 0" IsChecked="{Binding Config.UpgradePPCDatabaseVersion}" >Upgrade PPC Database Version</CheckBox>
+ <CheckBox Click="OnConfigChanged" Margin="0 5 0 0" IsChecked="{Binding Config.CopyMachineServiceFiles}" >Upgrade Machine Service</CheckBox>
</StackPanel>
</GroupBox>
<StackPanel Margin="0 20 0 0">
<Button Padding="20" Command="{Binding ValidateUpgradeCommand}">Validate</Button>
<StackPanel Margin="0 20 0 0" IsEnabled="{Binding CanUpgrade}">
- <Button Padding="20">Upgrade Database Schema</Button>
- <Button Margin="0 10 0 0" Padding="20">Upgrade Database Static Collections</Button>
- <Button Margin="0 10 0 0" Padding="20">Upgrade Machine Studio</Button>
- <Button Margin="0 10 0 0" Padding="20">Upgrade PPC</Button>
- <Button Margin="0 10 0 0" Padding="20">Upgrade Machine Service</Button>
- <Button Margin="0 10 0 0" Padding="20">Full Upgrade</Button>
+ <Button Margin="0 10 0 0" Padding="20" Command="{Binding UpgradeEnvironmentCommand}">Full Upgrade</Button>
</StackPanel>
</StackPanel>
</StackPanel>
diff --git a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/EnvironmentUpgradeView.xaml.cs b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/EnvironmentUpgradeView.xaml.cs
index f904a2aef..3c3ad9b28 100644
--- a/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/EnvironmentUpgradeView.xaml.cs
+++ b/Software/Visual_Studio/Azure/Tango.AzureUtils.UI/Views/EnvironmentUpgradeView.xaml.cs
@@ -24,5 +24,10 @@ namespace Tango.AzureUtils.UI.Views
{
InitializeComponent();
}
+
+ private void OnConfigChanged(object sender, RoutedEventArgs e)
+ {
+ (DataContext as ViewModels.EnvironmentUpgradeViewVM).CanUpgrade = false;
+ }
}
}