This commit is contained in:
chlafreniere
2020-04-03 00:14:28 -07:00
351 changed files with 7194 additions and 4889 deletions

View File

@@ -499,22 +499,23 @@ class TabbedPanelComponentBuilder extends ContainerBuilderImpl<azdata.TabbedPane
items.forEach(item => {
if (item && 'tabs' in item) {
item.tabs.forEach(tab => {
itemConfigs.push(this.toItemConfig(tab.content, tab.title, tab.id, item.title));
itemConfigs.push(this.toItemConfig(tab.content, tab.title, tab.id, item.title, tab.icon));
});
} else {
const tab = <azdata.Tab>item;
itemConfigs.push(this.toItemConfig(tab.content, tab.title, tab.id));
itemConfigs.push(this.toItemConfig(tab.content, tab.title, tab.id, undefined, tab.icon));
}
});
this._component.itemConfigs = itemConfigs;
return this;
}
toItemConfig(content: azdata.Component, title: string, id?: string, group?: string): InternalItemConfig {
toItemConfig(content: azdata.Component, title: string, id?: string, group?: string, icon?: string | URI | { light: string | URI; dark: string | URI }): InternalItemConfig {
return new InternalItemConfig(content as ComponentWrapper, {
title: title,
group: group,
id: id
id: id,
icon: icon
});
}
}

View File

@@ -457,6 +457,57 @@ class WizardImpl implements azdata.window.Wizard {
}
}
class ModelViewDashboardImpl implements azdata.window.ModelViewDashboard {
constructor(
private _editor: ModelViewEditorImpl
) {
}
registerTabs(handler: (view: azdata.ModelView) => Thenable<(azdata.DashboardTab | azdata.DashboardTabGroup)[]>): void {
this._editor.registerContent(async (view) => {
const dashboardTabs = await handler(view);
const tabs: (azdata.TabGroup | azdata.Tab)[] = [];
dashboardTabs.forEach((item: azdata.DashboardTab | azdata.DashboardTabGroup) => {
if ('tabs' in item) {
tabs.push(<azdata.TabGroup>{
title: item.title,
tabs: item.tabs.map(tab => {
return this.createTab(tab, view);
})
});
} else {
tabs.push(this.createTab(item, view));
}
});
const tabbedPanel = view.modelBuilder.tabbedPanel().withTabs(tabs).withLayout({
orientation: 'vertical',
showIcon: true
}).component();
return view.initializeModel(tabbedPanel);
});
}
open(): Thenable<void> {
return this._editor.openEditor();
}
createTab(tab: azdata.DashboardTab, view: azdata.ModelView): azdata.Tab {
if (tab.toolbar) {
const flexContainer = view.modelBuilder.flexContainer().withLayout({ flexFlow: 'column' }).component();
flexContainer.addItem(tab.toolbar, { flex: '0 0 auto' });
flexContainer.addItem(tab.content, { flex: '1 1 auto' });
return {
title: tab.title,
id: tab.id,
content: flexContainer,
icon: tab.icon
};
} else {
return tab;
}
}
}
export class ExtHostModelViewDialog implements ExtHostModelViewDialogShape {
private static _currentHandle = 0;
@@ -562,6 +613,11 @@ export class ExtHostModelViewDialog implements ExtHostModelViewDialogShape {
return editor;
}
public createModelViewDashboard(title: string, extension: IExtensionDescription): azdata.window.ModelViewDashboard {
const editor = this.createModelViewEditor(title, extension, { supportsSave: false }) as ModelViewEditorImpl;
return new ModelViewDashboardImpl(editor);
}
public updateDialogContent(dialog: azdata.window.Dialog): void {
let handle = this.getHandle(dialog);
let tabs = dialog.content;

View File

@@ -418,6 +418,9 @@ export function createAdsApiFactory(accessor: ServicesAccessor): IAdsExtensionAp
createWizard(title: string): azdata.window.Wizard {
return extHostModelViewDialog.createWizard(title);
},
createModelViewDashboard(title: string): azdata.window.ModelViewDashboard {
return extHostModelViewDialog.createModelViewDashboard(title, extension);
},
MessageLevel: sqlExtHostTypes.MessageLevel
};

View File

@@ -397,7 +397,8 @@ export enum AzureResource {
Sql = 1,
OssRdbms = 2,
AzureKeyVault = 3,
Graph = 4
Graph = 4,
MicrosoftResourceManagement = 5
}
export class TreeItem extends vsExtTypes.TreeItem {
@@ -838,4 +839,5 @@ export enum TabOrientation {
export interface TabbedPanelLayout {
orientation: TabOrientation;
showIcon: boolean;
}

View File

@@ -332,6 +332,7 @@ export abstract class ContainerBase<T> extends ComponentBase {
}
}));
this._changeRef.detectChanges();
this.onItemsUpdated();
return;
}
@@ -343,6 +344,7 @@ export abstract class ContainerBase<T> extends ComponentBase {
if (index >= 0) {
this.items.splice(index, 1);
this._changeRef.detectChanges();
this.onItemsUpdated();
return true;
}
return false;
@@ -373,4 +375,7 @@ export abstract class ContainerBase<T> extends ComponentBase {
}
abstract setLayout(layout: any): void;
protected onItemsUpdated(): void {
}
}

