mirror of
https://github.com/ansible/awx.git
synced 2026-04-10 04:29:21 -02:30
rename usePFSelect to useSyncedSelectValue
This commit is contained in:
@@ -1,2 +1,2 @@
|
|||||||
export { default as TagMultiSelect } from './TagMultiSelect';
|
export { default as TagMultiSelect } from './TagMultiSelect';
|
||||||
export { default as usePFSelect } from './usePFSelect';
|
export { default as useSyncedSelectValue } from './useSyncedSelectValue';
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { useState, useEffect } from 'react';
|
|||||||
between objects in `value` and the corresponding objects loaded as
|
between objects in `value` and the corresponding objects loaded as
|
||||||
`options` (based on matched id value).
|
`options` (based on matched id value).
|
||||||
*/
|
*/
|
||||||
export default function usePFSelect(value, onChange) {
|
export default function useSyncedSelectValue(value, onChange) {
|
||||||
const [options, setOptions] = useState([]);
|
const [options, setOptions] = useState([]);
|
||||||
const [selections, setSelections] = useState([]);
|
const [selections, setSelections] = useState([]);
|
||||||
|
|
||||||
@@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react';
|
|||||||
import { func, arrayOf, number, shape, string, oneOfType } from 'prop-types';
|
import { func, arrayOf, number, shape, string, oneOfType } from 'prop-types';
|
||||||
import { Select, SelectOption, SelectVariant } from '@patternfly/react-core';
|
import { Select, SelectOption, SelectVariant } from '@patternfly/react-core';
|
||||||
import { LabelsAPI } from '@api';
|
import { LabelsAPI } from '@api';
|
||||||
import usePFSelect from '@components/MultiSelect/usePFSelect';
|
import { useSyncedSelectValue } from '@components/MultiSelect';
|
||||||
|
|
||||||
async function loadLabelOptions(setLabels, onError) {
|
async function loadLabelOptions(setLabels, onError) {
|
||||||
let labels;
|
let labels;
|
||||||
@@ -30,7 +30,7 @@ async function loadLabelOptions(setLabels, onError) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function LabelSelect({ value, placeholder, onChange, onError }) {
|
function LabelSelect({ value, placeholder, onChange, onError }) {
|
||||||
const { selections, onSelect, options, setOptions } = usePFSelect(
|
const { selections, onSelect, options, setOptions } = useSyncedSelectValue(
|
||||||
value,
|
value,
|
||||||
onChange
|
onChange
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user