mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-16 01:25:36 -05:00
Dev/brih/task/make dropdowns searchable (#15615)
* make dropdown controls editable, searchable * updte method name and return type * update error message, and dropdown index selection logic * address review feedback
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { CategoryValue, DropDownComponent } from 'azdata';
|
||||
import { DAYS, HRS, MINUTE, SEC } from '../constants/strings';
|
||||
import { AdsMigrationStatus } from '../dialog/migrationStatus/migrationStatusDialogModel';
|
||||
import { MigrationContext } from '../models/migrationLocalStorage';
|
||||
@@ -120,3 +121,16 @@ export function filterMigrations(databaseMigrations: MigrationContext[], statusF
|
||||
}
|
||||
return filteredMigration;
|
||||
}
|
||||
|
||||
export function selectDropDownIndex(dropDown: DropDownComponent, index: number): void {
|
||||
if (index >= 0 && dropDown.values && index <= dropDown.values.length - 1) {
|
||||
const value = dropDown.values[index];
|
||||
dropDown.value = value as CategoryValue;
|
||||
}
|
||||
}
|
||||
|
||||
export function findDropDownItemIndex(dropDown: DropDownComponent, value: string): number {
|
||||
return dropDown.values &&
|
||||
dropDown.values.findIndex((v: any) => ((v as CategoryValue)?.displayName?.toLowerCase() === value?.toLowerCase())) ||
|
||||
-1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user