mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-31 01:25:38 -05:00
Update server tree action contributions (#15525)
* Update server tree action contributions * Fix test
This commit is contained in:
@@ -5,11 +5,10 @@
|
||||
|
||||
import { IConfigurationRegistry, Extensions as ConfigExtensions } from 'vs/platform/configuration/common/configurationRegistry';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { AddServerGroupAction, AddServerAction } from 'sql/workbench/services/objectExplorer/browser/connectionTreeAction';
|
||||
import { ClearRecentConnectionsAction, GetCurrentConnectionStringAction } from 'sql/workbench/services/connection/browser/connectionActions';
|
||||
import * as azdata from 'azdata';
|
||||
import { IWorkbenchActionRegistry, Extensions } from 'vs/workbench/common/actions';
|
||||
import { SyncActionDescriptor } from 'vs/platform/actions/common/actions';
|
||||
import { MenuId, MenuRegistry, SyncActionDescriptor } from 'vs/platform/actions/common/actions';
|
||||
import { localize } from 'vs/nls';
|
||||
import { ConnectionStatusbarItem } from 'sql/workbench/contrib/connection/browser/connectionStatus';
|
||||
import { CommandsRegistry } from 'vs/platform/commands/common/commands';
|
||||
@@ -20,12 +19,18 @@ import { integrated, azureMFA } from 'sql/platform/connection/common/constants';
|
||||
import { AuthenticationType } from 'sql/workbench/services/connection/browser/connectionWidget';
|
||||
import { LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle';
|
||||
import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions';
|
||||
import { ConnectionViewletPanel } from 'sql/workbench/contrib/dataExplorer/browser/connectionViewletPanel';
|
||||
import { ContextKeyEqualsExpr } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { ActiveConnectionsFilterAction, AddServerAction, AddServerGroupAction } from 'sql/workbench/services/objectExplorer/browser/connectionTreeAction';
|
||||
import { CONTEXT_SERVER_TREE_VIEW, CONTEXT_SERVER_TREE_HAS_CONNECTIONS } from 'sql/workbench/contrib/objectExplorer/browser/serverTreeView';
|
||||
import { SqlIconId } from 'sql/base/common/codicons';
|
||||
|
||||
const workbenchRegistry = Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench);
|
||||
|
||||
workbenchRegistry.registerWorkbenchContribution(ConnectionStatusbarItem, LifecyclePhase.Restored);
|
||||
|
||||
import 'sql/workbench/contrib/connection/common/connectionTreeProviderExentionPoint';
|
||||
import { ServerTreeViewView } from 'sql/workbench/services/objectExplorer/browser/objectExplorerService';
|
||||
|
||||
// Connection Dashboard registration
|
||||
|
||||
@@ -50,6 +55,15 @@ actionRegistry.registerWorkbenchAction(
|
||||
AddServerGroupAction.LABEL
|
||||
);
|
||||
|
||||
actionRegistry.registerWorkbenchAction(
|
||||
SyncActionDescriptor.create(
|
||||
ActiveConnectionsFilterAction,
|
||||
ActiveConnectionsFilterAction.ID,
|
||||
ActiveConnectionsFilterAction.SHOW_ACTIVE_CONNECTIONS_LABEL
|
||||
),
|
||||
ActiveConnectionsFilterAction.SHOW_ACTIVE_CONNECTIONS_LABEL
|
||||
);
|
||||
|
||||
actionRegistry.registerWorkbenchAction(
|
||||
SyncActionDescriptor.create(
|
||||
AddServerAction,
|
||||
@@ -59,6 +73,45 @@ actionRegistry.registerWorkbenchAction(
|
||||
AddServerAction.LABEL
|
||||
);
|
||||
|
||||
MenuRegistry.appendMenuItem(MenuId.ViewTitle, {
|
||||
group: 'navigation',
|
||||
order: 10,
|
||||
command: {
|
||||
id: AddServerAction.ID,
|
||||
title: AddServerAction.LABEL,
|
||||
icon: { id: SqlIconId.addServerAction }
|
||||
},
|
||||
when: ContextKeyEqualsExpr.create('view', ConnectionViewletPanel.ID),
|
||||
});
|
||||
|
||||
MenuRegistry.appendMenuItem(MenuId.ViewTitle, {
|
||||
group: 'navigation',
|
||||
order: 20,
|
||||
command: {
|
||||
id: AddServerGroupAction.ID,
|
||||
title: AddServerGroupAction.LABEL,
|
||||
icon: { id: SqlIconId.addServerGroupAction }
|
||||
},
|
||||
when: ContextKeyEqualsExpr.create('view', ConnectionViewletPanel.ID),
|
||||
});
|
||||
|
||||
MenuRegistry.appendMenuItem(MenuId.ViewTitle, {
|
||||
group: 'navigation',
|
||||
order: 30,
|
||||
command: {
|
||||
id: ActiveConnectionsFilterAction.ID,
|
||||
title: ActiveConnectionsFilterAction.SHOW_ACTIVE_CONNECTIONS_LABEL,
|
||||
icon: { id: SqlIconId.activeConnectionsAction },
|
||||
precondition: CONTEXT_SERVER_TREE_HAS_CONNECTIONS,
|
||||
toggled: {
|
||||
condition: CONTEXT_SERVER_TREE_VIEW.isEqualTo(ServerTreeViewView.active),
|
||||
icon: { id: SqlIconId.serverPage },
|
||||
tooltip: ActiveConnectionsFilterAction.SHOW_ALL_CONNECTIONS_LABEL
|
||||
}
|
||||
},
|
||||
when: ContextKeyEqualsExpr.create('view', ConnectionViewletPanel.ID),
|
||||
});
|
||||
|
||||
CommandsRegistry.registerCommand('azdata.connect',
|
||||
function (accessor, args: {
|
||||
serverName: string,
|
||||
|
||||
Reference in New Issue
Block a user