Bug fixes for ML 0.8.0 (#14659)

* Bug fixes for ML 0.8.0
This commit is contained in:
Leila Lali
2021-03-11 14:49:28 -08:00
committed by GitHub
parent bba3b93c6e
commit 063953f743
7 changed files with 72 additions and 56 deletions

View File

@@ -2,12 +2,12 @@
"name": "machine-learning", "name": "machine-learning",
"displayName": "%displayName%", "displayName": "%displayName%",
"description": "%description%", "description": "%description%",
"version": "0.7.0", "version": "0.8.0",
"publisher": "Microsoft", "publisher": "Microsoft",
"preview": true, "preview": true,
"engines": { "engines": {
"vscode": "^1.25.0", "vscode": "^1.25.0",
"azdata": ">=1.21.0" "azdata": ">=1.27.0"
}, },
"activationEvents": [ "activationEvents": [
"onCommand:ml.command.managePackages", "onCommand:ml.command.managePackages",

View File

@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/ *--------------------------------------------------------------------------------------------*/
import * as azdata from 'azdata'; import * as azdata from 'azdata';
import { ModelViewBase } from './modelViewBase'; import { ModelViewBase, ModelSourceType } from './modelViewBase';
import { ApiWrapper } from '../../common/apiWrapper'; import { ApiWrapper } from '../../common/apiWrapper';
import { AzureResourceFilterComponent } from './azureResourceFilterComponent'; import { AzureResourceFilterComponent } from './azureResourceFilterComponent';
import { AzureModelsTable } from './azureModelsTable'; import { AzureModelsTable } from './azureModelsTable';
@@ -92,6 +92,7 @@ export class AzureModelsComponent extends ModelViewBase implements IDataComponen
} }
public addComponents(formBuilder: azdata.FormBuilder) { public addComponents(formBuilder: azdata.FormBuilder) {
if (this.modelSourceType === ModelSourceType.Azure) {
this.removeComponents(formBuilder); this.removeComponents(formBuilder);
if (this.azureFilterComponent?.accountIsValid) { if (this.azureFilterComponent?.accountIsValid) {
this.addAzureComponents(formBuilder); this.addAzureComponents(formBuilder);
@@ -99,6 +100,7 @@ export class AzureModelsComponent extends ModelViewBase implements IDataComponen
this.addAzureSignInComponents(formBuilder); this.addAzureSignInComponents(formBuilder);
} }
} }
}
public removeComponents(formBuilder: azdata.FormBuilder) { public removeComponents(formBuilder: azdata.FormBuilder) {
this.removeAzureComponents(formBuilder); this.removeAzureComponents(formBuilder);
@@ -166,6 +168,7 @@ export class AzureModelsComponent extends ModelViewBase implements IDataComponen
* Loads the data in the components * Loads the data in the components
*/ */
public async loadData(): Promise<void> { public async loadData(): Promise<void> {
await this.onLoaded();
await this.azureFilterComponent?.loadData(); await this.azureFilterComponent?.loadData();
} }

View File

@@ -48,18 +48,26 @@ export class AzureResourceFilterComponent extends ModelViewBase implements IData
width: componentWidth width: componentWidth
}).component(); }).component();
this._accounts.onValueChanged(async () => { this._accounts.onValueChanged(async (newValue) => {
if (newValue.selected !== (<azdata.CategoryValue>this._accounts.value)?.name) {
await this.onAccountSelected(); await this.onAccountSelected();
}
}); });
this._subscriptions.onValueChanged(async () => { this._subscriptions.onValueChanged(async (newValue) => {
if (newValue.selected !== (<azdata.CategoryValue>this._subscriptions.value)?.name) {
await this.onSubscriptionSelected(); await this.onSubscriptionSelected();
}
}); });
this._groups.onValueChanged(async () => { this._groups.onValueChanged(async (newValue) => {
if (newValue.selected !== (<azdata.CategoryValue>this._groups.value)?.name) {
await this.onGroupSelected(); await this.onGroupSelected();
}
}); });
this._workspaces.onValueChanged(async () => { this._workspaces.onValueChanged(async (newValue) => {
if (newValue.selected !== (<azdata.CategoryValue>this._workspaces.value)?.name) {
await this.onWorkspaceSelectedChanged(); await this.onWorkspaceSelectedChanged();
}
}); });
this._form = this._modelBuilder.formContainer().withFormItems([{ this._form = this._modelBuilder.formContainer().withFormItems([{
@@ -174,6 +182,7 @@ export class AzureResourceFilterComponent extends ModelViewBase implements IData
} }
private async onGroupSelected(): Promise<void> { private async onGroupSelected(): Promise<void> {
let currentWorkspace = this._workspaces.value;
this._azureWorkspaces = await this.listWorkspaces(this.account, this.subscription, this.group); this._azureWorkspaces = await this.listWorkspaces(this.account, this.subscription, this.group);
if (this._azureWorkspaces && this._azureWorkspaces.length > 0) { if (this._azureWorkspaces && this._azureWorkspaces.length > 0) {
let values = this._azureWorkspaces.map(s => { return { displayName: s.name || '', name: s.id || '' }; }); let values = this._azureWorkspaces.map(s => { return { displayName: s.name || '', name: s.id || '' }; });
@@ -183,8 +192,10 @@ export class AzureResourceFilterComponent extends ModelViewBase implements IData
this._workspaces.values = []; this._workspaces.values = [];
this._workspaces.value = undefined; this._workspaces.value = undefined;
} }
if (currentWorkspace !== this._workspaces.value) {
this.onWorkspaceSelectedChanged(); this.onWorkspaceSelectedChanged();
} }
}
private onWorkspaceSelectedChanged(): void { private onWorkspaceSelectedChanged(): void {
this._onWorkspacesSelectedChanged.fire(); this._onWorkspacesSelectedChanged.fire();

View File

@@ -7,7 +7,7 @@ import * as azdata from 'azdata';
import * as constants from '../../../common/constants'; import * as constants from '../../../common/constants';
import { DataInfoComponent } from '../../dataInfoComponent'; import { DataInfoComponent } from '../../dataInfoComponent';
import { ModelActionType, ModelViewBase } from '../modelViewBase'; import { ModelActionType, ModelViewBase, ModelSourceType } from '../modelViewBase';
import { CurrentModelsTable } from './currentModelsTable'; import { CurrentModelsTable } from './currentModelsTable';
import { ApiWrapper } from '../../../common/apiWrapper'; import { ApiWrapper } from '../../../common/apiWrapper';
import { IPageView, IComponentSettings } from '../../interfaces'; import { IPageView, IComponentSettings } from '../../interfaces';
@@ -139,6 +139,7 @@ export class CurrentModelsComponent extends ModelViewBase implements IPageView {
} }
public addComponents(formBuilder: azdata.FormBuilder) { public addComponents(formBuilder: azdata.FormBuilder) {
if (this.modelSourceType === ModelSourceType.RegisteredModels) {
this._formBuilder = formBuilder; this._formBuilder = formBuilder;
if (this._tableSelectionComponent && this._dataTable && this._tableDataCountContainer && this._labelContainer && this._subheadingContainer) { if (this._tableSelectionComponent && this._dataTable && this._tableDataCountContainer && this._labelContainer && this._subheadingContainer) {
formBuilder.addFormItem({ title: '', component: this._subheadingContainer }); formBuilder.addFormItem({ title: '', component: this._subheadingContainer });
@@ -154,6 +155,7 @@ export class CurrentModelsComponent extends ModelViewBase implements IPageView {
} }
} }
} }
}
public removeComponents(formBuilder: azdata.FormBuilder) { public removeComponents(formBuilder: azdata.FormBuilder) {
if (this._tableSelectionComponent && this._dataTable && this._labelContainer && this._tableDataCountContainer && this._subheadingContainer) { if (this._tableSelectionComponent && this._dataTable && this._labelContainer && this._tableDataCountContainer && this._subheadingContainer) {

View File

@@ -5,7 +5,7 @@
import { CurrentModelsComponent } from './currentModelsComponent'; import { CurrentModelsComponent } from './currentModelsComponent';
import { ModelViewBase, RegisterModelEventName } from '../modelViewBase'; import { ModelViewBase, RegisterModelEventName, ModelSourceType } from '../modelViewBase';
import * as constants from '../../../common/constants'; import * as constants from '../../../common/constants';
import { ApiWrapper } from '../../../common/apiWrapper'; import { ApiWrapper } from '../../../common/apiWrapper';
import { DialogView } from '../../dialogView'; import { DialogView } from '../../dialogView';
@@ -33,6 +33,7 @@ export class ManageModelsDialog extends ModelViewBase {
editable: true, editable: true,
selectable: false selectable: false
}); });
this.currentLanguagesTab.modelSourceType = ModelSourceType.RegisteredModels;
let registerModelButton = this._apiWrapper.createButton(constants.registerModelTitle); let registerModelButton = this._apiWrapper.createButton(constants.registerModelTitle);
registerModelButton.onClick(async () => { registerModelButton.onClick(async () => {

View File

@@ -21,6 +21,7 @@ export class ModelBrowsePage extends ModelViewBase implements IPageView, IDataCo
private _form: azdata.FormContainer | undefined; private _form: azdata.FormContainer | undefined;
private _title: string = constants.localModelPageTitle; private _title: string = constants.localModelPageTitle;
private _currentModelSourceType: ModelSourceType | undefined;
private _formBuilder: azdata.FormBuilder | undefined; private _formBuilder: azdata.FormBuilder | undefined;
public localModelsComponent: LocalModelsComponent | undefined; public localModelsComponent: LocalModelsComponent | undefined;
public azureModelsComponent: AzureModelsComponent | undefined; public azureModelsComponent: AzureModelsComponent | undefined;
@@ -76,6 +77,9 @@ export class ModelBrowsePage extends ModelViewBase implements IPageView, IDataCo
*/ */
public async refresh(): Promise<void> { public async refresh(): Promise<void> {
if (this._formBuilder) { if (this._formBuilder) {
if (this._currentModelSourceType !== this.modelSourceType) {
this._currentModelSourceType = this.modelSourceType;
if (this.modelSourceType === ModelSourceType.Local) { if (this.modelSourceType === ModelSourceType.Local) {
if (this.localModelsComponent && this.azureModelsComponent && this.registeredModelsComponent) { if (this.localModelsComponent && this.azureModelsComponent && this.registeredModelsComponent) {
this.azureModelsComponent.removeComponents(this._formBuilder); this.azureModelsComponent.removeComponents(this._formBuilder);
@@ -87,9 +91,9 @@ export class ModelBrowsePage extends ModelViewBase implements IPageView, IDataCo
} else if (this.modelSourceType === ModelSourceType.Azure) { } else if (this.modelSourceType === ModelSourceType.Azure) {
if (this.localModelsComponent && this.azureModelsComponent && this.registeredModelsComponent) { if (this.localModelsComponent && this.azureModelsComponent && this.registeredModelsComponent) {
this.localModelsComponent.removeComponents(this._formBuilder); this.localModelsComponent.removeComponents(this._formBuilder);
this.registeredModelsComponent.removeComponents(this._formBuilder);
await this.azureModelsComponent.refresh(); await this.azureModelsComponent.refresh();
this.azureModelsComponent.addComponents(this._formBuilder); this.azureModelsComponent.addComponents(this._formBuilder);
this.registeredModelsComponent.removeComponents(this._formBuilder);
} }
} else if (this.modelSourceType === ModelSourceType.RegisteredModels) { } else if (this.modelSourceType === ModelSourceType.RegisteredModels) {
@@ -101,6 +105,7 @@ export class ModelBrowsePage extends ModelViewBase implements IPageView, IDataCo
} }
} }
} }
}
this.loadTitle(); this.loadTitle();
} }

View File

@@ -112,12 +112,6 @@ export class WizardView extends MainViewBase {
} }
public async refresh(): Promise<void> { public async refresh(): Promise<void> {
for (let index = 0; index < this._pages.length; index++) {
const page = this._pages[index];
if (this._wizard?.pages[index]?.title !== page.title) {
this.addWizardPage(page, index);
}
}
await super.refresh(); await super.refresh();
} }
} }