diff options
author | stanislavh <stanislav.honcharov@sonarsource.com> | 2024-05-02 17:29:48 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2024-05-06 20:02:40 +0000 |
commit | 422081485bf8e9646921f48d7b1f8d54b9854bd7 (patch) | |
tree | 4f05d3e9ff70bc1b3788bdd5aa48ffca03999c44 /server/sonar-web/src/main/js | |
parent | 6e3bc57e5e081c223b9d527f4de45c6b90e132f5 (diff) | |
download | sonarqube-422081485bf8e9646921f48d7b1f8d54b9854bd7.tar.gz sonarqube-422081485bf8e9646921f48d7b1f8d54b9854bd7.zip |
SONAR-22168 Align InputSelect
Diffstat (limited to 'server/sonar-web/src/main/js')
14 files changed, 22 insertions, 23 deletions
diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/StatusFilter.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/StatusFilter.tsx index fc29f14295f..22fb8307f43 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/StatusFilter.tsx +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/StatusFilter.tsx @@ -32,7 +32,7 @@ interface StatusFilterProps { export default function StatusFilter(props: Readonly<StatusFilterProps>) { const { id, value, onChange } = props; - const options: LabelValueSelectOption<string>[] = [ + const options: LabelValueSelectOption[] = [ { value: STATUSES.ALL, label: translate('background_task.status.ALL') }, { value: STATUSES.ALL_EXCEPT_PENDING, @@ -46,7 +46,7 @@ export default function StatusFilter(props: Readonly<StatusFilterProps>) { ]; const handleChange = React.useCallback( - ({ value }: LabelValueSelectOption<string>) => { + ({ value }: LabelValueSelectOption) => { onChange(value); }, [onChange], diff --git a/server/sonar-web/src/main/js/apps/background-tasks/components/TypesFilter.tsx b/server/sonar-web/src/main/js/apps/background-tasks/components/TypesFilter.tsx index d2d21891ae8..9a7a620c706 100644 --- a/server/sonar-web/src/main/js/apps/background-tasks/components/TypesFilter.tsx +++ b/server/sonar-web/src/main/js/apps/background-tasks/components/TypesFilter.tsx @@ -30,7 +30,7 @@ interface Props { } export default class TypesFilter extends React.PureComponent<Props> { - handleChange = ({ value }: LabelValueSelectOption<string>) => { + handleChange = ({ value }: LabelValueSelectOption) => { this.props.onChange(value); }; @@ -43,7 +43,7 @@ export default class TypesFilter extends React.PureComponent<Props> { }; }); - const allOptions: LabelValueSelectOption<string>[] = [ + const allOptions: LabelValueSelectOption[] = [ { value: ALL_TYPES, label: translate('background_task.type.ALL') }, ...options, ]; diff --git a/server/sonar-web/src/main/js/apps/coding-rules/components/CustomRuleFormModal.tsx b/server/sonar-web/src/main/js/apps/coding-rules/components/CustomRuleFormModal.tsx index fce45c211b2..4f7142ab3a9 100644 --- a/server/sonar-web/src/main/js/apps/coding-rules/components/CustomRuleFormModal.tsx +++ b/server/sonar-web/src/main/js/apps/coding-rules/components/CustomRuleFormModal.tsx @@ -224,7 +224,7 @@ export default function CustomRuleFormModal(props: Readonly<Props>) { ); const StatusField = React.useMemo(() => { - const statusesOptions = RULE_STATUSES.map((status) => ({ + const statusesOptions = RULE_STATUSES.map((status: Status) => ({ label: translate('rules.status', status), value: status, })); diff --git a/server/sonar-web/src/main/js/apps/create/project/Azure/AzureProjectCreate.tsx b/server/sonar-web/src/main/js/apps/create/project/Azure/AzureProjectCreate.tsx index 7ef68d6dea5..7a0fb275869 100644 --- a/server/sonar-web/src/main/js/apps/create/project/Azure/AzureProjectCreate.tsx +++ b/server/sonar-web/src/main/js/apps/create/project/Azure/AzureProjectCreate.tsx @@ -304,7 +304,7 @@ export default function AzureProjectCreate({ function transformToOptions( projects: AzureProject[], repositories?: Dict<AzureRepository[]>, -): Array<GroupBase<LabelValueSelectOption<string>>> { +): Array<GroupBase<LabelValueSelectOption>> { return projects.map(({ name: projectName }) => ({ label: projectName, options: @@ -314,6 +314,6 @@ function transformToOptions( })); } -function transformToOption({ name }: AzureRepository): LabelValueSelectOption<string> { +function transformToOption({ name }: AzureRepository): LabelValueSelectOption { return { value: name, label: name }; } diff --git a/server/sonar-web/src/main/js/apps/create/project/BitbucketCloud/BitbucketCloudProjectCreate.tsx b/server/sonar-web/src/main/js/apps/create/project/BitbucketCloud/BitbucketCloudProjectCreate.tsx index 1c206512972..a9081c898f5 100644 --- a/server/sonar-web/src/main/js/apps/create/project/BitbucketCloud/BitbucketCloudProjectCreate.tsx +++ b/server/sonar-web/src/main/js/apps/create/project/BitbucketCloud/BitbucketCloudProjectCreate.tsx @@ -212,9 +212,6 @@ export default function BitbucketCloudProjectCreate(props: Readonly<Props>) { ); } -function transformToOption({ - name, - slug, -}: BitbucketCloudRepository): LabelValueSelectOption<string> { +function transformToOption({ name, slug }: BitbucketCloudRepository): LabelValueSelectOption { return { value: slug, label: name }; } diff --git a/server/sonar-web/src/main/js/apps/create/project/Github/GitHubProjectCreate.tsx b/server/sonar-web/src/main/js/apps/create/project/Github/GitHubProjectCreate.tsx index 9eab22d95f5..e22904aedf1 100644 --- a/server/sonar-web/src/main/js/apps/create/project/Github/GitHubProjectCreate.tsx +++ b/server/sonar-web/src/main/js/apps/create/project/Github/GitHubProjectCreate.tsx @@ -256,6 +256,6 @@ export default function GitHubProjectCreate(props: Readonly<Props>) { function transformToOption({ key, name, -}: GithubOrganization | GithubRepository): LabelValueSelectOption<string> { +}: GithubOrganization | GithubRepository): LabelValueSelectOption { return { value: key, label: name }; } diff --git a/server/sonar-web/src/main/js/apps/create/project/Gitlab/GitlabProjectCreate.tsx b/server/sonar-web/src/main/js/apps/create/project/Gitlab/GitlabProjectCreate.tsx index 6b72f0db234..a5ff527ff4e 100644 --- a/server/sonar-web/src/main/js/apps/create/project/Gitlab/GitlabProjectCreate.tsx +++ b/server/sonar-web/src/main/js/apps/create/project/Gitlab/GitlabProjectCreate.tsx @@ -200,6 +200,6 @@ export default function GitlabProjectCreate(props: Readonly<Props>) { ); } -function transformToOption({ id, name }: GitlabProject): LabelValueSelectOption<string> { +function transformToOption({ id, name }: GitlabProject): LabelValueSelectOption { return { value: id, label: name }; } diff --git a/server/sonar-web/src/main/js/apps/issues/components/AssigneeSelect.tsx b/server/sonar-web/src/main/js/apps/issues/components/AssigneeSelect.tsx index 3acbfa32de7..781e9aa77b6 100644 --- a/server/sonar-web/src/main/js/apps/issues/components/AssigneeSelect.tsx +++ b/server/sonar-web/src/main/js/apps/issues/components/AssigneeSelect.tsx @@ -33,10 +33,10 @@ export const MIN_QUERY_LENGTH = 2; const UNASSIGNED = { value: '', label: translate('unassigned') }; export interface AssigneeSelectProps { - assignee?: SingleValue<LabelValueSelectOption<string>>; + assignee?: SingleValue<LabelValueSelectOption>; className?: string; issues: Issue[]; - onAssigneeSelect: (assignee: SingleValue<LabelValueSelectOption<string>>) => void; + onAssigneeSelect: (assignee: SingleValue<LabelValueSelectOption>) => void; inputId: string; } diff --git a/server/sonar-web/src/main/js/apps/issues/components/BulkChangeModal.tsx b/server/sonar-web/src/main/js/apps/issues/components/BulkChangeModal.tsx index 3721dfe716c..439af636783 100644 --- a/server/sonar-web/src/main/js/apps/issues/components/BulkChangeModal.tsx +++ b/server/sonar-web/src/main/js/apps/issues/components/BulkChangeModal.tsx @@ -54,7 +54,7 @@ interface Props { interface FormFields { addTags?: Array<string>; - assignee?: SingleValue<LabelValueSelectOption<string>>; + assignee?: SingleValue<LabelValueSelectOption>; comment?: string; notifications?: boolean; removeTags?: Array<string>; @@ -126,7 +126,7 @@ export class BulkChangeModal extends React.PureComponent<Props, State> { return this.props.fetchIssues({ additionalFields: 'actions,transitions', ps: MAX_PAGE_SIZE }); }; - handleAssigneeSelect = (assignee: SingleValue<LabelValueSelectOption<string>>) => { + handleAssigneeSelect = (assignee: SingleValue<LabelValueSelectOption>) => { this.setState({ assignee }); }; diff --git a/server/sonar-web/src/main/js/apps/permissions/project/components/ApplyTemplate.tsx b/server/sonar-web/src/main/js/apps/permissions/project/components/ApplyTemplate.tsx index 78b18822c40..2fe4a93fb8b 100644 --- a/server/sonar-web/src/main/js/apps/permissions/project/components/ApplyTemplate.tsx +++ b/server/sonar-web/src/main/js/apps/permissions/project/components/ApplyTemplate.tsx @@ -89,7 +89,7 @@ export default class ApplyTemplate extends React.PureComponent<Props, State> { } }; - handlePermissionTemplateChange = ({ value }: LabelValueSelectOption<string>) => { + handlePermissionTemplateChange = ({ value }: LabelValueSelectOption) => { this.setState({ permissionTemplate: value }); }; diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityPageFilters.tsx b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityPageFilters.tsx index 578135e7c6e..7b76d0800d8 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityPageFilters.tsx +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityPageFilters.tsx @@ -45,7 +45,7 @@ export default function ProjectActivityPageFilters(props: ProjectActivityPageFil const eventTypes = isApp ? Object.values(ApplicationAnalysisEventCategory) : Object.values(ProjectAnalysisEventCategory); - const options: LabelValueSelectOption<string>[] = eventTypes.map((category) => ({ + const options: LabelValueSelectOption[] = eventTypes.map((category) => ({ label: translate('event.category', category), value: category, })); @@ -64,7 +64,7 @@ export default function ProjectActivityPageFilters(props: ProjectActivityPageFil aria-label={translate('project_activity.filter_events')} className="sw-mr-8 sw-body-sm sw-w-abs-200" isClearable - onChange={(data: LabelValueSelectOption<string>) => handleCategoryChange(data)} + onChange={(data: LabelValueSelectOption) => handleCategoryChange(data)} options={options} placeholder={translate('project_activity.filter_events')} size="full" diff --git a/server/sonar-web/src/main/js/apps/projects/components/PerspectiveSelect.tsx b/server/sonar-web/src/main/js/apps/projects/components/PerspectiveSelect.tsx index 49b50a6b71b..2d4a69f12f3 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/PerspectiveSelect.tsx +++ b/server/sonar-web/src/main/js/apps/projects/components/PerspectiveSelect.tsx @@ -57,7 +57,7 @@ export default class PerspectiveSelect extends React.PureComponent<Props> { <InputSelect aria-labelledby="aria-projects-perspective" className="sw-mr-4 sw-body-sm" - onChange={(data: LabelValueSelectOption<string>) => this.handleChange(data)} + onChange={(data: LabelValueSelectOption) => this.handleChange(data)} options={options} placeholder={translate('project_activity.filter_events')} size="small" diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/BulkApplyTemplateModal.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/BulkApplyTemplateModal.tsx index cc84a71c127..347f3ae37de 100644 --- a/server/sonar-web/src/main/js/apps/projectsManagement/BulkApplyTemplateModal.tsx +++ b/server/sonar-web/src/main/js/apps/projectsManagement/BulkApplyTemplateModal.tsx @@ -130,7 +130,7 @@ export default class BulkApplyTemplateModal extends React.PureComponent<Props, S } }; - handlePermissionTemplateChange = ({ value }: LabelValueSelectOption<string>) => { + handlePermissionTemplateChange = ({ value }: LabelValueSelectOption) => { this.setState({ permissionTemplate: value }); }; diff --git a/server/sonar-web/src/main/js/apps/quality-gates/components/QualityGatePermissionsAddModalRenderer.tsx b/server/sonar-web/src/main/js/apps/quality-gates/components/QualityGatePermissionsAddModalRenderer.tsx index 963f7f8302d..363abc3a087 100644 --- a/server/sonar-web/src/main/js/apps/quality-gates/components/QualityGatePermissionsAddModalRenderer.tsx +++ b/server/sonar-web/src/main/js/apps/quality-gates/components/QualityGatePermissionsAddModalRenderer.tsx @@ -77,7 +77,9 @@ export default function QualityGatePermissionsAddModalRenderer( noOptionsMessage={() => translate('no_results')} onChange={props.onSelection} loadOptions={props.handleSearch} - getOptionValue={({ value }) => (isUser(value) ? value.login : value.name)} + getOptionValue={({ value }: LabelValueSelectOption<UserBase | UserGroup>) => + isUser(value) ? value.login : value.name + } controlLabel={renderedSelection} components={{ Option, |