diff --git a/packages/strapi-helper-plugin/lib/src/svgs/Layout/index.js b/packages/strapi-helper-plugin/lib/src/svgs/Layout/index.js index c7e0c45498..16840e8540 100644 --- a/packages/strapi-helper-plugin/lib/src/svgs/Layout/index.js +++ b/packages/strapi-helper-plugin/lib/src/svgs/Layout/index.js @@ -11,9 +11,13 @@ const Layout = styled(SvgCompo)` } &.colored { > g { - fill: #007eff; + fill: ${({ fill }) => fill}; } } `; +Layout.defaultProps = { + fill: '#007eff', +}; + export default Layout; diff --git a/packages/strapi-plugin-content-manager/admin/src/components/SelectWrapper/index.js b/packages/strapi-plugin-content-manager/admin/src/components/SelectWrapper/index.js index a708efd92f..2865983930 100644 --- a/packages/strapi-plugin-content-manager/admin/src/components/SelectWrapper/index.js +++ b/packages/strapi-plugin-content-manager/admin/src/components/SelectWrapper/index.js @@ -1,9 +1,9 @@ /* eslint-disable react-hooks/exhaustive-deps */ -import React, { useState, useEffect, useRef, memo } from 'react'; +import React, { useState, useEffect, useMemo, useRef, memo } from 'react'; import PropTypes from 'prop-types'; import { FormattedMessage } from 'react-intl'; import { Link, useLocation } from 'react-router-dom'; -import { cloneDeep, get, isArray, isEmpty } from 'lodash'; +import { cloneDeep, findIndex, get, isArray, isEmpty } from 'lodash'; import { request } from 'strapi-helper-plugin'; import pluginId from '../../pluginId'; import useDataManager from '../../hooks/useDataManager'; @@ -42,6 +42,22 @@ function SelectWrapper({ const ref = useRef(); const startRef = useRef(); + const filteredOptions = useMemo(() => { + return options.filter(option => { + if (!isEmpty(value)) { + // SelectMany + if (Array.isArray(value)) { + return findIndex(value, o => o.id === option.value.id) === -1; + } + + // SelectOne + return get(value, 'id', '') !== option.value.id; + } + + return true; + }); + }, [options, value]); + startRef.current = state._start; ref.current = async () => { @@ -193,7 +209,7 @@ function SelectWrapper({ move={moveRelation} name={name} nextSearch={nextSearch} - options={options} + options={filteredOptions} onChange={value => { onChange({ target: { name, value: value ? value.value : value } }); }} diff --git a/packages/strapi-plugin-content-type-builder/admin/src/containers/ListView/index.js b/packages/strapi-plugin-content-type-builder/admin/src/containers/ListView/index.js index 3c27b8fbcb..582dfa9c8d 100644 --- a/packages/strapi-plugin-content-type-builder/admin/src/containers/ListView/index.js +++ b/packages/strapi-plugin-content-type-builder/admin/src/containers/ListView/index.js @@ -53,6 +53,7 @@ const ListView = () => { const firstMainDataPath = isInContentTypeView ? 'contentType' : 'component'; const mainDataTypeAttributesPath = [firstMainDataPath, 'schema', 'attributes']; const targetUid = get(modifiedData, [firstMainDataPath, 'uid']); + const isTemporary = get(modifiedData, [firstMainDataPath, 'isTemporary'], false); const contentTypeKind = get(modifiedData, [firstMainDataPath, 'schema', 'kind'], null); const attributes = get(modifiedData, mainDataTypeAttributesPath, {}); @@ -259,15 +260,18 @@ const ListView = () => { ? `/plugins/content-manager/${contentTypeKind}/${targetUid}/ctm-configurations/edit-settings/content-types` : `/plugins/content-manager/ctm-configurations/edit-settings/components/${targetUid}/`; - push(endPoint); + if (!isTemporary) { + push(endPoint); + } }; const configureButtonProps = { - icon: , + icon: , color: 'secondary', label: formatMessage({ id: `${pluginId}.form.button.configure-view` }), onClick: goToCMSettingsPage, style: { marginTop: '2px' }, + disabled: isTemporary, }; const listActions = isInDevelopmentMode diff --git a/packages/strapi-plugin-documentation/admin/src/containers/HomePage/index.js b/packages/strapi-plugin-documentation/admin/src/containers/HomePage/index.js index c0431516c3..f7cbad66f9 100755 --- a/packages/strapi-plugin-documentation/admin/src/containers/HomePage/index.js +++ b/packages/strapi-plugin-documentation/admin/src/containers/HomePage/index.js @@ -80,9 +80,10 @@ export class HomePage extends React.Component { }; openCurrentDocumentation = () => { - const { currentDocVersion } = this.props; + const { currentDocVersion, prefix } = this.props; + const slash = prefix.startsWith('/') ? '' : '/'; - return openWithNewTab(`/documentation/v${currentDocVersion}`); + return openWithNewTab(`${slash}${prefix}/v${currentDocVersion}`); }; shouldHideInput = inputName => { @@ -218,6 +219,7 @@ HomePage.defaultProps = { onConfirmDeleteDoc: () => {}, onSubmit: () => {}, onUpdateDoc: () => {}, + prefix: '/documentation', versionToDelete: '', }; @@ -234,6 +236,7 @@ HomePage.propTypes = { onConfirmDeleteDoc: PropTypes.func, onSubmit: PropTypes.func, onUpdateDoc: PropTypes.func, + prefix: PropTypes.string, versionToDelete: PropTypes.string, };