Files
azuredatastudio/extensions/machine-learning/src/views/externalLanguages/languagesDialog.ts
Leila Lali 04af41c424 ML - dashboard icons and links (#10153)
* ML - dashboard icons and links
2020-04-28 21:21:30 -07:00

57 lines
1.9 KiB
TypeScript

/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { CurrentLanguagesTab } from './currentLanguagesTab';
import { AddEditLanguageTab } from './addEditLanguageTab';
import { LanguageViewBase } from './languageViewBase';
import * as constants from '../../common/constants';
import { ApiWrapper } from '../../common/apiWrapper';
export class LanguagesDialog extends LanguageViewBase {
public currentLanguagesTab: CurrentLanguagesTab | undefined;
public addNewLanguageTab: AddEditLanguageTab | undefined;
constructor(
apiWrapper: ApiWrapper,
root: string) {
super(apiWrapper, root);
}
/**
* Opens a dialog to manage packages used by notebooks.
*/
public showDialog(): void {
this.dialog = this._apiWrapper.createModelViewDialog(constants.extLangDialogTitle);
this.currentLanguagesTab = new CurrentLanguagesTab(this._apiWrapper, this);
let languageUpdateModel = {
language: this.createNewLanguage(),
content: this.createNewContent(),
newLang: true
};
this.addNewLanguageTab = new AddEditLanguageTab(this._apiWrapper, this, languageUpdateModel);
this.dialog.okButton.hidden = true;
this.dialog.cancelButton.label = constants.extLangDoneButtonText;
this.dialog.content = [this.currentLanguagesTab.tab, this.addNewLanguageTab.tab];
this.dialog.registerCloseValidator(() => {
return false; // Blocks Enter key from closing dialog.
});
this._apiWrapper.openDialog(this.dialog);
}
/**
* Resets the tabs for given provider Id
*/
public async reset(): Promise<void> {
await this.currentLanguagesTab?.reset();
await this.addNewLanguageTab?.reset();
}
}