mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-17 02:51:45 -05:00
Improve database properties view: (#501)
- Compatibility Level should be a numerical value. In using `enum.ToString()` the result was `Version140` instead of `140` - Backup date should be sensible if never backed up. Added a simple check that states it was never backed up if the backup date is before 1900.
This commit is contained in:
@@ -18,6 +18,8 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin
|
||||
{
|
||||
public class DatabaseTaskHelper: IDisposable
|
||||
{
|
||||
private static DateTime minBackupDate = new DateTime(1900, 1, 1);
|
||||
|
||||
private DatabasePrototype prototype;
|
||||
|
||||
private XmlDocument document;
|
||||
@@ -109,9 +111,9 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin
|
||||
databaseInfo.Options.Add(AdminServicesProviderOptionsHelper.RecoveryModel, prototype.RecoveryModel.ToString());
|
||||
databaseInfo.Options.Add(AdminServicesProviderOptionsHelper.IsSystemDB, prototype.IsSystemDB.ToString());
|
||||
databaseInfo.Options.Add(AdminServicesProviderOptionsHelper.AnsiNulls, prototype.AnsiNulls.ToString());
|
||||
databaseInfo.Options.Add(AdminServicesProviderOptionsHelper.CompatibilityLevel, prototype.DatabaseCompatibilityLevel.ToString());
|
||||
databaseInfo.Options.Add(AdminServicesProviderOptionsHelper.LastBackupDate, prototype.LastBackupDate.ToString());
|
||||
databaseInfo.Options.Add(AdminServicesProviderOptionsHelper.LastLogBackupDate, prototype.LastLogBackupDate.ToString());
|
||||
databaseInfo.Options.Add(AdminServicesProviderOptionsHelper.CompatibilityLevel, (int)prototype.DatabaseCompatibilityLevel);
|
||||
databaseInfo.Options.Add(AdminServicesProviderOptionsHelper.LastBackupDate, GetBackupDate(prototype.LastBackupDate));
|
||||
databaseInfo.Options.Add(AdminServicesProviderOptionsHelper.LastLogBackupDate, GetBackupDate(prototype.LastLogBackupDate));
|
||||
|
||||
databaseInfo.Options.Add(
|
||||
AdminServicesProviderOptionsHelper.FileGroups + "Count",
|
||||
@@ -151,6 +153,16 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin
|
||||
return databaseInfo;
|
||||
}
|
||||
|
||||
private static string GetBackupDate(DateTime backupDate)
|
||||
{
|
||||
if (backupDate == null
|
||||
|| backupDate < minBackupDate)
|
||||
{
|
||||
return SR.NeverBackedUp;
|
||||
}
|
||||
return backupDate.ToString();
|
||||
}
|
||||
|
||||
private static T GetValueOrDefault<T>(string key, Dictionary<string, object> map, T defaultValue)
|
||||
{
|
||||
if (map != null && map.ContainsKey(key))
|
||||
|
||||
@@ -3277,6 +3277,14 @@ namespace Microsoft.SqlTools.ServiceLayer
|
||||
}
|
||||
}
|
||||
|
||||
public static string NeverBackedUp
|
||||
{
|
||||
get
|
||||
{
|
||||
return Keys.GetString(Keys.NeverBackedUp);
|
||||
}
|
||||
}
|
||||
|
||||
public static string BackupTaskName
|
||||
{
|
||||
get
|
||||
@@ -4871,6 +4879,9 @@ namespace Microsoft.SqlTools.ServiceLayer
|
||||
public const string prototype_file_noApplicableFileGroup = "prototype_file_noApplicableFileGroup";
|
||||
|
||||
|
||||
public const string NeverBackedUp = "NeverBackedUp";
|
||||
|
||||
|
||||
public const string BackupTaskName = "BackupTaskName";
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1811,6 +1811,10 @@
|
||||
<value>No Applicable Filegroup</value>
|
||||
<comment></comment>
|
||||
</data>
|
||||
<data name="NeverBackedUp" xml:space="preserve">
|
||||
<value>Never</value>
|
||||
<comment></comment>
|
||||
</data>
|
||||
<data name="BackupTaskName" xml:space="preserve">
|
||||
<value>Backup Database</value>
|
||||
<comment></comment>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -802,6 +802,7 @@ general_containmentType_None = None
|
||||
general_containmentType_Partial = Partial
|
||||
filegroups_filestreamFiles = FILESTREAM Files
|
||||
prototype_file_noApplicableFileGroup = No Applicable Filegroup
|
||||
NeverBackedUp = Never
|
||||
|
||||
############################################################################
|
||||
# Backup Service
|
||||
|
||||
@@ -2275,6 +2275,11 @@
|
||||
<target state="new">No backupset selected to be restored</target>
|
||||
<note></note>
|
||||
</trans-unit>
|
||||
<trans-unit id="NeverBackedUp">
|
||||
<source>Never</source>
|
||||
<target state="new">Never</target>
|
||||
<note></note>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user