mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-18 17:22:45 -05:00
Merge remote-tracking branch 'origin/master' into ads-master-vscode-2020-05-31T19-47-47
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
/* Activity Bar */
|
||||
.monaco-workbench .activitybar .monaco-action-bar .action-label.book {
|
||||
background-color: rgba(255, 255, 255, 0.4);
|
||||
}
|
||||
|
||||
/* Activity Bar */
|
||||
.monaco-workbench .activitybar .monaco-action-bar .checked .action-label.book {
|
||||
background-color: rgb(255, 255, 255);
|
||||
}
|
||||
@@ -46,6 +46,9 @@ import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } fr
|
||||
import { NotebookThemingContribution } from 'sql/workbench/contrib/notebook/browser/notebookThemingContribution';
|
||||
import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
|
||||
import { ToggleTabFocusModeAction } from 'vs/editor/contrib/toggleTabFocusMode/toggleTabFocusMode';
|
||||
import { NotebookExplorerViewletViewsContribution, OpenNotebookExplorerViewletAction } from 'sql/workbench/contrib/notebook/browser/notebookExplorer/notebookExplorerViewlet';
|
||||
import 'vs/css!./media/notebook.contribution';
|
||||
|
||||
|
||||
Registry.as<IEditorInputFactoryRegistry>(EditorInputFactoryExtensions.EditorInputFactories)
|
||||
.registerEditorInputFactory(FileNotebookInput.ID, FileNoteBookEditorInputFactory);
|
||||
@@ -348,3 +351,16 @@ registerComponentType({
|
||||
selector: MimeRendererComponent.SELECTOR
|
||||
});
|
||||
registerCellComponent(TextCellComponent);
|
||||
|
||||
const workbenchRegistry = Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench);
|
||||
workbenchRegistry.registerWorkbenchContribution(NotebookExplorerViewletViewsContribution, LifecyclePhase.Starting);
|
||||
const registry = Registry.as<IWorkbenchActionRegistry>(WorkbenchActionsExtensions.WorkbenchActions);
|
||||
registry.registerWorkbenchAction(
|
||||
SyncActionDescriptor.create(
|
||||
OpenNotebookExplorerViewletAction,
|
||||
OpenNotebookExplorerViewletAction.ID,
|
||||
OpenNotebookExplorerViewletAction.LABEL,
|
||||
{ primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_B }),
|
||||
'View: Show Notebook Explorer',
|
||||
localize('notebookExplorer.view', "View")
|
||||
);
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
.notebookEditor .in-preview .actions-container .action-item .notebook-button {
|
||||
display: flex;
|
||||
background-size: 16px;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.notebookEditor
|
||||
|
||||
@@ -0,0 +1,149 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { localize } from 'vs/nls';
|
||||
import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
|
||||
import { IAction } from 'vs/base/common/actions';
|
||||
import { append, $, addClass, toggleClass, Dimension } from 'vs/base/browser/dom';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { IViewletViewOptions } from 'vs/workbench/browser/parts/views/viewsViewlet';
|
||||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
|
||||
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { Extensions as ViewContainerExtensions, IViewDescriptor, IViewsRegistry, IViewContainersRegistry, ViewContainerLocation, IViewDescriptorService } from 'vs/workbench/common/views';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { IMenuService, MenuId } from 'vs/platform/actions/common/actions';
|
||||
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
|
||||
import { ShowViewletAction, Viewlet } from 'vs/workbench/browser/viewlet';
|
||||
import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
|
||||
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
|
||||
import { ViewPaneContainer, ViewPane } from 'vs/workbench/browser/parts/views/viewPaneContainer';
|
||||
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
|
||||
|
||||
export const VIEWLET_ID = 'workbench.view.notebooks';
|
||||
|
||||
// Viewlet Action
|
||||
export class OpenNotebookExplorerViewletAction extends ShowViewletAction {
|
||||
public static ID = VIEWLET_ID;
|
||||
public static LABEL = localize('showNotebookExplorer', "Show Notebooks");
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
label: string,
|
||||
@IViewletService viewletService: IViewletService,
|
||||
@IEditorGroupsService editorGroupService: IEditorGroupsService,
|
||||
@IWorkbenchLayoutService layoutService: IWorkbenchLayoutService
|
||||
) {
|
||||
super(id, label, VIEWLET_ID, viewletService, editorGroupService, layoutService);
|
||||
}
|
||||
}
|
||||
|
||||
export class NotebookExplorerViewletViewsContribution implements IWorkbenchContribution {
|
||||
|
||||
constructor() {
|
||||
this.registerViews();
|
||||
}
|
||||
|
||||
private registerViews(): void {
|
||||
let viewDescriptors = [];
|
||||
Registry.as<IViewsRegistry>(ViewContainerExtensions.ViewsRegistry).registerViews(viewDescriptors, NOTEBOOK_VIEW_CONTAINER);
|
||||
}
|
||||
}
|
||||
|
||||
export class NotebookExplorerViewlet extends Viewlet {
|
||||
constructor(
|
||||
@ITelemetryService telemetryService: ITelemetryService,
|
||||
@IStorageService protected storageService: IStorageService,
|
||||
@IInstantiationService protected instantiationService: IInstantiationService,
|
||||
@IThemeService themeService: IThemeService,
|
||||
@IContextMenuService protected contextMenuService: IContextMenuService,
|
||||
@IExtensionService protected extensionService: IExtensionService,
|
||||
@IWorkspaceContextService protected contextService: IWorkspaceContextService,
|
||||
@IWorkbenchLayoutService protected layoutService: IWorkbenchLayoutService,
|
||||
@IConfigurationService protected configurationService: IConfigurationService
|
||||
) {
|
||||
super(VIEWLET_ID, instantiationService.createInstance(NotebookExplorerViewPaneContainer), telemetryService, storageService, instantiationService, themeService, contextMenuService, extensionService, contextService, layoutService, configurationService);
|
||||
}
|
||||
}
|
||||
|
||||
export class NotebookExplorerViewPaneContainer extends ViewPaneContainer {
|
||||
private root: HTMLElement;
|
||||
|
||||
private notebookSourcesBox: HTMLElement;
|
||||
|
||||
constructor(
|
||||
@IWorkbenchLayoutService layoutService: IWorkbenchLayoutService,
|
||||
@ITelemetryService telemetryService: ITelemetryService,
|
||||
@IInstantiationService instantiationService: IInstantiationService,
|
||||
@IThemeService themeService: IThemeService,
|
||||
@IStorageService storageService: IStorageService,
|
||||
@IWorkspaceContextService contextService: IWorkspaceContextService,
|
||||
@IContextMenuService contextMenuService: IContextMenuService,
|
||||
@IExtensionService extensionService: IExtensionService,
|
||||
@IConfigurationService configurationService: IConfigurationService,
|
||||
@IMenuService private menuService: IMenuService,
|
||||
@IContextKeyService private contextKeyService: IContextKeyService,
|
||||
@IViewDescriptorService viewDescriptorService: IViewDescriptorService
|
||||
) {
|
||||
super(VIEWLET_ID, { mergeViewWithContainerWhenSingleView: true }, instantiationService, configurationService, layoutService, contextMenuService, telemetryService, extensionService, themeService, storageService, contextService, viewDescriptorService);
|
||||
}
|
||||
|
||||
create(parent: HTMLElement): void {
|
||||
addClass(parent, 'notebookExplorer-viewlet');
|
||||
this.root = parent;
|
||||
|
||||
this.notebookSourcesBox = append(this.root, $('.notebookSources'));
|
||||
|
||||
return super.create(this.notebookSourcesBox);
|
||||
}
|
||||
|
||||
public updateStyles(): void {
|
||||
super.updateStyles();
|
||||
}
|
||||
|
||||
focus(): void {
|
||||
}
|
||||
|
||||
layout(dimension: Dimension): void {
|
||||
toggleClass(this.root, 'narrow', dimension.width <= 300);
|
||||
super.layout(new Dimension(dimension.width, dimension.height));
|
||||
}
|
||||
|
||||
getOptimalWidth(): number {
|
||||
return 400;
|
||||
}
|
||||
|
||||
getSecondaryActions(): IAction[] {
|
||||
let menu = this.menuService.createMenu(MenuId.NotebookTitle, this.contextKeyService);
|
||||
let actions = [];
|
||||
menu.getActions({}).forEach(group => {
|
||||
if (group[0] === 'secondary') {
|
||||
actions.push(...group[1]);
|
||||
}
|
||||
});
|
||||
menu.dispose();
|
||||
return actions;
|
||||
}
|
||||
|
||||
protected createView(viewDescriptor: IViewDescriptor, options: IViewletViewOptions): ViewPane {
|
||||
let viewletPanel = this.instantiationService.createInstance(viewDescriptor.ctorDescriptor.ctor, options) as ViewPane;
|
||||
this._register(viewletPanel);
|
||||
return viewletPanel;
|
||||
}
|
||||
}
|
||||
|
||||
export const NOTEBOOK_VIEW_CONTAINER = Registry.as<IViewContainersRegistry>(ViewContainerExtensions.ViewContainersRegistry).registerViewContainer({
|
||||
id: VIEWLET_ID,
|
||||
name: localize('notebookExplorer.name', "Notebooks"),
|
||||
ctorDescriptor: new SyncDescriptor(NotebookExplorerViewPaneContainer),
|
||||
icon: 'book',
|
||||
order: 6,
|
||||
storageId: `${VIEWLET_ID}.state`
|
||||
}, ViewContainerLocation.Sidebar);
|
||||
@@ -0,0 +1,94 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as assert from 'assert';
|
||||
import * as Platform from 'vs/platform/registry/common/platform';
|
||||
import { ViewletDescriptor, Extensions, ViewletRegistry, Viewlet } from 'vs/workbench/browser/viewlet';
|
||||
import * as Types from 'vs/base/common/types';
|
||||
import { workbenchInstantiationService } from 'sql/workbench/test/workbenchTestServices';
|
||||
import { Extensions as ViewContainerExtensions, IViewDescriptor, IViewsRegistry } from 'vs/workbench/common/views';
|
||||
import { NotebookExplorerViewPaneContainer, NOTEBOOK_VIEW_CONTAINER } from 'sql/workbench/contrib/notebook/browser/notebookExplorer/notebookExplorerViewlet';
|
||||
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
|
||||
|
||||
suite('Notebook Explorer Views', () => {
|
||||
|
||||
class NotebookExplorerTestViewlet extends Viewlet {
|
||||
|
||||
constructor() {
|
||||
const instantiationService = workbenchInstantiationService();
|
||||
super('notebookExplorer', instantiationService.createInstance(NotebookExplorerViewPaneContainer), undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined);
|
||||
}
|
||||
|
||||
public layout(dimension: any): void {
|
||||
throw new Error('Method not implemented.');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
test('ViewDescriptor API', function () {
|
||||
let d = ViewletDescriptor.create(NotebookExplorerTestViewlet, 'id', 'name', 'class', 1);
|
||||
assert.strictEqual(d.id, 'id');
|
||||
assert.strictEqual(d.name, 'name');
|
||||
assert.strictEqual(d.cssClass, 'class');
|
||||
assert.strictEqual(d.order, 1);
|
||||
});
|
||||
|
||||
test('Editor Aware ViewletDescriptor API', function () {
|
||||
let d = ViewletDescriptor.create(NotebookExplorerTestViewlet, 'id', 'name', 'class', 5);
|
||||
assert.strictEqual(d.id, 'id');
|
||||
assert.strictEqual(d.name, 'name');
|
||||
|
||||
d = ViewletDescriptor.create(NotebookExplorerTestViewlet, 'id', 'name', 'class', 5);
|
||||
assert.strictEqual(d.id, 'id');
|
||||
assert.strictEqual(d.name, 'name');
|
||||
});
|
||||
|
||||
test('NotebookExplorer Views registration', function () {
|
||||
assert(Types.isFunction(Platform.Registry.as<IViewsRegistry>(ViewContainerExtensions.ViewsRegistry).registerViews));
|
||||
assert(Types.isFunction(Platform.Registry.as<IViewsRegistry>(ViewContainerExtensions.ViewsRegistry).getViews));
|
||||
assert(Types.isFunction(Platform.Registry.as<IViewsRegistry>(ViewContainerExtensions.ViewsRegistry).getView));
|
||||
|
||||
Platform.Registry.as<IViewsRegistry>(ViewContainerExtensions.ViewsRegistry).registerViews([], NOTEBOOK_VIEW_CONTAINER);
|
||||
|
||||
let oldcount = Platform.Registry.as<IViewsRegistry>(ViewContainerExtensions.ViewsRegistry).getViews(NOTEBOOK_VIEW_CONTAINER).length;
|
||||
let d: IViewDescriptor = { id: 'notebookView-test-1', name: 'Notebooks', ctorDescriptor: new SyncDescriptor(NotebookExplorerViewPaneContainer) };
|
||||
Platform.Registry.as<IViewsRegistry>(ViewContainerExtensions.ViewsRegistry).registerViews([d], NOTEBOOK_VIEW_CONTAINER);
|
||||
let retrieved = Platform.Registry.as<IViewsRegistry>(ViewContainerExtensions.ViewsRegistry).getView('notebookView-test-1');
|
||||
assert(d === retrieved, 'Could not register view :' + d.id + 'Retrieved: ' + retrieved);
|
||||
let newCount = Platform.Registry.as<IViewsRegistry>(ViewContainerExtensions.ViewsRegistry).getViews(NOTEBOOK_VIEW_CONTAINER).length;
|
||||
assert.equal(oldcount + 1, newCount, 'View registration failed');
|
||||
|
||||
|
||||
});
|
||||
|
||||
test('NotebookExplorer Views should not register duplicate views', function () {
|
||||
let d: IViewDescriptor = { id: 'notebookView-test-1', name: 'Notebooks', ctorDescriptor: new SyncDescriptor(NotebookExplorerViewPaneContainer) };
|
||||
assert.throws(() => Platform.Registry.as<IViewsRegistry>(ViewContainerExtensions.ViewsRegistry).registerViews([d], NOTEBOOK_VIEW_CONTAINER));
|
||||
});
|
||||
|
||||
test('NotebookExplorer Views deregistration', function () {
|
||||
assert(Types.isFunction(Platform.Registry.as<IViewsRegistry>(ViewContainerExtensions.ViewsRegistry).deregisterViews));
|
||||
assert(Types.isFunction(Platform.Registry.as<IViewsRegistry>(ViewContainerExtensions.ViewsRegistry).getViews));
|
||||
|
||||
let d: IViewDescriptor = { id: 'notebookView-test-1', name: 'Notebooks', ctorDescriptor: new SyncDescriptor(NotebookExplorerViewPaneContainer) };
|
||||
assert.doesNotThrow(() => Platform.Registry.as<IViewsRegistry>(ViewContainerExtensions.ViewsRegistry).deregisterViews([d], NOTEBOOK_VIEW_CONTAINER));
|
||||
|
||||
});
|
||||
|
||||
test('NotebookExplorer Viewlet extension point should not register duplicate viewlets', function () {
|
||||
let v1 = ViewletDescriptor.create(NotebookExplorerTestViewlet, 'notebookExplorer-test-id', 'name');
|
||||
Platform.Registry.as<ViewletRegistry>(Extensions.Viewlets).registerViewlet(v1);
|
||||
let oldCount = Platform.Registry.as<ViewletRegistry>(Extensions.Viewlets).getViewlets().length;
|
||||
|
||||
let v1Duplicate = ViewletDescriptor.create(NotebookExplorerTestViewlet, 'notebookExplorer-test-id', 'name');
|
||||
// Shouldn't register the duplicate.
|
||||
Platform.Registry.as<ViewletRegistry>(Extensions.Viewlets).registerViewlet(v1Duplicate);
|
||||
|
||||
let newCount = Platform.Registry.as<ViewletRegistry>(Extensions.Viewlets).getViewlets().length;
|
||||
assert.equal(oldCount, newCount, 'Duplicate registration of views.');
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
@@ -57,7 +57,7 @@ const profilerViewTemplateSchema: IJSONSchema = {
|
||||
},
|
||||
{
|
||||
name: 'LoginName',
|
||||
eventsMapped: ['server_principal_name']
|
||||
eventsMapped: ['server_principal_name', 'username']
|
||||
},
|
||||
{
|
||||
name: 'ClientProcessID',
|
||||
@@ -159,7 +159,7 @@ const profilerViewTemplateSchema: IJSONSchema = {
|
||||
},
|
||||
{
|
||||
name: 'LoginName',
|
||||
eventsMapped: ['server_principal_name']
|
||||
eventsMapped: ['server_principal_name', 'username']
|
||||
}
|
||||
]
|
||||
},
|
||||
@@ -184,7 +184,7 @@ const profilerViewTemplateSchema: IJSONSchema = {
|
||||
},
|
||||
{
|
||||
name: 'LoginName',
|
||||
eventsMapped: ['server_principal_name']
|
||||
eventsMapped: ['server_principal_name', 'username']
|
||||
},
|
||||
{
|
||||
name: 'ClientProcessID',
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<svg id="Icon" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><defs><style>.cls-1{opacity:0;}.cls-2{fill:#f6f6f6;}.cls-3{fill:#424242;}.cls-4{fill:#f0eff1;}.cls-5{fill:#e51400;}</style></defs><title>Trigger_disabled_16x</title><g id="canvas" class="cls-1"><rect class="cls-2" width="16" height="16"/></g><polygon id="outline" class="cls-2" points="16 1 0 1 0 15 8.59 15 9.5 15.91 10.41 15 12.59 15 13.5 15.91 14.41 15 16 15 16 1"/><g id="iconBG"><path class="cls-3" d="M14,11.4v.17l1,1V10.41ZM2,5H14V7.59l1,1V2H1V14H4.38l.5-1H2Z"/><polygon class="cls-3" points="8.3 10.7 7.08 9.51 7.59 9 7 9 10 6 7 6 5 10 7.5 10 6 13 8.3 10.7"/></g><g id="iconFG"><polygon class="cls-4" points="6.38 5 2 5 2 13 4.88 13 5.88 11 4 11 4 9.76 6.38 5"/><polygon class="cls-4" points="13.91 11.48 14 11.57 14 11.4 13.91 11.48"/><polygon class="cls-4" points="10.41 8 11 8 11 8.59 11.5 9.09 13.5 7.09 14 7.59 14 5 11 5 11 6.41 9.91 7.5 10.41 8"/></g><path id="colorAction" class="cls-5" d="M12.5,11.47l2,2-1,1-2-2-2,2-1-1,2-2-2-2,1-1,2,2,2-2,1,1Z"/></svg>
|
||||
|
After Width: | Height: | Size: 1.0 KiB |
@@ -408,6 +408,12 @@
|
||||
background: url("ServerLevelServerTrigger.svg") center center no-repeat;
|
||||
}
|
||||
|
||||
.vs .icon.serverlevelservertrigger_disabled,
|
||||
.vs-dark .icon.serverlevelservertrigger_disabled,
|
||||
.hc-black .icon.serverlevelservertrigger_disabled {
|
||||
background: url("ServerLevelServerTrigger_Disabled.svg") center center no-repeat;
|
||||
}
|
||||
|
||||
.vs .icon.service,
|
||||
.vs-dark .icon.service,
|
||||
.hc-black .icon.service {
|
||||
|
||||
Reference in New Issue
Block a user