Hide refresh button on disconnected connections (#22009)

This commit is contained in:
Lewis Sanchez
2023-02-22 16:41:07 -08:00
committed by GitHub
parent 169138e24b
commit 872095ed84

View File

@@ -126,14 +126,15 @@ export class ServerTreeActionProvider {
private getBuiltinConnectionActions(context: ObjectExplorerContext): IAction[] {
let actions: IAction[] = [];
if (this._connectionManagementService.isProfileConnected(context.profile)) {
const isProfileConnected = this._connectionManagementService.isProfileConnected(context.profile);
if (isProfileConnected) {
actions.push(this._instantiationService.createInstance(DisconnectConnectionAction, DisconnectConnectionAction.ID, DisconnectConnectionAction.LABEL, context.profile));
}
actions.push(this._instantiationService.createInstance(EditConnectionAction, EditConnectionAction.ID, EditConnectionAction.LABEL, context.profile));
actions.push(this._instantiationService.createInstance(DeleteConnectionAction, DeleteConnectionAction.ID, DeleteConnectionAction.DELETE_CONNECTION_LABEL, context.profile));
// Contribute refresh action for scriptable objects via contribution
if (!this.isScriptableObject(context)) {
if (isProfileConnected && !this.isScriptableObject(context)) {
actions.push(this._instantiationService.createInstance(RefreshAction, RefreshAction.ID, RefreshAction.LABEL, context.tree, context.profile));
}
return actions;