View File

@@ -8,25 +8,30 @@
height: 100%;
}
.tabbedpanel-component .tabbedPanel {
border-top-width: 0px;
}
.tabbedpanel-component .tabbedPanel .tabContainer {
border-style: solid;
border-color: rgb(237, 235, 233);
border-width: 0px;
}
.vs-dark .tabbedpanel-component .tabbedPanel .tabContainer, .hc-black .tabbedpanel-component .tabbedPanel .tabContainer {
border-color: rgba(128, 128, 128, 0.5);;
.vs-dark .tabbedpanel-component .tabbedPanel .tabContainer,
.hc-black .tabbedpanel-component .tabbedPanel .tabContainer {
border-color: rgba(128, 128, 128, 0.5);
}
.tabbedpanel-component .tabbedPanel.vertical .tabContainer {
.tabbedpanel-component .tabbedPanel.vertical > .title .tabContainer {
border-right-width: 1px;
}
.tabbedpanel-component .tabbedPanel.horizontal .tabContainer {
.tabbedpanel-component .tabbedPanel.horizontal > .title .tabContainer {
border-bottom-width: 1px;
}
.tabbedpanel-component .tabbedPanel .tab>.tabLabel.active {
.tabbedpanel-component .tabbedPanel .tab > .tabLabel.active {
border-bottom: 0px solid;
}
@@ -45,9 +50,10 @@
}
.tabbedpanel-component .tabList .tab-header.active {
background-color: rgb(237, 235, 233);
background-color: #E1F0FE;
}
.vs-dark .tabbedpanel-component .tabList .tab-header.active, .hc-black .tabbedpanel-component .tabList .tab-header.active {
.vs-dark .tabbedpanel-component .tabList .tab-header.active,
.hc-black .tabbedpanel-component .tabList .tab-header.active {
background-color: rgba(128, 128, 128, 0.5);
}

View File

@@ -7,10 +7,9 @@
<div class="tabbedpanel-component">
<panel (onTabChange)="handleTabChange($event)">
<tab [visibilityType]="'visibility'" *ngFor="let tab of tabs" [title]="tab.title" class="fullsize"
[identifier]="tab.id" [type]="tab.type">
[identifier]="tab.id" [type]="tab.type" [iconClass]="tab.iconClass">
<ng-template>
<ng-container *ngIf="tab.type === 'tab'">
{{tab.title}}
<model-component-wrapper [descriptor]="tab.content" [modelStore]="modelStore">
</model-component-wrapper>
</ng-container>

View File

@@ -10,11 +10,13 @@ import { TabOrientation, TabbedPanelLayout } from 'sql/workbench/api/common/sqlE
import { ContainerBase } from 'sql/workbench/browser/modelComponents/componentBase';
import { ComponentEventType, IComponent, IComponentDescriptor, IModelStore } from 'sql/platform/dashboard/browser/interfaces';
import 'vs/css!./media/tabbedPanel';
import { IUserFriendlyIcon, createIconCssClass } from 'sql/workbench/browser/modelComponents/iconUtils';
export interface TabConfig {
title: string;
id?: string;
group: string;
icon?: IUserFriendlyIcon;
}
interface Tab {
@@ -22,6 +24,7 @@ interface Tab {
content?: IComponentDescriptor;
id?: string;
type: TabType;
iconClass?: string;
}
@Component({
@@ -56,7 +59,7 @@ export default class TabbedPanelComponent extends ContainerBase<TabConfig> imple
this._panel.options = {
showTabsWhenOne: true,
layout: layout.orientation === TabOrientation.Horizontal ? NavigationBarLayout.horizontal : NavigationBarLayout.vertical,
showIcon: false
showIcon: layout.showIcon
};
}
@@ -86,6 +89,7 @@ export default class TabbedPanelComponent extends ContainerBase<TabConfig> imple
title: item.config.title,
id: item.config.id,
content: item.descriptor,
iconClass: item.config.icon ? createIconCssClass(item.config.icon) : undefined,
type: 'tab'
});
}
@@ -93,4 +97,11 @@ export default class TabbedPanelComponent extends ContainerBase<TabConfig> imple
}
return this._tabs;
}
onItemsUpdated(): void {
const firstTabIndex = this.tabs.findIndex(tab => tab.type === 'tab');
if (firstTabIndex >= 0) {
this._panel.selectTab(firstTabIndex);
}
}
}

