Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CCS-4563-display-message-update #624

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
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const props = {
isBulkPublish: true,
isBulkUnpublish: false,
bulkOperationCompleted: true,
bulkOperationTitle: "Bulk Publish",
updateIsBulkPublish: (isBulkPublish) => anymatch,
updateIsBulkUnpublish: (isBulkUnpublish) => anymatch,
updateBulkOperationCompleted: (bulkOperationCompleted) => anymatch
Expand Down
4 changes: 3 additions & 1 deletion pantheon-bundle/frontend/src/app/BulkOperationPublish.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export interface IBulkOperationPublishProps {
isBulkPublish: boolean
isBulkUnpublish: boolean
bulkOperationCompleted: boolean
bulkOperationTitle: string
updateIsBulkPublish: (isBulkPublish) => any
updateIsBulkUnpublish: (isBulkUnpublish) => any
updateBulkOperationCompleted: (bulkOperationConfirmation) => any
Expand Down Expand Up @@ -126,7 +127,7 @@ class BulkOperationPublish extends React.Component<IBulkOperationPublishProps, a
{this.state.showBulkConfirmation &&
<BulkPublishConfirmation
key={new Date().getTime()}
header={this.props.isBulkPublish ? "Bulk Publish" : "Bulk Unpublish"}
header={this.props.bulkOperationTitle}
subheading="Documents updated in the bulk operation"
updateSucceeded={this.state.confirmationSucceeded}
updateIgnored={this.state.confirmationIgnored}
Expand All @@ -138,6 +139,7 @@ class BulkOperationPublish extends React.Component<IBulkOperationPublishProps, a
onShowBulkOperationConfirmation={this.updateShowBulkPublishConfirmation}
isBulkUnpublish={this.props.isBulkUnpublish}
bulkOperationCompleted={this.props.bulkOperationCompleted}
bulkOperationTitle={this.props.bulkOperationTitle}
updateBulkOperationCompleted={this.props.updateBulkOperationCompleted}
/>}

Expand Down
15 changes: 8 additions & 7 deletions pantheon-bundle/frontend/src/app/BulkPublishConfirmation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export interface IBulkPublishProps {
onShowBulkOperationConfirmation: (showBulkConfirmation) => any
isBulkUnpublish: boolean
bulkOperationCompleted: boolean
bulkOperationTitle: string
updateBulkOperationCompleted: (bulkOperationCompleted) => any
}

Expand Down Expand Up @@ -50,17 +51,17 @@ class BulkPublishConfirmation extends React.Component<IBulkPublishProps, any>{
<div className="p2-search__pf-c-alert">
<Alert
variant="info"
title={this.props.isBulkUnpublish ? "Bulk Unpublish" : "Bulk Publish"}
title={this.props.bulkOperationTitle}
actionClose={<AlertActionCloseButton data-testid="hide-alert-button" onClose={this.hideAlert} />}
actionLinks={
<React.Fragment>
<AlertActionLink data-testid="view-details-link" onClick={this.handleModalToggle}>View details</AlertActionLink>
</React.Fragment>
}
>
<div><Progress value={this.props.progressSuccessValue} title={this.props.isBulkUnpublish ? "Unpublish Successful" : "Publish Successful"} variant={ProgressVariant.success} size={ProgressSize.sm} /></div>
<div><Progress value={this.props.progressFailureValue} title={this.props.isBulkUnpublish ? "Unpublish Failed" : "Publish Failed (metadata missing)"} variant={ProgressVariant.danger} size={ProgressSize.sm} /></div>
{!this.props.isBulkUnpublish && <div><Progress value={this.props.progressWarningValue} title="Publish Failed (no draft version found)" variant={ProgressVariant.warning} size={ProgressSize.sm} /></div>}
<div><Progress value={this.props.progressSuccessValue} title="Succeeded" variant={ProgressVariant.success} size={ProgressSize.sm} /></div>
<div><Progress value={this.props.progressFailureValue} title="Failed" variant={ProgressVariant.danger} size={ProgressSize.sm} /></div>
{!this.props.isBulkUnpublish && <div><Progress value={this.props.progressWarningValue} title="No drafts found - no action taken" variant={ProgressVariant.warning} size={ProgressSize.sm} /></div>}
</Alert>
</div>
<Modal
Expand All @@ -73,7 +74,7 @@ class BulkPublishConfirmation extends React.Component<IBulkPublishProps, any>{
onClose={this.handleModalToggle}
footer={footer}
>
<strong>{`${this.props.isBulkUnpublish ? "Unpublished" : "Published"} Succeessfully:`}</strong>
<strong>Succeeded:</strong>
<br />
<span id="update-succeeded">
{this.props.updateSucceeded.length > 0 && <List aria-label="succeeded" component={ListComponent.ol} type={OrderType.number}>
Expand All @@ -88,7 +89,7 @@ class BulkPublishConfirmation extends React.Component<IBulkPublishProps, any>{
</span>
<br />
<br />
{!this.props.isBulkUnpublish && (<div><strong>Publish Ignored:</strong>
{!this.props.isBulkUnpublish && (<div><strong>Ignored:</strong>
<span id="update-ignored">
{this.props.updateIgnored.length > 0 && <List aria-label="ignored" component={ListComponent.ol} type={OrderType.number}>
{this.props.updateIgnored.split(",").map((data, index) => (
Expand All @@ -102,7 +103,7 @@ class BulkPublishConfirmation extends React.Component<IBulkPublishProps, any>{
</span></div>)}
<br />
<br />
<strong>{`${this.props.isBulkUnpublish ? "Unpublish" : "Publish"} Failed:`}</strong>
<strong>Failed:</strong>
<br />
<span id="update-failed">
{this.props.updateFailed.length > 0 && <List aria-label="failed" component={ListComponent.ol} type={OrderType.number}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ exports[`BulkOperationConfirmation tests should render BulkOperationConfirmation
measureLocation="top"
min={0}
size="sm"
title="Update Succeeded"
title="Succeeded"
tooltipPosition="top"
value={50}
valueText={null}
Expand All @@ -49,7 +49,7 @@ exports[`BulkOperationConfirmation tests should render BulkOperationConfirmation
measureLocation="top"
min={0}
size="sm"
title="Update failed"
title="Failed"
tooltipPosition="top"
value={10}
valueText={null}
Expand All @@ -66,7 +66,7 @@ exports[`BulkOperationConfirmation tests should render BulkOperationConfirmation
measureLocation="top"
min={0}
size="sm"
title="No draft version found. No action taken"
title="No drafts found - no action taken"
tooltipPosition="top"
value={40}
valueText={null}
Expand Down Expand Up @@ -120,7 +120,7 @@ exports[`BulkOperationConfirmation tests should render BulkOperationConfirmation
variant="large"
>
<strong>
Update Succeeded:
Succeeded:
</strong>
<br />
<span
Expand Down Expand Up @@ -151,7 +151,7 @@ exports[`BulkOperationConfirmation tests should render BulkOperationConfirmation
<br />
<br />
<strong>
Update Ignored:
Ignored:
</strong>
<br />
<span
Expand All @@ -177,7 +177,7 @@ exports[`BulkOperationConfirmation tests should render BulkOperationConfirmation
<br />
<br />
<strong>
Update Failed:
Failed:
</strong>
<br />
<span
Expand Down
14 changes: 7 additions & 7 deletions pantheon-bundle/frontend/src/app/bulkOperationConfirmation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ class BulkOperationConfirmation extends React.Component<IBulkOperationProps, any
</React.Fragment>
}
>
<div><Progress value={this.props.progressSuccessValue} title="Update Succeeded" variant={ProgressVariant.success} size={ProgressSize.sm} /></div>
<div><Progress value={this.props.progressFailureValue} title="Update failed" variant={ProgressVariant.danger} size={ProgressSize.sm} /></div>
<div><Progress value={this.props.progressWarningValue} title="No draft version found. No action taken" variant={ProgressVariant.warning} size={ProgressSize.sm} /></div>
<div><Progress value={this.props.progressSuccessValue} title="Succeeded" variant={ProgressVariant.success} size={ProgressSize.sm} /></div>
<div><Progress value={this.props.progressFailureValue} title="Failed" variant={ProgressVariant.danger} size={ProgressSize.sm} /></div>
<div><Progress value={this.props.progressWarningValue} title="No drafts found - no action taken" variant={ProgressVariant.warning} size={ProgressSize.sm} /></div>
</Alert>
<Modal
variant={ModalVariant.large}
Expand All @@ -80,7 +80,7 @@ class BulkOperationConfirmation extends React.Component<IBulkOperationProps, any
onClose={this.handleModalToggle}
footer={footer}
>
<strong>Update Succeeded:</strong>
<strong>Succeeded:</strong>
<br />
<span id="update-succeeded">
{this.props.updateSucceeded.length > 0 && <List aria-label="succeeded" component={ListComponent.ol} type={OrderType.number}>
Expand All @@ -96,7 +96,7 @@ class BulkOperationConfirmation extends React.Component<IBulkOperationProps, any
</span>
<br />
<br />
<strong>Update Ignored:</strong>
<strong>Ignored:</strong>
<br />
<span id="update-ignored">
{this.props.updateIgnored.length > 0 && <List aria-label="ignored" component={ListComponent.ol} type={OrderType.number}>
Expand All @@ -111,7 +111,7 @@ class BulkOperationConfirmation extends React.Component<IBulkOperationProps, any
</span>
<br />
<br />
<strong>Update Failed:</strong>
<strong>Failed:</strong>
<br />
<span id="update-failed">
{this.props.updateFailed.length > 0 && <List aria-label="failed" component={ListComponent.ol} type={OrderType.number}>
Expand Down Expand Up @@ -158,4 +158,4 @@ class BulkOperationConfirmation extends React.Component<IBulkOperationProps, any
}
}

export { BulkOperationConfirmation }
export { BulkOperationConfirmation }
4 changes: 2 additions & 2 deletions pantheon-bundle/frontend/src/app/bulkOperationMetadata.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ class BulkOperationMetadata extends React.Component<IBulkOperationMetadataProps,
this.calculateWarningProgress(this.state.bulkUpdateWarning)
if (this.state.bulkUpdateWarning > 0 && this.state.bulkUpdateWarning === this.props.documentsSelected.length) {

this.setState({ metadataEditError: "No draft versions found on selected items. Unable to save metadata." })
this.setState({ metadataEditError: "No drafts found on selected items. Unable to save metadata." })
}
})
}
Expand Down Expand Up @@ -507,4 +507,4 @@ class BulkOperationMetadata extends React.Component<IBulkOperationMetadataProps,
}
}
}
export { BulkOperationMetadata }
export { BulkOperationMetadata }
10 changes: 7 additions & 3 deletions pantheon-bundle/frontend/src/app/search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export interface ISearchState {
// bulk publish
isBulkPublish: boolean
isBulkUnpublish: boolean
bulkOperationTitle: string
}
class Search extends Component<IAppState, ISearchState> {
private drawerRef: React.RefObject<HTMLInputElement>;
Expand Down Expand Up @@ -110,7 +111,8 @@ class Search extends Component<IAppState, ISearchState> {

//bulk operation - publish
isBulkPublish: false,
isBulkUnpublish: false
isBulkUnpublish: false,
bulkOperationTitle: "Bulk Publish",
};
this.drawerRef = React.createRef();
}
Expand Down Expand Up @@ -348,6 +350,7 @@ class Search extends Component<IAppState, ISearchState> {
isBulkPublish={this.state.isBulkPublish}
isBulkUnpublish={this.state.isBulkUnpublish}
bulkOperationCompleted={this.state.bulkOperationCompleted}
bulkOperationTitle={this.state.bulkOperationTitle}
updateIsBulkPublish={this.updateIsBulkPublish}
updateIsBulkUnpublish={this.updateIsBulkUnpublish}
updateBulkOperationCompleted={this.updateBulkOperationCompleted}
Expand All @@ -358,6 +361,7 @@ class Search extends Component<IAppState, ISearchState> {
isBulkPublish={this.state.isBulkPublish}
isBulkUnpublish={this.state.isBulkUnpublish}
bulkOperationCompleted={this.state.bulkOperationCompleted}
bulkOperationTitle={this.state.bulkOperationTitle}
updateIsBulkPublish={this.updateIsBulkPublish}
updateIsBulkUnpublish={this.updateIsBulkUnpublish}
updateBulkOperationCompleted={this.updateBulkOperationCompleted}
Expand Down Expand Up @@ -687,7 +691,7 @@ class Search extends Component<IAppState, ISearchState> {

//determine if publish or unpublish bulk operation
if (text === 'publish') {
this.setState({ isBulkPublish: !this.state.isBulkPublish, isBulkUnpublish: false }, () => {
this.setState({ isBulkPublish: true, isBulkUnpublish: false, bulkOperationTitle: "Bulk Publish" }, () => {
if (this.state.bulkOperationWarn === false && this.state.repositoriesSelected.length === 1) {
this.setState({ isBulkOperationButtonDisabled: false, bulkOperationCompleted: false })
} else {
Expand All @@ -696,7 +700,7 @@ class Search extends Component<IAppState, ISearchState> {
})
}
else if (text === 'unpublish') {
this.setState({ isBulkUnpublish: !this.state.isBulkUnpublish, isBulkPublish: false }, () => {
this.setState({ isBulkUnpublish: true, isBulkPublish: false, bulkOperationTitle: "Bulk Unpublish" }, () => {
if (this.state.bulkOperationWarn === false && this.state.repositoriesSelected.length === 1) {
this.setState({ isBulkOperationButtonDisabled: false, bulkOperationCompleted: false })
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public interface Validation extends WorkspaceChild {

default Validation setValidation (Violations violations, int index) {
if(null != violations.get(PantheonConstants.TYPE_XREF)){
this.message().set("invalid Cross reference exists in the document");
this.message().set("Invalid cross references");
this.status().set("error");
this.validationType().set("xref");
this.xrefTarget().set(violations.get(PantheonConstants.TYPE_XREF).getDetails(index));
Expand Down