mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-20 09:35:38 -05:00
CMS fit and finish (#5542)
* cms connections dont save * added value to enum * remove refresh and update provider name for cms * removed ownerUri from saved connection and contributed to array * removed owneruri * ownerUri not needed any more * removed AAD from cms * initial review * changed comments * add back saveProfile option for connectionProfile * review fixes and other UI improvements * fixed auth * added cms integration tests * added constants * removed utils from apiwrapper * changed connection type name * review comments * clearer code and addressed reviews
This commit is contained in:
@@ -22,12 +22,12 @@ export function registerCmsServerCommand(appContext: AppContext, tree: CmsResour
|
||||
if (node && !(node instanceof CmsResourceEmptyTreeNode)) {
|
||||
return;
|
||||
}
|
||||
await appContext.apiWrapper.connection.then(async (connection) => {
|
||||
await appContext.cmsUtils.connection.then(async (connection) => {
|
||||
if (connection && connection.options) {
|
||||
let registeredCmsServerName = connection.options.registeredServerName ?
|
||||
connection.options.registeredServerName : connection.options.server;
|
||||
// check if a CMS with the same name is registered or not
|
||||
let cachedServers = appContext.apiWrapper.registeredCmsServers;
|
||||
let cachedServers = appContext.cmsUtils.registeredCmsServers;
|
||||
let serverExists: boolean = false;
|
||||
if (cachedServers) {
|
||||
serverExists = cachedServers.some((server) => {
|
||||
@@ -42,7 +42,7 @@ export function registerCmsServerCommand(appContext: AppContext, tree: CmsResour
|
||||
// remove server description from connection uri
|
||||
connection.options.registeredCmsServerDescription = null;
|
||||
let ownerUri = await azdata.connection.getUriForConnection(connection.connectionId);
|
||||
appContext.apiWrapper.cacheRegisteredCmsServer(registeredCmsServerName, registeredCmsServerDescription, ownerUri, connection);
|
||||
appContext.cmsUtils.cacheRegisteredCmsServer(registeredCmsServerName, registeredCmsServerDescription, ownerUri, connection);
|
||||
tree.notifyNodeChanged(undefined);
|
||||
} else {
|
||||
// error out for same server name
|
||||
@@ -61,7 +61,7 @@ export function deleteCmsServerCommand(appContext: AppContext, tree: CmsResource
|
||||
if (!(node instanceof CmsResourceTreeNode)) {
|
||||
return;
|
||||
}
|
||||
await appContext.apiWrapper.deleteCmsServer(node.name);
|
||||
await appContext.cmsUtils.deleteCmsServer(node.name);
|
||||
tree.isSystemInitialized = false;
|
||||
tree.notifyNodeChanged(undefined);
|
||||
});
|
||||
@@ -75,9 +75,9 @@ export function addRegisteredServerCommand(appContext: AppContext, tree: CmsReso
|
||||
}
|
||||
let relativePath = node instanceof CmsResourceTreeNode ? '' : node.relativePath;
|
||||
let serverName = node instanceof CmsResourceTreeNode ? node.connection.options.server : null;
|
||||
await appContext.apiWrapper.addRegisteredServer(relativePath, node.ownerUri, serverName).then((result) => {
|
||||
await appContext.cmsUtils.addRegisteredServer(relativePath, node.ownerUri, serverName).then((result) => {
|
||||
if (result) {
|
||||
tree.notifyNodeChanged(undefined);
|
||||
tree.notifyNodeChanged(node);
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -89,11 +89,18 @@ export function deleteRegisteredServerCommand(appContext: AppContext, tree: CmsR
|
||||
if (!(node instanceof RegisteredServerTreeNode)) {
|
||||
return;
|
||||
}
|
||||
appContext.apiWrapper.removeRegisteredServer(node.name, node.relativePath, node.ownerUri).then((result) => {
|
||||
if (result) {
|
||||
tree.notifyNodeChanged(undefined);
|
||||
}
|
||||
});
|
||||
appContext.apiWrapper.showWarningMessage(
|
||||
`${localize('cms.confirmDeleteServer', 'Are you sure you want to delete')} ${node.name}?`,
|
||||
localize('cms.yes', 'Yes'),
|
||||
localize('cms.no', 'No')).then((result) => {
|
||||
if (result && result === localize('cms.yes', 'Yes')) {
|
||||
appContext.cmsUtils.removeRegisteredServer(node.name, node.relativePath, node.ownerUri).then((result) => {
|
||||
if (result) {
|
||||
tree.notifyNodeChanged(node.parent);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -144,9 +151,9 @@ export function addServerGroupCommand(appContext: AppContext, tree: CmsResourceT
|
||||
groupExists = true;
|
||||
}
|
||||
if (!groupExists) {
|
||||
appContext.apiWrapper.addServerGroup(serverGroupName, serverDescription, path, node.ownerUri).then((result) => {
|
||||
appContext.cmsUtils.addServerGroup(serverGroupName, serverDescription, path, node.ownerUri).then((result) => {
|
||||
if (result) {
|
||||
tree.notifyNodeChanged(undefined);
|
||||
tree.notifyNodeChanged(node);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
@@ -165,11 +172,18 @@ export function deleteServerGroupCommand(appContext: AppContext, tree: CmsResour
|
||||
if (!(node instanceof ServerGroupTreeNode)) {
|
||||
return;
|
||||
}
|
||||
appContext.apiWrapper.removeServerGroup(node.name, node.relativePath, node.ownerUri).then((result) => {
|
||||
if (result) {
|
||||
tree.notifyNodeChanged(undefined);
|
||||
}
|
||||
});
|
||||
appContext.apiWrapper.showWarningMessage(
|
||||
`${localize('cms.confirmDeleteGroup', 'Are you sure you want to delete')} ${node.name}?`,
|
||||
localize('cms.yes', 'Yes'),
|
||||
localize('cms.no', 'No')).then((result) => {
|
||||
if (result && result === localize('cms.yes', 'Yes')) {
|
||||
appContext.cmsUtils.removeServerGroup(node.name, node.relativePath, node.ownerUri).then((result) => {
|
||||
if (result) {
|
||||
tree.notifyNodeChanged(node.parent);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -179,7 +193,7 @@ export function refreshCommand(appContext: AppContext, tree: CmsResourceTreeProv
|
||||
if (!node) {
|
||||
return;
|
||||
}
|
||||
tree.notifyNodeChanged(undefined);
|
||||
tree.notifyNodeChanged(node);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user