Resend selectBox change to on against master. PR against nativeNotebook was approved already. (#3215)

This commit is contained in:
Yurong He
2018-11-14 13:48:41 -08:00
committed by GitHub
parent d7d4c7236c
commit 5889c600fa
6 changed files with 82 additions and 36 deletions

View File

@@ -10,12 +10,15 @@ import { TPromise } from 'vs/base/common/winjs.base';
import { localize } from 'vs/nls';
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 { CellTypes, CellType } from 'sql/parts/notebook/models/contracts';
import { NotebookComponent } from 'sql/parts/notebook/notebook.component';
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).
export class AddCellAction extends Action {
@@ -40,15 +43,19 @@ export class AddCellAction extends Action {
export class KernelsDropdown extends SelectBox {
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) {
modelRegistered
.then((model) => this.updateModel(model))
.catch((err) => {
// No-op for now
});
.then((model) => this.updateModel(model))
.catch((err) => {
// No-op for now
});
}
this.onDidSelect(e => this.doChangeKernel(e.selected));
@@ -83,9 +90,11 @@ export class KernelsDropdown extends SelectBox {
}
export class AttachToDropdown extends SelectBox {
constructor(contextViewProvider: IContextViewProvider
) {
let options: string[] = ['localhost'];
super(options, 'localhost', contextViewProvider);
constructor(container: HTMLElement, contextViewProvider: IContextViewProvider) {
let selectBoxOptionsWithLabel: ISelectBoxOptionsWithLabel = {
labelText: attachToLabel,
labelOnTop: false
};
super([msgLocalHost], msgLocalHost, contextViewProvider, container, selectBoxOptionsWithLabel);
}
}