-
Notifications
You must be signed in to change notification settings - Fork 290
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
Fixes #23286 - Add confirmation dialog on delete manifest #7365
Fixes #23286 - Add confirmation dialog on delete manifest #7365
Conversation
Issues: #23286 |
There were the following issues with the commit message:
If you don't have a ticket number, please create an issue in Redmine. More guidelines are available in Coding Standards or on the Foreman wiki. This message was auto-generated by Foreman's prprocessor |
onConfirm={() => this.hideModal()} | ||
onCancel={() => this.showCancelConfirm(false)} | ||
/> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing spaces not allowed no-trailing-spaces
8e3b976
to
1146364
Compare
To review: go to new subscriptions page and click "manage manifest" button. Close the modal and you should see another modal confirming you want to exit the modal. |
@waldenraines @tstrachota: one loophole I found with this change is that you can click outside of a modal to dismiss it, which will just exit and wont trigger the "confirm you want to exit" dialog modal. |
I misunderstood the issue, marking this WIP while I update correctly. Please disregard my earlier question :) |
As discussed on IRC this modal is supposed to be displayed when delete is clicked to confirm the manifest deletion itself. There is actually no way to not save your changes from within the modal itself since everything is saved on change. |
1146364
to
ebb9056
Compare
}} | ||
confirmLabel={__('Delete')} | ||
confirmStyle={"danger"} | ||
onConfirm={() => this.deleteManifest() } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be no space before '}' react/jsx-curly-spacing
) | ||
}} | ||
confirmLabel={__('Delete')} | ||
confirmStyle={"danger"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curly braces are unnecessary here react/jsx-curly-brace-presence
Strings must use singlequote quotes
dangerouslySetInnerHTML={{ | ||
__html: sprintf( | ||
__(DeleteManifestModalText) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected newline before ')' function-paren-newline
Missing trailing comma comma-dangle
title={__('Confirm delete manifest')} | ||
dangerouslySetInnerHTML={{ | ||
__html: sprintf( | ||
__(DeleteManifestModalText) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing trailing comma comma-dangle
show={this.state.showDeleteManifestModalDialog} | ||
title={__('Confirm delete manifest')} | ||
dangerouslySetInnerHTML={{ | ||
__html: sprintf( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected newline after '(' function-paren-newline
@@ -56,6 +60,13 @@ class ManageManifestModal extends Component { | |||
|
|||
deleteManifest() { | |||
this.props.deleteManifest().then(this.props.loadOrganization); | |||
this.showDeleteManifestModal(false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon semi
@@ -5,13 +5,17 @@ import { bindMethods, Alert, Button, Icon, Modal, ProgressBar, Spinner, OverlayT | |||
import TooltipButton from 'react-bootstrap-tooltip-button'; | |||
import { Table } from '../../../move_to_foreman/components/common/table'; | |||
import { columns } from './ManifestHistoryTableSchema'; | |||
import ConfirmDialog from '../../../move_to_foreman/components/common/ConfirmDialog'; | |||
import DeleteManifestModalText from "./DeleteManifestModalText"; | |||
import { sprintf } from 'jed'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Absolute imports should come before relative imports import/first
@@ -5,13 +5,17 @@ import { bindMethods, Alert, Button, Icon, Modal, ProgressBar, Spinner, OverlayT | |||
import TooltipButton from 'react-bootstrap-tooltip-button'; | |||
import { Table } from '../../../move_to_foreman/components/common/table'; | |||
import { columns } from './ManifestHistoryTableSchema'; | |||
import ConfirmDialog from '../../../move_to_foreman/components/common/ConfirmDialog'; | |||
import DeleteManifestModalText from "./DeleteManifestModalText"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strings must use singlequote quotes
@@ -43,6 +44,7 @@ ConfirmDialog.defaultProps = { | |||
cancelLabel: __('Cancel'), | |||
dangerouslySetInnerHTML: undefined, | |||
message: undefined, | |||
confirmStyle: "primary", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strings must use singlequote quotes
}} | ||
confirmLabel={__('Delete')} | ||
confirmStyle={"danger"} | ||
onConfirm={() => this.deleteManifest() } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There should be no space before '}' react/jsx-curly-spacing
) | ||
}} | ||
confirmLabel={__('Delete')} | ||
confirmStyle={"danger"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curly braces are unnecessary here react/jsx-curly-brace-presence
Strings must use singlequote quotes
dangerouslySetInnerHTML={{ | ||
__html: sprintf( | ||
__(DeleteManifestModalText) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected newline before ')' function-paren-newline
Missing trailing comma comma-dangle
title={__('Confirm delete manifest')} | ||
dangerouslySetInnerHTML={{ | ||
__html: sprintf( | ||
__(DeleteManifestModalText) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing trailing comma comma-dangle
show={this.state.showDeleteManifestModalDialog} | ||
title={__('Confirm delete manifest')} | ||
dangerouslySetInnerHTML={{ | ||
__html: sprintf( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected newline after '(' function-paren-newline
@@ -56,6 +60,13 @@ class ManageManifestModal extends Component { | |||
|
|||
deleteManifest() { | |||
this.props.deleteManifest().then(this.props.loadOrganization); | |||
this.showDeleteManifestModal(false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing semicolon semi
@@ -5,13 +5,17 @@ import { bindMethods, Alert, Button, Icon, Modal, ProgressBar, Spinner, OverlayT | |||
import TooltipButton from 'react-bootstrap-tooltip-button'; | |||
import { Table } from '../../../move_to_foreman/components/common/table'; | |||
import { columns } from './ManifestHistoryTableSchema'; | |||
import ConfirmDialog from '../../../move_to_foreman/components/common/ConfirmDialog'; | |||
import DeleteManifestModalText from "./DeleteManifestModalText"; | |||
import { sprintf } from 'jed'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Absolute imports should come before relative imports import/first
@@ -5,13 +5,17 @@ import { bindMethods, Alert, Button, Icon, Modal, ProgressBar, Spinner, OverlayT | |||
import TooltipButton from 'react-bootstrap-tooltip-button'; | |||
import { Table } from '../../../move_to_foreman/components/common/table'; | |||
import { columns } from './ManifestHistoryTableSchema'; | |||
import ConfirmDialog from '../../../move_to_foreman/components/common/ConfirmDialog'; | |||
import DeleteManifestModalText from "./DeleteManifestModalText"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strings must use singlequote quotes
@@ -43,6 +44,7 @@ ConfirmDialog.defaultProps = { | |||
cancelLabel: __('Cancel'), | |||
dangerouslySetInnerHTML: undefined, | |||
message: undefined, | |||
confirmStyle: "primary", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strings must use singlequote quotes
ebb9056
to
1258f1b
Compare
@waldenraines I found the refresh/delete buttons were still enabled when there is no manifest imported, I filed an issue here: http://projects.theforeman.org/issues/23571 |
@tstrachota @waldenraines: updated the modal to show on manifest delete. I'm using a large JSX block inside the modal, I'm not sure what the best way to handle translating that is? |
1258f1b
to
0f2f334
Compare
show={this.state.showDeleteManifestModalDialog} | ||
title={__('Confirm delete manifest')} | ||
dangerouslySetInnerHTML={{ | ||
__html: sprintf(__(DeleteManifestModalText)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm afraid this is not going to work. AFAIK code isn't evaluated when the translations are being extracted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW sprintf
is useless here.
<li>Disable Red Hat Insights</li> | ||
<li>Require you to upload the subscription-manifest and re-attach subscriptions to hosts and activation keys.</li> | ||
</ul> | ||
<p>This action should only be taken in extreme circumstances or for debugging purposes.</p>`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about splitting it into three parts: "Are you sure..", "Note: ..." and "This action..." to get at least the paragraphs out of the translated text.
0f2f334
to
ed3babd
Compare
const l3 = __("Disable Red Hat Insights."); | ||
const l4 = __("Require you to upload the subscription-manifest and re-attach \ | ||
subscriptions to hosts and activation keys."); | ||
const debug = __("This action should only be taken in extreme circumstances or \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Multiline support is limited to browsers supporting ES5 only no-multi-str
Strings must use singlequote quotes
const l1 = __("Delete all subscriptions that are attached to running hosts."); | ||
const l2 = __("Delete all subscriptions attached to activation keys."); | ||
const l3 = __("Disable Red Hat Insights."); | ||
const l4 = __("Require you to upload the subscription-manifest and re-attach \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Multiline support is limited to browsers supporting ES5 only no-multi-str
Strings must use singlequote quotes
Deleting a manifest will:"); | ||
const l1 = __("Delete all subscriptions that are attached to running hosts."); | ||
const l2 = __("Delete all subscriptions attached to activation keys."); | ||
const l3 = __("Disable Red Hat Insights."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strings must use singlequote quotes
const note = __("Note: Deleting a subscription manifest is STRONGLY discouraged. \ | ||
Deleting a manifest will:"); | ||
const l1 = __("Delete all subscriptions that are attached to running hosts."); | ||
const l2 = __("Delete all subscriptions attached to activation keys."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strings must use singlequote quotes
const question = __("Are you sure you want to delete the manifest?"); | ||
const note = __("Note: Deleting a subscription manifest is STRONGLY discouraged. \ | ||
Deleting a manifest will:"); | ||
const l1 = __("Delete all subscriptions that are attached to running hosts."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strings must use singlequote quotes
@@ -0,0 +1,22 @@ | |||
const question = __("Are you sure you want to delete the manifest?"); | |||
const note = __("Note: Deleting a subscription manifest is STRONGLY discouraged. \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Multiline support is limited to browsers supporting ES5 only no-multi-str
Strings must use singlequote quotes
@@ -0,0 +1,22 @@ | |||
const question = __("Are you sure you want to delete the manifest?"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strings must use singlequote quotes
Sorry about the hound notifications, I'm having trouble running npm run test locally |
36a9922
to
24344d5
Compare
@@ -3,15 +3,19 @@ import PropTypes from 'prop-types'; | |||
import { Col, Tabs, Tab, Form, FormGroup, FormControl, ControlLabel } from 'react-bootstrap'; | |||
import { bindMethods, Alert, Button, Icon, Modal, ProgressBar, Spinner, OverlayTrigger, Tooltip } from 'patternfly-react'; | |||
import TooltipButton from 'react-bootstrap-tooltip-button'; | |||
import { sprintf } from 'jed'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'sprintf' is defined but never used no-unused-vars
24344d5
to
8ab296a
Compare
@waldenraines @tstrachota I updated to translate each string and then use it in the JSX, I'm not sure if that is the best solution but I'm open to suggestions 😸 |
Nice catch. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@waldenraines @tstrachota I updated to translate each string and then use it in the JSX, I'm not sure if that is the best solution but I'm open to suggestions
Responded to this with a code comment below.
const DeleteManifestModalText = `<p>${question}</p> | ||
<p>${note}</p> | ||
<ul class="list-aligned"> | ||
<li>${l1}</li> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would something like this work?
<li>{__('Delete all subscriptions that are attached to running hosts.')}</li>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like this is actually being evaluated as html so that won't work. When I tried <p>{__('does this work?')}</p>
, it looks like this:
It makes sense since we are passing to dangerouslySetInnerHTML
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It makes sense since we are passing to dangerouslySetInnerHTML
Oh, right. And same thing with this?
<p>${__('does this work?')}</p>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I wonder if we should update the Dialog
component to accept children too. That would probably solve the problem because we could easily pass array of components instead of a string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good thought but I'd want to do it outside of this PR. Since the above works I am fine merging as is and then fixing this later. See http://projects.theforeman.org/issues/23600
[test katello] |
1 similar comment
[test katello] |
No description provided.