mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Kenvh/noazurecms (#8755)
* Disallow Azure SQL DB servers for CMS * removed commented out lines * added check for valid serverInfo
This commit is contained in:
@@ -33,20 +33,27 @@ export function registerCmsServerCommand(appContext: AppContext, tree: CmsResour
|
|||||||
return server.name === registeredCmsServerName;
|
return server.name === registeredCmsServerName;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (!serverExists) {
|
|
||||||
// remove any group ID if user selects a connection from
|
// don't allow duplicate server entries
|
||||||
// recent connection list
|
if (serverExists) {
|
||||||
connection.options.groupId = null;
|
|
||||||
let registeredCmsServerDescription = connection.options.registeredServerDescription;
|
|
||||||
let ownerUri = await azdata.connection.getUriForConnection(connection.connectionId);
|
|
||||||
appContext.cmsUtils.cacheRegisteredCmsServer(registeredCmsServerName, registeredCmsServerDescription, ownerUri, connection);
|
|
||||||
tree.notifyNodeChanged(undefined);
|
|
||||||
} else {
|
|
||||||
// error out for same server name
|
|
||||||
let errorText = localize('cms.errors.sameCmsServerName', "Central Management Server Group already has a Registered Server with the name {0}", registeredCmsServerName);
|
let errorText = localize('cms.errors.sameCmsServerName', "Central Management Server Group already has a Registered Server with the name {0}", registeredCmsServerName);
|
||||||
appContext.apiWrapper.showErrorMessage(errorText);
|
|
||||||
throw new Error(errorText);
|
throw new Error(errorText);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// don't allow azure servers
|
||||||
|
let isCloud: boolean = connection.options.isCloud;
|
||||||
|
if (isCloud) {
|
||||||
|
let errorText = localize('cms.errors.azureNotAllowed', "Azure SQL Servers cannot be used as Central Management Servers");
|
||||||
|
throw new Error(errorText);
|
||||||
|
}
|
||||||
|
|
||||||
|
// remove any group ID if user selects a connection from
|
||||||
|
// recent connection list
|
||||||
|
connection.options.groupId = null;
|
||||||
|
let registeredCmsServerDescription = connection.options.registeredServerDescription;
|
||||||
|
let ownerUri = await azdata.connection.getUriForConnection(connection.connectionId);
|
||||||
|
appContext.cmsUtils.cacheRegisteredCmsServer(registeredCmsServerName, registeredCmsServerDescription, ownerUri, connection);
|
||||||
|
tree.notifyNodeChanged(undefined);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -336,6 +336,9 @@
|
|||||||
<trans-unit id="cms.errors.sameCmsServerName">
|
<trans-unit id="cms.errors.sameCmsServerName">
|
||||||
<source xml:lang="en">Central Management Server Group already has a Registered Server with the name {0}</source>
|
<source xml:lang="en">Central Management Server Group already has a Registered Server with the name {0}</source>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
|
<trans-unit id="cms.errors.azureNotAllowed">
|
||||||
|
<source xml:lang="en">Azure SQL Database Servers cannot be used as Central Management Servers</source>
|
||||||
|
</trans-unit>
|
||||||
<trans-unit id="cms.confirmDeleteServer">
|
<trans-unit id="cms.confirmDeleteServer">
|
||||||
<source xml:lang="en">Are you sure you want to delete</source>
|
<source xml:lang="en">Are you sure you want to delete</source>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
@@ -372,4 +375,4 @@
|
|||||||
<source xml:lang="en">You cannot add a shared registered server with the same name as the Configuration Server</source>
|
<source xml:lang="en">You cannot add a shared registered server with the same name as the Configuration Server</source>
|
||||||
</trans-unit>
|
</trans-unit>
|
||||||
</body></file>
|
</body></file>
|
||||||
</xliff>
|
</xliff>
|
||||||
|
|||||||
@@ -1040,6 +1040,9 @@ export class ConnectionManagementService extends Disposable implements IConnecti
|
|||||||
this._connectionStatusManager.deleteConnection(uri);
|
this._connectionStatusManager.deleteConnection(uri);
|
||||||
resolve({ connected: connectResult, errorMessage: errorMessage, errorCode: errorCode, callStack: callStack, connectionProfile: connection });
|
resolve({ connected: connectResult, errorMessage: errorMessage, errorCode: errorCode, callStack: callStack, connectionProfile: connection });
|
||||||
} else {
|
} else {
|
||||||
|
if (connectionMngInfo.serverInfo) {
|
||||||
|
connection.options.isCloud = connectionMngInfo.serverInfo.isCloud;
|
||||||
|
}
|
||||||
resolve({ connected: connectResult, errorMessage: errorMessage, errorCode: errorCode, callStack: callStack, connectionProfile: connection });
|
resolve({ connected: connectResult, errorMessage: errorMessage, errorCode: errorCode, callStack: callStack, connectionProfile: connection });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user