Merge pull request #8 from alexdrenea/feature/offer-throughput
Fix for issue #7 - respect offer throughput for target collection
This commit is contained in:
Коммит
ffe7b5d536
|
@ -19,5 +19,9 @@
|
||||||
<TextBlock Text="Offer Throughput" Style="{StaticResource TextBlockStyle}"/>
|
<TextBlock Text="Offer Throughput" Style="{StaticResource TextBlockStyle}"/>
|
||||||
<TextBox x:Name="OfferThroughput" Text="10000" Style="{StaticResource TextBoxStyle}" VerticalAlignment="Top"/>
|
<TextBox x:Name="OfferThroughput" Text="10000" Style="{StaticResource TextBoxStyle}" VerticalAlignment="Top"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<Image x:Name="ConnectionIcon" Width="30" Height="30"/>
|
||||||
|
<TextBlock Name="ConnectionTestMsg" TextWrapping="Wrap" />
|
||||||
|
</StackPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Page>
|
</Page>
|
|
@ -27,5 +27,31 @@ namespace CosmicCloneUI
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public bool TestCloneOptions()
|
||||||
|
{
|
||||||
|
var result = true;
|
||||||
|
if (!int.TryParse(OfferThroughput.Text, out int RU))
|
||||||
|
result = false;
|
||||||
|
|
||||||
|
if (RU < 400) result = false;
|
||||||
|
if (RU % 100 != 0) result = false;
|
||||||
|
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
var connectionIcon = (Image)this.FindName("ConnectionIcon");
|
||||||
|
ConnectionIcon.Source = new BitmapImage(new Uri("/Images/success.png", UriKind.Relative));
|
||||||
|
ConnectionTestMsg.Text = "Validation Passed";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var connectionIcon = (Image)this.FindName("ConnectionIcon");
|
||||||
|
ConnectionIcon.Source = new BitmapImage(new Uri("/Images/fail.png", UriKind.Relative));
|
||||||
|
ConnectionTestMsg.Text = "Invalid Throughput provided. Make sure it's a number greater than 400 and multiple of 100.";
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,12 +157,17 @@ namespace CosmicCloneUI
|
||||||
}
|
}
|
||||||
else if (GetPageNumber(currentPage) == 2)
|
else if (GetPageNumber(currentPage) == 2)
|
||||||
{
|
{
|
||||||
CloneSettings.CopyStoredProcedures = ((CheckBox)currentPage.FindName("SPs")).IsChecked.Value;
|
var page = ((CloneOptionsPage)currentPage);
|
||||||
CloneSettings.CopyUDFs = ((CheckBox)currentPage.FindName("UDFs")).IsChecked.Value;
|
var valid = page.TestCloneOptions();
|
||||||
CloneSettings.CopyTriggers = ((CheckBox)currentPage.FindName("CosmosTriggers")).IsChecked.Value;
|
if (!valid) return false;
|
||||||
CloneSettings.CopyDocuments = ((CheckBox)currentPage.FindName("Documents")).IsChecked.Value;
|
|
||||||
CloneSettings.CopyIndexingPolicy = ((CheckBox)currentPage.FindName("IPs")).IsChecked.Value;
|
CloneSettings.CopyStoredProcedures = page.SPs.IsChecked.Value;
|
||||||
CloneSettings.CopyPartitionKey = ((CheckBox)currentPage.FindName("PKs")).IsChecked.Value;
|
CloneSettings.CopyUDFs = page.UDFs.IsChecked.Value;
|
||||||
|
CloneSettings.CopyTriggers = page.CosmosTriggers.IsChecked.Value;
|
||||||
|
CloneSettings.CopyDocuments = page.Documents.IsChecked.Value;
|
||||||
|
CloneSettings.CopyIndexingPolicy = page.IPs.IsChecked.Value;
|
||||||
|
CloneSettings.CopyPartitionKey = page.PKs.IsChecked.Value;
|
||||||
|
CloneSettings.TargetMigrationOfferThroughputRUs = int.Parse(page.OfferThroughput.Text);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ namespace CosmosCloneCommon.Model
|
||||||
|
|
||||||
public static class RandomNumberGenerator
|
public static class RandomNumberGenerator
|
||||||
{
|
{
|
||||||
private static readonly Random _random = new Random(unchecked(Environment.TickCount * 31 + Thread.CurrentThread.ManagedThreadId));;
|
private static readonly Random _random = new Random(unchecked(Environment.TickCount * 31 + Thread.CurrentThread.ManagedThreadId));
|
||||||
|
|
||||||
public static int GetNext(int maxValue)
|
public static int GetNext(int maxValue)
|
||||||
{
|
{
|
||||||
|
|
|
@ -69,8 +69,8 @@ namespace CosmosCloneCommon.Utility
|
||||||
EndpointUrl = targetConfigs["EndpointUrl"],
|
EndpointUrl = targetConfigs["EndpointUrl"],
|
||||||
AccessKey = targetConfigs["AccessKey"],
|
AccessKey = targetConfigs["AccessKey"],
|
||||||
DatabaseName = targetConfigs["DatabaseName"],
|
DatabaseName = targetConfigs["DatabaseName"],
|
||||||
CollectionName = targetConfigs["CollectionName"]
|
CollectionName = targetConfigs["CollectionName"],
|
||||||
// OfferThroughputRUs = int.Parse(sourceConfigs["OfferThroughputRUs"])
|
OfferThroughputRUs = int.Parse(targetConfigs["OfferThroughputRUs"])
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,6 +95,6 @@ namespace CosmosCloneCommon.Utility
|
||||||
public string AccessKey { get; set; }
|
public string AccessKey { get; set; }
|
||||||
public string DatabaseName { get; set; }
|
public string DatabaseName { get; set; }
|
||||||
public string CollectionName { get; set; }
|
public string CollectionName { get; set; }
|
||||||
|
public int OfferThroughputRUs { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче