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