View File

@@ -17,7 +17,6 @@ import { TabChild } from 'sql/base/browser/ui/panel/tab.component';
import { Event, Emitter } from 'vs/base/common/event';
import { ScrollableDirective } from 'sql/base/browser/ui/scrollable/scrollable.directive';
import { values } from 'vs/base/common/collections';
import { fill } from 'vs/base/common/arrays';
import { ScrollbarVisibility } from 'vs/base/common/scrollable';
export interface GridCellConfig {
@@ -243,7 +242,7 @@ export class DashboardGridContainer extends DashboardTab implements OnDestroy {
private createIndexes(indexes: number[]) {
const max = Math.max(...indexes) + 1;
return fill(max, 0).map((x, i) => i);
return new Array(max).fill(0).map((x, i) => i);
}
ngOnDestroy() {

View File

@@ -1 +1 @@
<?xml version="1.0" ?><!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'><svg enable-background="new 0 0 50 50" height="50px" id="Layer_1" version="1.1" viewBox="0 0 50 50" width="50px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><rect fill="none" height="50" width="50"/><polyline fill="none" points="44,21 44,49 6,49 6,21 " stroke="#000000" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2"/><polyline fill="none" points="19,49 19,28 31,28 31,49 " stroke="#000000" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2"/><polygon points="35,5 35,8.016 37,10.094 37,7 39,7 39,12.203 41,14.266 41,5 "/><polyline fill="none" points=" 1.11,25.942 25,1.053 48.89,25.943 " stroke="#000000" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="2"/></svg>
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><defs><style>.cls-1{fill:none;}</style></defs><title>bv</title><path d="M8,1.289l7.352,7.359-.7.7L14,8.711V15H9V10H7v5H2V8.711l-.648.641-.7-.7ZM13,14V7.711l-5-5-5,5V14H6V9h4v5Z"/><rect class="cls-1" width="16" height="16"/></svg>

Before

Width:  |  Height:  |  Size: 910 B

After

Width:  |  Height:  |  Size: 322 B

View File

@@ -1,15 +1 @@
<svg width="50" height="50" xmlns="http://www.w3.org/2000/svg">
<g>
<title>background</title>
<rect fill="none" id="canvas_background" height="402" width="582" y="-1" x="-1"/>
</g>
<g>
<title>Layer 1</title>
<rect id="svg_1" width="50" height="50" fill="none"/>
<polyline id="svg_2" stroke-width="2" stroke-miterlimit="10" stroke-linecap="round" stroke="#ffffff" points="44,21 44,49 6,49 6,21 " fill="none"/>
<polyline id="svg_3" stroke-width="2" stroke-miterlimit="10" stroke-linecap="round" stroke="#ffffff" points="18.9292186871171,49 18.9292186871171,28 30.9292186871171,28 30.9292186871171,49 " fill="none"/>
<polygon fill="#ffffff" stroke="#000000" stroke-opacity="0" id="svg_4" points="35,5 35,8.016 37,10.094 37,7 39,7 39,12.203 41,14.266 41,5 "/>
<polyline id="svg_5" stroke-width="2" stroke-miterlimit="10" stroke-linejoin="round" stroke-linecap="round" stroke="#ffffff" points=" 1.11,25.942 25,1.053 48.89,25.943 " fill="none"/>
</g>
</svg>
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><defs><style>.cls-1{fill:#fff;}.cls-2{fill:none;}</style></defs><title>bv</title><path class="cls-1" d="M8,1.289l7.352,7.359-.7.7L14,8.711V15H9V10H7v5H2V8.711l-.648.641-.7-.7ZM13,14V7.711l-5-5-5,5V14H6V9h4v5Z"/><rect class="cls-2" width="16" height="16"/></svg>

Before

Width:  |  Height:  |  Size: 975 B

After

Width:  |  Height:  |  Size: 354 B

View File

@@ -84,16 +84,6 @@ const defaultVal = [
sizey: 1
}
},
{
name: nls.localize('databasesWidgetTitle', "Search"),
gridItemConfig: {
sizex: 1,
sizey: 2
},
widget: {
'explorer-widget': {}
}
},
{
widget: {
'backup-history-server-insight': null

View File

@@ -291,6 +291,11 @@ export class EditDataGridPanel extends GridParentComponent {
return;
}
if (this.isNullRow(row)) {
self.addRow(row);
self.refreshGrid();
}
let cellSelectTasks: Promise<void> = this.submitCurrentCellChange(
(result: EditUpdateCellResult) => {
// Cell update was successful, update the flags
@@ -543,15 +548,7 @@ export class EditDataGridPanel extends GridParentComponent {
private submitCurrentCellChange(resultHandler, errorHandler): Promise<void> {
let self = this;
let updateCellPromise: Promise<void> = Promise.resolve();
let refreshGrid = false;
if (this.currentCell && this.currentCell.isEditable && this.currentEditCellValue !== undefined && !this.removingNewRow) {
if (this.isNullRow(this.currentCell.row)) {
refreshGrid = true;
// We've entered the "new row", so we need to add a row and jump to it
updateCellPromise = updateCellPromise.then(() => {
return self.addRow(this.currentCell.row);
});
}
// We're exiting a read/write cell after having changed the value, update the cell value in the service
updateCellPromise = updateCellPromise.then(() => {
// Use the mapped row ID if we're on that row
@@ -564,9 +561,6 @@ export class EditDataGridPanel extends GridParentComponent {
result => {
self.currentEditCellValue = undefined;
let refreshPromise: Thenable<void> = Promise.resolve();
if (refreshGrid) {
refreshPromise = self.refreshGrid();
}
return refreshPromise.then(() => {
return resultHandler(result);
});

View File

@@ -32,7 +32,7 @@ import { tableBackground, cellBackground, cellBorderColor } from 'sql/platform/t
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import * as TelemetryKeys from 'sql/platform/telemetry/common/telemetryKeys';
import { attachButtonStyler } from 'sql/platform/theme/common/styler';
import { find, fill } from 'vs/base/common/arrays';
import { find } from 'vs/base/common/arrays';
import { IColorTheme } from 'vs/platform/theme/common/themeService';
import { onUnexpectedError } from 'vs/base/common/errors';
@@ -672,7 +672,7 @@ export class JobsViewComponent extends JobManagementView implements OnInit, OnDe
// if the durations are all 0 secs, show minimal chart
// instead of nothing
if (zeroDurationJobCount === jobHistories.length) {
return fill(jobHistories.length, '5px');
return new Array(jobHistories.length).fill('5px');
} else {
return chartHeights;
}

View File

@@ -33,7 +33,7 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import * as TelemetryKeys from 'sql/platform/telemetry/common/telemetryKeys';
import { attachButtonStyler } from 'sql/platform/theme/common/styler';
import { Taskbar } from 'sql/base/browser/ui/taskbar/taskbar';
import { find, fill } from 'vs/base/common/arrays';
import { find } from 'vs/base/common/arrays';
import { onUnexpectedError } from 'vs/base/common/errors';
import { IColorTheme } from 'vs/platform/theme/common/themeService';
@@ -731,7 +731,7 @@ export class NotebooksViewComponent extends JobManagementView implements OnInit,
// if the durations are all 0 secs, show minimal chart
// instead of nothing
if (zeroDurationJobCount === jobHistories.length) {
return fill(jobHistories.length, '5px');
return new Array(jobHistories.length).fill('5px');
} else {
return chartHeights;
}

View File

@@ -50,6 +50,7 @@ import { find } from 'vs/base/common/arrays';
import { values } from 'vs/base/common/collections';
import { assign } from 'vs/base/common/objects';
import { IAdsTelemetryService } from 'sql/platform/telemetry/common/telemetry';
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
export class ConnectionManagementService extends Disposable implements IConnectionManagementService {
@@ -90,7 +91,8 @@ export class ConnectionManagementService extends Disposable implements IConnecti
@IAccountManagementService private _accountManagementService: IAccountManagementService,
@ILogService private _logService: ILogService,
@IStorageService private _storageService: IStorageService,
@IEnvironmentService private _environmentService: IEnvironmentService
@IEnvironmentService private _environmentService: IEnvironmentService,
@IExtensionService private readonly extensionService: IExtensionService
) {
super();
@@ -819,6 +821,8 @@ export class ConnectionManagementService extends Disposable implements IConnecti
options: connection.options
});
await this.extensionService.activateByEvent(`onConnect:${connection.providerName}`);
return this._providers.get(connection.providerName).onReady.then((provider) => {
provider.connect(uri, connectionInfo);
this._onConnectRequestSent.fire();

View File

@@ -698,7 +698,7 @@ export class ConnectionWidget extends lifecycle.Disposable {
if (this.authType === AuthenticationType.AzureMFA || this.authType === AuthenticationType.AzureMFAAndUser) {
this.fillInAzureAccountOptions().then(async () => {
let accountName = (this.authType === AuthenticationType.AzureMFA)
? connectionInfo.userName : connectionInfo.azureAccount;
? connectionInfo.azureAccount : connectionInfo.userName;
this._azureAccountDropdown.selectWithOptionName(this.getModelValue(accountName));
await this.onAzureAccountSelected();
let tenantId = connectionInfo.azureTenantId;

View File

@@ -35,6 +35,7 @@ import { NullLogService } from 'vs/platform/log/common/log';
import { assign } from 'vs/base/common/objects';
import { NullAdsTelemetryService } from 'sql/platform/telemetry/common/adsTelemetryService';
import { TestStorageService } from 'vs/workbench/test/common/workbenchTestServices';
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
suite('SQL ConnectionManagementService tests', () => {
@@ -164,7 +165,8 @@ suite('SQL ConnectionManagementService tests', () => {
accountManagementService.object,
new NullLogService(), // ILogService
undefined, // IStorageService
TestEnvironmentService
TestEnvironmentService,
getBasicExtensionService()
);
return connectionManagementService;
}
@@ -922,7 +924,7 @@ suite('SQL ConnectionManagementService tests', () => {
connectionStoreMock.setup(x => x.getConnectionProfileGroups(TypeMoq.It.isAny(), undefined)).returns(() => {
return [group1];
});
const connectionManagementService = new ConnectionManagementService(connectionStoreMock.object, connectionStatusManagerMock.object, undefined, undefined, undefined, undefined, undefined, new TestCapabilitiesService(), undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined);
const connectionManagementService = new ConnectionManagementService(connectionStoreMock.object, connectionStatusManagerMock.object, undefined, undefined, undefined, undefined, undefined, new TestCapabilitiesService(), undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, getBasicExtensionService());
// dupe connections have been seeded the numbers below already reflected the de-duped results
@@ -968,3 +970,9 @@ function createConnectionProfile(id: string): ConnectionProfile {
function createConnectionGroup(id: string): ConnectionProfileGroup {
return new ConnectionProfileGroup(id, undefined, id, undefined, undefined);
}
function getBasicExtensionService(): IExtensionService {
return <any>{
activateByEvent: () => Promise.resolve()
};
}