Skip to content

Commit

Permalink
TASK: Remove publish drop down isDiscarding state because it's not …
Browse files Browse the repository at this point in the history
…in use

discarding is currently done always with a popup so we dont need to disable the publishing dropdown - similar to synchronizing which is also not handled.

Further its removed because the `Discarding...` label is not even translated.
  • Loading branch information
mhsdesign committed Jan 25, 2025
1 parent c2cdf75 commit 3c320e3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ import style from './style.module.css';
@connect(state => ({
isSaving: state?.ui?.remote?.isSaving,
isPublishing: state?.cr?.publishing?.mode === PublishingMode.PUBLISH,
// todo the discard state is unused:
isDiscarding: state?.cr?.publishing?.mode === PublishingMode.DISCARD,
publishableNodes: publishableNodesSelector(state),
publishableNodesInDocument: publishableNodesInDocumentSelector(state),
personalWorkspaceName: personalWorkspaceNameSelector(state),
Expand All @@ -39,7 +37,6 @@ export default class PublishDropDown extends PureComponent {
static propTypes = {
isSaving: PropTypes.bool,
isPublishing: PropTypes.bool,
isDiscarding: PropTypes.bool,
isWorkspaceReadOnly: PropTypes.bool,
publishableNodes: PropTypes.array,
publishableNodesInDocument: PropTypes.array,
Expand Down Expand Up @@ -78,7 +75,6 @@ export default class PublishDropDown extends PureComponent {
publishableNodesInDocument,
isSaving,
isPublishing,
isDiscarding,
isWorkspaceReadOnly,
baseWorkspace,
changeBaseWorkspaceAction,
Expand All @@ -89,16 +85,15 @@ export default class PublishDropDown extends PureComponent {
const workspaceModuleUri = neos?.routes?.core?.modules?.workspace;
const allowedWorkspaces = neos?.configuration?.allowedTargetWorkspaces;
const baseWorkspaceTitle = allowedWorkspaces?.[baseWorkspace]?.title;
const canPublishLocally = !isSaving && !isPublishing && !isDiscarding && publishableNodesInDocument && (publishableNodesInDocument.length > 0);
const canPublishGlobally = !isSaving && !isPublishing && !isDiscarding && publishableNodes && (publishableNodes.length > 0);
const canPublishLocally = !isSaving && !isPublishing && publishableNodesInDocument && (publishableNodesInDocument.length > 0);
const canPublishGlobally = !isSaving && !isPublishing && publishableNodes && (publishableNodes.length > 0);
const changingWorkspaceAllowed = !canPublishGlobally;
const mainButton = this.getTranslatedMainButton(baseWorkspaceTitle);
const dropDownBtnClassName = mergeClassNames({
[style.dropDown__btn]: true,
[style['dropDown__item--canPublish']]: canPublishGlobally,
[style['dropDown__item--isPublishing']]: isPublishing,
[style['dropDown__item--isSaving']]: isSaving,
[style['dropDown__item--isDiscarding']]: isDiscarding
[style['dropDown__item--isSaving']]: isSaving
});
const publishableNodesInDocumentCount = publishableNodesInDocument ? publishableNodesInDocument.length : 0;
const publishableNodesCount = publishableNodes ? publishableNodes.length : 0;
Expand All @@ -116,7 +111,7 @@ export default class PublishDropDown extends PureComponent {
</AbstractButton>

<DropDown className={style.dropDown}>
{isPublishing || isSaving || isDiscarding ? (
{isPublishing || isSaving ? (
<DropDown.Header
iconIsOpen={'spinner'}
iconIsClosed={'spinner'}
Expand Down Expand Up @@ -212,8 +207,7 @@ export default class PublishDropDown extends PureComponent {
const {
publishableNodesInDocument,
isSaving,
isPublishing,
isDiscarding
isPublishing
} = this.props;
const canPublishLocally = publishableNodesInDocument && (publishableNodesInDocument.length > 0);

Expand All @@ -225,10 +219,6 @@ export default class PublishDropDown extends PureComponent {
return translate('Neos.Neos:Main:publishTo', 'Publish to {0}', [baseWorkspaceTitle]) + ' ...';
}

if (isDiscarding) {
return 'Discarding...';
}

if (canPublishLocally) {
return translate('Neos.Neos:Main:publishTo', 'Publish to {0}', [baseWorkspaceTitle]);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,6 @@ for further information see https://github.com/neos/neos-ui/pull/3211
background: var(--colors-Warn);
opacity: .5;
}
.dropDown__item--isDiscarding {
opacity: .5;
}


.badge {
margin-left: var(--spacing-Half);
Expand Down

0 comments on commit 3c320e3

Please sign in to comment.