From 7d9bab803de29bc551d26d8d42b47a3934a8c551 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Gu=CC=88nther?= Date: Mon, 15 Jan 2024 20:28:24 +0100 Subject: [PATCH] !!! TASK: Removes Editors for plugins This change is breaking. We are removing the following Editors and endpoints: - MasterPluginEditor - PluginViewEditor - PluginViewsEditor - Plugin view endpoints (in JavaScript - Fusion integration) Resolves: #3534 --- Classes/Infrastructure/MVC/RoutesProvider.php | 10 -- .../src/Endpoints/index.ts | 24 ---- .../src/Editors/MasterPlugin/index.js | 100 -------------- .../src/Editors/PluginView/index.js | 117 ---------------- .../src/Editors/PluginViews/index.js | 125 ------------------ .../src/Editors/PluginViews/style.module.css | 25 ---- packages/neos-ui-editors/src/Editors/index.js | 6 - packages/neos-ui-editors/src/index.js | 9 -- packages/neos-ui-editors/src/manifest.js | 13 -- 9 files changed, 429 deletions(-) delete mode 100644 packages/neos-ui-editors/src/Editors/MasterPlugin/index.js delete mode 100644 packages/neos-ui-editors/src/Editors/PluginView/index.js delete mode 100644 packages/neos-ui-editors/src/Editors/PluginViews/index.js delete mode 100644 packages/neos-ui-editors/src/Editors/PluginViews/style.module.css diff --git a/Classes/Infrastructure/MVC/RoutesProvider.php b/Classes/Infrastructure/MVC/RoutesProvider.php index f27d03af3a..327533a1c0 100644 --- a/Classes/Infrastructure/MVC/RoutesProvider.php +++ b/Classes/Infrastructure/MVC/RoutesProvider.php @@ -67,16 +67,6 @@ public function getRoutes(UriBuilder $uriBuilder): array controllerName: 'Backend\\Content', actionName: 'createImageVariant' ), - 'loadMasterPlugins' => - $helper->buildCoreRoute( - controllerName: 'Backend\\Content', - actionName: 'masterPlugins' - ), - 'loadPluginViews' => - $helper->buildCoreRoute( - controllerName: 'Backend\\Content', - actionName: 'pluginViews' - ), 'uploadAsset' => $helper->buildCoreRoute( controllerName: 'Backend\\Content', diff --git a/packages/neos-ui-backend-connector/src/Endpoints/index.ts b/packages/neos-ui-backend-connector/src/Endpoints/index.ts index 7e2061958d..144dbf2ee2 100644 --- a/packages/neos-ui-backend-connector/src/Endpoints/index.ts +++ b/packages/neos-ui-backend-connector/src/Endpoints/index.ts @@ -26,8 +26,6 @@ export interface Routes { content: { imageWithMetadata: string; createImageVariant: string; - loadMasterPlugins: string; - loadPluginViews: string; uploadAsset: string; }; service: { @@ -206,26 +204,6 @@ export default (routes: Routes) => { })).then(response => fetchWithErrorHandling.parseJson(response)) .catch(reason => fetchWithErrorHandling.generalErrorHandler(reason)); - const loadMasterPlugins = (workspaceName: WorkspaceName, dimensions: DimensionCombination) => fetchWithErrorHandling.withCsrfToken(() => ({ - url: urlWithParams(routes.core.content.loadMasterPlugins, {workspaceName, dimensions}), - method: 'GET', - credentials: 'include', - headers: { - 'Content-Type': 'application/json' - } - })).then(response => fetchWithErrorHandling.parseJson(response)) - .catch(reason => fetchWithErrorHandling.generalErrorHandler(reason)); - - const loadPluginViews = (identifier: string, workspaceName: WorkspaceName, dimensions: DimensionCombination) => fetchWithErrorHandling.withCsrfToken(() => ({ - url: urlWithParams(routes.core.content.loadPluginViews, {identifier, workspaceName, dimensions}), - method: 'GET', - credentials: 'include', - headers: { - 'Content-Type': 'application/json' - } - })).then(response => fetchWithErrorHandling.parseJson(response)) - .catch(reason => fetchWithErrorHandling.generalErrorHandler(reason)); - const contentDimensions = (dimensionName: DimensionName, chosenDimensionPresets: DimensionPresetCombination) => fetchWithErrorHandling.withCsrfToken(() => ({ url: urlWithParams(`${routes.core.service.contentDimensions}/${dimensionName}.json`, {chosenDimensionPresets}), method: 'GET', @@ -681,8 +659,6 @@ export default (routes: Routes) => { cutNodes, clearClipboard, createImageVariant, - loadMasterPlugins, - loadPluginViews, uploadAsset, assetProxyImport, assetProxySearch, diff --git a/packages/neos-ui-editors/src/Editors/MasterPlugin/index.js b/packages/neos-ui-editors/src/Editors/MasterPlugin/index.js deleted file mode 100644 index 1664531bc4..0000000000 --- a/packages/neos-ui-editors/src/Editors/MasterPlugin/index.js +++ /dev/null @@ -1,100 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import SelectBox from '@neos-project/react-ui-components/src/SelectBox/'; -import backend from '@neos-project/neos-ui-backend-connector'; -import {neos} from '@neos-project/neos-ui-decorators'; -import {connect} from 'react-redux'; -import {selectors} from '@neos-project/neos-ui-redux-store'; - -@neos(globalRegistry => { - return { - i18nRegistry: globalRegistry.get('i18n') - }; -}) -@connect(state => ({ - activeContentDimensions: selectors.CR.ContentDimensions.active(state), - personalWorkspace: selectors.CR.Workspaces.personalWorkspaceNameSelector(state) -})) -class MasterPluginEditor extends React.PureComponent { - static propTypes = { - className: PropTypes.string, - id: PropTypes.string, - value: PropTypes.string, - commit: PropTypes.func.isRequired, - i18nRegistry: PropTypes.object.isRequired, - activeContentDimensions: PropTypes.object.isRequired, - personalWorkspace: PropTypes.string - }; - - constructor(...args) { - super(...args); - - this.state = { - isLoading: false, - options: [] - }; - } - - renderPlaceholder() { - const placeholderPrefix = 'Neos.Neos:Main:content.inspector.editors.masterPluginEditor.'; - const placeholderLabel = placeholderPrefix + (this.state.options.length > 0 ? 'selectPlugin' : 'noPluginConfigured'); - return this.props.i18nRegistry.translate(placeholderLabel); - } - - transformMasterPluginStructure(plugins) { - const pluginsList = []; - for (const property in plugins) { - if (Object.prototype.hasOwnProperty.call(plugins, property)) { - pluginsList.push({ - value: property, - label: plugins[property] - }); - } - } - - return pluginsList; - } - - componentDidMount() { - const {loadMasterPlugins} = backend.get().endpoints; - const {personalWorkspace, activeContentDimensions} = this.props; - - if (!this.state.options.length) { - this.setState({isLoading: true}); - - loadMasterPlugins(personalWorkspace, activeContentDimensions) - .then(options => { - this.setState({ - isLoading: false, - options: this.transformMasterPluginStructure(options) - }); - }); - } - } - - handleValueChange = value => { - this.props.commit(value); - } - - render() { - const {options, isLoading} = this.state; - const disabled = this.props?.options?.disabled; - - return ( - - ); - } -} - -export default MasterPluginEditor; diff --git a/packages/neos-ui-editors/src/Editors/PluginView/index.js b/packages/neos-ui-editors/src/Editors/PluginView/index.js deleted file mode 100644 index d9bac7d938..0000000000 --- a/packages/neos-ui-editors/src/Editors/PluginView/index.js +++ /dev/null @@ -1,117 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import SelectBox from '@neos-project/react-ui-components/src/SelectBox/'; -import backend from '@neos-project/neos-ui-backend-connector'; -import {neos} from '@neos-project/neos-ui-decorators'; -import {connect} from 'react-redux'; -import {selectors} from '@neos-project/neos-ui-redux-store'; - -@neos(globalRegistry => { - return { - i18nRegistry: globalRegistry.get('i18n') - }; -}) - -@connect(state => ({ - activeContentDimensions: selectors.CR.ContentDimensions.active(state), - personalWorkspace: selectors.CR.Workspaces.personalWorkspaceNameSelector(state), - focusedNode: selectors.CR.Nodes.focusedSelector(state), - transientValues: selectors.UI.Inspector.transientValues(state) -})) - -class PluginViewEditor extends React.PureComponent { - static propTypes = { - id: PropTypes.string, - value: PropTypes.string, - className: PropTypes.string, - commit: PropTypes.func.isRequired, - i18nRegistry: PropTypes.object.isRequired, - activeContentDimensions: PropTypes.object.isRequired, - personalWorkspace: PropTypes.string, - focusedNode: PropTypes.object.isRequired, - transientValues: PropTypes.object - // focusedNode: PropTypes.instanceOf(PluginViewEditor).isRequired TODO: This is currently broken and gives an error in console, needs to be fixed - }; - - state = { - isLoading: false, - options: [] - }; - - renderPlaceholder() { - const placeholderPrefix = 'Neos.Neos:Main:content.inspector.editors.masterPluginEditor.'; - const placeholderLabel = placeholderPrefix + (this.state.options.length > 0 ? 'selectPlugin' : 'noPluginConfigured'); - return this.props.i18nRegistry.translate(placeholderLabel); - } - - transformPluginStructure(plugins) { - const pluginsList = []; - for (const key in plugins) { - if (plugins[key] === undefined || plugins[key].label === undefined) { - continue; - } - pluginsList.push({value: key, label: plugins[key].label}); - } - - return pluginsList; - } - - componentDidMount() { - this.loadOptions(this.props); - } - - UNSAFE_componentWillReceiveProps(nextProps) { - if (nextProps.transientValues?.plugin?.value !== this.props.transientValues?.plugin?.value) { - this.loadOptions(nextProps); - } - } - - loadOptions(props) { - const {personalWorkspace, activeContentDimensions, focusedNode, transientValues} = props; - if (!focusedNode) { - return; - } - - const {loadPluginViews} = backend.get().endpoints; - - const pluginNodeProperties = focusedNode?.properties; - - if (pluginNodeProperties.plugin) { - const pluginNodeIdentifier = transientValues?.plugin?.value === undefined ? pluginNodeProperties?.plugin : transientValues?.plugin?.value; - this.setState({isLoading: true}); - loadPluginViews(pluginNodeIdentifier, personalWorkspace, activeContentDimensions) - .then(views => { - this.setState({ - isLoading: false, - options: this.transformPluginStructure(views) - }); - }); - } - } - - handleValueChange = value => { - this.props.commit(value); - } - - render() { - const {options, isLoading} = this.state; - const disabled = this.props?.options?.disabled; - - return ( - - ); - } -} - -export default PluginViewEditor; diff --git a/packages/neos-ui-editors/src/Editors/PluginViews/index.js b/packages/neos-ui-editors/src/Editors/PluginViews/index.js deleted file mode 100644 index 7007c9c5e6..0000000000 --- a/packages/neos-ui-editors/src/Editors/PluginViews/index.js +++ /dev/null @@ -1,125 +0,0 @@ -import React from 'react'; -import PropTypes from 'prop-types'; -import backend from '@neos-project/neos-ui-backend-connector'; -import {neos} from '@neos-project/neos-ui-decorators'; -import {connect} from 'react-redux'; -import {selectors, actions} from '@neos-project/neos-ui-redux-store'; -import mergeClassNames from 'classnames'; - -import style from './style.module.css'; - -@neos(globalRegistry => { - return { - i18nRegistry: globalRegistry.get('i18n') - }; -}) - -@connect(state => ({ - activeContentDimensions: selectors.CR.ContentDimensions.active(state), - personalWorkspace: selectors.CR.Workspaces.personalWorkspaceNameSelector(state), - focusedNodeIdentifier: selectors.CR.Nodes.focusedNodeIdentifierSelector(state) -}), { - setActiveContentCanvasSrc: actions.UI.ContentCanvas.setSrc -}) - -class PluginViewsEditor extends React.PureComponent { - static propTypes = { - i18nRegistry: PropTypes.object.isRequired, - className: PropTypes.string, - activeContentDimensions: PropTypes.object.isRequired, - personalWorkspace: PropTypes.string, - focusedNodeIdentifier: PropTypes.string.isRequired, - setActiveContentCanvasSrc: PropTypes.func - }; - - state = { - isLoading: false, - views: [] - }; - - componentDidMount() { - const {personalWorkspace, activeContentDimensions, focusedNodeIdentifier} = this.props; - - if (!focusedNodeIdentifier) { - return; - } - - const {loadPluginViews} = backend.get().endpoints; - - if (!this.state.views.length) { - this.setState({isLoading: true}); - - loadPluginViews(focusedNodeIdentifier, personalWorkspace, activeContentDimensions) - .then(views => { - const viewsArray = []; - for (const viewName in views) { - if (views[viewName]) { - viewsArray.push(views[viewName]); - } - } - - this.setState({ - isLoading: false, - views: viewsArray - }); - }); - } - } - - renderViewListItems() { - const {isLoading, views} = this.state; - - if (isLoading) { - return ( -
  • - {this.props.i18nRegistry.translate('Neos.Neos:Main:loading', 'Loading')} -
  • - ); - } - - if (views.length > 0) { - return views.map(view => -
  • - {view.label} - {this.renderLocationLabel(Object.prototype.hasOwnProperty.call(view, 'pageNode'))} - {this.renderLink(view.pageNode)} -
  • - ); - } - } - - renderLocationLabel(onPage) { - let label = 'content.inspector.editors.pluginViewsEditor.'; - label += onPage ? 'displayedOnPage' : 'displayedOnCurrentPage'; - return this.props.i18nRegistry.translate(label); - } - - renderLink(pageNode) { - return ( - pageNode ? {pageNode.title} : null - ); - } - - handleClick = source => () => { - const {setActiveContentCanvasSrc} = this.props; - if (setActiveContentCanvasSrc) { - setActiveContentCanvasSrc(source); - } - } - - render() { - const {className} = this.props; - const classNames = mergeClassNames({ - [className]: true, - [style.pluginViewContainer]: true - }); - - return ( -
      - {this.renderViewListItems()} -
    - ); - } -} - -export default PluginViewsEditor; diff --git a/packages/neos-ui-editors/src/Editors/PluginViews/style.module.css b/packages/neos-ui-editors/src/Editors/PluginViews/style.module.css deleted file mode 100644 index 5bcaab86a1..0000000000 --- a/packages/neos-ui-editors/src/Editors/PluginViews/style.module.css +++ /dev/null @@ -1,25 +0,0 @@ -.pluginViewContainer { - width: 100%; - list-style: none; - background: var(--colors-ContrastNeutral); - margin: 0; - padding: 0; -} - -.pluginViewContainer__listItem { - font-size: var(--fontSize-Small); - line-height: var(--spacing-Full); - margin-bottom: var(--spacing-Half); - padding: var(--spacing-Full); -} - -.pluginViewContainer__listItem b { - margin-right: calc(var(--spacing-Half) / 2); -} - -.pluginViewContainer__listItem a { - font-size: var(--fontSize-Small); - color: var(--colors-PrimaryBlue); - text-decoration: none; - margin-left: calc(var(--spacing-Half) / 2); -} diff --git a/packages/neos-ui-editors/src/Editors/index.js b/packages/neos-ui-editors/src/Editors/index.js index 9450b1e8b5..1e21cd2730 100644 --- a/packages/neos-ui-editors/src/Editors/index.js +++ b/packages/neos-ui-editors/src/Editors/index.js @@ -12,9 +12,6 @@ import NodeType from './NodeType/index'; import CodeMirror from './CodeMirror/index'; import CKEditor from './CKEditor/index'; import AssetEditor from './AssetEditor/index'; -import MasterPlugin from './MasterPlugin/index'; -import PluginViews from './PluginViews/index'; -import PluginView from './PluginView/index'; import UriPathSegment from './UriPathSegment/index'; export { @@ -32,8 +29,5 @@ export { CodeMirror, CKEditor, AssetEditor, - MasterPlugin, - PluginViews, - PluginView, UriPathSegment }; diff --git a/packages/neos-ui-editors/src/index.js b/packages/neos-ui-editors/src/index.js index fac72fe053..33fea98200 100644 --- a/packages/neos-ui-editors/src/index.js +++ b/packages/neos-ui-editors/src/index.js @@ -14,10 +14,7 @@ import { NodeType, CodeMirror, CKEditor, - MasterPlugin, AssetEditor, - PluginViews, - PluginView, UriPathSegment } from './Editors/index'; @@ -53,10 +50,7 @@ export { NodeType, CodeMirror, CKEditor, - MasterPlugin, AssetEditor, - PluginViews, - PluginView, UriPathSegment, CodeMirrorWrap, @@ -88,10 +82,7 @@ export default { NodeType, CodeMirror, CKEditor, - MasterPlugin, AssetEditor, - PluginViews, - PluginView, UriPathSegment, CodeMirrorWrap, diff --git a/packages/neos-ui-editors/src/manifest.js b/packages/neos-ui-editors/src/manifest.js index 3c6749d5bc..c3d3f20879 100644 --- a/packages/neos-ui-editors/src/manifest.js +++ b/packages/neos-ui-editors/src/manifest.js @@ -77,19 +77,6 @@ manifest('inspectorEditors', {}, globalRegistry => { component: Editors.AssetEditor }); - editorsRegistry.set('Neos.Neos/Inspector/Editors/MasterPluginEditor', { - component: Editors.MasterPlugin - }); - - editorsRegistry.set('Neos.Neos/Inspector/Editors/PluginViewsEditor', { - component: Editors.PluginViews, - hasOwnLabel: true - }); - - editorsRegistry.set('Neos.Neos/Inspector/Editors/PluginViewEditor', { - component: Editors.PluginView - }); - editorsRegistry.set('Neos.Neos/Inspector/Editors/UriPathSegmentEditor', { component: Editors.UriPathSegment });