mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-03 09:35:40 -05:00
Fixed the bug with refreshing the page over and over (#13966)
This commit is contained in:
@@ -206,8 +206,10 @@ export class CurrentModelsComponent extends ModelViewBase implements IPageView {
|
||||
|
||||
private async onTableSelected(): Promise<void> {
|
||||
if (this._tableSelectionComponent?.data) {
|
||||
this.importTable = this._tableSelectionComponent?.data;
|
||||
await this.storeImportConfigTable();
|
||||
if (this._tableSelectionComponent?.isDataValid) {
|
||||
this.importTable = this._tableSelectionComponent?.data;
|
||||
await this.storeImportConfigTable();
|
||||
}
|
||||
if (this._dataTable) {
|
||||
await this._dataTable.refresh();
|
||||
if (this._emptyModelsComponent) {
|
||||
|
||||
@@ -277,17 +277,18 @@ export class ColumnsTable extends ModelViewBase implements IDataComponent<Predic
|
||||
if (columns.length > 0 && columns[0].columnName !== constants.selectColumnTitle) {
|
||||
values = [{ displayName: constants.selectColumnTitle, name: '' }].concat(values);
|
||||
}
|
||||
let nameInput = this._modelBuilder.dropDown().withProperties({
|
||||
values: values,
|
||||
width: this.componentMaxLength
|
||||
}).component();
|
||||
|
||||
const name = modelParameter.name;
|
||||
let column = values.find(x => x.name.toLocaleUpperCase() === modelParameter.name.toLocaleUpperCase());
|
||||
if (!column) {
|
||||
column = values.length > 0 ? values[0] : undefined;
|
||||
}
|
||||
const currentColumn = columns.find(x => x.columnName === column?.name);
|
||||
nameInput.value = column;
|
||||
let nameInput = this._modelBuilder.dropDown().withProperties({
|
||||
values: values,
|
||||
value: column,
|
||||
width: this.componentMaxLength
|
||||
}).component();
|
||||
|
||||
if (column) {
|
||||
this._parameters.push({ columnName: column.name, paramName: name, paramType: modelParameter.type, maxLength: currentColumn?.maxLength });
|
||||
|
||||
@@ -30,6 +30,7 @@ export class TableSelectionComponent extends ModelViewBase implements IDataCompo
|
||||
private _form: azdata.FormContainer | undefined;
|
||||
private _databases: azdata.DropDownComponent | undefined;
|
||||
private _selectedTableName: string = '';
|
||||
private _selectedDatabaseName: string = '';
|
||||
private _tables: azdata.DropDownComponent | undefined;
|
||||
private _dbNames: string[] = [];
|
||||
private _tableNames: DatabaseTable[] = [];
|
||||
@@ -62,8 +63,11 @@ export class TableSelectionComponent extends ModelViewBase implements IDataCompo
|
||||
width: '275px'
|
||||
}).component();
|
||||
|
||||
this._databases.onValueChanged(async () => {
|
||||
await this.onDatabaseSelected();
|
||||
this._databases.onValueChanged(async (value) => {
|
||||
if (this._databases?.values && this._selectedDatabaseName !== value.selected) {
|
||||
this._selectedDatabaseName = value.selected;
|
||||
await this.onDatabaseSelected();
|
||||
}
|
||||
});
|
||||
|
||||
this._existingTableButton = modelBuilder.radioButton().withProperties({
|
||||
@@ -115,10 +119,10 @@ export class TableSelectionComponent extends ModelViewBase implements IDataCompo
|
||||
this._tables.onValueChanged(async (value) => {
|
||||
// There's an issue with dropdown doesn't set the value in editable mode. this is the workaround
|
||||
|
||||
if (this._tables && value) {
|
||||
if (this._tables && value && this._selectedTableName !== value.selected) {
|
||||
this._selectedTableName = value.selected;
|
||||
await this.onTableSelected();
|
||||
}
|
||||
await this.onTableSelected();
|
||||
});
|
||||
|
||||
const databaseForm = modelBuilder.formContainer().withFormItems([{
|
||||
|
||||
Reference in New Issue
Block a user