mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Fix Loading component removal (#13478)
* Fix Loading component removal * More undefined checks
This commit is contained in:
@@ -95,6 +95,11 @@ export default class LoadingComponent extends ComponentBase<azdata.LoadingCompon
|
|||||||
this.layout();
|
this.layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public removeFromContainer(_componentDescriptor: IComponentDescriptor): void {
|
||||||
|
this._component = undefined;
|
||||||
|
this.layout();
|
||||||
|
}
|
||||||
|
|
||||||
public getStatusText(): string {
|
public getStatusText(): string {
|
||||||
return this.loading ? this.loadingText : this.loadingCompletedText;
|
return this.loading ? this.loadingText : this.loadingCompletedText;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,6 +88,10 @@ export abstract class ViewBase extends AngularDisposable implements IModelView {
|
|||||||
clearContainer(componentId: string): void {
|
clearContainer(componentId: string): void {
|
||||||
this.logService.debug(`Queuing action to clear component ${componentId}`);
|
this.logService.debug(`Queuing action to clear component ${componentId}`);
|
||||||
this.queueAction(componentId, (component) => {
|
this.queueAction(componentId, (component) => {
|
||||||
|
if (!component.clearContainer) {
|
||||||
|
this.logService.warn(`Trying to clear container ${componentId} but does not implement clearContainer!`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.logService.debug(`Clearing component ${componentId}`);
|
this.logService.debug(`Clearing component ${componentId}`);
|
||||||
component.clearContainer();
|
component.clearContainer();
|
||||||
});
|
});
|
||||||
@@ -97,6 +101,10 @@ export abstract class ViewBase extends AngularDisposable implements IModelView {
|
|||||||
this.logService.debug(`Queueing action to add component ${itemConfig.componentShape.id} to container ${containerId}`);
|
this.logService.debug(`Queueing action to add component ${itemConfig.componentShape.id} to container ${containerId}`);
|
||||||
// Do not return the promise as this should be non-blocking
|
// Do not return the promise as this should be non-blocking
|
||||||
this.queueAction(containerId, (component) => {
|
this.queueAction(containerId, (component) => {
|
||||||
|
if (!component.addToContainer) {
|
||||||
|
this.logService.warn(`Container ${containerId} is trying to add component ${itemConfig.componentShape.id} but does not implement addToContainer!`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.logService.debug(`Adding component ${itemConfig.componentShape.id} to container ${containerId}`);
|
this.logService.debug(`Adding component ${itemConfig.componentShape.id} to container ${containerId}`);
|
||||||
let childDescriptor = this.defineComponent(itemConfig.componentShape);
|
let childDescriptor = this.defineComponent(itemConfig.componentShape);
|
||||||
component.addToContainer(childDescriptor, itemConfig.config, index);
|
component.addToContainer(childDescriptor, itemConfig.config, index);
|
||||||
@@ -107,6 +115,10 @@ export abstract class ViewBase extends AngularDisposable implements IModelView {
|
|||||||
this.logService.debug(`Queueing action to remove component ${itemConfig.componentShape.id} from container ${containerId}`);
|
this.logService.debug(`Queueing action to remove component ${itemConfig.componentShape.id} from container ${containerId}`);
|
||||||
let childDescriptor = this.modelStore.getComponentDescriptor(itemConfig.componentShape.id);
|
let childDescriptor = this.modelStore.getComponentDescriptor(itemConfig.componentShape.id);
|
||||||
this.queueAction(containerId, (component) => {
|
this.queueAction(containerId, (component) => {
|
||||||
|
if (!component.removeFromContainer) {
|
||||||
|
this.logService.warn(`Container ${containerId} is trying to remove component ${itemConfig.componentShape.id} but does not implement removeFromContainer!`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.logService.debug(`Removing component ${itemConfig.componentShape.id} from container ${containerId}`);
|
this.logService.debug(`Removing component ${itemConfig.componentShape.id} from container ${containerId}`);
|
||||||
component.removeFromContainer(childDescriptor);
|
component.removeFromContainer(childDescriptor);
|
||||||
this.removeComponent(itemConfig.componentShape);
|
this.removeComponent(itemConfig.componentShape);
|
||||||
|
|||||||
Reference in New Issue
Block a user