Check provider type before throwing error message on cloud servers (#5948)

* check provider type in backup action

* check provider name in case of restore as well

* removed harcoding of constant
This commit is contained in:
Anup N. Kamath
2019-06-19 22:53:54 -07:00
committed by Alan Ren
parent b9a0c9ce7e
commit 433e5633cf

View File

@@ -26,6 +26,7 @@ import { IEditorService } from 'vs/workbench/services/editor/common/editorServic
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { INotificationService } from 'vs/platform/notification/common/notification';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { mssqlProviderName } from 'sql/platform/connection/common/constants';
export interface BaseActionContext {
object?: ObjectMetadata;
@@ -253,7 +254,7 @@ export class BackupAction extends Task {
}
if (profile) {
const serverInfo = connectionManagementService.getServerInfo(profile.id);
if (serverInfo && serverInfo.isCloud) {
if (serverInfo && serverInfo.isCloud && profile.providerName === mssqlProviderName) {
return accessor.get<INotificationService>(INotificationService).info(nls.localize('backup.commandNotSupported', 'Backup command is not supported for Azure SQL databases.'));
}
}
@@ -296,7 +297,7 @@ export class RestoreAction extends Task {
}
if (profile) {
const serverInfo = connectionManagementService.getServerInfo(profile.id);
if (serverInfo && serverInfo.isCloud) {
if (serverInfo && serverInfo.isCloud && profile.providerName === mssqlProviderName) {
return accessor.get<INotificationService>(INotificationService).info(nls.localize('restore.commandNotSupported', 'Restore command is not supported for Azure SQL databases.'));
}
}