Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ All notable changes to this project will be documented in this file.

## [Unreleased]

- [#272](https://github.com/os2display/display-admin-client/pull/272)
- Fixed feed source selector.
- [#264](https://github.com/os2display/display-admin-client/pull/264)
- Added checkbox options component for use in calendar modifiers.
- Fixed multiselect when more than one feed source of the given type is installed.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const CalendarApiFeedType = ({
<MultiselectFromEndpoint
onChange={handleInput}
name="locations"
disableSearch={false}
label={t("locations")}
value={formStateObject.locations ?? []}
optionsEndpoint={optionsEndpoint}
Expand Down
4 changes: 1 addition & 3 deletions src/components/slide/content/feed-selector.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ function FeedSelector({
const [feedSourceOptions, setFeedSourceOptions] = useState([]);
const [feedSourceData, setFeedSourceData] = useState();

// @TODO: Filter by dataType

const {
data: feedSourcesData,
error: feedSourcesLoadingError,
Expand All @@ -47,7 +45,7 @@ function FeedSelector({
});

useEffect(() => {
if (feedSourceOptions?.length === 1) {
if (!value.feedSource && feedSourceOptions?.length === 1) {
// If there's only one feed source option select it.
const feedSource = feedSourceOptions[0]["@id"];
const configuration = value?.configuration ?? {};
Expand Down
5 changes: 4 additions & 1 deletion src/components/slide/content/multiselect-from-endpoint.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { displayError } from "../../util/list/toast-component/display-toast";
* @param {Function} props.onChange - On change callback.
* @param {string} props.optionsEndpoint - Endpoint from which to fetch the options.
* @param {boolean} props.singleSelect - Allow only to select one option.
* @param {boolean} props.disableSearch - Disable search. Defaults to true.
* @returns {object} - The FeedSelector component.
*/
function MultiselectFromEndpoint({
Expand All @@ -23,6 +24,7 @@ function MultiselectFromEndpoint({
optionsEndpoint,
label = null,
value = [],
disableSearch = true,
singleSelect = false,
}) {
const { t } = useTranslation("common");
Expand Down Expand Up @@ -81,7 +83,7 @@ function MultiselectFromEndpoint({
options={options}
selected={getSelected(value)}
name={name}
disableSearch
disableSearch={disableSearch}
singleSelect={singleSelect}
labelledBy="Select"
overrideStrings={{
Expand Down Expand Up @@ -109,6 +111,7 @@ MultiselectFromEndpoint.propTypes = {
onChange: PropTypes.func.isRequired,
optionsEndpoint: PropTypes.string.isRequired,
singleSelect: PropTypes.bool,
disableSearch: PropTypes.bool,
};

export default MultiselectFromEndpoint;