mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Resend selectBox change to on against master. PR against nativeNotebook was approved already. (#3215)
This commit is contained in:
10
src/sql/base/browser/ui/selectBox/media/selectBox.css
Normal file
10
src/sql/base/browser/ui/selectBox/media/selectBox.css
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
.labelOnTopContainer {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.labelOnLeftContainer {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
@@ -4,6 +4,8 @@
|
|||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
import 'vs/css!./media/selectBox';
|
||||||
|
|
||||||
import { SelectBox as vsSelectBox, ISelectBoxStyles as vsISelectBoxStyles, ISelectBoxOptions } from 'vs/base/browser/ui/selectBox/selectBox';
|
import { SelectBox as vsSelectBox, ISelectBoxStyles as vsISelectBoxStyles, ISelectBoxOptions } from 'vs/base/browser/ui/selectBox/selectBox';
|
||||||
import { Color } from 'vs/base/common/color';
|
import { Color } from 'vs/base/common/color';
|
||||||
import { IContextViewProvider, AnchorAlignment } from 'vs/base/browser/ui/contextview/contextview';
|
import { IContextViewProvider, AnchorAlignment } from 'vs/base/browser/ui/contextview/contextview';
|
||||||
@@ -30,6 +32,7 @@ export class SelectBox extends vsSelectBox {
|
|||||||
private _optionsDictionary;
|
private _optionsDictionary;
|
||||||
private _dialogOptions: string[];
|
private _dialogOptions: string[];
|
||||||
private _selectedOption: string;
|
private _selectedOption: string;
|
||||||
|
private _selectBoxOptions: ISelectBoxOptions;
|
||||||
private enabledSelectBackground: Color;
|
private enabledSelectBackground: Color;
|
||||||
private enabledSelectForeground: Color;
|
private enabledSelectForeground: Color;
|
||||||
private enabledSelectBorder: Color;
|
private enabledSelectBorder: Color;
|
||||||
@@ -72,6 +75,7 @@ export class SelectBox extends vsSelectBox {
|
|||||||
|
|
||||||
// explicitly set the accessible role so that the screen readers can read the control type properly
|
// explicitly set the accessible role so that the screen readers can read the control type properly
|
||||||
this.selectElement.setAttribute('role', 'combobox');
|
this.selectElement.setAttribute('role', 'combobox');
|
||||||
|
this._selectBoxOptions = selectBoxOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
public style(styles: ISelectBoxStyles): void {
|
public style(styles: ISelectBoxStyles): void {
|
||||||
@@ -226,4 +230,34 @@ export class SelectBox extends vsSelectBox {
|
|||||||
default: return { border: this.inputValidationErrorBorder, background: this.inputValidationErrorBackground };
|
default: return { border: this.inputValidationErrorBorder, background: this.inputValidationErrorBackground };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public render(container: HTMLElement): void {
|
||||||
|
let selectOptions: ISelectBoxOptionsWithLabel = this._selectBoxOptions as ISelectBoxOptionsWithLabel;
|
||||||
|
|
||||||
|
if (selectOptions && selectOptions.labelText && selectOptions.labelText !== undefined) {
|
||||||
|
let outerContainer = document.createElement('div');
|
||||||
|
let selectContainer = document.createElement('div');
|
||||||
|
|
||||||
|
outerContainer.className = selectOptions.labelOnTop ? 'labelOnTopContainer' : 'labelOnLeftContainer';
|
||||||
|
|
||||||
|
let labelText = document.createElement('div');
|
||||||
|
labelText.className = 'action-item-label';
|
||||||
|
labelText.innerHTML = selectOptions.labelText;
|
||||||
|
|
||||||
|
container.appendChild(outerContainer);
|
||||||
|
outerContainer.appendChild(labelText);
|
||||||
|
outerContainer.appendChild(selectContainer);
|
||||||
|
|
||||||
|
super.render(selectContainer);
|
||||||
|
this.selectElement.classList.add('action-item-label');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
super.render(container);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ISelectBoxOptionsWithLabel extends ISelectBoxOptions {
|
||||||
|
labelText?: string;
|
||||||
|
labelOnTop?: boolean;
|
||||||
}
|
}
|
||||||
@@ -54,6 +54,12 @@
|
|||||||
padding-left: 15px;
|
padding-left: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.carbon-taskbar .action-item-label {
|
||||||
|
display: flex;
|
||||||
|
font-size:11px;
|
||||||
|
padding-right: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
.listDatabasesSelectBox {
|
.listDatabasesSelectBox {
|
||||||
padding-left: 2px;
|
padding-left: 2px;
|
||||||
min-width: 100px;
|
min-width: 100px;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import { CommonServiceInterface } from 'sql/services/common/commonServiceInterfa
|
|||||||
import { AngularDisposable } from 'sql/base/common/lifecycle';
|
import { AngularDisposable } from 'sql/base/common/lifecycle';
|
||||||
|
|
||||||
import { CellTypes, CellType, NotebookChangeType } from 'sql/parts/notebook/models/contracts';
|
import { CellTypes, CellType, NotebookChangeType } from 'sql/parts/notebook/models/contracts';
|
||||||
import { ICellModel, INotebookModel, IModelFactory, INotebookModelOptions } from 'sql/parts/notebook/models/modelInterfaces';
|
import { ICellModel, IModelFactory } from 'sql/parts/notebook/models/modelInterfaces';
|
||||||
import { IConnectionManagementService } from 'sql/parts/connection/common/connectionManagement';
|
import { IConnectionManagementService } from 'sql/parts/connection/common/connectionManagement';
|
||||||
import { INotebookService, INotebookParams, INotebookManager } from 'sql/services/notebook/notebookService';
|
import { INotebookService, INotebookParams, INotebookManager } from 'sql/services/notebook/notebookService';
|
||||||
import { IBootstrapParams } from 'sql/services/bootstrap/bootstrapService';
|
import { IBootstrapParams } from 'sql/services/bootstrap/bootstrapService';
|
||||||
@@ -193,21 +193,15 @@ export class NotebookComponent extends AngularDisposable implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected initActionBar() {
|
protected initActionBar() {
|
||||||
let kernelInfoText = document.createElement('div');
|
let kernelContainer = document.createElement('div');
|
||||||
kernelInfoText.className = 'notebook-info-label';
|
let kernelDropdown = new KernelsDropdown(kernelContainer, this.contextViewService, this.modelRegistered);
|
||||||
kernelInfoText.innerText = 'Kernel: ';
|
kernelDropdown.render(kernelContainer);
|
||||||
|
attachSelectBoxStyler(kernelDropdown, this.themeService);
|
||||||
|
|
||||||
let kernelsDropdown = new KernelsDropdown(this.contextViewService, this.modelRegistered);
|
let attachToContainer = document.createElement('div');
|
||||||
let kernelsDropdownTemplateContainer = document.createElement('div');
|
let attachTodropdwon = new AttachToDropdown(attachToContainer, this.contextViewService);
|
||||||
kernelsDropdownTemplateContainer.className = 'notebook-toolbar-dropdown';
|
attachTodropdwon.render(attachToContainer);
|
||||||
kernelsDropdown.render(kernelsDropdownTemplateContainer);
|
attachSelectBoxStyler(attachTodropdwon, this.themeService);
|
||||||
attachSelectBoxStyler(kernelsDropdown, this.themeService);
|
|
||||||
|
|
||||||
let attachToDropdown = new AttachToDropdown(this.contextViewService);
|
|
||||||
let attachToDropdownTemplateContainer = document.createElement('div');
|
|
||||||
attachToDropdownTemplateContainer.className = 'notebook-toolbar-dropdown';
|
|
||||||
attachToDropdown.render(attachToDropdownTemplateContainer);
|
|
||||||
attachSelectBoxStyler(attachToDropdown, this.themeService);
|
|
||||||
|
|
||||||
let attachToInfoText = document.createElement('div');
|
let attachToInfoText = document.createElement('div');
|
||||||
attachToInfoText.className = 'notebook-info-label';
|
attachToInfoText.className = 'notebook-info-label';
|
||||||
@@ -223,10 +217,8 @@ export class NotebookComponent extends AngularDisposable implements OnInit {
|
|||||||
this._actionBar = new Taskbar(taskbar, this.contextMenuService);
|
this._actionBar = new Taskbar(taskbar, this.contextMenuService);
|
||||||
this._actionBar.context = this;
|
this._actionBar.context = this;
|
||||||
this._actionBar.setContent([
|
this._actionBar.setContent([
|
||||||
{ element: kernelInfoText },
|
{ element: kernelContainer },
|
||||||
{ element: kernelsDropdownTemplateContainer },
|
{ element: attachToContainer },
|
||||||
{ element: attachToInfoText },
|
|
||||||
{ element: attachToDropdownTemplateContainer },
|
|
||||||
{ action: addCodeCellButton},
|
{ action: addCodeCellButton},
|
||||||
{ action: addTextCellButton}
|
{ action: addTextCellButton}
|
||||||
]);
|
]);
|
||||||
|
|||||||
@@ -13,11 +13,6 @@
|
|||||||
border-style: solid;
|
border-style: solid;
|
||||||
}
|
}
|
||||||
|
|
||||||
.notebookEditor .notebook-toolbar-dropdown {
|
|
||||||
width: 150px;
|
|
||||||
padding-right: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.notebookEditor .notebook-info-label {
|
.notebookEditor .notebook-info-label {
|
||||||
padding-right: 5px;
|
padding-right: 5px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
|||||||
@@ -10,12 +10,15 @@ import { TPromise } from 'vs/base/common/winjs.base';
|
|||||||
import { localize } from 'vs/nls';
|
import { localize } from 'vs/nls';
|
||||||
import { IContextViewProvider } from 'vs/base/browser/ui/contextview/contextview';
|
import { IContextViewProvider } from 'vs/base/browser/ui/contextview/contextview';
|
||||||
|
|
||||||
import { SelectBox } from 'sql/base/browser/ui/selectBox/selectBox';
|
import { SelectBox, ISelectBoxOptionsWithLabel } from 'sql/base/browser/ui/selectBox/selectBox';
|
||||||
import { INotebookModel } from 'sql/parts/notebook/models/modelInterfaces';
|
import { INotebookModel } from 'sql/parts/notebook/models/modelInterfaces';
|
||||||
import { CellTypes, CellType } from 'sql/parts/notebook/models/contracts';
|
import { CellTypes, CellType } from 'sql/parts/notebook/models/contracts';
|
||||||
import { NotebookComponent } from 'sql/parts/notebook/notebook.component';
|
import { NotebookComponent } from 'sql/parts/notebook/notebook.component';
|
||||||
|
|
||||||
const msgLoading = localize('loading', 'Loading kernels...');
|
const msgLoading = localize('loading', 'Loading kernels...');
|
||||||
|
const kernelLabel: string = localize('Kernel', 'Kernel: ');
|
||||||
|
const attachToLabel: string = localize('AttachTo', 'Attach to: ');
|
||||||
|
const msgLocalHost: string = localize('localhost', 'Localhost');
|
||||||
|
|
||||||
//Action to add a cell to notebook based on cell type(code/markdown).
|
//Action to add a cell to notebook based on cell type(code/markdown).
|
||||||
export class AddCellAction extends Action {
|
export class AddCellAction extends Action {
|
||||||
@@ -40,9 +43,13 @@ export class AddCellAction extends Action {
|
|||||||
|
|
||||||
export class KernelsDropdown extends SelectBox {
|
export class KernelsDropdown extends SelectBox {
|
||||||
private model: INotebookModel;
|
private model: INotebookModel;
|
||||||
constructor(contextViewProvider: IContextViewProvider, modelRegistered: Promise<INotebookModel>
|
constructor(container: HTMLElement, contextViewProvider: IContextViewProvider, modelRegistered: Promise<INotebookModel>
|
||||||
) {
|
) {
|
||||||
super( [msgLoading], msgLoading, contextViewProvider);
|
let selectBoxOptionsWithLabel: ISelectBoxOptionsWithLabel = {
|
||||||
|
labelText: kernelLabel,
|
||||||
|
labelOnTop: false
|
||||||
|
};
|
||||||
|
super([msgLoading], msgLoading, contextViewProvider, container, selectBoxOptionsWithLabel);
|
||||||
if (modelRegistered) {
|
if (modelRegistered) {
|
||||||
modelRegistered
|
modelRegistered
|
||||||
.then((model) => this.updateModel(model))
|
.then((model) => this.updateModel(model))
|
||||||
@@ -83,9 +90,11 @@ export class KernelsDropdown extends SelectBox {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class AttachToDropdown extends SelectBox {
|
export class AttachToDropdown extends SelectBox {
|
||||||
constructor(contextViewProvider: IContextViewProvider
|
constructor(container: HTMLElement, contextViewProvider: IContextViewProvider) {
|
||||||
) {
|
let selectBoxOptionsWithLabel: ISelectBoxOptionsWithLabel = {
|
||||||
let options: string[] = ['localhost'];
|
labelText: attachToLabel,
|
||||||
super(options, 'localhost', contextViewProvider);
|
labelOnTop: false
|
||||||
|
};
|
||||||
|
super([msgLocalHost], msgLocalHost, contextViewProvider, container, selectBoxOptionsWithLabel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user