mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Arc - Delete registration
This commit is contained in:
@@ -138,12 +138,19 @@ export class ControllerModel {
|
|||||||
return this._controllerRegistration;
|
return this._controllerRegistration;
|
||||||
}
|
}
|
||||||
|
|
||||||
public getRegistration(type: string, namespace: string, name: string): Registration | undefined {
|
public getRegistration(type: ResourceType, namespace: string, name: string): Registration | undefined {
|
||||||
return this._registrations.find(r => {
|
return this._registrations.find(r => {
|
||||||
return r.instanceType === type && r.instanceNamespace === namespace && parseInstanceName(r.instanceName) === name;
|
return r.instanceType === type && r.instanceNamespace === namespace && parseInstanceName(r.instanceName) === name;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async deleteRegistration(type: ResourceType, namespace: string, name: string) {
|
||||||
|
const r = this.getRegistration(type, namespace, name);
|
||||||
|
if (r && !r.isDeleted && r.customObjectName) {
|
||||||
|
await this._registrationRouter.apiV1RegistrationNsNameIsDeletedDelete(this._namespace, r.customObjectName, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes the specified MIAA resource from the controller
|
* Deletes the specified MIAA resource from the controller
|
||||||
* @param namespace The namespace of the resource
|
* @param namespace The namespace of the resource
|
||||||
@@ -151,6 +158,7 @@ export class ControllerModel {
|
|||||||
*/
|
*/
|
||||||
public async miaaDelete(namespace: string, name: string): Promise<void> {
|
public async miaaDelete(namespace: string, name: string): Promise<void> {
|
||||||
await this._sqlInstanceRouter.apiV1HybridSqlNsNameDelete(namespace, name);
|
await this._sqlInstanceRouter.apiV1HybridSqlNsNameDelete(namespace, name);
|
||||||
|
await this.deleteRegistration(ResourceType.sqlManagedInstances, namespace, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -231,6 +231,7 @@ export class PostgresOverviewPage extends DashboardPage {
|
|||||||
try {
|
try {
|
||||||
if (await promptForResourceDeletion(this._postgresModel.namespace, this._postgresModel.name)) {
|
if (await promptForResourceDeletion(this._postgresModel.namespace, this._postgresModel.name)) {
|
||||||
await this._postgresModel.delete();
|
await this._postgresModel.delete();
|
||||||
|
await this._controllerModel.deleteRegistration(ResourceType.postgresInstances, this._postgresModel.namespace, this._postgresModel.name);
|
||||||
vscode.window.showInformationMessage(loc.resourceDeleted(this._postgresModel.fullName));
|
vscode.window.showInformationMessage(loc.resourceDeleted(this._postgresModel.fullName));
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ export class ControllerTreeNode extends TreeNode {
|
|||||||
|
|
||||||
private refreshChildren(registrations: Registration[]): void {
|
private refreshChildren(registrations: Registration[]): void {
|
||||||
const newChildren: ResourceTreeNode[] = [];
|
const newChildren: ResourceTreeNode[] = [];
|
||||||
registrations.forEach(registration => {
|
registrations.filter(r => !r.isDeleted).forEach(registration => {
|
||||||
if (!registration.instanceNamespace || !registration.instanceName) {
|
if (!registration.instanceNamespace || !registration.instanceName) {
|
||||||
console.warn('Registration is missing required namespace and name values, skipping');
|
console.warn('Registration is missing required namespace and name values, skipping');
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user